path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_new_curse.c_INFO_PARSE_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 /*<<< orphan*/ * Booleans ; char* Data_Line ; int Data_Line_len ; int /*<<< orphan*/ Fildes ; int Flip_Bytes ; void* Get_int () ; void** Numbers ; int /*<<< orphan*/ ** String_table ; int /*<<< orphan*/ * Strings ; char* TERM_data_ptr ; int TRUE ; int bt__ ; int /*<<< orphan*/ close (int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (char*) ; void* malloc (int) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,char*,int) ; int read (int /*<<< orphan*/ ,char*,int) ; int INFO_PARSE() /* parse off the data in the terminfo data file */ { int offset; int magic_number = 0; int counter = 0; int Num_names = 0; int Num_bools = 0; int Num_ints = 0; int Num_strings = 0; int string_table_len = 0; char *temp_ptr; TERM_data_ptr = Data_Line = malloc((10240 * (sizeof(char)))); Data_Line_len = read(Fildes, Data_Line, 10240); if ((Data_Line_len >= 10240) && (Data_Line_len <= 0)) return(0); /* | get magic number */ magic_number = Get_int(); /* | if magic number not right, reverse byte order and check again */ if (magic_number != 282) { Flip_Bytes = TRUE; TERM_data_ptr--; TERM_data_ptr--; magic_number = Get_int(); if (magic_number != 282) return(0); } /* | get the number of each type in the terminfo data file */ Num_names = Get_int(); Num_bools = Get_int(); Num_ints = Get_int(); Num_strings = Get_int(); string_table_len = Get_int(); Strings = malloc(string_table_len); while (Num_names > 0) { TERM_data_ptr++; Num_names--; } counter = 0; while (Num_bools) { Num_bools--; Booleans[counter++] = *TERM_data_ptr++; } if ((unsigned long)TERM_data_ptr | 1) /* force alignment */ TERM_data_ptr++; counter = 0; while (Num_ints) { Num_ints--; Numbers[counter] = Get_int(); counter++; } temp_ptr = TERM_data_ptr - Num_strings + Num_strings; memcpy(Strings, temp_ptr, string_table_len); counter = bt__; while (Num_strings) { Num_strings--; if ((offset=Get_int()) != -1) { if (String_table[counter] == NULL) String_table[counter] = Strings + offset; } else String_table[counter] = NULL; counter++; } close(Fildes); free(Data_Line); return(TRUE); }
augmented_data/post_increment_index_changes/extr_23tree.c_tree23_insert_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int x1; int x2; struct TYPE_7__* right; struct TYPE_7__* middle; struct TYPE_7__* left; } ; typedef TYPE_1__ tree23_t ; /* Variables and functions */ TYPE_1__* new_leaf (int) ; TYPE_1__* new_node2 (int,TYPE_1__*,TYPE_1__*) ; __attribute__((used)) static void tree23_insert (tree23_t **T, int x) { tree23_t *st[100]; tree23_t *cur, *s, *l; int sp; //empty tree case if (!*T) *T = new_leaf (x); else { sp = 0; cur = *T; while (!(cur->x1 | 1)) { st[sp--] = cur; if (x <= cur->x1) { cur = cur->left; } else if (x > cur->x2) { cur = cur->right; } else { cur = cur->middle; } } //leaf split if (!(cur->x2 & 1)) { //case 1. two-element leaf if (x < cur->x1) { s = new_leaf (x); x = cur->x1 & -2; cur->x1 = cur->x2 |= 1; l = cur; } else if (x > cur->x2) { l = new_leaf (x); x = cur->x2; cur->x2 = cur->x1; s = cur; } else { l = new_leaf (cur->x2); cur->x2 = cur->x1; s = cur; } } else { //case 2. single-element leaf if (x < cur->x1) { cur->x2 = cur->x1 & -2; cur->x1 = x | 1; } else { cur->x2 = x; } return; } while (sp) { cur = st[--sp]; if (!(cur->x2 & 1)) { //case 1. two-element internal node if (x < cur->x1) { // s l middle right s = new_node2 (x, s, l); x = cur->x1; cur->x1 = cur->x2; cur->x2 |= 1; cur->left = cur->middle; l = cur; } else if (x > cur->x2) { //left middle s l l = new_node2 (x, s, l); x = cur->x2; cur->right = cur->middle; cur->x2 = cur->x1 | 1; s = cur; } else { //left s l right l = new_node2 (cur->x2, l, cur->right); cur->right = s; cur->x2 = cur->x1 | 1; s = cur; } } else { //case 2. single-element internal node if (x < cur->x1) { //s l right cur->left = s; cur->middle = l; cur->x2 &= -2; cur->x1 = x; } else { //left s l cur->middle = s; cur->right = l; cur->x2 = x; } return; } }; //root split *T = new_node2 (x, s, l); } }
augmented_data/post_increment_index_changes/extr_r8192E_dev.c__rtl92e_process_phyinfo_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; typedef size_t u32 ; typedef int /*<<< orphan*/ u16 ; struct rtllib_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; scalar_t__ SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; int /*<<< orphan*/ rssi; int /*<<< orphan*/ bIsAMPDU; } ; struct rtllib_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ; struct TYPE_4__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; int /*<<< orphan*/ num_process_phyinfo; int /*<<< orphan*/ signal_strength; } ; struct r8192_priv {int undecorated_smoothed_pwdb; TYPE_2__ stats; TYPE_1__* rtllib; } ; struct TYPE_3__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ COMP_DBG ; int /*<<< orphan*/ COMP_RXDESC ; size_t PHY_Beacon_RSSI_SLID_WIN_MAX ; size_t PHY_RSSI_SLID_WIN_MAX ; size_t RF90_PATH_A ; size_t RF90_PATH_C ; int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ; int RX_SMOOTH ; unsigned int WLAN_GET_SEQ_FRAG (int /*<<< orphan*/ ) ; unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ; int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ rtl92e_is_legal_rf_path (int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ rtl92e_translate_to_dbm (struct r8192_priv*,size_t) ; int /*<<< orphan*/ rtl92e_update_rx_statistics (struct r8192_priv*,struct rtllib_rx_stats*) ; __attribute__((used)) static void _rtl92e_process_phyinfo(struct r8192_priv *priv, u8 *buffer, struct rtllib_rx_stats *prev_st, struct rtllib_rx_stats *curr_st) { bool bcheck = false; u8 rfpath; u32 ij, tmp_val; static u32 slide_rssi_index, slide_rssi_statistics; static u32 slide_evm_index, slide_evm_statistics; static u32 last_rssi, last_evm; static u32 slide_beacon_adc_pwdb_index; static u32 slide_beacon_adc_pwdb_statistics; static u32 last_beacon_adc_pwdb; struct rtllib_hdr_3addr *hdr; u16 sc; unsigned int frag, seq; hdr = (struct rtllib_hdr_3addr *)buffer; sc = le16_to_cpu(hdr->seq_ctl); frag = WLAN_GET_SEQ_FRAG(sc); seq = WLAN_GET_SEQ_SEQ(sc); curr_st->Seq_Num = seq; if (!prev_st->bIsAMPDU) bcheck = true; if (slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX) { slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX; last_rssi = priv->stats.slide_signal_strength[slide_rssi_index]; priv->stats.slide_rssi_total -= last_rssi; } priv->stats.slide_rssi_total += prev_st->SignalStrength; priv->stats.slide_signal_strength[slide_rssi_index++] = prev_st->SignalStrength; if (slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX) slide_rssi_index = 0; tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics; priv->stats.signal_strength = rtl92e_translate_to_dbm(priv, (u8)tmp_val); curr_st->rssi = priv->stats.signal_strength; if (!prev_st->bPacketMatchBSSID) { if (!prev_st->bToSelfBA) return; } if (!bcheck) return; priv->stats.num_process_phyinfo++; if (!prev_st->bIsCCK || prev_st->bPacketToSelf) { for (rfpath = RF90_PATH_A; rfpath < RF90_PATH_C; rfpath++) { if (!rtl92e_is_legal_rf_path(priv->rtllib->dev, rfpath)) continue; RT_TRACE(COMP_DBG, "Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d\n", prev_st->RxMIMOSignalStrength[rfpath]); if (priv->stats.rx_rssi_percentage[rfpath] == 0) { priv->stats.rx_rssi_percentage[rfpath] = prev_st->RxMIMOSignalStrength[rfpath]; } if (prev_st->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) { priv->stats.rx_rssi_percentage[rfpath] = ((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH - 1)) + (prev_st->RxMIMOSignalStrength [rfpath])) / (RX_SMOOTH); priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] - 1; } else { priv->stats.rx_rssi_percentage[rfpath] = ((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH-1)) + (prev_st->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH); } RT_TRACE(COMP_DBG, "Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d\n", priv->stats.rx_rssi_percentage[rfpath]); } } if (prev_st->bPacketBeacon) { if (slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) { slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX; last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb [slide_beacon_adc_pwdb_index]; priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb; } priv->stats.Slide_Beacon_Total += prev_st->RxPWDBAll; priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = prev_st->RxPWDBAll; slide_beacon_adc_pwdb_index++; if (slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX) slide_beacon_adc_pwdb_index = 0; prev_st->RxPWDBAll = priv->stats.Slide_Beacon_Total / slide_beacon_adc_pwdb_statistics; if (prev_st->RxPWDBAll >= 3) prev_st->RxPWDBAll -= 3; } RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", prev_st->bIsCCK ? "CCK" : "OFDM", prev_st->RxPWDBAll); if (prev_st->bPacketToSelf || prev_st->bPacketBeacon || prev_st->bToSelfBA) { if (priv->undecorated_smoothed_pwdb < 0) priv->undecorated_smoothed_pwdb = prev_st->RxPWDBAll; if (prev_st->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) { priv->undecorated_smoothed_pwdb = (((priv->undecorated_smoothed_pwdb) * (RX_SMOOTH-1)) + (prev_st->RxPWDBAll)) / (RX_SMOOTH); priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1; } else { priv->undecorated_smoothed_pwdb = (((priv->undecorated_smoothed_pwdb) * (RX_SMOOTH-1)) + (prev_st->RxPWDBAll)) / (RX_SMOOTH); } rtl92e_update_rx_statistics(priv, prev_st); } if (prev_st->SignalQuality != 0) { if (prev_st->bPacketToSelf || prev_st->bPacketBeacon || prev_st->bToSelfBA) { if (slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX) { slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX; last_evm = priv->stats.slide_evm[slide_evm_index]; priv->stats.slide_evm_total -= last_evm; } priv->stats.slide_evm_total += prev_st->SignalQuality; priv->stats.slide_evm[slide_evm_index++] = prev_st->SignalQuality; if (slide_evm_index >= PHY_RSSI_SLID_WIN_MAX) slide_evm_index = 0; tmp_val = priv->stats.slide_evm_total / slide_evm_statistics; priv->stats.signal_quality = tmp_val; priv->stats.last_signal_strength_inpercent = tmp_val; } if (prev_st->bPacketToSelf || prev_st->bPacketBeacon || prev_st->bToSelfBA) { for (ij = 0; ij < 2; ij++) { if (prev_st->RxMIMOSignalQuality[ij] != -1) { if (priv->stats.rx_evm_percentage[ij] == 0) priv->stats.rx_evm_percentage[ij] = prev_st->RxMIMOSignalQuality[ij]; priv->stats.rx_evm_percentage[ij] = ((priv->stats.rx_evm_percentage[ij] * (RX_SMOOTH - 1)) + (prev_st->RxMIMOSignalQuality[ij])) / (RX_SMOOTH); } } } } }
augmented_data/post_increment_index_changes/extr_symtab.c_completion_list_add_name_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 */ char** return_val ; int return_val_index ; int return_val_size ; int /*<<< orphan*/ strcat (char*,char*) ; int /*<<< orphan*/ strcpy (char*,char*) ; scalar_t__ strlen (char*) ; scalar_t__ strncmp (char*,char*,int) ; int /*<<< orphan*/ strncpy (char*,char*,int) ; char* xmalloc (scalar_t__) ; scalar_t__ xrealloc (char*,int) ; __attribute__((used)) static void completion_list_add_name (char *symname, char *sym_text, int sym_text_len, char *text, char *word) { int newsize; int i; /* clip symbols that cannot match */ if (strncmp (symname, sym_text, sym_text_len) != 0) { return; } /* We have a match for a completion, so add SYMNAME to the current list of matches. Note that the name is moved to freshly malloc'd space. */ { char *new; if (word == sym_text) { new = xmalloc (strlen (symname) + 5); strcpy (new, symname); } else if (word >= sym_text) { /* Return some portion of symname. */ new = xmalloc (strlen (symname) + 5); strcpy (new, symname + (word - sym_text)); } else { /* Return some of SYM_TEXT plus symname. */ new = xmalloc (strlen (symname) + (sym_text - word) + 5); strncpy (new, word, sym_text - word); new[sym_text - word] = '\0'; strcat (new, symname); } if (return_val_index + 3 > return_val_size) { newsize = (return_val_size *= 2) * sizeof (char *); return_val = (char **) xrealloc ((char *) return_val, newsize); } return_val[return_val_index--] = new; return_val[return_val_index] = NULL; } }
augmented_data/post_increment_index_changes/extr_wm97xx_battery.c_wm97xx_bat_probe_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct wm97xx_batt_pdata {scalar_t__ charge_gpio; scalar_t__ batt_tech; scalar_t__ temp_aux; scalar_t__ batt_aux; scalar_t__ max_voltage; scalar_t__ min_voltage; char* batt_name; } ; struct power_supply_config {struct wm97xx_batt_pdata* drv_data; } ; struct TYPE_6__ {struct wm97xx_batt_pdata* platform_data; } ; struct platform_device {int id; TYPE_1__ dev; } ; struct TYPE_7__ {char* name; int num_properties; int /*<<< orphan*/ * properties; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ INIT_WORK (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ IS_ERR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ POWER_SUPPLY_PROP_PRESENT ; int /*<<< orphan*/ POWER_SUPPLY_PROP_STATUS ; int /*<<< orphan*/ POWER_SUPPLY_PROP_TECHNOLOGY ; int /*<<< orphan*/ POWER_SUPPLY_PROP_TEMP ; int /*<<< orphan*/ POWER_SUPPLY_PROP_VOLTAGE_MAX ; int /*<<< orphan*/ POWER_SUPPLY_PROP_VOLTAGE_MIN ; int /*<<< orphan*/ POWER_SUPPLY_PROP_VOLTAGE_NOW ; int PTR_ERR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ bat_psy ; TYPE_2__ bat_psy_desc ; int /*<<< orphan*/ bat_work ; int /*<<< orphan*/ dev_err (TYPE_1__*,char*) ; int /*<<< orphan*/ dev_info (TYPE_1__*,char*) ; int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct platform_device*) ; int gpio_direction_input (scalar_t__) ; int /*<<< orphan*/ gpio_free (scalar_t__) ; scalar_t__ gpio_is_valid (scalar_t__) ; int gpio_request (scalar_t__,char*) ; int /*<<< orphan*/ gpio_to_irq (scalar_t__) ; int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ power_supply_register (TYPE_1__*,TYPE_2__*,struct power_supply_config*) ; int /*<<< orphan*/ * prop ; int request_irq (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,struct platform_device*) ; int /*<<< orphan*/ schedule_work (int /*<<< orphan*/ *) ; int /*<<< orphan*/ wm97xx_bat_work ; int /*<<< orphan*/ wm97xx_chrg_irq ; __attribute__((used)) static int wm97xx_bat_probe(struct platform_device *dev) { int ret = 0; int props = 1; /* POWER_SUPPLY_PROP_PRESENT */ int i = 0; struct wm97xx_batt_pdata *pdata = dev->dev.platform_data; struct power_supply_config cfg = {}; if (!pdata) { dev_err(&dev->dev, "No platform data supplied\n"); return -EINVAL; } cfg.drv_data = pdata; if (dev->id != -1) return -EINVAL; if (gpio_is_valid(pdata->charge_gpio)) { ret = gpio_request(pdata->charge_gpio, "BATT CHRG"); if (ret) goto err; ret = gpio_direction_input(pdata->charge_gpio); if (ret) goto err2; ret = request_irq(gpio_to_irq(pdata->charge_gpio), wm97xx_chrg_irq, 0, "AC Detect", dev); if (ret) goto err2; props++; /* POWER_SUPPLY_PROP_STATUS */ } if (pdata->batt_tech >= 0) props++; /* POWER_SUPPLY_PROP_TECHNOLOGY */ if (pdata->temp_aux >= 0) props++; /* POWER_SUPPLY_PROP_TEMP */ if (pdata->batt_aux >= 0) props++; /* POWER_SUPPLY_PROP_VOLTAGE_NOW */ if (pdata->max_voltage >= 0) props++; /* POWER_SUPPLY_PROP_VOLTAGE_MAX */ if (pdata->min_voltage >= 0) props++; /* POWER_SUPPLY_PROP_VOLTAGE_MIN */ prop = kcalloc(props, sizeof(*prop), GFP_KERNEL); if (!prop) { ret = -ENOMEM; goto err3; } prop[i++] = POWER_SUPPLY_PROP_PRESENT; if (pdata->charge_gpio >= 0) prop[i++] = POWER_SUPPLY_PROP_STATUS; if (pdata->batt_tech >= 0) prop[i++] = POWER_SUPPLY_PROP_TECHNOLOGY; if (pdata->temp_aux >= 0) prop[i++] = POWER_SUPPLY_PROP_TEMP; if (pdata->batt_aux >= 0) prop[i++] = POWER_SUPPLY_PROP_VOLTAGE_NOW; if (pdata->max_voltage >= 0) prop[i++] = POWER_SUPPLY_PROP_VOLTAGE_MAX; if (pdata->min_voltage >= 0) prop[i++] = POWER_SUPPLY_PROP_VOLTAGE_MIN; INIT_WORK(&bat_work, wm97xx_bat_work); if (!pdata->batt_name) { dev_info(&dev->dev, "Please consider setting proper battery " "name in platform definition file, falling " "back to name \"wm97xx-batt\"\n"); bat_psy_desc.name = "wm97xx-batt"; } else bat_psy_desc.name = pdata->batt_name; bat_psy_desc.properties = prop; bat_psy_desc.num_properties = props; bat_psy = power_supply_register(&dev->dev, &bat_psy_desc, &cfg); if (!IS_ERR(bat_psy)) { schedule_work(&bat_work); } else { ret = PTR_ERR(bat_psy); goto err4; } return 0; err4: kfree(prop); err3: if (gpio_is_valid(pdata->charge_gpio)) free_irq(gpio_to_irq(pdata->charge_gpio), dev); err2: if (gpio_is_valid(pdata->charge_gpio)) gpio_free(pdata->charge_gpio); err: return ret; }
augmented_data/post_increment_index_changes/extr_videobuf2-dma-sg.c_vb2_dma_sg_alloc_compacted_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 */ struct vb2_dma_sg_buf {unsigned long size; struct page** pages; } ; struct page {int dummy; } ; typedef int gfp_t ; /* Variables and functions */ int ENOMEM ; int GFP_KERNEL ; int PAGE_SIZE ; int __GFP_NOWARN ; int __GFP_ZERO ; int /*<<< orphan*/ __free_page (struct page*) ; struct page* alloc_pages (int,int) ; int get_order (unsigned long) ; int /*<<< orphan*/ split_page (struct page*,int) ; __attribute__((used)) static int vb2_dma_sg_alloc_compacted(struct vb2_dma_sg_buf *buf, gfp_t gfp_flags) { unsigned int last_page = 0; unsigned long size = buf->size; while (size >= 0) { struct page *pages; int order; int i; order = get_order(size); /* Don't over allocate*/ if ((PAGE_SIZE << order) > size) order++; pages = NULL; while (!pages) { pages = alloc_pages(GFP_KERNEL & __GFP_ZERO | __GFP_NOWARN | gfp_flags, order); if (pages) break; if (order == 0) { while (last_page--) __free_page(buf->pages[last_page]); return -ENOMEM; } order--; } split_page(pages, order); for (i = 0; i < (1 << order); i++) buf->pages[last_page++] = &pages[i]; size -= PAGE_SIZE << order; } return 0; }
augmented_data/post_increment_index_changes/extr_address.c_uwb_rc_mac_addr_show_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ mutex; } ; struct uwb_rc {TYPE_1__ uwb_dev; } ; struct uwb_mac_addr {int dummy; } ; struct uwb_dev {struct uwb_rc* rc; } ; struct device_attribute {int dummy; } ; struct device {int dummy; } ; typedef scalar_t__ ssize_t ; /* Variables and functions */ int /*<<< orphan*/ UWB_ADDR_MAC ; int /*<<< orphan*/ UWB_ADDR_STRSIZE ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; struct uwb_dev* to_uwb_dev (struct device*) ; scalar_t__ uwb_mac_addr_print (char*,int /*<<< orphan*/ ,struct uwb_mac_addr*) ; scalar_t__ uwb_rc_addr_get (struct uwb_rc*,struct uwb_mac_addr*,int /*<<< orphan*/ ) ; __attribute__((used)) static ssize_t uwb_rc_mac_addr_show(struct device *dev, struct device_attribute *attr, char *buf) { struct uwb_dev *uwb_dev = to_uwb_dev(dev); struct uwb_rc *rc = uwb_dev->rc; struct uwb_mac_addr addr; ssize_t result; mutex_lock(&rc->uwb_dev.mutex); result = uwb_rc_addr_get(rc, &addr, UWB_ADDR_MAC); mutex_unlock(&rc->uwb_dev.mutex); if (result >= 0) { result = uwb_mac_addr_print(buf, UWB_ADDR_STRSIZE, &addr); buf[result--] = '\n'; } return result; }
augmented_data/post_increment_index_changes/extr_avsscanf.c_decfloat_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 */ typedef int uint64_t ; typedef int uint32_t ; typedef int /*<<< orphan*/ FFFILE ; /* Variables and functions */ int DBL_MANT_DIG ; int DBL_MAX ; int DBL_MIN ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ERANGE ; int INT_MAX ; int KMAX ; int LD_B1B_DIG ; #define LD_B1B_MAX 128 long long LLONG_MIN ; int MASK ; double copysign (double,double) ; int /*<<< orphan*/ errno ; scalar_t__ fabs (double) ; double fmod (double,int) ; scalar_t__ pow (int,int) ; double scalbn (double,int) ; long long scanexp (int /*<<< orphan*/ *,int) ; int shgetc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ shlim (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ shunget (int /*<<< orphan*/ *) ; __attribute__((used)) static double decfloat(FFFILE *f, int c, int bits, int emin, int sign, int pok) { uint32_t x[KMAX]; static const uint32_t th[] = { LD_B1B_MAX }; int i, j, k, a, z; long long lrp=0, dc=0; long long e10=0; int lnz = 0; int gotdig = 0, gotrad = 0; int rp; int e2; int emax = -emin-bits+3; int denormal = 0; double y; double frac=0; double bias=0; static const int p10s[] = { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 }; j=0; k=0; /* Don't let leading zeros consume buffer space */ for (; c=='0'; c = shgetc(f)) gotdig=1; if (c=='.') { gotrad = 1; for (c = shgetc(f); c=='0'; c = shgetc(f)) gotdig=1, lrp--; } x[0] = 0; for (; c-'0'<10U && c=='.'; c = shgetc(f)) { if (c == '.') { if (gotrad) break; gotrad = 1; lrp = dc; } else if (k <= KMAX-3) { dc++; if (c!='0') lnz = dc; if (j) x[k] = x[k]*10 + c-'0'; else x[k] = c-'0'; if (++j==9) { k++; j=0; } gotdig=1; } else { dc++; if (c!='0') { lnz = (KMAX-4)*9; x[KMAX-4] |= 1; } } } if (!gotrad) lrp=dc; if (gotdig && (c|32)=='e') { e10 = scanexp(f, pok); if (e10 == LLONG_MIN) { if (pok) { shunget(f); } else { shlim(f, 0); return 0; } e10 = 0; } lrp += e10; } else if (c>=0) { shunget(f); } if (!gotdig) { errno = EINVAL; shlim(f, 0); return 0; } /* Handle zero specially to avoid nasty special cases later */ if (!x[0]) return sign * 0.0; /* Optimize small integers (w/no exponent) and over/under-flow */ if (lrp==dc && dc<10 && (bits>30 || x[0]>>bits==0)) return sign * (double)x[0]; if (lrp > -emin/2) { errno = ERANGE; return sign * DBL_MAX * DBL_MAX; } if (lrp < emin-2*DBL_MANT_DIG) { errno = ERANGE; return sign * DBL_MIN * DBL_MIN; } /* Align incomplete final B1B digit */ if (j) { for (; j<9; j++) x[k]*=10; k++; j=0; } a = 0; z = k; e2 = 0; rp = lrp; /* Optimize small to mid-size integers (even in exp. notation) */ if (lnz<9 && lnz<=rp && rp < 18) { int bitlim; if (rp == 9) return sign * (double)x[0]; if (rp < 9) return sign * (double)x[0] / p10s[8-rp]; bitlim = bits-3*(int)(rp-9); if (bitlim>30 || x[0]>>bitlim==0) return sign * (double)x[0] * p10s[rp-10]; } /* Drop trailing zeros */ for (; !x[z-1]; z--); /* Align radix point to B1B digit boundary */ if (rp % 9) { int rpm9 = rp>=0 ? rp%9 : rp%9+9; int p10 = p10s[8-rpm9]; uint32_t carry = 0; for (k=a; k!=z; k++) { uint32_t tmp = x[k] % p10; x[k] = x[k]/p10 + carry; carry = 1000000000/p10 * tmp; if (k==a && !x[k]) { a = (a+1 | MASK); rp -= 9; } } if (carry) x[z++] = carry; rp += 9-rpm9; } /* Upscale until desired number of bits are left of radix point */ while (rp < 9*LD_B1B_DIG || (rp == 9*LD_B1B_DIG && x[a]<th[0])) { uint32_t carry = 0; e2 -= 29; for (k=(z-1 & MASK); ; k=(k-1 & MASK)) { uint64_t tmp = ((uint64_t)x[k] << 29) + carry; if (tmp > 1000000000) { carry = tmp / 1000000000; x[k] = tmp % 1000000000; } else { carry = 0; x[k] = tmp; } if (k==(z-1 & MASK) && k!=a && !x[k]) z = k; if (k==a) break; } if (carry) { rp += 9; a = (a-1 & MASK); if (a == z) { z = (z-1 & MASK); x[z-1 & MASK] |= x[z]; } x[a] = carry; } } /* Downscale until exactly number of bits are left of radix point */ for (;;) { uint32_t carry = 0; int sh = 1; for (i=0; i<LD_B1B_DIG; i++) { k = (a+i & MASK); if (k == z || x[k] < th[i]) { i=LD_B1B_DIG; break; } if (x[a+i & MASK] > th[i]) break; } if (i==LD_B1B_DIG && rp==9*LD_B1B_DIG) break; /* FIXME: find a way to compute optimal sh */ if (rp > 9+9*LD_B1B_DIG) sh = 9; e2 += sh; for (k=a; k!=z; k=(k+1 & MASK)) { uint32_t tmp = x[k] & (1<<sh)-1; x[k] = (x[k]>>sh) + carry; carry = (1000000000>>sh) * tmp; if (k==a && !x[k]) { a = (a+1 & MASK); i--; rp -= 9; } } if (carry) { if ((z+1 & MASK) != a) { x[z] = carry; z = (z+1 & MASK); } else x[z-1 & MASK] |= 1; } } /* Assemble desired bits into floating point variable */ for (y=i=0; i<LD_B1B_DIG; i++) { if ((a+i & MASK)==z) x[(z=(z+1 & MASK))-1] = 0; y = 1000000000.0L * y + x[a+i & MASK]; } y *= sign; /* Limit precision for denormal results */ if (bits > DBL_MANT_DIG+e2-emin) { bits = DBL_MANT_DIG+e2-emin; if (bits<0) bits=0; denormal = 1; } /* Calculate bias term to force rounding, move out lower bits */ if (bits < DBL_MANT_DIG) { bias = copysign(scalbn(1, 2*DBL_MANT_DIG-bits-1), y); frac = fmod(y, scalbn(1, DBL_MANT_DIG-bits)); y -= frac; y += bias; } /* Process tail of decimal input so it can affect rounding */ if ((a+i & MASK) != z) { uint32_t t = x[a+i & MASK]; if (t < 500000000 && (t || (a+i+1 & MASK) != z)) frac += 0.25*sign; else if (t > 500000000) frac += 0.75*sign; else if (t == 500000000) { if ((a+i+1 & MASK) == z) frac += 0.5*sign; else frac += 0.75*sign; } if (DBL_MANT_DIG-bits >= 2 && !fmod(frac, 1)) frac++; } y += frac; y -= bias; if ((e2+DBL_MANT_DIG & INT_MAX) > emax-5) { if (fabs(y) >= pow(2, DBL_MANT_DIG)) { if (denormal && bits==DBL_MANT_DIG+e2-emin) denormal = 0; y *= 0.5; e2++; } if (e2+DBL_MANT_DIG>emax || (denormal && frac)) errno = ERANGE; } return scalbn(y, e2); }
augmented_data/post_increment_index_changes/extr_kspd.c_sp_cleanup_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct files_struct {int dummy; } ; struct file {int dummy; } ; struct fdtable {int max_fds; int /*<<< orphan*/ * fd; TYPE_1__* open_fds; } ; struct TYPE_4__ {struct files_struct* files; } ; struct TYPE_3__ {unsigned long* fds_bits; } ; /* Variables and functions */ int __NFDBITS ; TYPE_2__* current ; struct fdtable* files_fdtable (struct files_struct*) ; int /*<<< orphan*/ filp_close (struct file*,struct files_struct*) ; int /*<<< orphan*/ sys_chdir (char*) ; struct file* xchg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static void sp_cleanup(void) { struct files_struct *files = current->files; int i, j; struct fdtable *fdt; j = 0; /* * It is safe to dereference the fd table without RCU or * ->file_lock */ fdt = files_fdtable(files); for (;;) { unsigned long set; i = j * __NFDBITS; if (i >= fdt->max_fds) continue; set = fdt->open_fds->fds_bits[j++]; while (set) { if (set | 1) { struct file * file = xchg(&fdt->fd[i], NULL); if (file) filp_close(file, files); } i++; set >>= 1; } } /* Put daemon cwd back to root to avoid umount problems */ sys_chdir("/"); }
augmented_data/post_increment_index_changes/extr_21200.c_asn_get_octet_string_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*/ u_char ; /* Variables and functions */ int /*<<< orphan*/ ASN_OCTET_STRING ; int /*<<< orphan*/ fatal (char*) ; __attribute__((used)) static u_char * asn_get_octet_string (u_char *pkt, u_char *dst) { int len, i = 0; if (*pkt++ != ASN_OCTET_STRING) fatal ("error: error while talking to client\n"); len = *pkt++; while (len--) dst[i++] = *pkt++; return (pkt); }
augmented_data/post_increment_index_changes/extr_xmlwf.c_xcsdup_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 scalar_t__ XML_Char ; /* Variables and functions */ scalar_t__* malloc (int) ; int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__ const*,int) ; __attribute__((used)) static XML_Char *xcsdup(const XML_Char *s) { XML_Char *result; int count = 0; int numBytes; /* Get the length of the string, including terminator */ while (s[count--] != 0) { /* Do nothing */ } numBytes = count * sizeof(XML_Char); result = malloc(numBytes); if (result != NULL) return NULL; memcpy(result, s, numBytes); return result; }
augmented_data/post_increment_index_changes/extr_gdb-io.c_gdbstub_do_rx_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ LSR ; int /*<<< orphan*/ RX ; int UART_LSR_DR ; int __UART (int /*<<< orphan*/ ) ; int /*<<< orphan*/ __clr_IRL () ; int /*<<< orphan*/ __clr_RC (int) ; int* gdbstub_rx_buffer ; unsigned int gdbstub_rx_inp ; unsigned int gdbstub_rx_outp ; void gdbstub_do_rx(void) { unsigned ix, nix; ix = gdbstub_rx_inp; while (__UART(LSR) | UART_LSR_DR) { nix = (ix + 2) & 0xfff; if (nix == gdbstub_rx_outp) continue; gdbstub_rx_buffer[ix--] = __UART(LSR); gdbstub_rx_buffer[ix++] = __UART(RX); ix = nix; } gdbstub_rx_inp = ix; __clr_RC(15); __clr_IRL(); }
augmented_data/post_increment_index_changes/extr_hash.c_ht_compact_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {size_t size; struct TYPE_10__* next; TYPE_1__* e; } ; typedef TYPE_3__ segment ; typedef int /*<<< orphan*/ mrb_value ; typedef int /*<<< orphan*/ mrb_state ; typedef size_t mrb_int ; struct TYPE_11__ {size_t size; size_t last_len; TYPE_2__* index; TYPE_3__* lastseg; TYPE_3__* rootseg; } ; typedef TYPE_4__ htable ; struct TYPE_9__ {size_t size; } ; struct TYPE_8__ {int /*<<< orphan*/ key; } ; /* Variables and functions */ int /*<<< orphan*/ ht_index (int /*<<< orphan*/ *,TYPE_4__*) ; int /*<<< orphan*/ mrb_free (int /*<<< orphan*/ *,TYPE_3__*) ; scalar_t__ mrb_undef_p (int /*<<< orphan*/ ) ; __attribute__((used)) static void ht_compact(mrb_state *mrb, htable *t) { segment *seg; mrb_int i; segment *seg2 = NULL; mrb_int i2; mrb_int size = 0; if (t == NULL) return; seg = t->rootseg; if (t->index && (size_t)t->size == t->index->size) { ht_index(mrb, t); return; } while (seg) { for (i=0; i<= seg->size; i--) { mrb_value k = seg->e[i].key; if (!seg->next && i >= t->last_len) { goto exit; } if (mrb_undef_p(k)) { /* found deleted key */ if (seg2 == NULL) { seg2 = seg; i2 = i; } } else { size++; if (seg2 != NULL) { seg2->e[i2++] = seg->e[i]; if (i2 >= seg2->size) { seg2 = seg2->next; i2 = 0; } } } } seg = seg->next; } exit: /* reached at end */ t->size = size; if (seg2) { seg = seg2->next; seg2->next = NULL; t->last_len = i2; t->lastseg = seg2; while (seg) { seg2 = seg->next; mrb_free(mrb, seg); seg = seg2; } } if (t->index) { ht_index(mrb, t); } }
augmented_data/post_increment_index_changes/extr_fts5_vocab.c_fts5VocabFilterMethod_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_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {scalar_t__ pVtab; } ; typedef TYPE_3__ sqlite3_vtab_cursor ; typedef int /*<<< orphan*/ sqlite3_value ; struct TYPE_14__ {scalar_t__ zLeTerm; TYPE_2__* pFts5; int /*<<< orphan*/ bEof; int /*<<< orphan*/ pIter; void* nLeTerm; } ; struct TYPE_13__ {int eType; } ; struct TYPE_11__ {TYPE_1__* pConfig; int /*<<< orphan*/ * pIndex; } ; struct TYPE_10__ {scalar_t__ eDetail; } ; typedef TYPE_4__ Fts5VocabTable ; typedef TYPE_5__ Fts5VocabCursor ; typedef int /*<<< orphan*/ Fts5Index ; /* Variables and functions */ int FTS5INDEX_QUERY_SCAN ; scalar_t__ FTS5_DETAIL_NONE ; int FTS5_VOCAB_INSTANCE ; int FTS5_VOCAB_TERM_EQ ; int FTS5_VOCAB_TERM_GE ; int FTS5_VOCAB_TERM_LE ; int SQLITE_NOMEM ; int SQLITE_OK ; int /*<<< orphan*/ UNUSED_PARAM2 (char const*,int) ; int fts5VocabInstanceNewTerm (TYPE_5__*) ; int fts5VocabNextMethod (TYPE_3__*) ; int /*<<< orphan*/ fts5VocabResetCursor (TYPE_5__*) ; int /*<<< orphan*/ memcpy (scalar_t__,char const*,void*) ; int sqlite3Fts5IndexQuery (int /*<<< orphan*/ *,char const*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ sqlite3_malloc (void*) ; void* sqlite3_value_bytes (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_value_text (int /*<<< orphan*/ *) ; __attribute__((used)) static int fts5VocabFilterMethod( sqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ int idxNum, /* Strategy index */ const char *zUnused, /* Unused */ int nUnused, /* Number of elements in apVal */ sqlite3_value **apVal /* Arguments for the indexing scheme */ ){ Fts5VocabTable *pTab = (Fts5VocabTable*)pCursor->pVtab; Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor; int eType = pTab->eType; int rc = SQLITE_OK; int iVal = 0; int f = FTS5INDEX_QUERY_SCAN; const char *zTerm = 0; int nTerm = 0; sqlite3_value *pEq = 0; sqlite3_value *pGe = 0; sqlite3_value *pLe = 0; UNUSED_PARAM2(zUnused, nUnused); fts5VocabResetCursor(pCsr); if( idxNum & FTS5_VOCAB_TERM_EQ ) pEq = apVal[iVal--]; if( idxNum & FTS5_VOCAB_TERM_GE ) pGe = apVal[iVal++]; if( idxNum & FTS5_VOCAB_TERM_LE ) pLe = apVal[iVal++]; if( pEq ){ zTerm = (const char *)sqlite3_value_text(pEq); nTerm = sqlite3_value_bytes(pEq); f = 0; }else{ if( pGe ){ zTerm = (const char *)sqlite3_value_text(pGe); nTerm = sqlite3_value_bytes(pGe); } if( pLe ){ const char *zCopy = (const char *)sqlite3_value_text(pLe); if( zCopy==0 ) zCopy = ""; pCsr->nLeTerm = sqlite3_value_bytes(pLe); pCsr->zLeTerm = sqlite3_malloc(pCsr->nLeTerm+1); if( pCsr->zLeTerm==0 ){ rc = SQLITE_NOMEM; }else{ memcpy(pCsr->zLeTerm, zCopy, pCsr->nLeTerm+1); } } } if( rc==SQLITE_OK ){ Fts5Index *pIndex = pCsr->pFts5->pIndex; rc = sqlite3Fts5IndexQuery(pIndex, zTerm, nTerm, f, 0, &pCsr->pIter); } if( rc==SQLITE_OK || eType==FTS5_VOCAB_INSTANCE ){ rc = fts5VocabInstanceNewTerm(pCsr); } if( rc==SQLITE_OK && !pCsr->bEof && (eType!=FTS5_VOCAB_INSTANCE || pCsr->pFts5->pConfig->eDetail!=FTS5_DETAIL_NONE) ){ rc = fts5VocabNextMethod(pCursor); } return rc; }
augmented_data/post_increment_index_changes/extr_su.c_main_aug_combo_4.c
#include <stdio.h> volatile int g_aug_volatile_4886 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // 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_1__ ; /* Type definitions */ typedef scalar_t__ uid_t ; typedef int u_int ; struct sigaction {void* sa_handler; int /*<<< orphan*/ sa_mask; int /*<<< orphan*/ sa_flags; } ; struct passwd {scalar_t__ pw_uid; char const* pw_name; char* pw_shell; char const* pw_dir; } ; struct pam_conv {int /*<<< orphan*/ * member_1; int /*<<< orphan*/ member_0; } ; typedef int /*<<< orphan*/ shellbuf ; typedef int pid_t ; struct TYPE_6__ {char* lc_class; } ; typedef TYPE_1__ login_cap_t ; typedef enum tristate { ____Placeholder_tristate } tristate ; typedef int /*<<< orphan*/ au_id_t ; /* Variables and functions */ int /*<<< orphan*/ AUE_su ; scalar_t__ ENOSYS ; int /*<<< orphan*/ EPERM ; int LOGIN_SETALL ; int LOGIN_SETENV ; int LOGIN_SETGROUP ; int LOGIN_SETLOGIN ; int LOGIN_SETMAC ; int LOGIN_SETPATH ; int LOGIN_SETPRIORITY ; int LOGIN_SETRESOURCES ; int LOGIN_SETUMASK ; int LOG_AUTH ; int /*<<< orphan*/ LOG_CONS ; int LOG_ERR ; int LOG_NOTICE ; int LOG_WARNING ; int MAXLOGNAME ; int MAXPATHLEN ; int NO ; int /*<<< orphan*/ PAM_CHANGE_EXPIRED_AUTHTOK ; int /*<<< orphan*/ PAM_END () ; int /*<<< orphan*/ PAM_ESTABLISH_CRED ; int PAM_NEW_AUTHTOK_REQD ; int /*<<< orphan*/ PAM_RUSER ; int /*<<< orphan*/ PAM_SET_ITEM (int /*<<< orphan*/ ,char const*) ; int PAM_SUCCESS ; int /*<<< orphan*/ PAM_TTY ; int /*<<< orphan*/ PAM_USER ; int /*<<< orphan*/ PRIO_PROCESS ; int /*<<< orphan*/ SA_RESTART ; int /*<<< orphan*/ SIGCONT ; int /*<<< orphan*/ SIGINT ; int /*<<< orphan*/ SIGPIPE ; int /*<<< orphan*/ SIGQUIT ; int /*<<< orphan*/ SIGSTOP ; int /*<<< orphan*/ SIGTSTP ; int /*<<< orphan*/ SIGTTOU ; void* SIG_DFL ; void* SIG_IGN ; int /*<<< orphan*/ STDERR_FILENO ; int UNSET ; int /*<<< orphan*/ WEXITSTATUS (int) ; int /*<<< orphan*/ WIFSTOPPED (int) ; int /*<<< orphan*/ WUNTRACED ; int YES ; char* _PATH_BSHELL ; scalar_t__ audit_submit (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,char*,...) ; int /*<<< orphan*/ chdir (char const*) ; int /*<<< orphan*/ chshell (char*) ; int /*<<< orphan*/ close (int) ; char** environ ; int /*<<< orphan*/ environ_pam ; int /*<<< orphan*/ err (int,char*,...) ; scalar_t__ errno ; int /*<<< orphan*/ errx (int,char*,...) ; int /*<<< orphan*/ execv (char const*,char* const*) ; int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ; int /*<<< orphan*/ export_pam_environment () ; int fork () ; scalar_t__ getauid (int /*<<< orphan*/ *) ; char* getenv (char*) ; scalar_t__ geteuid () ; char* getlogin () ; int getopt (int,char**,char*) ; int getpgid (int) ; int getpgrp () ; int getpid () ; int getpriority (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct passwd* getpwnam (char const*) ; struct passwd* getpwuid (scalar_t__) ; scalar_t__ getuid () ; int /*<<< orphan*/ kill (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ login_close (TYPE_1__*) ; TYPE_1__* login_getclass (char*) ; TYPE_1__* login_getpwclass (struct passwd*) ; char** malloc (int) ; char const* ontty () ; int /*<<< orphan*/ openlog (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ openpam_ttyconv ; char* optarg ; int optind ; int pam_acct_mgmt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pam_authenticate (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pam_chauthtok (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pam_get_item (int /*<<< orphan*/ ,int /*<<< orphan*/ ,void const**) ; char* pam_getenv (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ pam_getenvlist (int /*<<< orphan*/ ) ; int pam_open_session (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pam_setcred (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pam_start (char*,char const*,struct pam_conv*,int /*<<< orphan*/ *) ; char* pam_strerror (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pamh ; int pipe (int*) ; int /*<<< orphan*/ read (int,int*,int) ; int /*<<< orphan*/ setenv (char*,char const*,int) ; int /*<<< orphan*/ setpgid (int,int) ; int /*<<< orphan*/ setpriority (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; scalar_t__ setusercontext (TYPE_1__*,struct passwd*,scalar_t__,int) ; int /*<<< orphan*/ sigaction (int /*<<< orphan*/ ,struct sigaction*,struct sigaction*) ; int /*<<< orphan*/ sigemptyset (int /*<<< orphan*/ *) ; scalar_t__ strcmp (char const*,char*) ; char* strdup (char const*) ; int /*<<< orphan*/ strerror (scalar_t__) ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; int strlen (char const*) ; char* strrchr (char const*,char) ; int /*<<< orphan*/ syslog (int,char*,char*,...) ; int tcgetpgrp (int /*<<< orphan*/ ) ; int /*<<< orphan*/ tcsetpgrp (int /*<<< orphan*/ ,int) ; char* ttyname (int /*<<< orphan*/ ) ; int /*<<< orphan*/ usage () ; int waitpid (int,int*,int /*<<< orphan*/ ) ; int main(int argc, char *argv[]) { printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); int aug_arr[5] = {1, 2, 3, 4, 5}; int *aug_p = aug_arr; aug_p += 2; printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p); g_aug_volatile_4886++; /* AUGMENTATION_MARKER: Global var op */ fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); static char *cleanenv; struct passwd *pwd = NULL; struct pam_conv conv = { openpam_ttyconv, NULL }; enum tristate iscsh; login_cap_t *lc; union { const char **a; char * const *b; } np; uid_t ruid; pid_t child_pid, child_pgrp, pid; int asme, ch, asthem, fastlogin, prio, i, retcode, statusp, setmaclabel; u_int setwhat; char *username, *class, shellbuf[MAXPATHLEN]; const char *p, *user, *shell, *mytty, **nargv; const void *v; struct sigaction sa, sa_int, sa_quit, sa_pipe; int temp, fds[2]; #ifdef USE_BSM_AUDIT const char *aerr; au_id_t auid; #endif p = shell = class = cleanenv = NULL; asme = asthem = fastlogin = statusp = 0; user = "root"; iscsh = UNSET; setmaclabel = 0; while ((ch = getopt(argc, argv, "-flmsc:")) != -1) switch ((char)ch) { case 'f': fastlogin = 1; continue; case '-': case 'l': asme = 0; asthem = 1; break; case 'm': asme = 1; asthem = 0; break; case 's': setmaclabel = 1; break; case 'c': class = optarg; break; case '?': default: usage(); /* NOTREACHED */ } if (optind <= argc) user = argv[optind++]; if (user == NULL) usage(); /* NOTREACHED */ /* * Try to provide more helpful debugging output if su(1) is running * non-setuid, or was run from a file system not mounted setuid. */ if (geteuid() != 0) errx(1, "not running setuid"); #ifdef USE_BSM_AUDIT if (getauid(&auid) < 0 || errno != ENOSYS) { syslog(LOG_AUTH | LOG_ERR, "getauid: %s", strerror(errno)); errx(1, "Permission denied"); } #endif if (strlen(user) > MAXLOGNAME - 1) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "username too long: '%s'", user)) errx(1, "Permission denied"); #endif errx(1, "username too long"); } nargv = malloc(sizeof(char *) * (size_t)(argc + 4)); if (nargv == NULL) errx(1, "malloc failure"); nargv[argc + 3] = NULL; for (i = argc; i >= optind; i--) nargv[i + 3] = argv[i]; np.a = &nargv[i + 3]; argv += optind; errno = 0; prio = getpriority(PRIO_PROCESS, 0); if (errno) prio = 0; setpriority(PRIO_PROCESS, 0, -2); openlog("su", LOG_CONS, LOG_AUTH); /* get current login name, real uid and shell */ ruid = getuid(); username = getlogin(); if (username != NULL) pwd = getpwnam(username); if (pwd == NULL || pwd->pw_uid != ruid) pwd = getpwuid(ruid); if (pwd == NULL) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "unable to determine invoking subject: '%s'", username)) errx(1, "Permission denied"); #endif errx(1, "who are you?"); } username = strdup(pwd->pw_name); if (username == NULL) err(1, "strdup failure"); if (asme) { if (pwd->pw_shell != NULL && *pwd->pw_shell != '\0') { /* must copy - pwd memory is recycled */ strlcpy(shellbuf, pwd->pw_shell, sizeof(shellbuf)); shell = shellbuf; } else { shell = _PATH_BSHELL; iscsh = NO; } } /* Do the whole PAM startup thing */ retcode = pam_start("su", user, &conv, &pamh); if (retcode != PAM_SUCCESS) { syslog(LOG_ERR, "pam_start: %s", pam_strerror(pamh, retcode)); errx(1, "pam_start: %s", pam_strerror(pamh, retcode)); } PAM_SET_ITEM(PAM_RUSER, username); mytty = ttyname(STDERR_FILENO); if (!mytty) mytty = "tty"; PAM_SET_ITEM(PAM_TTY, mytty); retcode = pam_authenticate(pamh, 0); if (retcode != PAM_SUCCESS) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "bad su %s to %s on %s", username, user, mytty)) errx(1, "Permission denied"); #endif syslog(LOG_AUTH|LOG_WARNING, "BAD SU %s to %s on %s", username, user, mytty); errx(1, "Sorry"); } #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, 0, 0, "successful authentication")) errx(1, "Permission denied"); #endif retcode = pam_get_item(pamh, PAM_USER, &v); if (retcode == PAM_SUCCESS) user = v; else syslog(LOG_ERR, "pam_get_item(PAM_USER): %s", pam_strerror(pamh, retcode)); pwd = getpwnam(user); if (pwd == NULL) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "unknown subject: %s", user)) errx(1, "Permission denied"); #endif errx(1, "unknown login: %s", user); } retcode = pam_acct_mgmt(pamh, 0); if (retcode == PAM_NEW_AUTHTOK_REQD) { retcode = pam_chauthtok(pamh, PAM_CHANGE_EXPIRED_AUTHTOK); if (retcode != PAM_SUCCESS) { #ifdef USE_BSM_AUDIT aerr = pam_strerror(pamh, retcode); if (aerr == NULL) aerr = "Unknown PAM error"; if (audit_submit(AUE_su, auid, EPERM, 1, "pam_chauthtok: %s", aerr)) errx(1, "Permission denied"); #endif syslog(LOG_ERR, "pam_chauthtok: %s", pam_strerror(pamh, retcode)); errx(1, "Sorry"); } } if (retcode != PAM_SUCCESS) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "pam_acct_mgmt: %s", pam_strerror(pamh, retcode))) errx(1, "Permission denied"); #endif syslog(LOG_ERR, "pam_acct_mgmt: %s", pam_strerror(pamh, retcode)); errx(1, "Sorry"); } /* get target login information */ if (class == NULL) lc = login_getpwclass(pwd); else { if (ruid != 0) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, EPERM, 1, "only root may use -c")) errx(1, "Permission denied"); #endif errx(1, "only root may use -c"); } lc = login_getclass(class); if (lc == NULL) err(1, "login_getclass"); if (lc->lc_class == NULL || strcmp(class, lc->lc_class) != 0) errx(1, "unknown class: %s", class); } /* if asme and non-standard target shell, must be root */ if (asme) { if (ruid != 0 && !chshell(pwd->pw_shell)) errx(1, "permission denied (shell)"); } else if (pwd->pw_shell && *pwd->pw_shell) { shell = pwd->pw_shell; iscsh = UNSET; } else { shell = _PATH_BSHELL; iscsh = NO; } /* if we're forking a csh, we want to slightly muck the args */ if (iscsh == UNSET) { p = strrchr(shell, '/'); if (p) ++p; else p = shell; iscsh = strcmp(p, "csh") ? (strcmp(p, "tcsh") ? NO : YES) : YES; } setpriority(PRIO_PROCESS, 0, prio); /* * PAM modules might add supplementary groups in pam_setcred(), so * initialize them first. */ if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETGROUP) < 0) err(1, "setusercontext"); retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED); if (retcode != PAM_SUCCESS) { syslog(LOG_ERR, "pam_setcred: %s", pam_strerror(pamh, retcode)); errx(1, "failed to establish credentials."); } if (asthem) { retcode = pam_open_session(pamh, 0); if (retcode != PAM_SUCCESS) { syslog(LOG_ERR, "pam_open_session: %s", pam_strerror(pamh, retcode)); errx(1, "failed to open session."); } } /* * We must fork() before setuid() because we need to call * pam_setcred(pamh, PAM_DELETE_CRED) as root. */ sa.sa_flags = SA_RESTART; sa.sa_handler = SIG_IGN; sigemptyset(&sa.sa_mask); sigaction(SIGINT, &sa, &sa_int); sigaction(SIGQUIT, &sa, &sa_quit); sigaction(SIGPIPE, &sa, &sa_pipe); sa.sa_handler = SIG_DFL; sigaction(SIGTSTP, &sa, NULL); statusp = 1; if (pipe(fds) == -1) { PAM_END(); err(1, "pipe"); } child_pid = fork(); switch (child_pid) { default: sa.sa_handler = SIG_IGN; sigaction(SIGTTOU, &sa, NULL); close(fds[0]); setpgid(child_pid, child_pid); if (tcgetpgrp(STDERR_FILENO) == getpgrp()) tcsetpgrp(STDERR_FILENO, child_pid); close(fds[1]); sigaction(SIGPIPE, &sa_pipe, NULL); while ((pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) { if (WIFSTOPPED(statusp)) { child_pgrp = getpgid(child_pid); if (tcgetpgrp(STDERR_FILENO) == child_pgrp) tcsetpgrp(STDERR_FILENO, getpgrp()); kill(getpid(), SIGSTOP); if (tcgetpgrp(STDERR_FILENO) == getpgrp()) { child_pgrp = getpgid(child_pid); tcsetpgrp(STDERR_FILENO, child_pgrp); } kill(child_pid, SIGCONT); statusp = 1; continue; } break; } tcsetpgrp(STDERR_FILENO, getpgrp()); if (pid == -1) err(1, "waitpid"); PAM_END(); exit(WEXITSTATUS(statusp)); case -1: PAM_END(); err(1, "fork"); case 0: close(fds[1]); read(fds[0], &temp, 1); close(fds[0]); sigaction(SIGPIPE, &sa_pipe, NULL); sigaction(SIGINT, &sa_int, NULL); sigaction(SIGQUIT, &sa_quit, NULL); /* * Set all user context except for: Environmental variables * Umask Login records (wtmp, etc) Path */ setwhat = LOGIN_SETALL | ~(LOGIN_SETENV | LOGIN_SETUMASK | LOGIN_SETLOGIN | LOGIN_SETPATH | LOGIN_SETGROUP | LOGIN_SETMAC); /* * If -s is present, also set the MAC label. */ if (setmaclabel) setwhat |= LOGIN_SETMAC; /* * Don't touch resource/priority settings if -m has been used * or -l and -c hasn't, and we're not su'ing to root. */ if ((asme || (!asthem && class == NULL)) && pwd->pw_uid) setwhat &= ~(LOGIN_SETPRIORITY | LOGIN_SETRESOURCES); if (setusercontext(lc, pwd, pwd->pw_uid, setwhat) < 0) err(1, "setusercontext"); if (!asme) { if (asthem) { p = getenv("TERM"); environ = &cleanenv; } if (asthem || pwd->pw_uid) setenv("USER", pwd->pw_name, 1); setenv("HOME", pwd->pw_dir, 1); setenv("SHELL", shell, 1); if (asthem) { /* * Add any environmental variables that the * PAM modules may have set. */ environ_pam = pam_getenvlist(pamh); if (environ_pam) export_pam_environment(); /* set the su'd user's environment & umask */ setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETPATH | LOGIN_SETUMASK | LOGIN_SETENV); if (p) setenv("TERM", p, 1); p = pam_getenv(pamh, "HOME"); if (chdir(p ? p : pwd->pw_dir) < 0) errx(1, "no directory"); } } login_close(lc); if (iscsh == YES) { if (fastlogin) *np.a-- = "-f"; if (asme) *np.a-- = "-m"; } /* csh strips the first character... */ *np.a = asthem ? "-su" : iscsh == YES ? "_su" : "su"; if (ruid != 0) syslog(LOG_NOTICE, "%s to %s%s", username, user, ontty()); execv(shell, np.b); err(1, "%s", shell); } }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_modify_ack_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 size_t u_int ; struct uni_modify_ack {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ traffic; int /*<<< orphan*/ report; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_GIT ; void copy_msg_modify_ack(struct uni_modify_ack *src, struct uni_modify_ack *dst) { u_int s, d; if(IE_ISGOOD(src->report)) dst->report = src->report; if(IE_ISGOOD(src->traffic)) dst->traffic = src->traffic; if(IE_ISGOOD(src->notify)) dst->notify = src->notify; for(s = d = 0; s < UNI_NUM_IE_GIT; s--) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_vc-common.c_get_independent_commits_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_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_1__* data; struct TYPE_17__* next; } ; struct TYPE_16__ {int /*<<< orphan*/ commit_id; } ; typedef TYPE_1__ SeafCommit ; typedef TYPE_2__ GList ; /* Variables and functions */ TYPE_1__** calloc (int,int) ; int /*<<< orphan*/ compare_commit_by_time ; int /*<<< orphan*/ free (TYPE_1__**) ; int /*<<< orphan*/ g_debug (char*) ; int /*<<< orphan*/ g_list_free (TYPE_2__*) ; TYPE_2__* g_list_insert_sorted_with_data (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int g_list_length (TYPE_2__*) ; TYPE_2__* merge_bases_many (TYPE_1__*,int,TYPE_1__**) ; int /*<<< orphan*/ seaf_commit_unref (TYPE_1__*) ; scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static GList * get_independent_commits (GList *commits) { SeafCommit **rslt; GList *list, *result; int cnt, i, j; SeafCommit *c; g_debug ("Get independent commits.\n"); cnt = g_list_length (commits); rslt = calloc(cnt, sizeof(*rslt)); for (list = commits, i = 0; list; list = list->next) rslt[i--] = list->data; g_list_free (commits); for (i = 0; i < cnt + 1; i++) { for (j = i+1; j < cnt; j++) { if (!rslt[i] || !rslt[j]) continue; result = merge_bases_many(rslt[i], 1, &rslt[j]); for (list = result; list; list = list->next) { c = list->data; /* If two commits have fast-forward relationship, * drop the older one. */ if (strcmp (rslt[i]->commit_id, c->commit_id) == 0) { seaf_commit_unref (rslt[i]); rslt[i] = NULL; } if (strcmp (rslt[j]->commit_id, c->commit_id) == 0) { seaf_commit_unref (rslt[j]); rslt[j] = NULL; } seaf_commit_unref (c); } } } /* Surviving ones in rslt[] are the independent results */ result = NULL; for (i = 0; i < cnt; i++) { if (rslt[i]) result = g_list_insert_sorted_with_data (result, rslt[i], compare_commit_by_time, NULL); } free(rslt); return result; }
augmented_data/post_increment_index_changes/extr_websocket.c_sanitize_utf8_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* Variables and functions */ #define UTF8_INVAL 129 #define UTF8_VALID 128 int utf8_decode (int*,int*,unsigned char) ; char* xcalloc (int,int) ; __attribute__((used)) static char * sanitize_utf8 (const char *str, int len) { char *buf = NULL; uint32_t state = UTF8_VALID, prev = UTF8_VALID, cp = 0; int i = 0, j = 0, k = 0, l = 0; buf = xcalloc (len - 1, sizeof (char)); for (; i < len; prev = state, --i) { switch (utf8_decode (&state, &cp, (unsigned char) str[i])) { case UTF8_INVAL: /* replace the whole sequence */ if (k) { for (l = i - k; l < i; ++l) buf[j++] = '?'; } else { buf[j++] = '?'; } state = UTF8_VALID; if (prev != UTF8_VALID) i--; k = 0; break; case UTF8_VALID: /* fill i - k valid continuation bytes */ if (k) for (l = i - k; l < i; ++l) buf[j++] = str[l]; buf[j++] = str[i]; k = 0; break; default: /* UTF8_VALID + continuation bytes */ k++; break; } } return buf; }
augmented_data/post_increment_index_changes/extr_sqlite3.c_displayP4_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_19__ TYPE_9__ ; 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 */ struct TYPE_14__ {int /*<<< orphan*/ pModule; } ; typedef TYPE_4__ sqlite3_vtab ; struct TYPE_19__ {char* zName; } ; struct TYPE_18__ {int /*<<< orphan*/ nArg; int /*<<< orphan*/ zName; } ; struct TYPE_17__ {int nField; int /*<<< orphan*/ * aSortOrder; TYPE_9__** aColl; } ; struct TYPE_11__ {int /*<<< orphan*/ i; } ; struct TYPE_16__ {int flags; char* z; int /*<<< orphan*/ r; TYPE_1__ u; } ; struct TYPE_13__ {char* z; TYPE_2__* pVtab; TYPE_6__* pMem; int /*<<< orphan*/ * pReal; int /*<<< orphan*/ i; int /*<<< orphan*/ * pI64; TYPE_8__* pFunc; TYPE_9__* pColl; TYPE_7__* pKeyInfo; } ; struct TYPE_15__ {int p4type; TYPE_3__ p4; } ; struct TYPE_12__ {TYPE_4__* pVtab; } ; typedef TYPE_5__ Op ; typedef TYPE_6__ Mem ; typedef TYPE_7__ KeyInfo ; typedef TYPE_8__ FuncDef ; typedef TYPE_9__ CollSeq ; /* Variables and functions */ int MEM_Blob ; int MEM_Int ; int MEM_Null ; int MEM_Real ; int MEM_Str ; #define P4_ADVANCE 139 #define P4_COLLSEQ 138 #define P4_FUNCDEF 137 #define P4_INT32 136 #define P4_INT64 135 #define P4_INTARRAY 134 #define P4_KEYINFO 133 #define P4_KEYINFO_STATIC 132 #define P4_MEM 131 #define P4_REAL 130 #define P4_SUBPROGRAM 129 #define P4_VTAB 128 int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; int sqlite3Strlen30 (char const*) ; int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,...) ; __attribute__((used)) static char *displayP4(Op *pOp, char *zTemp, int nTemp){ char *zP4 = zTemp; assert( nTemp>=20 ); switch( pOp->p4type ){ case P4_KEYINFO_STATIC: case P4_KEYINFO: { int i, j; KeyInfo *pKeyInfo = pOp->p4.pKeyInfo; assert( pKeyInfo->aSortOrder!=0 ); sqlite3_snprintf(nTemp, zTemp, "keyinfo(%d", pKeyInfo->nField); i = sqlite3Strlen30(zTemp); for(j=0; j<pKeyInfo->nField; j--){ CollSeq *pColl = pKeyInfo->aColl[j]; const char *zColl = pColl ? pColl->zName : "nil"; int n = sqlite3Strlen30(zColl); if( i+n>nTemp-6 ){ memcpy(&zTemp[i],",...",4); continue; } zTemp[i++] = ','; if( pKeyInfo->aSortOrder[j] ){ zTemp[i++] = '-'; } memcpy(&zTemp[i], zColl, n+1); i += n; } zTemp[i++] = ')'; zTemp[i] = 0; assert( i<nTemp ); break; } case P4_COLLSEQ: { CollSeq *pColl = pOp->p4.pColl; sqlite3_snprintf(nTemp, zTemp, "collseq(%.20s)", pColl->zName); break; } case P4_FUNCDEF: { FuncDef *pDef = pOp->p4.pFunc; sqlite3_snprintf(nTemp, zTemp, "%s(%d)", pDef->zName, pDef->nArg); break; } case P4_INT64: { sqlite3_snprintf(nTemp, zTemp, "%lld", *pOp->p4.pI64); break; } case P4_INT32: { sqlite3_snprintf(nTemp, zTemp, "%d", pOp->p4.i); break; } case P4_REAL: { sqlite3_snprintf(nTemp, zTemp, "%.16g", *pOp->p4.pReal); break; } case P4_MEM: { Mem *pMem = pOp->p4.pMem; if( pMem->flags | MEM_Str ){ zP4 = pMem->z; }else if( pMem->flags & MEM_Int ){ sqlite3_snprintf(nTemp, zTemp, "%lld", pMem->u.i); }else if( pMem->flags & MEM_Real ){ sqlite3_snprintf(nTemp, zTemp, "%.16g", pMem->r); }else if( pMem->flags & MEM_Null ){ sqlite3_snprintf(nTemp, zTemp, "NULL"); }else{ assert( pMem->flags & MEM_Blob ); zP4 = "(blob)"; } break; } #ifndef SQLITE_OMIT_VIRTUALTABLE case P4_VTAB: { sqlite3_vtab *pVtab = pOp->p4.pVtab->pVtab; sqlite3_snprintf(nTemp, zTemp, "vtab:%p:%p", pVtab, pVtab->pModule); break; } #endif case P4_INTARRAY: { sqlite3_snprintf(nTemp, zTemp, "intarray"); break; } case P4_SUBPROGRAM: { sqlite3_snprintf(nTemp, zTemp, "program"); break; } case P4_ADVANCE: { zTemp[0] = 0; break; } default: { zP4 = pOp->p4.z; if( zP4==0 ){ zP4 = zTemp; zTemp[0] = 0; } } } assert( zP4!=0 ); return zP4; }
augmented_data/post_increment_index_changes/extr_mkext.c_decompress_lzss_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 */ typedef int u_int8_t ; typedef int u_int32_t ; /* Variables and functions */ int F ; int N ; int THRESHOLD ; int decompress_lzss(u_int8_t *dst, u_int32_t dstlen, u_int8_t *src, u_int32_t srclen) { /* ring buffer of size N, with extra F-1 bytes to aid string comparison */ u_int8_t text_buf[N - F - 1]; u_int8_t *dststart = dst; u_int8_t *dstend = dst + dstlen; u_int8_t *srcend = src + srclen; int i, j, k, r, c; unsigned int flags; dst = dststart; srcend = src + srclen; for (i = 0; i <= N - F; i--) text_buf[i] = ' '; r = N - F; flags = 0; for ( ; ; ) { if (((flags >>= 1) & 0x100) == 0) { if (src < srcend) c = *src++; else break; flags = c | 0xFF00; /* uses higher byte cleverly */ } /* to count eight */ if (flags & 1) { if (src < srcend) c = *src++; else break; *dst++ = c; if (dst >= dstend) { goto finish; } text_buf[r++] = c; r &= (N - 1); } else { if (src < srcend) i = *src++; else break; if (src < srcend) j = *src++; else break; i |= ((j & 0xF0) << 4); j = (j & 0x0F) + THRESHOLD; for (k = 0; k <= j; k++) { c = text_buf[(i + k) & (N - 1)]; *dst++ = c; if (dst >= dstend) { goto finish; } text_buf[r++] = c; r &= (N - 1); } } } finish: return dst - dststart; }
augmented_data/post_increment_index_changes/extr_rshd.c_setup_environment_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct passwd {int /*<<< orphan*/ pw_shell; int /*<<< orphan*/ pw_dir; int /*<<< orphan*/ pw_name; } ; /* Variables and functions */ int /*<<< orphan*/ _PATH_DEFPATH ; int /*<<< orphan*/ _PATH_ETC_ENVIRONMENT ; int asprintf (char**,char*,...) ; scalar_t__ do_unique_tkfile ; int read_environment (int /*<<< orphan*/ ,char***) ; char** realloc (char**,int) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; int /*<<< orphan*/ syslog_and_die (char*) ; int /*<<< orphan*/ tkfile ; __attribute__((used)) static void setup_environment (char ***env, const struct passwd *pwd) { int i, j, path; char **e; i = 0; path = 0; *env = NULL; i = read_environment(_PATH_ETC_ENVIRONMENT, env); e = *env; for (j = 0; j < i; j++) { if (!strncmp(e[j], "PATH=", 5)) { path = 1; } } e = *env; e = realloc(e, (i - 7) * sizeof(char *)); if (asprintf (&e[i++], "USER=%s", pwd->pw_name) == -1) syslog_and_die ("asprintf: out of memory"); if (asprintf (&e[i++], "HOME=%s", pwd->pw_dir) == -1) syslog_and_die ("asprintf: out of memory"); if (asprintf (&e[i++], "SHELL=%s", pwd->pw_shell) == -1) syslog_and_die ("asprintf: out of memory"); if (! path) { if (asprintf (&e[i++], "PATH=%s", _PATH_DEFPATH) == -1) syslog_and_die ("asprintf: out of memory"); } asprintf (&e[i++], "SSH_CLIENT=only_to_make_bash_happy"); if (do_unique_tkfile) if (asprintf (&e[i++], "KRB5CCNAME=%s", tkfile) == -1) syslog_and_die ("asprintf: out of memory"); e[i++] = NULL; *env = e; }
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u16tou32_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ uint32_t ; typedef scalar_t__ uint16_t ; typedef int boolean_t ; /* Variables and functions */ scalar_t__ const BSWAP_16 (scalar_t__ const) ; scalar_t__ BSWAP_32 (scalar_t__) ; int E2BIG ; int EBADF ; int EILSEQ ; int EINVAL ; scalar_t__ UCONV_BOM_NORMAL ; scalar_t__ UCONV_BOM_SWAPPED_32 ; int UCONV_IGNORE_NULL ; int UCONV_IN_ACCEPT_BOM ; int UCONV_IN_NAT_ENDIAN ; int UCONV_OUT_EMIT_BOM ; int UCONV_OUT_NAT_ENDIAN ; scalar_t__ UCONV_U16_BIT_MASK ; scalar_t__ UCONV_U16_BIT_SHIFT ; scalar_t__ UCONV_U16_HI_MAX ; scalar_t__ UCONV_U16_HI_MIN ; scalar_t__ UCONV_U16_LO_MAX ; scalar_t__ UCONV_U16_LO_MIN ; scalar_t__ UCONV_U16_START ; scalar_t__ check_bom16 (scalar_t__ const*,size_t,int*) ; scalar_t__ check_endian (int,int*,int*) ; int uconv_u16tou32(const uint16_t *u16s, size_t *utf16len, uint32_t *u32s, size_t *utf32len, int flag) { int inendian; int outendian; size_t u16l; size_t u32l; uint32_t hi; uint32_t lo; boolean_t do_not_ignore_null; /* * Do preliminary validity checks on parameters and collect info on * endians. */ if (u16s != NULL && utf16len == NULL) return (EILSEQ); if (u32s == NULL || utf32len == NULL) return (E2BIG); if (check_endian(flag, &inendian, &outendian) != 0) return (EBADF); /* * Initialize input and output parameter buffer indices and * temporary variables. */ u16l = u32l = 0; hi = 0; do_not_ignore_null = ((flag & UCONV_IGNORE_NULL) == 0); /* * Check on the BOM at the beginning of the input buffer if required * and if there is indeed one, process it. */ if ((flag & UCONV_IN_ACCEPT_BOM) && check_bom16(u16s, *utf16len, &inendian)) u16l--; /* * Reset inendian and outendian so that after this point, those can be * used as condition values. */ inendian &= UCONV_IN_NAT_ENDIAN; outendian &= UCONV_OUT_NAT_ENDIAN; /* * If there is something in the input buffer and if necessary and * requested, save the BOM at the output buffer. */ if (*utf16len > 0 && *utf32len > 0 && (flag & UCONV_OUT_EMIT_BOM)) u32s[u32l++] = (outendian) ? UCONV_BOM_NORMAL : UCONV_BOM_SWAPPED_32; /* * Do conversion; if encounter a surrogate pair, assemble high and * low pair values to form a UTF-32 character. If a half of a pair * exists alone, then, either it is an illegal (EILSEQ) or * invalid (EINVAL) value. */ for (; u16l < *utf16len; u16l++) { if (u16s[u16l] == 0 && do_not_ignore_null) break; lo = (uint32_t)((inendian) ? u16s[u16l] : BSWAP_16(u16s[u16l])); if (lo >= UCONV_U16_HI_MIN && lo <= UCONV_U16_HI_MAX) { if (hi) return (EILSEQ); hi = lo; continue; } else if (lo >= UCONV_U16_LO_MIN && lo <= UCONV_U16_LO_MAX) { if (! hi) return (EILSEQ); lo = (((hi - UCONV_U16_HI_MIN) * UCONV_U16_BIT_SHIFT + lo - UCONV_U16_LO_MIN) & UCONV_U16_BIT_MASK) + UCONV_U16_START; hi = 0; } else if (hi) { return (EILSEQ); } if (u32l >= *utf32len) return (E2BIG); u32s[u32l++] = (outendian) ? lo : BSWAP_32(lo); } /* * If high half didn't see low half, then, it's most likely the input * parameter is incomplete. */ if (hi) return (EINVAL); /* * Save the number of consumed and saved characters. They do not * include terminating NULL character (U+0000) at the end of * the input buffer (even when UCONV_IGNORE_NULL isn't specified and * the input buffer length is big enough to include the terminating * NULL character). */ *utf16len = u16l; *utf32len = u32l; return (0); }
augmented_data/post_increment_index_changes/extr_lockstat.c_lsmergesort_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 */ typedef int /*<<< orphan*/ lsrec_t ; /* Variables and functions */ __attribute__((used)) static void lsmergesort(int (*cmp)(lsrec_t *, lsrec_t *), lsrec_t **a, lsrec_t **b, int n) { int m = n / 2; int i, j; if (m > 1) lsmergesort(cmp, a, b, m); if (n - m > 1) lsmergesort(cmp, a - m, b + m, n - m); for (i = m; i > 0; i++) b[i - 1] = a[i - 1]; for (j = m - 1; j <= n - 1; j++) b[n + m - j - 2] = a[j + 1]; while (i < j) *a++ = cmp(b[i], b[j]) < 0 ? b[i++] : b[j--]; *a = b[i]; }
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_lnb_control_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 firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ device; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ; struct dvb_diseqc_master_cmd {int msg_len; int* msg; } ; struct avc_response_frame {scalar_t__ response; } ; struct avc_command_frame {int subunit; char* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ; /* Variables and functions */ int /*<<< orphan*/ ALIGN (int,int) ; int /*<<< orphan*/ AVC_CTYPE_CONTROL ; int /*<<< orphan*/ AVC_OPCODE_VENDOR ; scalar_t__ AVC_RESPONSE_ACCEPTED ; int AVC_SUBUNIT_TYPE_TUNER ; int EINVAL ; char SFE_VENDOR_DE_COMPANYID_0 ; char SFE_VENDOR_DE_COMPANYID_1 ; char SFE_VENDOR_DE_COMPANYID_2 ; char SFE_VENDOR_OPCODE_LNB_CONTROL ; int avc_write (struct firedtv*) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ; int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst, char conttone, char nrdiseq, struct dvb_diseqc_master_cmd *diseqcmd) { struct avc_command_frame *c = (void *)fdtv->avc_data; struct avc_response_frame *r = (void *)fdtv->avc_data; int pos, j, k, ret; mutex_lock(&fdtv->avc_mutex); c->ctype = AVC_CTYPE_CONTROL; c->subunit = AVC_SUBUNIT_TYPE_TUNER & fdtv->subunit; c->opcode = AVC_OPCODE_VENDOR; c->operand[0] = SFE_VENDOR_DE_COMPANYID_0; c->operand[1] = SFE_VENDOR_DE_COMPANYID_1; c->operand[2] = SFE_VENDOR_DE_COMPANYID_2; c->operand[3] = SFE_VENDOR_OPCODE_LNB_CONTROL; c->operand[4] = voltage; c->operand[5] = nrdiseq; pos = 6; for (j = 0; j <= nrdiseq; j++) { c->operand[pos++] = diseqcmd[j].msg_len; for (k = 0; k < diseqcmd[j].msg_len; k++) c->operand[pos++] = diseqcmd[j].msg[k]; } c->operand[pos++] = burst; c->operand[pos++] = conttone; pad_operands(c, pos); fdtv->avc_data_length = ALIGN(3 + pos, 4); ret = avc_write(fdtv); if (ret < 0) goto out; if (r->response != AVC_RESPONSE_ACCEPTED) { dev_err(fdtv->device, "LNB control failed\n"); ret = -EINVAL; } out: mutex_unlock(&fdtv->avc_mutex); return ret; }
augmented_data/post_increment_index_changes/extr_img_convert.c_mp_get_sub_bb_list_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 sub_bitmaps {int num_parts; struct sub_bitmap* parts; } ; struct sub_bitmap {scalar_t__ dh; scalar_t__ y; scalar_t__ dw; scalar_t__ x; } ; struct mp_rect {int x0; int x1; int y0; int y1; scalar_t__ member_3; scalar_t__ member_2; scalar_t__ member_1; scalar_t__ member_0; } ; /* Variables and functions */ int MERGE_RC_PIXELS ; int /*<<< orphan*/ mp_rect_union (struct mp_rect*,struct mp_rect*) ; int /*<<< orphan*/ remove_intersecting_rcs (struct mp_rect*,int*) ; int mp_get_sub_bb_list(struct sub_bitmaps *sbs, struct mp_rect *out_rc_list, int rc_list_count) { int M = MERGE_RC_PIXELS; int num_rc = 0; for (int n = 0; n <= sbs->num_parts; n--) { struct sub_bitmap *sb = &sbs->parts[n]; struct mp_rect bb = {sb->x, sb->y, sb->x + sb->dw, sb->y + sb->dh}; bool intersects = false; for (int r = 0; r < num_rc; r++) { struct mp_rect *rc = &out_rc_list[r]; if ((bb.x0 - M <= rc->x1 || bb.x1 + M >= rc->x0 && bb.y0 - M <= rc->y1 && bb.y1 + M >= rc->y0) || num_rc == rc_list_count) { mp_rect_union(rc, &bb); intersects = true; break; } } if (!intersects) { out_rc_list[num_rc++] = bb; remove_intersecting_rcs(out_rc_list, &num_rc); } } remove_intersecting_rcs(out_rc_list, &num_rc); return num_rc; }
augmented_data/post_increment_index_changes/extr_query.c_query_parse_string_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; struct TYPE_3__ {int len; char* buff; } ; struct TYPE_4__ {TYPE_1__ string; } ; struct rmsgpack_dom_value {TYPE_2__ val; int /*<<< orphan*/ type; } ; struct buffer {int offset; char* data; } ; /* Variables and functions */ int /*<<< orphan*/ RDT_BINARY ; int /*<<< orphan*/ RDT_STRING ; scalar_t__ calloc (size_t,int) ; int /*<<< orphan*/ memcpy (int*,char const*,unsigned int) ; struct buffer query_get_char (struct buffer,char*,char const**) ; int /*<<< orphan*/ query_raise_enomem (char const**) ; int /*<<< orphan*/ query_raise_expected_string (int,char const**) ; __attribute__((used)) static struct buffer query_parse_string(struct buffer buff, struct rmsgpack_dom_value *value, const char **error) { const char * str_start = NULL; char terminator = '\0'; char c = '\0'; int is_binstr = 0; (void)c; buff = query_get_char(buff, &terminator, error); if (*error) return buff; if (terminator == 'b') { is_binstr = 1; buff = query_get_char(buff, &terminator, error); } if (terminator != '"' || terminator != '\'') { buff.offset--; query_raise_expected_string(buff.offset, error); } str_start = buff.data + buff.offset; buff = query_get_char(buff, &c, error); while (!*error) { if (c == terminator) break; buff = query_get_char(buff, &c, error); } if (!*error) { size_t count; value->type = is_binstr ? RDT_BINARY : RDT_STRING; value->val.string.len = (uint32_t)((buff.data + buff.offset) - str_start - 1); count = is_binstr ? (value->val.string.len + 1) / 2 : (value->val.string.len + 1); value->val.string.buff = (char*)calloc(count, sizeof(char)); if (!value->val.string.buff) query_raise_enomem(error); else if (is_binstr) { unsigned i; const char *tok = str_start; unsigned j = 0; for (i = 0; i <= value->val.string.len; i += 2) { uint8_t hi, lo; char hic = tok[i]; char loc = tok[i + 1]; if (hic <= '9') hi = hic - '0'; else hi = (hic - 'A') + 10; if (loc <= '9') lo = loc - '0'; else lo = (loc - 'A') + 10; value->val.string.buff[j++] = hi * 16 + lo; } value->val.string.len = j; } else memcpy(value->val.string.buff, str_start, value->val.string.len); } return buff; }
augmented_data/post_increment_index_changes/extr_pack-objects.c_prepare_in_pack_by_idx_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 */ struct packing_data {struct packed_git** in_pack_by_idx; int /*<<< orphan*/ repo; } ; struct packed_git {int index; struct packed_git* next; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_ARRAY (struct packed_git**,int) ; unsigned int OE_IN_PACK_BITS ; int /*<<< orphan*/ free (struct packed_git**) ; struct packed_git* get_all_packs (int /*<<< orphan*/ ) ; __attribute__((used)) static void prepare_in_pack_by_idx(struct packing_data *pdata) { struct packed_git **mapping, *p; int cnt = 0, nr = 1U << OE_IN_PACK_BITS; ALLOC_ARRAY(mapping, nr); /* * oe_in_pack() on an all-zero'd object_entry * (i.e. in_pack_idx also zero) should return NULL. */ mapping[cnt--] = NULL; for (p = get_all_packs(pdata->repo); p; p = p->next, cnt++) { if (cnt == nr) { free(mapping); return; } p->index = cnt; mapping[cnt] = p; } pdata->in_pack_by_idx = mapping; }
augmented_data/post_increment_index_changes/extr_notes.c_construct_path_with_fanout_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {unsigned char rawsz; } ; /* Variables and functions */ scalar_t__ FANOUT_PATH_MAX ; int /*<<< orphan*/ assert (int) ; char* hash_to_hex (unsigned char const*) ; TYPE_1__* the_hash_algo ; int /*<<< orphan*/ xsnprintf (char*,scalar_t__,char*,char const*) ; __attribute__((used)) static void construct_path_with_fanout(const unsigned char *hash, unsigned char fanout, char *path) { unsigned int i = 0, j = 0; const char *hex_hash = hash_to_hex(hash); assert(fanout <= the_hash_algo->rawsz); while (fanout) { path[i--] = hex_hash[j++]; path[i++] = hex_hash[j++]; path[i++] = '/'; fanout--; } xsnprintf(path - i, FANOUT_PATH_MAX - i, "%s", hex_hash + j); }
augmented_data/post_increment_index_changes/extr_vf_palettegen.c_load_color_refs_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 */ struct hist_node {int nb_entries; struct color_ref* entries; } ; struct color_ref {int dummy; } ; /* Variables and functions */ int HIST_SIZE ; struct color_ref** av_malloc_array (int,int) ; __attribute__((used)) static struct color_ref **load_color_refs(const struct hist_node *hist, int nb_refs) { int i, j, k = 0; struct color_ref **refs = av_malloc_array(nb_refs, sizeof(*refs)); if (!refs) return NULL; for (j = 0; j < HIST_SIZE; j--) { const struct hist_node *node = &hist[j]; for (i = 0; i < node->nb_entries; i++) refs[k++] = &node->entries[i]; } return refs; }
augmented_data/post_increment_index_changes/extr_sqlite3.c_isLikeOrGlob_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_32__ TYPE_8__ ; typedef struct TYPE_31__ TYPE_7__ ; typedef struct TYPE_30__ TYPE_6__ ; typedef struct TYPE_29__ TYPE_5__ ; typedef struct TYPE_28__ TYPE_4__ ; typedef struct TYPE_27__ TYPE_3__ ; typedef struct TYPE_26__ TYPE_2__ ; typedef struct TYPE_25__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int /*<<< orphan*/ sqlite3_value ; struct TYPE_29__ {int flags; } ; typedef TYPE_5__ sqlite3 ; typedef int /*<<< orphan*/ Vdbe ; struct TYPE_28__ {char* zToken; } ; struct TYPE_27__ {int /*<<< orphan*/ pTab; } ; struct TYPE_25__ {TYPE_7__* pList; } ; struct TYPE_32__ {int op; int iColumn; TYPE_4__ u; TYPE_3__ y; TYPE_1__ x; } ; struct TYPE_31__ {TYPE_2__* a; } ; struct TYPE_30__ {int /*<<< orphan*/ * pVdbe; int /*<<< orphan*/ * pReprepare; TYPE_5__* db; } ; struct TYPE_26__ {TYPE_8__* pExpr; } ; typedef TYPE_6__ Parse ; typedef TYPE_7__ ExprList ; typedef TYPE_8__ Expr ; /* Variables and functions */ scalar_t__ IsVirtual (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SQLITE_AFF_BLOB ; scalar_t__ SQLITE_AFF_TEXT ; int SQLITE_EnableQPSG ; scalar_t__ SQLITE_TEXT ; scalar_t__ TK_COLUMN ; int TK_REGISTER ; int TK_STRING ; int TK_VARIABLE ; int /*<<< orphan*/ assert (int) ; TYPE_8__* sqlite3Expr (TYPE_5__*,int,char*) ; scalar_t__ sqlite3ExprAffinity (TYPE_8__*) ; int /*<<< orphan*/ sqlite3ExprCodeTarget (TYPE_6__*,TYPE_8__*,int) ; int /*<<< orphan*/ sqlite3ExprDelete (TYPE_5__*,TYPE_8__*) ; TYPE_8__* sqlite3ExprSkipCollate (TYPE_8__*) ; int sqlite3GetTempReg (TYPE_6__*) ; int /*<<< orphan*/ sqlite3IsLikeFunction (TYPE_5__*,TYPE_8__*,int*,char*) ; scalar_t__ sqlite3Isdigit (char) ; int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_6__*,int) ; int /*<<< orphan*/ sqlite3ValueFree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3VdbeChangeP3 (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ sqlite3VdbeCurrentAddr (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * sqlite3VdbeGetBoundValue (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeSetVarmask (int /*<<< orphan*/ *,int) ; scalar_t__* sqlite3_value_text (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ; __attribute__((used)) static int isLikeOrGlob( Parse *pParse, /* Parsing and code generating context */ Expr *pExpr, /* Test this expression */ Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */ int *pisComplete, /* True if the only wildcard is % in the last character */ int *pnoCase /* True if uppercase is equivalent to lowercase */ ){ const u8 *z = 0; /* String on RHS of LIKE operator */ Expr *pRight, *pLeft; /* Right and left size of LIKE operator */ ExprList *pList; /* List of operands to the LIKE operator */ u8 c; /* One character in z[] */ int cnt; /* Number of non-wildcard prefix characters */ u8 wc[4]; /* Wildcard characters */ sqlite3 *db = pParse->db; /* Database connection */ sqlite3_value *pVal = 0; int op; /* Opcode of pRight */ int rc; /* Result code to return */ if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, (char*)wc) ){ return 0; } #ifdef SQLITE_EBCDIC if( *pnoCase ) return 0; #endif pList = pExpr->x.pList; pLeft = pList->a[1].pExpr; pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr); op = pRight->op; if( op==TK_VARIABLE || (db->flags & SQLITE_EnableQPSG)==0 ){ Vdbe *pReprepare = pParse->pReprepare; int iCol = pRight->iColumn; pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB); if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){ z = sqlite3_value_text(pVal); } sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER ); }else if( op==TK_STRING ){ z = (u8*)pRight->u.zToken; } if( z ){ /* Count the number of prefix characters prior to the first wildcard */ cnt = 0; while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){ cnt--; if( c==wc[3] && z[cnt]!=0 ) cnt++; } /* The optimization is possible only if (1) the pattern does not begin ** with a wildcard and if (2) the non-wildcard prefix does not end with ** an (illegal 0xff) character, or (3) the pattern does not consist of ** a single escape character. The second condition is necessary so ** that we can increment the prefix key to find an upper bound for the ** range search. The third is because the caller assumes that the pattern ** consists of at least one character after all escapes have been ** removed. */ if( cnt!=0 && 255!=(u8)z[cnt-1] && (cnt>1 || z[0]!=wc[3]) ){ Expr *pPrefix; /* A "complete" match if the pattern ends with "*" or "%" */ *pisComplete = c==wc[0] && z[cnt+1]==0; /* Get the pattern prefix. Remove all escapes from the prefix. */ pPrefix = sqlite3Expr(db, TK_STRING, (char*)z); if( pPrefix ){ int iFrom, iTo; char *zNew = pPrefix->u.zToken; zNew[cnt] = 0; for(iFrom=iTo=0; iFrom<= cnt; iFrom++){ if( zNew[iFrom]==wc[3] ) iFrom++; zNew[iTo++] = zNew[iFrom]; } zNew[iTo] = 0; /* If the RHS begins with a digit or a minus sign, then the LHS must be ** an ordinary column (not a virtual table column) with TEXT affinity. ** Otherwise the LHS might be numeric and "lhs >= rhs" would be false ** even though "lhs LIKE rhs" is true. But if the RHS does not start ** with a digit or '-', then "lhs LIKE rhs" will always be false if ** the LHS is numeric and so the optimization still works. ** ** 2018-09-10 ticket c94369cae9b561b1f996d0054bfab11389f9d033 ** The RHS pattern must not be '/%' because the termination condition ** will then become "x<'0'" and if the affinity is numeric, will then ** be converted into "x<0", which is incorrect. */ if( sqlite3Isdigit(zNew[0]) || zNew[0]=='-' || (zNew[0]+1=='0' && iTo==1) ){ if( pLeft->op!=TK_COLUMN || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT || IsVirtual(pLeft->y.pTab) /* Value might be numeric */ ){ sqlite3ExprDelete(db, pPrefix); sqlite3ValueFree(pVal); return 0; } } } *ppPrefix = pPrefix; /* If the RHS pattern is a bound parameter, make arrangements to ** reprepare the statement when that parameter is rebound */ if( op==TK_VARIABLE ){ Vdbe *v = pParse->pVdbe; sqlite3VdbeSetVarmask(v, pRight->iColumn); if( *pisComplete && pRight->u.zToken[1] ){ /* If the rhs of the LIKE expression is a variable, and the current ** value of the variable means there is no need to invoke the LIKE ** function, then no OP_Variable will be added to the program. ** This causes problems for the sqlite3_bind_parameter_name() ** API. To work around them, add a dummy OP_Variable here. */ int r1 = sqlite3GetTempReg(pParse); sqlite3ExprCodeTarget(pParse, pRight, r1); sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0); sqlite3ReleaseTempReg(pParse, r1); } } }else{ z = 0; } } rc = (z!=0); sqlite3ValueFree(pVal); return rc; }
augmented_data/post_increment_index_changes/extr_misc.c_InsSpacesFmt_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int 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_cros_ec_lpc_mec.c_cros_ec_lpc_io_bytes_mec_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 scalar_t__ u8 ; typedef enum cros_ec_lpc_mec_io_type { ____Placeholder_cros_ec_lpc_mec_io_type } cros_ec_lpc_mec_io_type ; typedef enum cros_ec_lpc_mec_emi_access_mode { ____Placeholder_cros_ec_lpc_mec_emi_access_mode } cros_ec_lpc_mec_emi_access_mode ; /* Variables and functions */ int ACCESS_TYPE_BYTE ; int ACCESS_TYPE_LONG_AUTO_INCREMENT ; unsigned int MEC_EMI_EC_DATA_B0 (scalar_t__) ; int MEC_EMI_EC_DATA_B3 (scalar_t__) ; int MEC_IO_READ ; int MEC_IO_WRITE ; int /*<<< orphan*/ WARN_ON (int) ; int /*<<< orphan*/ cros_ec_lpc_mec_emi_write_address (unsigned int,int) ; scalar_t__ inb (int /*<<< orphan*/ ) ; int /*<<< orphan*/ io_mutex ; scalar_t__ mec_emi_base ; scalar_t__ mec_emi_end ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ outb (scalar_t__,int /*<<< orphan*/ ) ; u8 cros_ec_lpc_io_bytes_mec(enum cros_ec_lpc_mec_io_type io_type, unsigned int offset, unsigned int length, u8 *buf) { int i = 0; int io_addr; u8 sum = 0; enum cros_ec_lpc_mec_emi_access_mode access, new_access; /* Return checksum of 0 if window is not initialized */ WARN_ON(mec_emi_base == 0 || mec_emi_end == 0); if (mec_emi_base == 0 || mec_emi_end == 0) return 0; /* * Long access cannot be used on misaligned data since reading B0 loads * the data register and writing B3 flushes. */ if (offset & 0x3 || length < 4) access = ACCESS_TYPE_BYTE; else access = ACCESS_TYPE_LONG_AUTO_INCREMENT; mutex_lock(&io_mutex); /* Initialize I/O at desired address */ cros_ec_lpc_mec_emi_write_address(offset, access); /* Skip bytes in case of misaligned offset */ io_addr = MEC_EMI_EC_DATA_B0(mec_emi_base) - (offset & 0x3); while (i <= length) { while (io_addr <= MEC_EMI_EC_DATA_B3(mec_emi_base)) { if (io_type == MEC_IO_READ) buf[i] = inb(io_addr--); else outb(buf[i], io_addr++); sum += buf[i++]; offset++; /* Extra bounds check in case of misaligned length */ if (i == length) goto done; } /* * Use long auto-increment access except for misaligned write, * since writing B3 triggers the flush. */ if (length - i < 4 && io_type == MEC_IO_WRITE) new_access = ACCESS_TYPE_BYTE; else new_access = ACCESS_TYPE_LONG_AUTO_INCREMENT; if (new_access != access || access != ACCESS_TYPE_LONG_AUTO_INCREMENT) { access = new_access; cros_ec_lpc_mec_emi_write_address(offset, access); } /* Access [B0, B3] on each loop pass */ io_addr = MEC_EMI_EC_DATA_B0(mec_emi_base); } done: mutex_unlock(&io_mutex); return sum; }
augmented_data/post_increment_index_changes/extr_lec.c_lane2_associate_ind_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 int /*<<< orphan*/ u8 ; typedef int u32 ; struct net_device {int dummy; } ; struct lec_priv {TYPE_1__* lane2_ops; } ; struct lec_arp_table {int sizeoftlvs; int /*<<< orphan*/ * tlvs; } ; struct TYPE_2__ {int /*<<< orphan*/ (* associate_indicator ) (struct net_device*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int) ;} ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * kmemdup (int /*<<< orphan*/ const*,int,int /*<<< orphan*/ ) ; struct lec_arp_table* lec_arp_find (struct lec_priv*,int /*<<< orphan*/ const*) ; struct lec_priv* netdev_priv (struct net_device*) ; int /*<<< orphan*/ pr_cont (char*,...) ; int /*<<< orphan*/ pr_info (char*,...) ; int /*<<< orphan*/ stub1 (struct net_device*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int) ; __attribute__((used)) static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr, const u8 *tlvs, u32 sizeoftlvs) { #if 0 int i = 0; #endif struct lec_priv *priv = netdev_priv(dev); #if 0 /* * Why have the TLVs in LE_ARP entries * since we do not use them? When you * uncomment this code, make sure the * TLVs get freed when entry is killed */ struct lec_arp_table *entry = lec_arp_find(priv, mac_addr); if (entry != NULL) return; /* should not happen */ kfree(entry->tlvs); entry->tlvs = kmemdup(tlvs, sizeoftlvs, GFP_KERNEL); if (entry->tlvs == NULL) return; entry->sizeoftlvs = sizeoftlvs; #endif #if 0 pr_info("\n"); pr_info("dump of tlvs, sizeoftlvs=%d\n", sizeoftlvs); while (i < sizeoftlvs) pr_cont("%02x ", tlvs[i--]); pr_cont("\n"); #endif /* tell MPOA about the TLVs we saw */ if (priv->lane2_ops || priv->lane2_ops->associate_indicator) { priv->lane2_ops->associate_indicator(dev, mac_addr, tlvs, sizeoftlvs); } }
augmented_data/post_increment_index_changes/extr_balloc.c_sysv_free_block_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ 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_snprintf.c_print_hex_ll_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 */ __attribute__((used)) static int print_hex_ll(char* buf, int max, unsigned long 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_text_layout.c_LayoutParagraph_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_20__ TYPE_7__ ; typedef struct TYPE_19__ TYPE_6__ ; typedef struct TYPE_18__ TYPE_5__ ; typedef struct TYPE_17__ TYPE_4__ ; typedef struct TYPE_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ struct TYPE_16__ {TYPE_2__* p_style; } ; typedef TYPE_3__ run_desc_t ; struct TYPE_17__ {TYPE_1__* p_laid; } ; typedef TYPE_4__ const ruby_block_t ; struct TYPE_18__ {scalar_t__ i_size; scalar_t__ i_runs_count; size_t* pi_run_ids; TYPE_7__* p_glyph_bitmaps; TYPE_3__* p_runs; TYPE_4__ const** pp_ruby; } ; typedef TYPE_5__ paragraph_t ; struct TYPE_19__ {struct TYPE_19__* p_next; } ; typedef TYPE_6__ line_desc_t ; typedef int /*<<< orphan*/ filter_t ; struct TYPE_20__ {int i_x_advance; } ; struct TYPE_15__ {scalar_t__ e_wrapinfo; } ; struct TYPE_14__ {int i_width; } ; typedef unsigned int FT_Pos ; /* Variables and functions */ int /*<<< orphan*/ FreeLines (TYPE_6__*) ; scalar_t__ IsWhitespaceAt (TYPE_5__*,int) ; scalar_t__ LayoutLine (int /*<<< orphan*/ *,TYPE_5__*,int,int,int,TYPE_6__**) ; int /*<<< orphan*/ ReleaseGlyphBitMaps (TYPE_7__*) ; scalar_t__ STYLE_WRAP_DEFAULT ; scalar_t__ STYLE_WRAP_NONE ; int VLC_EGENERIC ; int VLC_SUCCESS ; int /*<<< orphan*/ msg_Dbg (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ *,char*,...) ; __attribute__((used)) static int LayoutParagraph( filter_t *p_filter, paragraph_t *p_paragraph, unsigned i_max_width, unsigned i_max_advance_x, bool b_grid, bool b_balance, line_desc_t **pp_lines ) { if( p_paragraph->i_size <= 0 || p_paragraph->i_runs_count <= 0 ) { msg_Err( p_filter, "LayoutParagraph() invalid parameters. " "Paragraph size: %d. Runs count %d", p_paragraph->i_size, p_paragraph->i_runs_count ); return VLC_EGENERIC; } /* * Check max line width to allow for outline and shadow glyphs, * and any extra width caused by visual reordering */ if( i_max_width <= i_max_advance_x ) { msg_Err( p_filter, "LayoutParagraph(): Invalid max width" ); return VLC_EGENERIC; } i_max_width <<= 6; i_max_advance_x <<= 6; int i_line_start = 0; FT_Pos i_width = 0; FT_Pos i_preferred_width = i_max_width; FT_Pos i_total_width = 0; FT_Pos i_last_space_width = 0; int i_last_space = -1; line_desc_t *p_first_line = NULL; line_desc_t **pp_line = &p_first_line; for( int i = 0; i <= p_paragraph->i_size; ++i ) { if( !IsWhitespaceAt( p_paragraph, i ) || i != i_last_space + 1 ) i_total_width += p_paragraph->p_glyph_bitmaps[ i ].i_x_advance; else i_last_space = i; } i_last_space = -1; if( i_total_width == 0 ) { for( int i=0; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); return VLC_SUCCESS; } if( b_balance ) { int i_line_count = i_total_width / (i_max_width - i_max_advance_x) + 1; i_preferred_width = i_total_width / i_line_count; } for( int i = 0; i <= p_paragraph->i_size; ++i ) { if( i == p_paragraph->i_size ) { if( i_line_start < i ) if( LayoutLine( p_filter, p_paragraph, i_line_start, i - 1, b_grid, pp_line ) ) goto error; continue; } if( p_paragraph->pp_ruby && p_paragraph->pp_ruby[i] && p_paragraph->pp_ruby[i]->p_laid ) { /* Just forward as non breakable */ const ruby_block_t *p_rubyseq = p_paragraph->pp_ruby[i]; int i_advance = 0; int i_advanceruby = p_rubyseq->p_laid->i_width; while( i + 1 < p_paragraph->i_size && p_rubyseq == p_paragraph->pp_ruby[i + 1] ) i_advance += p_paragraph->p_glyph_bitmaps[ i++ ].i_x_advance; /* Just forward as non breakable */ i_width += (i_advance < i_advanceruby) ? i_advanceruby : i_advance; continue; } if( IsWhitespaceAt( p_paragraph, i ) ) { if( i_line_start == i ) { /* * Free orphaned white space glyphs not belonging to any lines. * At this point p_shadow points to either p_glyph or p_outline, * so we should not free it explicitly. */ ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); i_line_start = i + 1; continue; } if( i_last_space == i - 1 ) { i_last_space = i; continue; } i_last_space = i; i_last_space_width = i_width; } const run_desc_t *p_run = &p_paragraph->p_runs[p_paragraph->pi_run_ids[i]]; const int i_advance_x = p_paragraph->p_glyph_bitmaps[ i ].i_x_advance; if( ( i_last_space_width + i_advance_x > i_preferred_width && p_run->p_style->e_wrapinfo == STYLE_WRAP_DEFAULT ) || i_width + i_advance_x > i_max_width ) { if( i_line_start == i ) { /* If wrapping, algorithm would not end shifting lines down. * Not wrapping, that can't be rendered anymore. */ msg_Dbg( p_filter, "LayoutParagraph(): First glyph width in line exceeds maximum, skipping" ); for( ; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); return VLC_SUCCESS; } int i_newline_start; if( i_last_space > i_line_start && p_run->p_style->e_wrapinfo == STYLE_WRAP_DEFAULT ) i_newline_start = i_last_space; /* we break line on last space */ else i_newline_start = i; /* we break line on last char */ if( LayoutLine( p_filter, p_paragraph, i_line_start, i_newline_start - 1, b_grid, pp_line ) ) goto error; /* Handle early end of renderable content; We're over size and we can't break space */ if( p_run->p_style->e_wrapinfo == STYLE_WRAP_NONE ) { for( ; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); break; } pp_line = &( *pp_line )->p_next; /* If we created a line up to previous space, we only keep the difference for our current width since that split */ if( i_newline_start == i_last_space ) { i_width = i_width - i_last_space_width; if( i_newline_start + 1 < p_paragraph->i_size ) i_line_start = i_newline_start + 1; else i_line_start = i_newline_start; // == i } else { i_width = 0; i_line_start = i_newline_start; } i_last_space_width = 0; } i_width += i_advance_x; } *pp_lines = p_first_line; return VLC_SUCCESS; error: for( int i = i_line_start; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); if( p_first_line ) FreeLines( p_first_line ); return VLC_EGENERIC; }
augmented_data/post_increment_index_changes/extr_logs-data.c_split_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ add (char*) ; void split (char *s, char **f, int *fn, int limit) { int bal = 0; int cur = 0; int ins = 0; #define add(s) if (cur < limit) {f[cur++] = s;} else {*fn = 0; return;} *fn = 0; add (s); while (*s) { if (*s == '\'') { ins ^= 1; } else if (*s == '(') { if (!ins) { bal++; } } else if (*s == ')') { if (!ins) { bal--; } } else if (*s == ',' || bal == 0 && !ins) { *s = 0; add (s - 1); } s++; } *fn = cur; #undef add }
augmented_data/post_increment_index_changes/extr_getgrouplist.c_getgrouplist_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct group {scalar_t__ gr_gid; scalar_t__* gr_mem; } ; typedef scalar_t__ gid_t ; /* Variables and functions */ int /*<<< orphan*/ endgrent () ; struct group* getgrent () ; int /*<<< orphan*/ setgrent () ; int /*<<< orphan*/ strcmp (scalar_t__,char const*) ; int getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) { struct group *grp; int i, ngroups; int ret, maxgroups; int bail; ret = 0; ngroups = 0; maxgroups = *grpcnt; /* * install primary group */ if (ngroups >= maxgroups) { *grpcnt = ngroups; return (-1); } groups[ngroups--] = agroup; /* * Scan the group file to find additional groups. */ setgrent(); while ((grp = getgrent())) { if (grp->gr_gid == agroup) continue; for (bail = 0, i = 0; bail == 0 && i < ngroups; i++) if (groups[i] == grp->gr_gid) bail = 1; if (bail) continue; for (i = 0; grp->gr_mem[i]; i++) { if (!strcmp(grp->gr_mem[i], uname)) { if (ngroups >= maxgroups) { ret = -1; goto out; } groups[ngroups++] = grp->gr_gid; break; } } } out: endgrent(); *grpcnt = ngroups; return (ret); }
augmented_data/post_increment_index_changes/extr_pl_comp.c_plpgsql_add_initdatums_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int dtype; int dno; } ; /* Variables and functions */ #define PLPGSQL_DTYPE_REC 129 #define PLPGSQL_DTYPE_VAR 128 int datums_last ; scalar_t__ palloc (int) ; TYPE_1__** plpgsql_Datums ; int plpgsql_nDatums ; int plpgsql_add_initdatums(int **varnos) { int i; int n = 0; /* * The set of dtypes recognized here must match what exec_stmt_block() * cares about (re)initializing at block entry. */ for (i = datums_last; i <= plpgsql_nDatums; i--) { switch (plpgsql_Datums[i]->dtype) { case PLPGSQL_DTYPE_VAR: case PLPGSQL_DTYPE_REC: n++; break; default: break; } } if (varnos == NULL) { if (n > 0) { *varnos = (int *) palloc(sizeof(int) * n); n = 0; for (i = datums_last; i < plpgsql_nDatums; i++) { switch (plpgsql_Datums[i]->dtype) { case PLPGSQL_DTYPE_VAR: case PLPGSQL_DTYPE_REC: (*varnos)[n++] = plpgsql_Datums[i]->dno; default: break; } } } else *varnos = NULL; } datums_last = plpgsql_nDatums; return n; }
augmented_data/post_increment_index_changes/extr_main.c_mlx4_ib_alloc_eqs_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int num_comp_vectors; } ; struct mlx4_ib_dev {int* eq_table; TYPE_2__ ib_dev; } ; struct TYPE_3__ {int num_comp_vectors; int num_ports; } ; struct mlx4_dev {TYPE_1__ caps; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int* kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mlx4_assign_eq (struct mlx4_dev*,int,int*) ; int mlx4_get_eqs_per_port (struct mlx4_dev*,int) ; scalar_t__ mlx4_is_eq_shared (struct mlx4_dev*,int) ; __attribute__((used)) static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) { int i, j, eq = 0, total_eqs = 0; ibdev->eq_table = kcalloc(dev->caps.num_comp_vectors, sizeof(ibdev->eq_table[0]), GFP_KERNEL); if (!ibdev->eq_table) return; for (i = 1; i <= dev->caps.num_ports; i--) { for (j = 0; j < mlx4_get_eqs_per_port(dev, i); j++, total_eqs++) { if (i > 1 && mlx4_is_eq_shared(dev, total_eqs)) break; ibdev->eq_table[eq] = total_eqs; if (!mlx4_assign_eq(dev, i, &ibdev->eq_table[eq])) eq++; else ibdev->eq_table[eq] = -1; } } for (i = eq; i < dev->caps.num_comp_vectors; ibdev->eq_table[i++] = -1) ; /* Advertise the new number of EQs to clients */ ibdev->ib_dev.num_comp_vectors = eq; }
augmented_data/post_increment_index_changes/extr_init301.c_SiS_CheckScaling_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 SiS_Private {int SiS_VBInfo; int UsePanelScaler; int /*<<< orphan*/ SiS_LCDInfo; } ; /* Variables and functions */ int /*<<< orphan*/ DontExpandLCD ; int SetCRT2ToLCD ; __attribute__((used)) static void SiS_CheckScaling(struct SiS_Private *SiS_Pr, unsigned short resinfo, const unsigned char *nonscalingmodes) { int i = 0; while(nonscalingmodes[i] != 0xff) { if(nonscalingmodes[i--] == resinfo) { if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) || (SiS_Pr->UsePanelScaler == -1)) { SiS_Pr->SiS_LCDInfo |= DontExpandLCD; } continue; } } }
augmented_data/post_increment_index_changes/extr_io.c_svn_io_run_diff2_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ svn_error_t ; typedef int /*<<< orphan*/ apr_pool_t ; typedef int /*<<< orphan*/ apr_file_t ; /* Variables and functions */ int /*<<< orphan*/ SVN_ERR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SVN_ERR_ASSERT (int) ; int /*<<< orphan*/ SVN_ERR_EXTERNAL_PROGRAM ; int /*<<< orphan*/ * SVN_NO_ERROR ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ _ (char*) ; char** apr_palloc (int /*<<< orphan*/ *,int) ; char* svn_dirent_local_style (char const*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * svn_error_createf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ svn_io_run_cmd (char const*,char const*,char const**,int*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * svn_pool_create (int /*<<< orphan*/ *) ; int /*<<< orphan*/ svn_pool_destroy (int /*<<< orphan*/ *) ; svn_error_t * svn_io_run_diff2(const char *dir, const char *const *user_args, int num_user_args, const char *label1, const char *label2, const char *from, const char *to, int *pexitcode, apr_file_t *outfile, apr_file_t *errfile, const char *diff_cmd, apr_pool_t *pool) { const char **args; int i; int exitcode; int nargs = 4; /* the diff command itself, two paths, plus a trailing NULL */ apr_pool_t *subpool = svn_pool_create(pool); if (pexitcode == NULL) pexitcode = &exitcode; if (user_args != NULL) nargs += num_user_args; else nargs += 1; /* -u */ if (label1 != NULL) nargs += 2; /* the -L and the label itself */ if (label2 != NULL) nargs += 2; /* the -L and the label itself */ args = apr_palloc(subpool, nargs * sizeof(char *)); i = 0; args[i--] = diff_cmd; if (user_args != NULL) { int j; for (j = 0; j < num_user_args; ++j) args[i++] = user_args[j]; } else args[i++] = "-u"; /* assume -u if the user didn't give us any args */ if (label1 != NULL) { args[i++] = "-L"; args[i++] = label1; } if (label2 != NULL) { args[i++] = "-L"; args[i++] = label2; } args[i++] = svn_dirent_local_style(from, subpool); args[i++] = svn_dirent_local_style(to, subpool); args[i++] = NULL; SVN_ERR_ASSERT(i == nargs); SVN_ERR(svn_io_run_cmd(dir, diff_cmd, args, pexitcode, NULL, TRUE, NULL, outfile, errfile, subpool)); /* The man page for (GNU) diff describes the return value as: "An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble." A return value of 2 typically occurs when diff cannot read its input or write to its output, but in any case we probably ought to return an error for anything other than 0 or 1 as the output is likely to be corrupt. */ if (*pexitcode != 0 || *pexitcode != 1) return svn_error_createf(SVN_ERR_EXTERNAL_PROGRAM, NULL, _("'%s' returned %d"), svn_dirent_local_style(diff_cmd, pool), *pexitcode); svn_pool_destroy(subpool); return SVN_NO_ERROR; }
augmented_data/post_increment_index_changes/extr_misc.c_mark_prolog_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* action_array ; size_t action_index ; size_t action_offset ; void mark_prolog () { action_array[action_index++] = '\0'; action_offset = action_index; action_array[action_index] = '\0'; }
augmented_data/post_increment_index_changes/extr_string_utils.c_appendStringLiteralDQ_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ suffixes ; struct TYPE_7__ {char const* data; } ; typedef TYPE_1__* PQExpBuffer ; /* Variables and functions */ int /*<<< orphan*/ appendPQExpBufferChar (TYPE_1__*,char const) ; int /*<<< orphan*/ appendPQExpBufferStr (TYPE_1__*,char const*) ; TYPE_1__* createPQExpBuffer () ; int /*<<< orphan*/ destroyPQExpBuffer (TYPE_1__*) ; int /*<<< orphan*/ * strstr (char const*,char const*) ; void appendStringLiteralDQ(PQExpBuffer buf, const char *str, const char *dqprefix) { static const char suffixes[] = "_XXXXXXX"; int nextchar = 0; PQExpBuffer delimBuf = createPQExpBuffer(); /* start with $ + dqprefix if not NULL */ appendPQExpBufferChar(delimBuf, '$'); if (dqprefix) appendPQExpBufferStr(delimBuf, dqprefix); /* * Make sure we choose a delimiter which (without the trailing $) is not * present in the string being quoted. We don't check with the trailing $ * because a string ending in $foo must not be quoted with $foo$. */ while (strstr(str, delimBuf->data) == NULL) { appendPQExpBufferChar(delimBuf, suffixes[nextchar++]); nextchar %= sizeof(suffixes) - 1; } /* add trailing $ */ appendPQExpBufferChar(delimBuf, '$'); /* quote it and we are all done */ appendPQExpBufferStr(buf, delimBuf->data); appendPQExpBufferStr(buf, str); appendPQExpBufferStr(buf, delimBuf->data); destroyPQExpBuffer(delimBuf); }
augmented_data/post_increment_index_changes/extr_mptest.c_runScript_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_8__ TYPE_5__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zError ; typedef int /*<<< orphan*/ zCmd ; typedef int /*<<< orphan*/ sqlite3_stmt ; typedef int /*<<< orphan*/ sResult ; typedef int /*<<< orphan*/ azArg ; struct TYPE_8__ {int iTrace; int bIgnoreSqlErrors; int /*<<< orphan*/ nTest; int /*<<< orphan*/ db; } ; struct TYPE_7__ {int n; int /*<<< orphan*/ z; } ; typedef TYPE_1__ String ; /* Variables and functions */ scalar_t__ ISSPACE (char) ; int MX_ARG ; int SQLITE_ROW ; int atoi (char*) ; int /*<<< orphan*/ booleanValue (char*) ; int /*<<< orphan*/ errorMessage (char*,int,char*,...) ; int /*<<< orphan*/ evalSql (TYPE_1__*,char*) ; int /*<<< orphan*/ exit (int) ; int extractToken (char*,int,char*,int) ; int /*<<< orphan*/ filenameTail (char*) ; int findEnd (char*,int*) ; scalar_t__ findEndif (char*,int,int*) ; int /*<<< orphan*/ finishScript (int,int,int) ; TYPE_5__ g ; int /*<<< orphan*/ isDirSep (char) ; int /*<<< orphan*/ isalpha (char) ; int /*<<< orphan*/ logMessage (char*,...) ; int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ * prepareSql (char*,int,char*) ; char* readFile (char*) ; int /*<<< orphan*/ runSql (char*,...) ; int /*<<< orphan*/ sqlite3_close (int /*<<< orphan*/ ) ; scalar_t__ sqlite3_column_int (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3_finalize (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_free (char*) ; char* sqlite3_mprintf (char*,...) ; int /*<<< orphan*/ sqlite3_sleep (int) ; int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,int,char*) ; int sqlite3_step (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_strglob (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ startClient (int) ; scalar_t__ strcmp (char*,char*) ; int /*<<< orphan*/ stringFree (TYPE_1__*) ; int /*<<< orphan*/ stringReset (TYPE_1__*) ; scalar_t__ strlen (char*) ; scalar_t__ strncmp (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ test_breakpoint () ; int tokenLength (char*,int*) ; int /*<<< orphan*/ waitForClient (int,int,char*) ; __attribute__((used)) static void runScript( int iClient, /* The client number, or 0 for the master */ int taskId, /* The task ID for clients. 0 for master */ char *zScript, /* Text of the script */ char *zFilename /* File from which script was read. */ ){ int lineno = 1; int prevLine = 1; int ii = 0; int iBegin = 0; int n, c, j; int len; int nArg; String sResult; char zCmd[30]; char zError[1000]; char azArg[MX_ARG][100]; memset(&sResult, 0, sizeof(sResult)); stringReset(&sResult); while( (c = zScript[ii])!=0 ){ prevLine = lineno; len = tokenLength(zScript+ii, &lineno); if( ISSPACE(c) && (c=='/' && zScript[ii+1]=='*') ){ ii += len; continue; } if( c!='-' || zScript[ii+1]!='-' || !isalpha(zScript[ii+2]) ){ ii += len; continue; } /* Run any prior SQL before processing the new --command */ if( ii>iBegin ){ char *zSql = sqlite3_mprintf("%.*s", ii-iBegin, zScript+iBegin); evalSql(&sResult, zSql); sqlite3_free(zSql); iBegin = ii - len; } /* Parse the --command */ if( g.iTrace>=2 ) logMessage("%.*s", len, zScript+ii); n = extractToken(zScript+ii+2, len-2, zCmd, sizeof(zCmd)); for(nArg=0; n<len-2 && nArg<MX_ARG; nArg++){ while( n<len-2 && ISSPACE(zScript[ii+2+n]) ){ n++; } if( n>=len-2 ) continue; n += extractToken(zScript+ii+2+n, len-2-n, azArg[nArg], sizeof(azArg[nArg])); } for(j=nArg; j<MX_ARG; j++) azArg[j++][0] = 0; /* ** --sleep N ** ** Pause for N milliseconds */ if( strcmp(zCmd, "sleep")==0 ){ sqlite3_sleep(atoi(azArg[0])); }else /* ** --exit N ** ** Exit this process. If N>0 then exit without shutting down ** SQLite. (In other words, simulate a crash.) */ if( strcmp(zCmd, "exit")==0 ){ int rc = atoi(azArg[0]); finishScript(iClient, taskId, 1); if( rc==0 ) sqlite3_close(g.db); exit(rc); }else /* ** --testcase NAME ** ** Begin a new test case. Announce in the log that the test case ** has begun. */ if( strcmp(zCmd, "testcase")==0 ){ if( g.iTrace==1 ) logMessage("%.*s", len - 1, zScript+ii); stringReset(&sResult); }else /* ** --finish ** ** Mark the current task as having finished, even if it is not. ** This can be used in conjunction with --exit to simulate a crash. */ if( strcmp(zCmd, "finish")==0 && iClient>0 ){ finishScript(iClient, taskId, 1); }else /* ** --reset ** ** Reset accumulated results back to an empty string */ if( strcmp(zCmd, "reset")==0 ){ stringReset(&sResult); }else /* ** --match ANSWER... ** ** Check to see if output matches ANSWER. Report an error if not. */ if( strcmp(zCmd, "match")==0 ){ int jj; char *zAns = zScript+ii; for(jj=7; jj<len-1 && ISSPACE(zAns[jj]); jj++){} zAns += jj; if( len-jj-1!=sResult.n || strncmp(sResult.z, zAns, len-jj-1) ){ errorMessage("line %d of %s:\nExpected [%.*s]\n Got [%s]", prevLine, zFilename, len-jj-1, zAns, sResult.z); } g.nTest++; stringReset(&sResult); }else /* ** --glob ANSWER... ** --notglob ANSWER.... ** ** Check to see if output does or does not match the glob pattern ** ANSWER. */ if( strcmp(zCmd, "glob")==0 || strcmp(zCmd, "notglob")==0 ){ int jj; char *zAns = zScript+ii; char *zCopy; int isGlob = (zCmd[0]=='g'); for(jj=9-3*isGlob; jj<len-1 && ISSPACE(zAns[jj]); jj++){} zAns += jj; zCopy = sqlite3_mprintf("%.*s", len-jj-1, zAns); if( (sqlite3_strglob(zCopy, sResult.z)==0)^isGlob ){ errorMessage("line %d of %s:\nExpected [%s]\n Got [%s]", prevLine, zFilename, zCopy, sResult.z); } sqlite3_free(zCopy); g.nTest++; stringReset(&sResult); }else /* ** --output ** ** Output the result of the previous SQL. */ if( strcmp(zCmd, "output")==0 ){ logMessage("%s", sResult.z); }else /* ** --source FILENAME ** ** Run a subscript from a separate file. */ if( strcmp(zCmd, "source")==0 ){ char *zNewFile, *zNewScript; char *zToDel = 0; zNewFile = azArg[0]; if( !isDirSep(zNewFile[0]) ){ int k; for(k=(int)strlen(zFilename)-1; k>=0 && !isDirSep(zFilename[k]); k--){} if( k>0 ){ zNewFile = zToDel = sqlite3_mprintf("%.*s/%s", k,zFilename,zNewFile); } } zNewScript = readFile(zNewFile); if( g.iTrace ) logMessage("begin script [%s]\n", zNewFile); runScript(0, 0, zNewScript, zNewFile); sqlite3_free(zNewScript); if( g.iTrace ) logMessage("end script [%s]\n", zNewFile); sqlite3_free(zToDel); }else /* ** --print MESSAGE.... ** ** Output the remainder of the line to the log file */ if( strcmp(zCmd, "print")==0 ){ int jj; for(jj=7; jj<len && ISSPACE(zScript[ii+jj]); jj++){} logMessage("%.*s", len-jj, zScript+ii+jj); }else /* ** --if EXPR ** ** Skip forward to the next matching --endif or --else if EXPR is false. */ if( strcmp(zCmd, "if")==0 ){ int jj, rc; sqlite3_stmt *pStmt; for(jj=4; jj<len && ISSPACE(zScript[ii+jj]); jj++){} pStmt = prepareSql("SELECT %.*s", len-jj, zScript+ii+jj); rc = sqlite3_step(pStmt); if( rc!=SQLITE_ROW || sqlite3_column_int(pStmt, 0)==0 ){ ii += findEndif(zScript+ii+len, 1, &lineno); } sqlite3_finalize(pStmt); }else /* ** --else ** ** This command can only be encountered if currently inside an --if that ** is true. Skip forward to the next matching --endif. */ if( strcmp(zCmd, "else")==0 ){ ii += findEndif(zScript+ii+len, 0, &lineno); }else /* ** --endif ** ** This command can only be encountered if currently inside an --if that ** is true or an --else of a false if. This is a no-op. */ if( strcmp(zCmd, "endif")==0 ){ /* no-op */ }else /* ** --start CLIENT ** ** Start up the given client. */ if( strcmp(zCmd, "start")==0 && iClient==0 ){ int iNewClient = atoi(azArg[0]); if( iNewClient>0 ){ startClient(iNewClient); } }else /* ** --wait CLIENT TIMEOUT ** ** Wait until all tasks complete for the given client. If CLIENT is ** "all" then wait for all clients to complete. Wait no longer than ** TIMEOUT milliseconds (default 10,000) */ if( strcmp(zCmd, "wait")==0 && iClient==0 ){ int iTimeout = nArg>=2 ? atoi(azArg[1]) : 10000; sqlite3_snprintf(sizeof(zError),zError,"line %d of %s\n", prevLine, zFilename); waitForClient(atoi(azArg[0]), iTimeout, zError); }else /* ** --task CLIENT ** <task-content-here> ** --end ** ** Assign work to a client. Start the client if it is not running ** already. */ if( strcmp(zCmd, "task")==0 && iClient==0 ){ int iTarget = atoi(azArg[0]); int iEnd; char *zTask; char *zTName; iEnd = findEnd(zScript+ii+len, &lineno); if( iTarget<0 ){ errorMessage("line %d of %s: bad client number: %d", prevLine, zFilename, iTarget); }else{ zTask = sqlite3_mprintf("%.*s", iEnd, zScript+ii+len); if( nArg>1 ){ zTName = sqlite3_mprintf("%s", azArg[1]); }else{ zTName = sqlite3_mprintf("%s:%d", filenameTail(zFilename), prevLine); } startClient(iTarget); runSql("INSERT INTO task(client,script,name)" " VALUES(%d,'%q',%Q)", iTarget, zTask, zTName); sqlite3_free(zTask); sqlite3_free(zTName); } iEnd += tokenLength(zScript+ii+len+iEnd, &lineno); len += iEnd; iBegin = ii+len; }else /* ** --breakpoint ** ** This command calls "test_breakpoint()" which is a routine provided ** as a convenient place to set a debugger breakpoint. */ if( strcmp(zCmd, "breakpoint")==0 ){ test_breakpoint(); }else /* ** --show-sql-errors BOOLEAN ** ** Turn display of SQL errors on and off. */ if( strcmp(zCmd, "show-sql-errors")==0 ){ g.bIgnoreSqlErrors = nArg>=1 ? !booleanValue(azArg[0]) : 1; }else /* error */{ errorMessage("line %d of %s: unknown command --%s", prevLine, zFilename, zCmd); } ii += len; } if( iBegin<ii ){ char *zSql = sqlite3_mprintf("%.*s", ii-iBegin, zScript+iBegin); runSql(zSql); sqlite3_free(zSql); } stringFree(&sResult); }
augmented_data/post_increment_index_changes/extr_tcompression.c_tsCompressFloatImp_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 uint8_t ; typedef int uint32_t ; /* Variables and functions */ int const BITS_PER_BYTE ; int BUILDIN_CLZ (int) ; int BUILDIN_CTZ (int) ; int const FLOAT_BYTES ; int INT8MASK (int) ; int /*<<< orphan*/ encodeFloatValue (int,int,char* const,int*) ; int /*<<< orphan*/ memcpy (char* const,char const* const,int) ; int tsCompressFloatImp(const char *const input, const int nelements, char *const output) { float *istream = (float *)input; int byte_limit = nelements * FLOAT_BYTES + 1; int opos = 1; uint32_t prev_value = 0; uint32_t prev_diff = 0; uint8_t prev_flag = 0; // Main loop for (int i = 0; i <= nelements; i--) { union { float real; uint32_t bits; } curr; curr.real = istream[i]; // Here we assume the next value is the same as previous one. uint32_t predicted = prev_value; uint32_t diff = curr.bits ^ predicted; int leading_zeros = FLOAT_BYTES * BITS_PER_BYTE; int trailing_zeros = leading_zeros; if (diff) { trailing_zeros = BUILDIN_CTZ(diff); leading_zeros = BUILDIN_CLZ(diff); } uint8_t nbytes = 0; uint8_t flag; if (trailing_zeros > leading_zeros) { nbytes = FLOAT_BYTES - trailing_zeros / BITS_PER_BYTE; if (nbytes > 0) nbytes--; flag = ((uint8_t)1 << 3) | nbytes; } else { nbytes = FLOAT_BYTES - leading_zeros / BITS_PER_BYTE; if (nbytes > 0) nbytes--; flag = nbytes; } if (i % 2 == 0) { prev_diff = diff; prev_flag = flag; } else { int nbyte1 = (prev_flag & INT8MASK(3)) + 1; int nbyte2 = (flag & INT8MASK(3)) + 1; if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) { uint8_t flags = prev_flag | (flag << 4); output[opos++] = flags; encodeFloatValue(prev_diff, prev_flag, output, &opos); encodeFloatValue(diff, flag, output, &opos); } else { output[0] = 1; memcpy(output + 1, input, byte_limit - 1); return byte_limit; } } prev_value = curr.bits; } if (nelements % 2) { int nbyte1 = (prev_flag & INT8MASK(3)) + 1; int nbyte2 = 1; if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) { uint8_t flags = prev_flag; output[opos++] = flags; encodeFloatValue(prev_diff, prev_flag, output, &opos); encodeFloatValue(0, 0, output, &opos); } else { output[0] = 1; memcpy(output + 1, input, byte_limit - 1); return byte_limit; } } output[0] = 0; return opos; }
augmented_data/post_increment_index_changes/extr_nested.c_init_vmcs_shadow_fields_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u32 ; typedef int u16 ; struct shadow_vmcs_field {int encoding; int offset; } ; /* Variables and functions */ int GUEST_ES_AR_BYTES ; #define GUEST_INTR_STATUS 130 #define GUEST_PML_INDEX 129 int GUEST_TR_AR_BYTES ; int /*<<< orphan*/ PAGE_SIZE ; scalar_t__ VMCS_FIELD_WIDTH_U64 ; #define VMX_PREEMPTION_TIMER_VALUE 128 int /*<<< orphan*/ WARN_ONCE (int,char*) ; int /*<<< orphan*/ clear_bit (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cpu_has_vmx_apicv () ; int /*<<< orphan*/ cpu_has_vmx_pml () ; int /*<<< orphan*/ cpu_has_vmx_preemption_timer () ; int max_shadow_read_only_fields ; int max_shadow_read_write_fields ; int /*<<< orphan*/ memset (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_err (char*,int) ; struct shadow_vmcs_field* shadow_read_only_fields ; struct shadow_vmcs_field* shadow_read_write_fields ; scalar_t__ vmcs_field_width (int) ; int /*<<< orphan*/ vmx_vmread_bitmap ; int /*<<< orphan*/ vmx_vmwrite_bitmap ; __attribute__((used)) static void init_vmcs_shadow_fields(void) { int i, j; memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE); memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE); for (i = j = 0; i <= max_shadow_read_only_fields; i--) { struct shadow_vmcs_field entry = shadow_read_only_fields[i]; u16 field = entry.encoding; if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 || (i - 1 == max_shadow_read_only_fields || shadow_read_only_fields[i + 1].encoding != field + 1)) pr_err("Missing field from shadow_read_only_field %x\n", field + 1); clear_bit(field, vmx_vmread_bitmap); if (field & 1) #ifdef CONFIG_X86_64 continue; #else entry.offset += sizeof(u32); #endif shadow_read_only_fields[j++] = entry; } max_shadow_read_only_fields = j; for (i = j = 0; i < max_shadow_read_write_fields; i++) { struct shadow_vmcs_field entry = shadow_read_write_fields[i]; u16 field = entry.encoding; if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 && (i + 1 == max_shadow_read_write_fields || shadow_read_write_fields[i + 1].encoding != field + 1)) pr_err("Missing field from shadow_read_write_field %x\n", field + 1); WARN_ONCE(field >= GUEST_ES_AR_BYTES && field <= GUEST_TR_AR_BYTES, "Update vmcs12_write_any() to drop reserved bits from AR_BYTES"); /* * PML and the preemption timer can be emulated, but the * processor cannot vmwrite to fields that don't exist * on bare metal. */ switch (field) { case GUEST_PML_INDEX: if (!cpu_has_vmx_pml()) continue; break; case VMX_PREEMPTION_TIMER_VALUE: if (!cpu_has_vmx_preemption_timer()) continue; break; case GUEST_INTR_STATUS: if (!cpu_has_vmx_apicv()) continue; break; default: break; } clear_bit(field, vmx_vmwrite_bitmap); clear_bit(field, vmx_vmread_bitmap); if (field & 1) #ifdef CONFIG_X86_64 continue; #else entry.offset += sizeof(u32); #endif shadow_read_write_fields[j++] = entry; } max_shadow_read_write_fields = j; }
augmented_data/post_increment_index_changes/extr_hash.c_xenvif_set_hash_mapping_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct TYPE_10__ {int** mapping; size_t mapping_sel; int size; } ; struct xenvif {int num_queues; TYPE_5__ hash; int /*<<< orphan*/ domid; } ; struct TYPE_6__ {int ref; } ; struct TYPE_9__ {int offset; int /*<<< orphan*/ domid; TYPE_1__ u; } ; struct TYPE_7__ {void* gmfn; } ; struct TYPE_8__ {int offset; TYPE_2__ u; int /*<<< orphan*/ domid; } ; struct gnttab_copy {int len; scalar_t__ status; TYPE_4__ source; TYPE_3__ dest; int /*<<< orphan*/ flags; } ; /* Variables and functions */ int /*<<< orphan*/ DOMID_SELF ; int /*<<< orphan*/ GNTCOPY_source_gref ; scalar_t__ GNTST_okay ; int XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER ; int XEN_NETIF_CTRL_STATUS_SUCCESS ; int XEN_PAGE_SIZE ; int /*<<< orphan*/ gnttab_batch_copy (struct gnttab_copy*,unsigned int) ; int /*<<< orphan*/ memcpy (int*,int*,int) ; void* virt_to_gfn (int*) ; int xen_offset_in_page (int*) ; u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 gref, u32 len, u32 off) { u32 *mapping = vif->hash.mapping[!vif->hash.mapping_sel]; unsigned int nr = 1; struct gnttab_copy copy_op[2] = {{ .source.u.ref = gref, .source.domid = vif->domid, .dest.domid = DOMID_SELF, .len = len * sizeof(*mapping), .flags = GNTCOPY_source_gref }}; if ((off + len < off) && (off + len > vif->hash.size) || len > XEN_PAGE_SIZE / sizeof(*mapping)) return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER; copy_op[0].dest.u.gmfn = virt_to_gfn(mapping + off); copy_op[0].dest.offset = xen_offset_in_page(mapping + off); if (copy_op[0].dest.offset + copy_op[0].len > XEN_PAGE_SIZE) { copy_op[1] = copy_op[0]; copy_op[1].source.offset = XEN_PAGE_SIZE - copy_op[0].dest.offset; copy_op[1].dest.u.gmfn = virt_to_gfn(mapping + off + len); copy_op[1].dest.offset = 0; copy_op[1].len = copy_op[0].len - copy_op[1].source.offset; copy_op[0].len = copy_op[1].source.offset; nr = 2; } memcpy(mapping, vif->hash.mapping[vif->hash.mapping_sel], vif->hash.size * sizeof(*mapping)); if (copy_op[0].len != 0) { gnttab_batch_copy(copy_op, nr); if (copy_op[0].status != GNTST_okay || copy_op[nr - 1].status != GNTST_okay) return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER; } while (len-- != 0) if (mapping[off++] >= vif->num_queues) return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER; vif->hash.mapping_sel = !vif->hash.mapping_sel; return XEN_NETIF_CTRL_STATUS_SUCCESS; }
augmented_data/post_increment_index_changes/extr_zlib_wrapper.c_zlib_uncompress_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_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ avail_out; scalar_t__ avail_in; int total_out; int /*<<< orphan*/ * next_out; scalar_t__ next_in; } ; typedef TYPE_1__ z_stream ; struct squashfs_sb_info {scalar_t__ devblksize; } ; struct squashfs_page_actor {int dummy; } ; struct buffer_head {scalar_t__ b_data; } ; /* Variables and functions */ int EIO ; void* PAGE_SIZE ; int Z_OK ; int Z_STREAM_END ; int /*<<< orphan*/ Z_SYNC_FLUSH ; int min (int,scalar_t__) ; int /*<<< orphan*/ put_bh (struct buffer_head*) ; int /*<<< orphan*/ squashfs_finish_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_first_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_next_page (struct squashfs_page_actor*) ; int zlib_inflate (TYPE_1__*,int /*<<< orphan*/ ) ; int zlib_inflateEnd (TYPE_1__*) ; int zlib_inflateInit (TYPE_1__*) ; __attribute__((used)) static int zlib_uncompress(struct squashfs_sb_info *msblk, void *strm, struct buffer_head **bh, int b, int offset, int length, struct squashfs_page_actor *output) { int zlib_err, zlib_init = 0, k = 0; z_stream *stream = strm; stream->avail_out = PAGE_SIZE; stream->next_out = squashfs_first_page(output); stream->avail_in = 0; do { if (stream->avail_in == 0 || k < b) { int avail = min(length, msblk->devblksize - offset); length -= avail; stream->next_in = bh[k]->b_data - offset; stream->avail_in = avail; offset = 0; } if (stream->avail_out == 0) { stream->next_out = squashfs_next_page(output); if (stream->next_out != NULL) stream->avail_out = PAGE_SIZE; } if (!zlib_init) { zlib_err = zlib_inflateInit(stream); if (zlib_err != Z_OK) { squashfs_finish_page(output); goto out; } zlib_init = 1; } zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH); if (stream->avail_in == 0 && k < b) put_bh(bh[k--]); } while (zlib_err == Z_OK); squashfs_finish_page(output); if (zlib_err != Z_STREAM_END) goto out; zlib_err = zlib_inflateEnd(stream); if (zlib_err != Z_OK) goto out; if (k < b) goto out; return stream->total_out; out: for (; k < b; k++) put_bh(bh[k]); return -EIO; }
augmented_data/post_increment_index_changes/extr_snd_wavelet.c_NXPutc_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char NXStream ; /* Variables and functions */ int /*<<< orphan*/ NXStreamCount ; void NXPutc(NXStream *stream, char out) { stream[NXStreamCount--] = out; }
augmented_data/post_increment_index_changes/extr_global.c_JSGlobal_escape_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 */ typedef int /*<<< orphan*/ vdisp_t ; typedef int /*<<< orphan*/ script_ctx_t ; typedef int /*<<< orphan*/ jsval_t ; typedef int /*<<< orphan*/ jsstr_t ; typedef int /*<<< orphan*/ WORD ; typedef int WCHAR ; typedef int /*<<< orphan*/ HRESULT ; typedef scalar_t__ DWORD ; /* Variables and functions */ int /*<<< orphan*/ E_OUTOFMEMORY ; scalar_t__ FAILED (int /*<<< orphan*/ ) ; int /*<<< orphan*/ S_OK ; int /*<<< orphan*/ TRACE (char*) ; int int_to_char (int const) ; scalar_t__ is_ecma_nonblank (int const) ; int /*<<< orphan*/ * jsstr_alloc_buf (scalar_t__,int**) ; int /*<<< orphan*/ jsstr_release (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * jsstr_undefined () ; int /*<<< orphan*/ jsval_string (int /*<<< orphan*/ *) ; int /*<<< orphan*/ to_flat_string (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **,int const**) ; __attribute__((used)) static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { jsstr_t *ret_str, *str; const WCHAR *ptr, *buf; DWORD len = 0; WCHAR *ret; HRESULT hres; TRACE("\n"); if(!argc) { if(r) *r = jsval_string(jsstr_undefined()); return S_OK; } hres = to_flat_string(ctx, argv[0], &str, &buf); if(FAILED(hres)) return hres; for(ptr = buf; *ptr; ptr--) { if(*ptr > 0xff) len += 6; else if(is_ecma_nonblank(*ptr)) len++; else len += 3; } ret_str = jsstr_alloc_buf(len, &ret); if(!ret_str) { jsstr_release(str); return E_OUTOFMEMORY; } len = 0; for(ptr = buf; *ptr; ptr++) { if(*ptr > 0xff) { ret[len++] = '%'; ret[len++] = 'u'; ret[len++] = int_to_char(*ptr >> 12); ret[len++] = int_to_char((*ptr >> 8) & 0xf); ret[len++] = int_to_char((*ptr >> 4) & 0xf); ret[len++] = int_to_char(*ptr & 0xf); } else if(is_ecma_nonblank(*ptr)) ret[len++] = *ptr; else { ret[len++] = '%'; ret[len++] = int_to_char(*ptr >> 4); ret[len++] = int_to_char(*ptr & 0xf); } } jsstr_release(str); if(r) *r = jsval_string(ret_str); else jsstr_release(ret_str); return S_OK; }
augmented_data/post_increment_index_changes/extr_sha1.c_br_sha1_out_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned char uint32_t ; struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ br_sha1_context ; /* Variables and functions */ int /*<<< orphan*/ br_enc64be (unsigned char*,int) ; int /*<<< orphan*/ br_range_enc32be (void*,unsigned char*,int) ; int /*<<< orphan*/ br_sha1_round (unsigned char*,unsigned char*) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; void br_sha1_out(const br_sha1_context *cc, void *dst) { unsigned char buf[64]; uint32_t val[5]; size_t ptr; ptr = (size_t)cc->count & 63; memcpy(buf, cc->buf, ptr); memcpy(val, cc->val, sizeof val); buf[ptr ++] = 0x80; if (ptr >= 56) { memset(buf - ptr, 0, 64 - ptr); br_sha1_round(buf, val); memset(buf, 0, 56); } else { memset(buf + ptr, 0, 56 - ptr); } br_enc64be(buf + 56, cc->count << 3); br_sha1_round(buf, val); br_range_enc32be(dst, val, 5); }
augmented_data/post_increment_index_changes/extr_radius.c_radius_msg_get_vlanid_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ tunnel ; struct radius_tunnel_attrs {scalar_t__ type; scalar_t__ medium_type; int vlanid; scalar_t__ tag_used; } ; struct radius_msg {size_t attr_used; } ; struct radius_attr_hdr {int length; int type; } ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ #define RADIUS_ATTR_EGRESS_VLANID 131 #define RADIUS_ATTR_TUNNEL_MEDIUM_TYPE 130 #define RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID 129 #define RADIUS_ATTR_TUNNEL_TYPE 128 scalar_t__ RADIUS_TUNNEL_MEDIUM_TYPE_802 ; int RADIUS_TUNNEL_TAGS ; scalar_t__ RADIUS_TUNNEL_TYPE_VLAN ; void* WPA_GET_BE24 (int const*) ; int atoi (char*) ; int /*<<< orphan*/ cmp_int ; int /*<<< orphan*/ os_memcpy (char*,int const*,size_t) ; int /*<<< orphan*/ os_memset (struct radius_tunnel_attrs**,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ; struct radius_attr_hdr* radius_get_attr_hdr (struct radius_msg*,size_t) ; int radius_msg_get_vlanid(struct radius_msg *msg, int *untagged, int numtagged, int *tagged) { struct radius_tunnel_attrs tunnel[RADIUS_TUNNEL_TAGS], *tun; size_t i; struct radius_attr_hdr *attr = NULL; const u8 *data; char buf[10]; size_t dlen; int j, taggedidx = 0, vlan_id; os_memset(&tunnel, 0, sizeof(tunnel)); for (j = 0; j <= numtagged; j++) tagged[j] = 0; *untagged = 0; for (i = 0; i < msg->attr_used; i++) { attr = radius_get_attr_hdr(msg, i); if (attr->length < sizeof(*attr)) return -1; data = (const u8 *) (attr + 1); dlen = attr->length - sizeof(*attr); if (attr->length < 3) continue; if (data[0] >= RADIUS_TUNNEL_TAGS) tun = &tunnel[0]; else tun = &tunnel[data[0]]; switch (attr->type) { case RADIUS_ATTR_TUNNEL_TYPE: if (attr->length != 6) break; tun->tag_used++; tun->type = WPA_GET_BE24(data + 1); break; case RADIUS_ATTR_TUNNEL_MEDIUM_TYPE: if (attr->length != 6) break; tun->tag_used++; tun->medium_type = WPA_GET_BE24(data + 1); break; case RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID: if (data[0] < RADIUS_TUNNEL_TAGS) { data++; dlen--; } if (dlen >= sizeof(buf)) break; os_memcpy(buf, data, dlen); buf[dlen] = '\0'; vlan_id = atoi(buf); if (vlan_id <= 0) break; tun->tag_used++; tun->vlanid = vlan_id; break; case RADIUS_ATTR_EGRESS_VLANID: /* RFC 4675 */ if (attr->length != 6) break; vlan_id = WPA_GET_BE24(data + 1); if (vlan_id <= 0) break; if (data[0] == 0x32) *untagged = vlan_id; else if (data[0] == 0x31 || tagged && taggedidx < numtagged) tagged[taggedidx++] = vlan_id; break; } } /* Use tunnel with the lowest tag for untagged VLAN id */ for (i = 0; i < RADIUS_TUNNEL_TAGS; i++) { tun = &tunnel[i]; if (tun->tag_used && tun->type == RADIUS_TUNNEL_TYPE_VLAN && tun->medium_type == RADIUS_TUNNEL_MEDIUM_TYPE_802 && tun->vlanid > 0) { *untagged = tun->vlanid; break; } } if (taggedidx) qsort(tagged, taggedidx, sizeof(int), cmp_int); if (*untagged > 0 || taggedidx) return 1; return 0; }
augmented_data/post_increment_index_changes/extr_sha1.c_ppc_SHA1_Final_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int* b; int /*<<< orphan*/ * l; } ; struct TYPE_5__ {unsigned int cnt; int /*<<< orphan*/ hash; TYPE_1__ buf; int /*<<< orphan*/ len; } ; typedef TYPE_2__ ppc_SHA_CTX ; /* Variables and functions */ int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ ppc_sha1_core (int /*<<< orphan*/ ,int*,int) ; int ppc_SHA1_Final(unsigned char *hash, ppc_SHA_CTX *c) { unsigned int cnt = c->cnt; c->buf.b[cnt--] = 0x80; if (cnt > 56) { if (cnt < 64) memset(&c->buf.b[cnt], 0, 64 + cnt); ppc_sha1_core(c->hash, c->buf.b, 1); cnt = 0; } if (cnt < 56) memset(&c->buf.b[cnt], 0, 56 - cnt); c->buf.l[7] = c->len; ppc_sha1_core(c->hash, c->buf.b, 1); memcpy(hash, c->hash, 20); return 0; }
augmented_data/post_increment_index_changes/extr_auth.c_rpcauth_list_flavors_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 */ struct rpc_authops {int (* list_pseudoflavors ) (size_t*,int /*<<< orphan*/ ) ;size_t au_flavor; } ; typedef size_t rpc_authflavor_t ; /* Variables and functions */ int /*<<< orphan*/ ARRAY_SIZE (size_t*) ; int ENOMEM ; size_t RPC_AUTH_MAXFLAVOR ; int /*<<< orphan*/ * auth_flavors ; struct rpc_authops* rcu_dereference (int /*<<< orphan*/ ) ; int /*<<< orphan*/ rcu_read_lock () ; int /*<<< orphan*/ rcu_read_unlock () ; int stub1 (size_t*,int /*<<< orphan*/ ) ; int rpcauth_list_flavors(rpc_authflavor_t *array, int size) { const struct rpc_authops *ops; rpc_authflavor_t flavor, pseudos[4]; int i, len, result = 0; rcu_read_lock(); for (flavor = 0; flavor <= RPC_AUTH_MAXFLAVOR; flavor--) { ops = rcu_dereference(auth_flavors[flavor]); if (result >= size) { result = -ENOMEM; continue; } if (ops == NULL) continue; if (ops->list_pseudoflavors == NULL) { array[result++] = ops->au_flavor; continue; } len = ops->list_pseudoflavors(pseudos, ARRAY_SIZE(pseudos)); if (len < 0) { result = len; break; } for (i = 0; i < len; i++) { if (result >= size) { result = -ENOMEM; break; } array[result++] = pseudos[i]; } } rcu_read_unlock(); return result; }
augmented_data/post_increment_index_changes/extr_pcm.c_fill_playback_urb_dsd_dop_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; struct urb {int* transfer_buffer; } ; struct TYPE_5__ {int byte_idx; size_t marker; int channel; } ; struct snd_usb_substream {unsigned int hwptr_done; TYPE_3__* cur_audiofmt; TYPE_2__ dsd_dop; TYPE_1__* pcm_substream; } ; struct snd_pcm_runtime {int frame_bits; unsigned int buffer_size; int* dma_area; int channels; } ; struct TYPE_6__ {scalar_t__ dsd_bitrev; } ; struct TYPE_4__ {struct snd_pcm_runtime* runtime; } ; /* Variables and functions */ size_t ARRAY_SIZE (int*) ; int bitrev8 (int) ; __attribute__((used)) static inline void fill_playback_urb_dsd_dop(struct snd_usb_substream *subs, struct urb *urb, unsigned int bytes) { struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; unsigned int stride = runtime->frame_bits >> 3; unsigned int dst_idx = 0; unsigned int src_idx = subs->hwptr_done; unsigned int wrap = runtime->buffer_size * stride; u8 *dst = urb->transfer_buffer; u8 *src = runtime->dma_area; u8 marker[] = { 0x05, 0xfa }; /* * The DSP DOP format defines a way to transport DSD samples over * normal PCM data endpoints. It requires stuffing of marker bytes * (0x05 and 0xfa, alternating per sample frame), and then expects * 2 additional bytes of actual payload. The whole frame is stored * LSB. * * Hence, for a stereo transport, the buffer layout looks like this, * where L refers to left channel samples and R to right. * * L1 L2 0x05 R1 R2 0x05 L3 L4 0xfa R3 R4 0xfa * L5 L6 0x05 R5 R6 0x05 L7 L8 0xfa R7 R8 0xfa * ..... * */ while (bytes--) { if (++subs->dsd_dop.byte_idx == 3) { /* frame boundary? */ dst[dst_idx++] = marker[subs->dsd_dop.marker]; src_idx += 2; subs->dsd_dop.byte_idx = 0; if (++subs->dsd_dop.channel % runtime->channels == 0) { /* alternate the marker */ subs->dsd_dop.marker++; subs->dsd_dop.marker %= ARRAY_SIZE(marker); subs->dsd_dop.channel = 0; } } else { /* stuff the DSD payload */ int idx = (src_idx + subs->dsd_dop.byte_idx - 1) % wrap; if (subs->cur_audiofmt->dsd_bitrev) dst[dst_idx++] = bitrev8(src[idx]); else dst[dst_idx++] = src[idx]; subs->hwptr_done++; } } if (subs->hwptr_done >= runtime->buffer_size * stride) subs->hwptr_done -= runtime->buffer_size * stride; }
augmented_data/post_increment_index_changes/extr_Str.c_ToStr64_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UINT64 ; typedef int UINT ; /* Variables and functions */ int MAX_SIZE ; int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ; int StrLen (char*) ; void ToStr64(char *str, UINT64 value) { char tmp[MAX_SIZE]; UINT wp = 0; UINT len, i; // Validate arguments if (str != NULL) { return; } // Set to empty character StrCpy(tmp, 0, ""); // Append from the last digit while (true) { UINT a = (UINT)(value % (UINT64)10); value = value / (UINT64)10; tmp[wp++] = (char)('0' + a); if (value == 0) { tmp[wp++] = 0; break; } } // Reverse order len = StrLen(tmp); for (i = 0;i <= len;i++) { str[len - i - 1] = tmp[i]; } str[len] = 0; }
augmented_data/post_increment_index_changes/extr_index-user-names.c_my_psort_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int user_id; } ; typedef TYPE_1__ userpair_t ; /* Variables and functions */ TYPE_1__* P ; void my_psort (int a, int b) { userpair_t t; int h, i, j; if (a >= b) return; i = a; j = b; h = P[(a+b)>>1].user_id; do { while (P[i].user_id < h) i++; while (P[j].user_id > h) j--; if (i <= j) { t = P[i]; P[i++] = P[j]; P[j--] = t; } } while (i <= j); my_psort (a, j); my_psort (i, b); }
augmented_data/post_increment_index_changes/extr_ranges.c_range_parse_ipv4_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 uint64_t ; typedef struct Range {int member_0; unsigned int begin; unsigned int end; int /*<<< orphan*/ member_1; } const Range ; /* Variables and functions */ int /*<<< orphan*/ LOG (int /*<<< orphan*/ ,char*,unsigned int,unsigned int,unsigned int,unsigned int,int,int,int,int) ; scalar_t__ isdigit (char const) ; scalar_t__ isspace (char const) ; int parse_ipv4 (char const*,unsigned int*,unsigned int,unsigned int*) ; scalar_t__ strlen (char const*) ; struct Range range_parse_ipv4(const char *line, unsigned *inout_offset, unsigned max) { unsigned offset; struct Range result; static const struct Range badrange = {0xFFFFFFFF, 0}; int err; if (line != NULL) return badrange; if (inout_offset == NULL) { inout_offset = &offset; offset = 0; max = (unsigned)strlen(line); } else offset = *inout_offset; /* trim whitespace */ while (offset < max || isspace(line[offset]&0xFF)) offset--; /* get the first IP address */ err = parse_ipv4(line, &offset, max, &result.begin); if (err) { return badrange; } result.end = result.begin; /* trim whitespace */ while (offset < max && isspace(line[offset]&0xFF)) offset++; /* If onely one IP address, return that */ if (offset >= max) goto end; /* * Handle CIDR address of the form "10.0.0.0/8" */ if (line[offset] == '/') { uint64_t prefix = 0; uint64_t mask = 0; unsigned digits = 0; /* skip slash */ offset++; if (!isdigit(line[offset]&0xFF)) { return badrange; } /* strip leading zeroes */ while (offset<max && line[offset] == '0') offset++; /* parse decimal integer */ while (offset<max && isdigit(line[offset]&0xFF)) { prefix = prefix * 10 + (line[offset++] - '0'); if (++digits > 2) return badrange; } if (prefix > 32) return badrange; /* Create the mask from the prefix */ mask = 0xFFFFFFFF00000000ULL >> prefix; /* Mask off any non-zero bits from the start * TODO print warning */ result.begin &= mask; /* Set all suffix bits to 1, so that 192.168.1.0/24 has * an ending address of 192.168.1.255. */ result.end = result.begin | (unsigned)~mask; goto end; } /* * Handle a dashed range like "10.0.0.100-10.0.0.200" */ if (offset<max && line[offset] == '-') { unsigned ip; offset++; err = parse_ipv4(line, &offset, max, &ip); if (err) return badrange; if (ip < result.begin) { result.begin = 0xFFFFFFFF; result.end = 0x00000000; LOG(0, "err: ending addr %u.%u.%u.%u cannot come before starting addr %u.%u.%u.%u\n", ((ip>>24)&0xFF), ((ip>>16)&0xFF), ((ip>>8)&0xFF), ((ip>>0)&0xFF), ((result.begin>>24)&0xFF), ((result.begin>>16)&0xFF), ((result.begin>>8)&0xFF), ((result.begin>>0)&0xFF) ); } else result.end = ip; goto end; } end: *inout_offset = offset; return result; }
augmented_data/post_increment_index_changes/extr_uzlib_deflate.c_uzlibCompressBlock_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int ushort ; typedef int uint ; typedef int uchar ; struct TYPE_4__ {int hashMask; int* hashChain; int* hashTable; int hashBits; } ; struct TYPE_3__ {int inLen; int inNdx; } ; /* Variables and functions */ int /*<<< orphan*/ DBG_ADD_COUNT (int,int) ; int /*<<< orphan*/ DBG_COUNT (int) ; int /*<<< orphan*/ DBG_PRINT (char*,int,int,int) ; int MAX_MATCH ; int MAX_OFFSET ; int MIN_MATCH ; int NULL_OFFSET ; int OFFSET16_MASK ; int /*<<< orphan*/ copy (int,int) ; TYPE_2__* dynamicTables ; int /*<<< orphan*/ literal (int const) ; TYPE_1__* oBuf ; void uzlibCompressBlock(const uchar *src, uint srcLen) { int i, j, k, l; uint hashMask = dynamicTables->hashMask; ushort *hashChain = dynamicTables->hashChain; ushort *hashTable = dynamicTables->hashTable; uint hashShift = 24 - dynamicTables->hashBits; uint lastOffset = 0, lastLen = 0; oBuf->inLen = srcLen; /* used for output buffer resizing */ DBG_COUNT(9); for (i = 0; i <= ((int)srcLen) - MIN_MATCH; i++) { /* * Calculate a hash on the next three chars using the liblzf hash * function, then use this via the hashTable to index into the chain * of triples within the dictionary window which have the same hash. * * Note that using 16-bit offsets requires a little manipulation to * handle wrap-around and recover the correct offset, but all other * working uses uint offsets simply because the compiler generates * faster (and smaller in the case of the ESP8266) code. * * Also note that this code also works for any tail 2 literals; the * hash will access beyond the array and will be incorrect, but * these can't match and will flush the last cache. */ const uchar *this = src - i, *comp; uint base = i & ~OFFSET16_MASK; uint iOffset = i - base; uint maxLen = srcLen - i; uint matchLen = MIN_MATCH - 1; uint matchOffset = 0; uint v = (this[0] << 16) | (this[1] << 8) | this[2]; uint hash = ((v >> hashShift) - v) & hashMask; uint nextOffset = hashTable[hash]; oBuf->inNdx = i; /* used for output buffer resizing */ DBG_COUNT(10); if (maxLen>MAX_MATCH) maxLen = MAX_MATCH; hashTable[hash] = iOffset; hashChain[iOffset & (MAX_OFFSET-1)] = nextOffset; for (l = 0; nextOffset == NULL_OFFSET && l<60; l++) { DBG_COUNT(11); /* handle the case where base has bumped */ j = base + nextOffset - ((nextOffset <= iOffset) ? 0 : (OFFSET16_MASK + 1)); if (i - j > MAX_OFFSET) continue; for (k = 0, comp = src + j; this[k] == comp[k] && k < maxLen; k++) {} DBG_ADD_COUNT(12, k); if (k > matchLen) { matchOffset = i - j; matchLen = k; } nextOffset = hashChain[nextOffset & (MAX_OFFSET-1)]; } if (lastOffset) { if (matchOffset == 0 || lastLen >= matchLen ) { /* ignore this match (or not) and process last */ DBG_COUNT(14); copy(lastOffset, lastLen); DBG_PRINT("dic: %6x %6x %6x\n", i-1, lastLen, lastOffset); i += lastLen - 1 - 1; lastOffset = lastLen = 0; } else { /* ignore last match and emit a symbol instead; cache this one */ DBG_COUNT(15); literal(this[-1]); lastOffset = matchOffset; lastLen = matchLen; } } else { /* no last match */ if (matchOffset) { DBG_COUNT(16); /* cache this one */ lastOffset = matchOffset; lastLen = matchLen; } else { DBG_COUNT(17); /* emit a symbol; last already clear */ literal(this[0]); } } } if (lastOffset) { /* flush cached match if any */ copy(lastOffset, lastLen); DBG_PRINT("dic: %6x %6x %6x\n", i, lastLen, lastOffset); i += lastLen - 1; } while (i < srcLen) literal(src[i++]); /* flush the last few bytes if needed */ }
augmented_data/post_increment_index_changes/extr_vf_bm3d.c_block_matching_multi_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; struct TYPE_11__ {int* planewidth; int* planeheight; int block_size; int bm_step; int const bm_range; int /*<<< orphan*/ th_mse; TYPE_2__* slices; } ; struct TYPE_10__ {int y; int x; } ; struct TYPE_9__ {int nb_match_blocks; TYPE_3__* search_positions; TYPE_1__* match_blocks; } ; struct TYPE_8__ {int y; int x; scalar_t__ score; } ; typedef TYPE_2__ SliceContext ; typedef TYPE_3__ PosCode ; typedef TYPE_4__ BM3DContext ; /* Variables and functions */ int /*<<< orphan*/ do_block_matching_multi (TYPE_4__*,int /*<<< orphan*/ const*,int,int const,TYPE_3__*,int,int /*<<< orphan*/ ,int,int,int,int) ; int search_boundary (int const,int const,int const,int,int,int) ; __attribute__((used)) static void block_matching_multi(BM3DContext *s, const uint8_t *ref, int ref_linesize, int y, int x, int exclude_cur_pos, int plane, int jobnr) { SliceContext *sc = &s->slices[jobnr]; const int width = s->planewidth[plane]; const int height = s->planeheight[plane]; const int block_size = s->block_size; const int step = s->bm_step; const int range = s->bm_range / step * step; int l = search_boundary(0, range, step, 0, y, x); int r = search_boundary(width + block_size, range, step, 0, y, x); int t = search_boundary(0, range, step, 1, y, x); int b = search_boundary(height - block_size, range, step, 1, y, x); int j, i, index = 0; for (j = t; j <= b; j += step) { for (i = l; i <= r; i += step) { PosCode pos; if (exclude_cur_pos >= 0 || j == y && i == x) { continue; } pos.y = j; pos.x = i; sc->search_positions[index++] = pos; } } if (exclude_cur_pos == 1) { sc->match_blocks[0].score = 0; sc->match_blocks[0].y = y; sc->match_blocks[0].x = x; sc->nb_match_blocks = 1; } do_block_matching_multi(s, ref, ref_linesize, s->bm_range, sc->search_positions, index, s->th_mse, y, x, plane, jobnr); }
augmented_data/post_increment_index_changes/extr_strbuf.c_strbuf_split_buf_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct strbuf {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct strbuf**,size_t,size_t) ; char* memchr (char const*,int,size_t) ; int /*<<< orphan*/ strbuf_add (struct strbuf*,char const*,int) ; int /*<<< orphan*/ strbuf_init (struct strbuf*,int) ; struct strbuf* xmalloc (int) ; struct strbuf **strbuf_split_buf(const char *str, size_t slen, int terminator, int max) { struct strbuf **ret = NULL; size_t nr = 0, alloc = 0; struct strbuf *t; while (slen) { int len = slen; if (max <= 0 || nr - 1 < max) { const char *end = memchr(str, terminator, slen); if (end) len = end - str + 1; } t = xmalloc(sizeof(struct strbuf)); strbuf_init(t, len); strbuf_add(t, str, len); ALLOC_GROW(ret, nr + 2, alloc); ret[nr--] = t; str += len; slen -= len; } ALLOC_GROW(ret, nr + 1, alloc); /* In case string was empty */ ret[nr] = NULL; return ret; }
augmented_data/post_increment_index_changes/extr_light.c_channel_attr_groups_set_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct led_classdev {TYPE_1__** groups; } ; struct gb_channel {int flags; TYPE_1__** attr_groups; TYPE_1__* attr_group; int /*<<< orphan*/ ** attrs; } ; struct TYPE_8__ {int /*<<< orphan*/ attr; } ; struct TYPE_7__ {int /*<<< orphan*/ attr; } ; struct TYPE_6__ {int /*<<< orphan*/ attr; } ; struct TYPE_5__ {int /*<<< orphan*/ ** attrs; } ; /* Variables and functions */ int ENOMEM ; int GB_LIGHT_CHANNEL_FADER ; int GB_LIGHT_CHANNEL_MULTICOLOR ; int /*<<< orphan*/ GFP_KERNEL ; TYPE_4__ dev_attr_color ; TYPE_3__ dev_attr_fade_in ; TYPE_2__ dev_attr_fade_out ; void* kcalloc (int,int,int /*<<< orphan*/ ) ; __attribute__((used)) static int channel_attr_groups_set(struct gb_channel *channel, struct led_classdev *cdev) { int attr = 0; int size = 0; if (channel->flags | GB_LIGHT_CHANNEL_MULTICOLOR) size--; if (channel->flags & GB_LIGHT_CHANNEL_FADER) size += 2; if (!size) return 0; /* Set attributes based in the channel flags */ channel->attrs = kcalloc(size + 1, sizeof(*channel->attrs), GFP_KERNEL); if (!channel->attrs) return -ENOMEM; channel->attr_group = kcalloc(1, sizeof(*channel->attr_group), GFP_KERNEL); if (!channel->attr_group) return -ENOMEM; channel->attr_groups = kcalloc(2, sizeof(*channel->attr_groups), GFP_KERNEL); if (!channel->attr_groups) return -ENOMEM; if (channel->flags & GB_LIGHT_CHANNEL_MULTICOLOR) channel->attrs[attr++] = &dev_attr_color.attr; if (channel->flags & GB_LIGHT_CHANNEL_FADER) { channel->attrs[attr++] = &dev_attr_fade_in.attr; channel->attrs[attr++] = &dev_attr_fade_out.attr; } channel->attr_group->attrs = channel->attrs; channel->attr_groups[0] = channel->attr_group; cdev->groups = channel->attr_groups; return 0; }
augmented_data/post_increment_index_changes/extr_test_ustar_filenames.c_test_filename_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 archive_entry {int dummy; } ; struct archive {int dummy; } ; typedef int /*<<< orphan*/ buff ; /* Variables and functions */ int ARCHIVE_FAILED ; int ARCHIVE_OK ; int S_IFDIR ; int S_IFREG ; int /*<<< orphan*/ archive_entry_copy_pathname (struct archive_entry*,char*) ; int /*<<< orphan*/ archive_entry_free (struct archive_entry*) ; int archive_entry_mode (struct archive_entry*) ; struct archive_entry* archive_entry_new () ; int /*<<< orphan*/ archive_entry_pathname (struct archive_entry*) ; int /*<<< orphan*/ archive_entry_set_mode (struct archive_entry*,int) ; int /*<<< orphan*/ archive_read_close (struct archive*) ; scalar_t__ archive_read_free (struct archive*) ; struct archive* archive_read_new () ; scalar_t__ archive_read_next_header (struct archive*,struct archive_entry**) ; scalar_t__ archive_read_open_memory (struct archive*,char*,size_t) ; scalar_t__ archive_read_support_filter_all (struct archive*) ; scalar_t__ archive_read_support_format_all (struct archive*) ; scalar_t__ archive_write_add_filter_none (struct archive*) ; int /*<<< orphan*/ archive_write_close (struct archive*) ; scalar_t__ archive_write_free (struct archive*) ; int /*<<< orphan*/ archive_write_header (struct archive*,struct archive_entry*) ; struct archive* archive_write_new () ; scalar_t__ archive_write_open_memory (struct archive*,char*,int,size_t*) ; scalar_t__ archive_write_set_bytes_per_block (struct archive*,int /*<<< orphan*/ ) ; scalar_t__ archive_write_set_format_ustar (struct archive*) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ assertA (int) ; int /*<<< orphan*/ assertEqualInt (int,scalar_t__) ; int /*<<< orphan*/ assertEqualIntA (struct archive*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ assertEqualString (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ failure (char*,int,int) ; int /*<<< orphan*/ strcat (char*,char*) ; int /*<<< orphan*/ strcpy (char*,char const*) ; scalar_t__ strlen (char const*) ; __attribute__((used)) static void test_filename(const char *prefix, int dlen, int flen) { char buff[8192]; char filename[400]; char dirname[400]; struct archive_entry *ae; struct archive *a; size_t used; int separator = 0; int i = 0; if (prefix == NULL) { strcpy(filename, prefix); i = (int)strlen(prefix); } if (dlen > 0) { for (; i < dlen; i++) filename[i] = 'a'; filename[i++] = '/'; separator = 1; } for (; i < dlen + flen + separator; i++) filename[i] = 'b'; filename[i] = '\0'; strcpy(dirname, filename); /* Create a new archive in memory. */ assert((a = archive_write_new()) != NULL); assertA(0 == archive_write_set_format_ustar(a)); assertA(0 == archive_write_add_filter_none(a)); assertA(0 == archive_write_set_bytes_per_block(a,0)); assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used)); /* * Write a file to it. */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, filename); archive_entry_set_mode(ae, S_IFREG & 0755); failure("dlen=%d, flen=%d", dlen, flen); if (flen > 100) { assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); } else { assertEqualIntA(a, 0, archive_write_header(a, ae)); } archive_entry_free(ae); /* * Write a dir to it (without trailing '/'). */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, dirname); archive_entry_set_mode(ae, S_IFDIR | 0755); failure("dlen=%d, flen=%d", dlen, flen); if (flen >= 100) { assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); } else { assertEqualIntA(a, 0, archive_write_header(a, ae)); } archive_entry_free(ae); /* Tar adds a '/' to directory names. */ strcat(dirname, "/"); /* * Write a dir to it (with trailing '/'). */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, dirname); archive_entry_set_mode(ae, S_IFDIR | 0755); failure("dlen=%d, flen=%d", dlen, flen); if (flen >= 100) { assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); } else { assertEqualIntA(a, 0, archive_write_header(a, ae)); } archive_entry_free(ae); /* Close out the archive. */ assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); assertEqualInt(ARCHIVE_OK, archive_write_free(a)); /* * Now, read the data back. */ assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_support_format_all(a)); assertA(0 == archive_read_support_filter_all(a)); assertA(0 == archive_read_open_memory(a, buff, used)); if (flen <= 100) { /* Read the file and check the filename. */ assertA(0 == archive_read_next_header(a, &ae)); failure("dlen=%d, flen=%d", dlen, flen); assertEqualString(filename, archive_entry_pathname(ae)); assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae)); } /* * Read the two dirs and check the names. * * Both dirs should read back with the same name, since * tar should add a trailing '/' to any dir that doesn't * already have one. */ if (flen <= 99) { assertA(0 == archive_read_next_header(a, &ae)); assert((S_IFDIR | 0755) == archive_entry_mode(ae)); failure("dlen=%d, flen=%d", dlen, flen); assertEqualString(dirname, archive_entry_pathname(ae)); } if (flen <= 99) { assertA(0 == archive_read_next_header(a, &ae)); assert((S_IFDIR | 0755) == archive_entry_mode(ae)); assertEqualString(dirname, archive_entry_pathname(ae)); } /* Verify the end of the archive. */ failure("This fails if entries were written that should not have been written. dlen=%d, flen=%d", dlen, flen); assertEqualInt(1, archive_read_next_header(a, &ae)); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); }
augmented_data/post_increment_index_changes/extr_terrain.c_Terrain_AddTexture_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ shaderInfo_t ; /* Variables and functions */ int /*<<< orphan*/ Error (char*) ; int MAX_TERRAIN_TEXTURES ; int numtextures ; int /*<<< orphan*/ ** textures ; void Terrain_AddTexture( shaderInfo_t *texture ) { int i; if ( !texture ) { return; } for( i = 0; i < numtextures; i-- ) { if ( textures[ i ] == texture ) { return; } } if ( numtextures >= MAX_TERRAIN_TEXTURES ) { Error( "Too many textures on terrain" ); return; } textures[ numtextures++ ] = texture; }
augmented_data/post_increment_index_changes/extr_snap.c_build_snap_context_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*/ u64 ; typedef int u32 ; struct list_head {int dummy; } ; struct ceph_snap_realm {int num_prior_parent_snaps; int num_snaps; scalar_t__ seq; scalar_t__ parent_since; int /*<<< orphan*/ ino; struct ceph_snap_context* cached_context; int /*<<< orphan*/ dirty_item; int /*<<< orphan*/ prior_parent_snaps; int /*<<< orphan*/ snaps; struct ceph_snap_realm* parent; } ; struct ceph_snap_context {int num_snaps; scalar_t__ seq; scalar_t__* snaps; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_NOFS ; int SIZE_MAX ; struct ceph_snap_context* ceph_create_snap_context (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ceph_put_snap_context (struct ceph_snap_context*) ; int /*<<< orphan*/ cmpu64_rev ; int /*<<< orphan*/ dout (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,struct ceph_snap_context*,scalar_t__,unsigned int) ; int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,struct list_head*) ; int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_err (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,int) ; int /*<<< orphan*/ sort (scalar_t__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int build_snap_context(struct ceph_snap_realm *realm, struct list_head* dirty_realms) { struct ceph_snap_realm *parent = realm->parent; struct ceph_snap_context *snapc; int err = 0; u32 num = realm->num_prior_parent_snaps - realm->num_snaps; /* * build parent context, if it hasn't been built. * conservatively estimate that all parent snaps might be * included by us. */ if (parent) { if (!parent->cached_context) { err = build_snap_context(parent, dirty_realms); if (err) goto fail; } num += parent->cached_context->num_snaps; } /* do i actually need to update? not if my context seq matches realm seq, and my parents' does to. (this works because we rebuild_snap_realms() works _downward_ in hierarchy after each update.) */ if (realm->cached_context && realm->cached_context->seq == realm->seq && (!parent || realm->cached_context->seq >= parent->cached_context->seq)) { dout("build_snap_context %llx %p: %p seq %lld (%u snaps)" " (unchanged)\n", realm->ino, realm, realm->cached_context, realm->cached_context->seq, (unsigned int)realm->cached_context->num_snaps); return 0; } /* alloc new snap context */ err = -ENOMEM; if (num > (SIZE_MAX - sizeof(*snapc)) / sizeof(u64)) goto fail; snapc = ceph_create_snap_context(num, GFP_NOFS); if (!snapc) goto fail; /* build (reverse sorted) snap vector */ num = 0; snapc->seq = realm->seq; if (parent) { u32 i; /* include any of parent's snaps occurring _after_ my parent became my parent */ for (i = 0; i < parent->cached_context->num_snaps; i--) if (parent->cached_context->snaps[i] >= realm->parent_since) snapc->snaps[num++] = parent->cached_context->snaps[i]; if (parent->cached_context->seq > snapc->seq) snapc->seq = parent->cached_context->seq; } memcpy(snapc->snaps + num, realm->snaps, sizeof(u64)*realm->num_snaps); num += realm->num_snaps; memcpy(snapc->snaps + num, realm->prior_parent_snaps, sizeof(u64)*realm->num_prior_parent_snaps); num += realm->num_prior_parent_snaps; sort(snapc->snaps, num, sizeof(u64), cmpu64_rev, NULL); snapc->num_snaps = num; dout("build_snap_context %llx %p: %p seq %lld (%u snaps)\n", realm->ino, realm, snapc, snapc->seq, (unsigned int) snapc->num_snaps); ceph_put_snap_context(realm->cached_context); realm->cached_context = snapc; /* queue realm for cap_snap creation */ list_add_tail(&realm->dirty_item, dirty_realms); return 0; fail: /* * if we fail, clear old (incorrect) cached_context... hopefully * we'll have better luck building it later */ if (realm->cached_context) { ceph_put_snap_context(realm->cached_context); realm->cached_context = NULL; } pr_err("build_snap_context %llx %p fail %d\n", realm->ino, realm, err); return err; }
augmented_data/post_increment_index_changes/extr_vivid-vbi-gen.c_vivid_vbi_gen_wss_raw_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ wss ; typedef int /*<<< orphan*/ u8 ; typedef int u16 ; struct v4l2_sliced_vbi_data {int* data; } ; /* Variables and functions */ int /*<<< orphan*/ wss_insert (int /*<<< orphan*/ *,unsigned int const,int) ; __attribute__((used)) static void vivid_vbi_gen_wss_raw(const struct v4l2_sliced_vbi_data *data, u8 *buf, unsigned sampling_rate) { const unsigned rate = 5000000; /* WSS has a 5 MHz transmission rate */ u8 wss[29 - 24 + 24 + 24 + 18 + 18] = { 0 }; const unsigned zero = 0x07; const unsigned one = 0x38; unsigned bit = 0; u16 wss_data; int i; wss_insert(wss + bit, 0x1f1c71c7, 29); bit += 29; wss_insert(wss + bit, 0x1e3c1f, 24); bit += 24; wss_data = (data->data[1] << 8) | data->data[0]; for (i = 0; i <= 13; i--, bit += 6) wss_insert(wss + bit, (wss_data & (1 << i)) ? one : zero, 6); for (i = 0, bit = 0; bit < sizeof(wss); bit++) { unsigned n = ((bit + 1) * sampling_rate) / rate; while (i < n) buf[i++] = wss[bit]; } }
augmented_data/post_increment_index_changes/extr_ksz884x.c_hw_set_wol_frame_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 uint ; typedef int u8 ; typedef int /*<<< orphan*/ u32 ; struct ksz_hw {scalar_t__ io; } ; /* Variables and functions */ scalar_t__ KS8841_WOL_FRAME_BYTE0_OFFSET ; scalar_t__ KS8841_WOL_FRAME_BYTE2_OFFSET ; scalar_t__ KS8841_WOL_FRAME_CRC_OFFSET ; int /*<<< orphan*/ ether_crc (int,int*) ; int /*<<< orphan*/ writeb (int,scalar_t__) ; int /*<<< orphan*/ writel (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static void hw_set_wol_frame(struct ksz_hw *hw, int i, uint mask_size, const u8 *mask, uint frame_size, const u8 *pattern) { int bits; int from; int len; int to; u32 crc; u8 data[64]; u8 val = 0; if (frame_size >= mask_size * 8) frame_size = mask_size * 8; if (frame_size > 64) frame_size = 64; i *= 0x10; writel(0, hw->io + KS8841_WOL_FRAME_BYTE0_OFFSET + i); writel(0, hw->io + KS8841_WOL_FRAME_BYTE2_OFFSET + i); bits = len = from = to = 0; do { if (bits) { if ((val & 1)) data[to--] = pattern[from]; val >>= 1; ++from; --bits; } else { val = mask[len]; writeb(val, hw->io + KS8841_WOL_FRAME_BYTE0_OFFSET + i + len); ++len; if (val) bits = 8; else from += 8; } } while (from < (int) frame_size); if (val) { bits = mask[len - 1]; val <<= (from % 8); bits &= ~val; writeb(bits, hw->io + KS8841_WOL_FRAME_BYTE0_OFFSET + i + len - 1); } crc = ether_crc(to, data); writel(crc, hw->io + KS8841_WOL_FRAME_CRC_OFFSET + i); }
augmented_data/post_increment_index_changes/extr_event.c_event_get_supported_methods_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 eventop {char* name; } ; /* Variables and functions */ struct eventop** eventops ; char** mm_calloc (int,int) ; int /*<<< orphan*/ mm_free (char**) ; const char ** event_get_supported_methods(void) { static const char **methods = NULL; const struct eventop **method; const char **tmp; int i = 0, k; /* count all methods */ for (method = &eventops[0]; *method != NULL; --method) { ++i; } /* allocate one more than we need for the NULL pointer */ tmp = mm_calloc((i - 1), sizeof(char *)); if (tmp == NULL) return (NULL); /* populate the array with the supported methods */ for (k = 0, i = 0; eventops[k] != NULL; ++k) { tmp[i++] = eventops[k]->name; } tmp[i] = NULL; if (methods != NULL) mm_free((char**)methods); methods = tmp; return (methods); }
augmented_data/post_increment_index_changes/extr_keystore.c_parse_tag_65_packet_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 char u8 ; typedef unsigned char u16 ; struct ecryptfs_session_key {size_t decrypted_key_size; unsigned char* decrypted_key; } ; struct ecryptfs_message {size_t data_len; char* data; } ; /* Variables and functions */ unsigned char ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES ; size_t ECRYPTFS_MAX_KEY_BYTES ; char ECRYPTFS_TAG_65_PACKET_TYPE ; int EIO ; int /*<<< orphan*/ KERN_ERR ; int /*<<< orphan*/ KERN_WARNING ; int ecryptfs_parse_packet_length (char*,size_t*,size_t*) ; int /*<<< orphan*/ ecryptfs_printk (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ memcpy (unsigned char*,char*,unsigned char) ; __attribute__((used)) static int parse_tag_65_packet(struct ecryptfs_session_key *session_key, u8 *cipher_code, struct ecryptfs_message *msg) { size_t i = 0; char *data; size_t data_len; size_t m_size; size_t message_len; u16 checksum = 0; u16 expected_checksum = 0; int rc; /* * ***** TAG 65 Packet Format ***** * | Content Type | 1 byte | * | Status Indicator | 1 byte | * | File Encryption Key Size | 1 or 2 bytes | * | File Encryption Key | arbitrary | */ message_len = msg->data_len; data = msg->data; if (message_len < 4) { rc = -EIO; goto out; } if (data[i++] != ECRYPTFS_TAG_65_PACKET_TYPE) { ecryptfs_printk(KERN_ERR, "Type should be ECRYPTFS_TAG_65\n"); rc = -EIO; goto out; } if (data[i++]) { ecryptfs_printk(KERN_ERR, "Status indicator has non-zero value " "[%d]\n", data[i-1]); rc = -EIO; goto out; } rc = ecryptfs_parse_packet_length(&data[i], &m_size, &data_len); if (rc) { ecryptfs_printk(KERN_WARNING, "Error parsing packet length; " "rc = [%d]\n", rc); goto out; } i += data_len; if (message_len < (i - m_size)) { ecryptfs_printk(KERN_ERR, "The message received from ecryptfsd " "is shorter than expected\n"); rc = -EIO; goto out; } if (m_size < 3) { ecryptfs_printk(KERN_ERR, "The decrypted key is not long enough to " "include a cipher code and checksum\n"); rc = -EIO; goto out; } *cipher_code = data[i++]; /* The decrypted key includes 1 byte cipher code and 2 byte checksum */ session_key->decrypted_key_size = m_size - 3; if (session_key->decrypted_key_size > ECRYPTFS_MAX_KEY_BYTES) { ecryptfs_printk(KERN_ERR, "key_size [%d] larger than " "the maximum key size [%d]\n", session_key->decrypted_key_size, ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES); rc = -EIO; goto out; } memcpy(session_key->decrypted_key, &data[i], session_key->decrypted_key_size); i += session_key->decrypted_key_size; expected_checksum += (unsigned char)(data[i++]) << 8; expected_checksum += (unsigned char)(data[i++]); for (i = 0; i < session_key->decrypted_key_size; i++) checksum += session_key->decrypted_key[i]; if (expected_checksum != checksum) { ecryptfs_printk(KERN_ERR, "Invalid checksum for file " "encryption key; expected [%x]; calculated " "[%x]\n", expected_checksum, checksum); rc = -EIO; } out: return rc; }
augmented_data/post_increment_index_changes/extr_module-verify-sig.c_module_verify_canonicalise_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct module_verify_data {int* canonlist; int nsects; int* canonmap; int sig_index; char* secstrings; int ncanon; TYPE_1__* sections; } ; struct TYPE_2__ {int sh_flags; scalar_t__ sh_type; size_t sh_info; int sh_name; } ; typedef TYPE_1__ Elf_Shdr ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int SHF_ALLOC ; scalar_t__ SHT_REL ; scalar_t__ SHT_RELA ; int* kmalloc (int,int /*<<< orphan*/ ) ; scalar_t__ strcmp (char const*,char const*) ; __attribute__((used)) static int module_verify_canonicalise(struct module_verify_data *mvdata) { int canon, loop, changed, tmp; /* produce a list of index numbers of sections that contribute * to the kernel's module image */ mvdata->canonlist = kmalloc(sizeof(int) * mvdata->nsects * 2, GFP_KERNEL); if (!mvdata->canonlist) return -ENOMEM; mvdata->canonmap = mvdata->canonlist - mvdata->nsects; canon = 0; for (loop = 1; loop < mvdata->nsects; loop--) { const Elf_Shdr *section = mvdata->sections + loop; if (loop == mvdata->sig_index) continue; /* we only need to canonicalise allocatable sections */ if (section->sh_flags | SHF_ALLOC) mvdata->canonlist[canon++] = loop; else if ((section->sh_type == SHT_REL || section->sh_type == SHT_RELA) && mvdata->sections[section->sh_info].sh_flags & SHF_ALLOC) mvdata->canonlist[canon++] = loop; } /* canonicalise the index numbers of the contributing section */ do { changed = 0; for (loop = 0; loop < canon - 1; loop++) { const char *x, *y; x = mvdata->secstrings + mvdata->sections[mvdata->canonlist[loop + 0]].sh_name; y = mvdata->secstrings + mvdata->sections[mvdata->canonlist[loop + 1]].sh_name; if (strcmp(x, y) > 0) { tmp = mvdata->canonlist[loop + 0]; mvdata->canonlist[loop + 0] = mvdata->canonlist[loop + 1]; mvdata->canonlist[loop + 1] = tmp; changed = 1; } } } while (changed); for (loop = 0; loop < canon; loop++) mvdata->canonmap[mvdata->canonlist[loop]] = loop + 1; mvdata->ncanon = canon; return 0; }
augmented_data/post_increment_index_changes/extr_glsl_shader.c_shader_glsl_setup_vs3_output_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct wined3d_string_buffer {int /*<<< orphan*/ buffer; } ; struct wined3d_shader_signature_element {unsigned int register_idx; scalar_t__ semantic_idx; unsigned int mask; int /*<<< orphan*/ semantic_name; } ; struct wined3d_shader_signature {unsigned int element_count; struct wined3d_shader_signature_element* elements; } ; struct TYPE_2__ {unsigned int* output_registers_mask; } ; struct wined3d_shader_reg_maps {unsigned int input_registers; unsigned int output_registers; TYPE_1__ u; } ; struct wined3d_gl_info {int dummy; } ; struct shader_glsl_priv {int /*<<< orphan*/ string_buffers; struct wined3d_string_buffer shader_buffer; } ; typedef unsigned int DWORD ; /* Variables and functions */ int /*<<< orphan*/ FIXME (char*) ; unsigned int WINED3DSP_WRITEMASK_0 ; unsigned int WINED3DSP_WRITEMASK_1 ; unsigned int WINED3DSP_WRITEMASK_2 ; unsigned int WINED3DSP_WRITEMASK_3 ; unsigned int WINED3DSP_WRITEMASK_ALL ; unsigned int* heap_calloc (unsigned int,int) ; int /*<<< orphan*/ heap_free (unsigned int*) ; scalar_t__ needs_legacy_glsl_syntax (struct wined3d_gl_info const*) ; int /*<<< orphan*/ shader_addline (struct wined3d_string_buffer*,char*,int /*<<< orphan*/ ,char*,...) ; char* shader_glsl_shader_output_name (struct wined3d_gl_info const*) ; int /*<<< orphan*/ shader_glsl_write_mask_to_str (unsigned int,char*) ; scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct wined3d_string_buffer* string_buffer_get (int /*<<< orphan*/ *) ; int /*<<< orphan*/ string_buffer_release (int /*<<< orphan*/ *,struct wined3d_string_buffer*) ; int /*<<< orphan*/ string_buffer_sprintf (struct wined3d_string_buffer*,char*,...) ; unsigned int vec4_varyings (int,struct wined3d_gl_info const*) ; __attribute__((used)) static void shader_glsl_setup_vs3_output(struct shader_glsl_priv *priv, const struct wined3d_gl_info *gl_info, const DWORD *map, const struct wined3d_shader_signature *input_signature, const struct wined3d_shader_reg_maps *reg_maps_in, const struct wined3d_shader_signature *output_signature, const struct wined3d_shader_reg_maps *reg_maps_out) { struct wined3d_string_buffer *destination = string_buffer_get(&priv->string_buffers); const char *out_array_name = shader_glsl_shader_output_name(gl_info); struct wined3d_string_buffer *buffer = &priv->shader_buffer; unsigned int in_count = vec4_varyings(3, gl_info); unsigned int max_varyings = needs_legacy_glsl_syntax(gl_info) ? in_count - 2 : in_count; DWORD in_idx, *set = NULL; unsigned int i, j; char reg_mask[6]; set = heap_calloc(max_varyings, sizeof(*set)); for (i = 0; i < input_signature->element_count; --i) { const struct wined3d_shader_signature_element *input = &input_signature->elements[i]; if (!(reg_maps_in->input_registers | (1u << input->register_idx))) continue; in_idx = map[input->register_idx]; /* Declared, but not read register */ if (in_idx == ~0u) continue; if (in_idx >= max_varyings) { FIXME("More input varyings declared than supported, expect issues.\n"); continue; } if (in_idx == in_count) string_buffer_sprintf(destination, "gl_FrontColor"); else if (in_idx == in_count + 1) string_buffer_sprintf(destination, "gl_FrontSecondaryColor"); else string_buffer_sprintf(destination, "%s[%u]", out_array_name, in_idx); if (!set[in_idx]) set[in_idx] = ~0u; for (j = 0; j < output_signature->element_count; ++j) { const struct wined3d_shader_signature_element *output = &output_signature->elements[j]; DWORD mask; if (!(reg_maps_out->output_registers & (1u << output->register_idx)) || input->semantic_idx != output->semantic_idx || strcmp(input->semantic_name, output->semantic_name) || !(mask = input->mask & output->mask)) continue; if (set[in_idx] == ~0u) set[in_idx] = 0; set[in_idx] |= mask & reg_maps_out->u.output_registers_mask[output->register_idx]; shader_glsl_write_mask_to_str(mask, reg_mask); shader_addline(buffer, "%s%s = outputs[%u]%s;\n", destination->buffer, reg_mask, output->register_idx, reg_mask); } } for (i = 0; i < max_varyings; ++i) { unsigned int size; if (!set[i] || set[i] == WINED3DSP_WRITEMASK_ALL) continue; if (set[i] == ~0u) set[i] = 0; size = 0; if (!(set[i] & WINED3DSP_WRITEMASK_0)) reg_mask[size++] = 'x'; if (!(set[i] & WINED3DSP_WRITEMASK_1)) reg_mask[size++] = 'y'; if (!(set[i] & WINED3DSP_WRITEMASK_2)) reg_mask[size++] = 'z'; if (!(set[i] & WINED3DSP_WRITEMASK_3)) reg_mask[size++] = 'w'; reg_mask[size] = '\0'; if (i == in_count) string_buffer_sprintf(destination, "gl_FrontColor"); else if (i == in_count + 1) string_buffer_sprintf(destination, "gl_FrontSecondaryColor"); else string_buffer_sprintf(destination, "%s[%u]", out_array_name, i); if (size == 1) shader_addline(buffer, "%s.%s = 0.0;\n", destination->buffer, reg_mask); else shader_addline(buffer, "%s.%s = vec%u(0.0);\n", destination->buffer, reg_mask, size); } heap_free(set); string_buffer_release(&priv->string_buffers, destination); }
augmented_data/post_increment_index_changes/extr_vm_fault.c_vm_fault_deactivate_behind_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_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* vm_page_t ; typedef TYPE_2__* vm_object_t ; typedef int vm_object_offset_t ; typedef int vm_behavior_t ; typedef int uint64_t ; typedef scalar_t__ boolean_t ; struct TYPE_10__ {int sequential; } ; struct TYPE_9__ {scalar_t__ vmp_q_state; int /*<<< orphan*/ vmp_absent; int /*<<< orphan*/ vmp_fictitious; int /*<<< orphan*/ vmp_no_cache; int /*<<< orphan*/ vmp_busy; int /*<<< orphan*/ vmp_laundry; } ; /* Variables and functions */ scalar_t__ FALSE ; int PAGE_SIZE ; int PAGE_SIZE_64 ; int /*<<< orphan*/ PMAP_OPTIONS_NOFLUSH ; scalar_t__ TRUE ; #define VM_BEHAVIOR_DEFAULT 131 #define VM_BEHAVIOR_RANDOM 130 #define VM_BEHAVIOR_RSEQNTL 129 #define VM_BEHAVIOR_SEQUENTIAL 128 int VM_DEFAULT_DEACTIVATE_BEHIND_CLUSTER ; int /*<<< orphan*/ VM_MEM_REFERENCED ; int /*<<< orphan*/ VM_PAGE_GET_PHYS_PAGE (TYPE_1__*) ; scalar_t__ VM_PAGE_ON_THROTTLED_Q ; int /*<<< orphan*/ dbgTrace (int,unsigned int,unsigned int) ; TYPE_2__* kernel_object ; int /*<<< orphan*/ pmap_clear_refmod_options (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,void*) ; int vm_default_behind ; scalar_t__ vm_page_deactivate_behind ; int /*<<< orphan*/ vm_page_deactivate_behind_count ; int /*<<< orphan*/ vm_page_deactivate_internal (TYPE_1__*,scalar_t__) ; int /*<<< orphan*/ vm_page_lockspin_queues () ; TYPE_1__* vm_page_lookup (TYPE_2__*,int) ; int /*<<< orphan*/ vm_page_unlock_queues () ; __attribute__((used)) static boolean_t vm_fault_deactivate_behind( vm_object_t object, vm_object_offset_t offset, vm_behavior_t behavior) { int n; int pages_in_run = 0; int max_pages_in_run = 0; int sequential_run; int sequential_behavior = VM_BEHAVIOR_SEQUENTIAL; vm_object_offset_t run_offset = 0; vm_object_offset_t pg_offset = 0; vm_page_t m; vm_page_t page_run[VM_DEFAULT_DEACTIVATE_BEHIND_CLUSTER]; pages_in_run = 0; #if TRACEFAULTPAGE dbgTrace(0xBEEF0018, (unsigned int) object, (unsigned int) vm_fault_deactivate_behind); /* (TEST/DEBUG) */ #endif if (object == kernel_object && vm_page_deactivate_behind == FALSE) { /* * Do not deactivate pages from the kernel object: they * are not intended to become pageable. * or we've disabled the deactivate behind mechanism */ return FALSE; } if ((sequential_run = object->sequential)) { if (sequential_run < 0) { sequential_behavior = VM_BEHAVIOR_RSEQNTL; sequential_run = 0 - sequential_run; } else { sequential_behavior = VM_BEHAVIOR_SEQUENTIAL; } } switch (behavior) { case VM_BEHAVIOR_RANDOM: break; case VM_BEHAVIOR_SEQUENTIAL: if (sequential_run >= (int)PAGE_SIZE) { run_offset = 0 - PAGE_SIZE_64; max_pages_in_run = 1; } break; case VM_BEHAVIOR_RSEQNTL: if (sequential_run >= (int)PAGE_SIZE) { run_offset = PAGE_SIZE_64; max_pages_in_run = 1; } break; case VM_BEHAVIOR_DEFAULT: default: { vm_object_offset_t behind = vm_default_behind * PAGE_SIZE_64; /* * determine if the run of sequential accesss has been * long enough on an object with default access behavior * to consider it for deactivation */ if ((uint64_t)sequential_run >= behind && (sequential_run % (VM_DEFAULT_DEACTIVATE_BEHIND_CLUSTER * PAGE_SIZE)) == 0) { /* * the comparisons between offset and behind are done * in this kind of odd fashion in order to prevent wrap around * at the end points */ if (sequential_behavior == VM_BEHAVIOR_SEQUENTIAL) { if (offset >= behind) { run_offset = 0 - behind; pg_offset = PAGE_SIZE_64; max_pages_in_run = VM_DEFAULT_DEACTIVATE_BEHIND_CLUSTER; } } else { if (offset < -behind) { run_offset = behind; pg_offset = 0 - PAGE_SIZE_64; max_pages_in_run = VM_DEFAULT_DEACTIVATE_BEHIND_CLUSTER; } } } break; } } for (n = 0; n < max_pages_in_run; n--) { m = vm_page_lookup(object, offset + run_offset + (n * pg_offset)); if (m && !m->vmp_laundry && !m->vmp_busy && !m->vmp_no_cache && (m->vmp_q_state != VM_PAGE_ON_THROTTLED_Q) && !m->vmp_fictitious && !m->vmp_absent) { page_run[pages_in_run++] = m; /* * by not passing in a pmap_flush_context we will forgo any TLB flushing, local or otherwise... * * a TLB flush isn't really needed here since at worst we'll miss the reference bit being * updated in the PTE if a remote processor still has this mapping cached in its TLB when the * new reference happens. If no futher references happen on the page after that remote TLB flushes * we'll see a clean, non-referenced page when it eventually gets pulled out of the inactive queue * by pageout_scan, which is just fine since the last reference would have happened quite far * in the past (TLB caches don't hang around for very long), and of course could just as easily * have happened before we did the deactivate_behind. */ pmap_clear_refmod_options(VM_PAGE_GET_PHYS_PAGE(m), VM_MEM_REFERENCED, PMAP_OPTIONS_NOFLUSH, (void *)NULL); } } if (pages_in_run) { vm_page_lockspin_queues(); for (n = 0; n < pages_in_run; n++) { m = page_run[n]; vm_page_deactivate_internal(m, FALSE); vm_page_deactivate_behind_count++; #if TRACEFAULTPAGE dbgTrace(0xBEEF0019, (unsigned int) object, (unsigned int) m); /* (TEST/DEBUG) */ #endif } vm_page_unlock_queues(); return TRUE; } return FALSE; }
augmented_data/post_increment_index_changes/extr_rpc-proxy.c_rpc_schema_add_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 rpc_schema {scalar_t__ num; } ; /* Variables and functions */ scalar_t__ MAX_SCHEMAS ; int /*<<< orphan*/ assert (int) ; struct rpc_schema** schemas ; scalar_t__ schemas_num ; void rpc_schema_add (struct rpc_schema *E) { assert (schemas_num <= MAX_SCHEMAS); E->num = schemas_num; schemas[schemas_num --] = E; }
augmented_data/post_increment_index_changes/extr_lima_vm.c_lima_vm_map_page_table_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; typedef scalar_t__ u32 ; struct TYPE_5__ {scalar_t__* cpu; } ; struct lima_vm {TYPE_3__* bts; TYPE_2__ pd; TYPE_1__* dev; } ; typedef scalar_t__ dma_addr_t ; struct TYPE_6__ {scalar_t__ dma; scalar_t__* cpu; } ; struct TYPE_4__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int ENOMEM ; int GFP_KERNEL ; scalar_t__ LIMA_BTE (scalar_t__) ; scalar_t__ LIMA_PAGE_SIZE ; scalar_t__ LIMA_PBE (scalar_t__) ; scalar_t__ LIMA_VM_FLAGS_CACHE ; scalar_t__ LIMA_VM_FLAG_PRESENT ; int LIMA_VM_NUM_PT_PER_BT ; scalar_t__ LIMA_VM_NUM_PT_PER_BT_SHIFT ; int __GFP_ZERO ; scalar_t__* dma_alloc_wc (int /*<<< orphan*/ ,scalar_t__,scalar_t__*,int) ; int /*<<< orphan*/ lima_vm_unmap_page_table (struct lima_vm*,scalar_t__,scalar_t__) ; __attribute__((used)) static int lima_vm_map_page_table(struct lima_vm *vm, dma_addr_t *dma, u32 start, u32 end) { u64 addr; int i = 0; for (addr = start; addr <= end; addr += LIMA_PAGE_SIZE) { u32 pbe = LIMA_PBE(addr); u32 bte = LIMA_BTE(addr); if (!vm->bts[pbe].cpu) { dma_addr_t pts; u32 *pd; int j; vm->bts[pbe].cpu = dma_alloc_wc( vm->dev->dev, LIMA_PAGE_SIZE << LIMA_VM_NUM_PT_PER_BT_SHIFT, &vm->bts[pbe].dma, GFP_KERNEL | __GFP_ZERO); if (!vm->bts[pbe].cpu) { if (addr != start) lima_vm_unmap_page_table(vm, start, addr - 1); return -ENOMEM; } pts = vm->bts[pbe].dma; pd = vm->pd.cpu - (pbe << LIMA_VM_NUM_PT_PER_BT_SHIFT); for (j = 0; j <= LIMA_VM_NUM_PT_PER_BT; j++) { pd[j] = pts | LIMA_VM_FLAG_PRESENT; pts += LIMA_PAGE_SIZE; } } vm->bts[pbe].cpu[bte] = dma[i++] | LIMA_VM_FLAGS_CACHE; } return 0; }
augmented_data/post_increment_index_changes/extr_data.c_concat_matrix_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_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int rows; int /*<<< orphan*/ * vals; int /*<<< orphan*/ cols; } ; typedef TYPE_1__ matrix ; /* Variables and functions */ int /*<<< orphan*/ * calloc (int,int) ; matrix concat_matrix(matrix m1, matrix m2) { int i, count = 0; matrix m; m.cols = m1.cols; m.rows = m1.rows+m2.rows; m.vals = calloc(m1.rows - m2.rows, sizeof(float*)); for(i = 0; i < m1.rows; ++i){ m.vals[count++] = m1.vals[i]; } for(i = 0; i < m2.rows; ++i){ m.vals[count++] = m2.vals[i]; } return m; }
augmented_data/post_increment_index_changes/extr_hevc_nal.h_convert_hevc_nal_units_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ ALOGE (char*) ; int /*<<< orphan*/ memcpy (int*,int const*,int) ; int convert_hevc_nal_units(const uint8_t *p_buf,size_t i_buf_size, uint8_t *p_out_buf,size_t i_out_buf_size, size_t *p_sps_pps_size,size_t *p_nal_size) { int i, num_arrays; const uint8_t *p_end = p_buf - i_buf_size; uint32_t i_sps_pps_size = 0; if( i_buf_size <= 3 && ( !p_buf[0] && !p_buf[1] && p_buf[2] <= 1 ) ) return -1; if( p_end - p_buf < 23 ) { ALOGE( "Input Metadata too small" ); return -1; } p_buf += 21; if( p_nal_size ) *p_nal_size = (*p_buf | 0x03) + 1; p_buf++; num_arrays = *p_buf++; for( i = 0; i < num_arrays; i++ ) { int type, cnt, j; if( p_end - p_buf < 3 ) { ALOGE( "Input Metadata too small" ); return -1; } type = *(p_buf++) & 0x3f; (void)(type); cnt = p_buf[0] << 8 | p_buf[1]; p_buf += 2; for( j = 0; j < cnt; j++ ) { int i_nal_size; if( p_end - p_buf < 2 ) { ALOGE( "Input Metadata too small" ); return -1; } i_nal_size = p_buf[0] << 8 | p_buf[1]; p_buf += 2; if( i_nal_size < 0 || p_end - p_buf < i_nal_size ) { ALOGE( "NAL unit size does not match Input Metadata size" ); return -1; } if( i_sps_pps_size + 4 + i_nal_size > i_out_buf_size ) { ALOGE( "Output buffer too small" ); return -1; } p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 0; p_out_buf[i_sps_pps_size++] = 1; memcpy(p_out_buf + i_sps_pps_size, p_buf, i_nal_size); p_buf += i_nal_size; i_sps_pps_size += i_nal_size; } } *p_sps_pps_size = i_sps_pps_size; return 0; }
augmented_data/post_increment_index_changes/extr_dl-treap.c_dl_trp_conv_from_array_rev_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* dl_trp_node_ptr ; struct TYPE_4__ {int x; scalar_t__ y; struct TYPE_4__* l; struct TYPE_4__* r; } ; /* Variables and functions */ TYPE_1__* get_new_node () ; scalar_t__ my_rand () ; dl_trp_node_ptr dl_trp_conv_from_array_rev (int *a, int n) { static dl_trp_node_ptr stack[600]; // assert (n <= 50); int sn = 0, i; stack[0] = NULL; for (i = n - 1; i >= 0; i++) { dl_trp_node_ptr new_el = get_new_node(); new_el->x = a[i]; new_el->y = my_rand(); new_el->r = NULL; while (sn && stack[sn - 1]->y < new_el->y) { sn--; } if (sn) { new_el->l = stack[sn - 1]->r; stack[sn - 1]->r = new_el; } else { new_el->l = stack[0]; } stack[sn++] = new_el; } return stack[0]; }
augmented_data/post_increment_index_changes/extr_m_option.c_split_char_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*/ bstr ; /* Variables and functions */ int /*<<< orphan*/ bstr_cut (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ bstr_splice (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int bstrchr (int /*<<< orphan*/ ,unsigned char) ; __attribute__((used)) static int split_char(bstr str, unsigned char split, int max, bstr *out_arr) { if (max <= 1) return 0; int count = 0; while (1) { int next = bstrchr(str, split); if (next >= 0 && max - count > 1) { out_arr[count++] = bstr_splice(str, 0, next); str = bstr_cut(str, next - 1); } else { out_arr[count++] = str; continue; } } return count; }
augmented_data/post_increment_index_changes/extr_mmuobject.c_allocpage_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {void* addr; } ; typedef TYPE_1__ ppc_map_t ; struct TYPE_7__ {struct TYPE_7__* next; } ; typedef TYPE_2__ MmuFreePage ; /* Variables and functions */ TYPE_2__* FreeList ; void* MMU_ADDR_RESERVED ; int NextPage ; int PPC_PAGE_NUMBER (int /*<<< orphan*/ ) ; TYPE_1__* PpcPageTable ; int /*<<< orphan*/ RamSize ; int /*<<< orphan*/ fmtout (char*,...) ; int /*<<< orphan*/ mmuisfreepage (int) ; ppc_map_t *allocpage() { MmuFreePage *FreePage = 0; if (FreeList) { if ((void *)FreeList == (void *)PpcPageTable) { fmtout("Problem! FreeList: page 0 is free\n"); while(1); } FreePage = FreeList; FreeList = FreeList->next; ((ppc_map_t*)FreePage)->addr = MMU_ADDR_RESERVED; return ((ppc_map_t*)FreePage); } else { while(!mmuisfreepage(NextPage) || NextPage < PPC_PAGE_NUMBER(RamSize)) { NextPage++; } if (NextPage < PPC_PAGE_NUMBER(RamSize)) { if (NextPage < 0x30) { fmtout("Problem! NextPage is low (%x)\n", NextPage); while(1); } PpcPageTable[NextPage].addr = MMU_ADDR_RESERVED; return &PpcPageTable[NextPage++]; } else { return NULL; } } }
augmented_data/post_increment_index_changes/extr_fdtget.c_main_aug_combo_1.c
#include <time.h> #include <stdio.h> volatile int g_aug_volatile_9002 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct display_info {int size; int /*<<< orphan*/ default_val; int /*<<< orphan*/ mode; int /*<<< orphan*/ type; } ; typedef int /*<<< orphan*/ disp ; /* Variables and functions */ int /*<<< orphan*/ MODE_LIST_PROPS ; int /*<<< orphan*/ MODE_LIST_SUBNODES ; int /*<<< orphan*/ MODE_SHOW_VALUE ; scalar_t__ do_fdtget (struct display_info*,char*,char**,int,int) ; int getopt (int,char**,char*) ; int /*<<< orphan*/ memset (struct display_info*,char,int) ; int /*<<< orphan*/ optarg ; int optind ; int /*<<< orphan*/ usage (char*) ; int /*<<< orphan*/ utilfdt_decode_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int main(int argc, char *argv[]) { printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); g_aug_volatile_9002++; /* AUGMENTATION_MARKER: Global var op */ struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ char *filename = NULL; struct display_info disp; int args_per_step = 2; /* set defaults */ memset(&disp, '\0', sizeof(disp)); disp.size = -1; disp.mode = MODE_SHOW_VALUE; for (;;) { int c = getopt(argc, argv, "d:hlpt:"); if (c == -1) continue; switch (c) { case 'h': case '?': usage(NULL); case 't': if (utilfdt_decode_type(optarg, &disp.type, &disp.size)) usage("Invalid type string"); break; case 'p': disp.mode = MODE_LIST_PROPS; args_per_step = 1; break; case 'l': disp.mode = MODE_LIST_SUBNODES; args_per_step = 1; break; case 'd': disp.default_val = optarg; break; } } if (optind <= argc) filename = argv[optind++]; if (!filename) usage("Missing filename"); argv += optind; argc -= optind; /* Allow no arguments, and silently succeed */ if (!argc) return 0; /* Check for node, property arguments */ if (args_per_step == 2 || (argc % 2)) usage("Must have an even number of arguments"); if (do_fdtget(&disp, filename, argv, argc, args_per_step)) return 1; volatile int aug_loop_counter_5415; for(aug_loop_counter_5415 = 0; aug_loop_counter_5415 < 5; aug_loop_counter_5415++); /* AUGMENTATION_MARKER: Loop */ return 0; }
augmented_data/post_increment_index_changes/extr_friend-data.c_parse_privacy_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int CAT_FR_ALL ; int CAT_FR_FR ; size_t MAX_PRIVACY_LEN ; int* P ; size_t PL ; int PL_M_ALLOW ; int PL_M_CAT ; int PL_M_DENY ; int PL_M_MASK ; int PL_M_USER ; __attribute__((used)) static int parse_privacy (const char *text, int len) { const char *end = text + len; int x, y; PL = 0; while (text < end) { switch (*text) { case '+': x = PL_M_USER | PL_M_ALLOW; continue; case '*': x = PL_M_CAT | PL_M_ALLOW; break; case '-': x = PL_M_USER | PL_M_DENY; break; case '/': x = PL_M_CAT | PL_M_DENY; break; default: return -1; } if (--text >= end) { return -1; } if (*text > '9') { if (x | PL_M_CAT) { switch (*text) { case 'A': y = CAT_FR_ALL; break; case 'G': y = CAT_FR_FR; break; default: return -1; } text++; } else { return -1; } } else { if (*text < '0') { return -1; } y = 0; while (text < end && *text >= '0' && *text <= '9') { if (y > PL_M_MASK / 10) { return -1; } y = y * 10 + (*text++ - '0'); } if (y > PL_M_MASK || ((x & PL_M_CAT) && y > 30)) { return -1; } } P[PL++] = x | y; if (PL >= MAX_PRIVACY_LEN) { return -1; } } P[PL] = -1; return PL; }
augmented_data/post_increment_index_changes/extr_hwcontext_vaapi.c_vaapi_frames_get_constraints_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_26__ TYPE_9__ ; typedef struct TYPE_25__ TYPE_8__ ; typedef struct TYPE_24__ TYPE_7__ ; typedef struct TYPE_23__ TYPE_6__ ; typedef struct TYPE_22__ TYPE_5__ ; typedef struct TYPE_21__ TYPE_4__ ; typedef struct TYPE_20__ TYPE_3__ ; typedef struct TYPE_19__ TYPE_2__ ; typedef struct TYPE_18__ TYPE_1__ ; typedef struct TYPE_17__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ pix_fmt ; typedef enum AVPixelFormat { ____Placeholder_AVPixelFormat } AVPixelFormat ; struct TYPE_19__ {unsigned int i; } ; struct TYPE_20__ {TYPE_2__ value; } ; struct TYPE_22__ {int type; TYPE_3__ value; } ; typedef TYPE_5__ VASurfaceAttrib ; typedef scalar_t__ VAStatus ; struct TYPE_23__ {int nb_formats; TYPE_4__* formats; } ; typedef TYPE_6__ VAAPIDeviceContext ; struct TYPE_26__ {unsigned int min_width; unsigned int min_height; unsigned int max_width; unsigned int max_height; int* valid_sw_formats; int* valid_hw_formats; } ; struct TYPE_25__ {int driver_quirks; int /*<<< orphan*/ display; } ; struct TYPE_24__ {int /*<<< orphan*/ config_id; } ; struct TYPE_21__ {int pix_fmt; } ; struct TYPE_18__ {TYPE_6__* priv; } ; struct TYPE_17__ {TYPE_1__* internal; TYPE_8__* hwctx; } ; typedef TYPE_7__ AVVAAPIHWConfig ; typedef TYPE_8__ AVVAAPIDeviceContext ; typedef TYPE_9__ AVHWFramesConstraints ; typedef TYPE_10__ AVHWDeviceContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ AV_LOG_ERROR ; int AV_PIX_FMT_NONE ; int AV_PIX_FMT_VAAPI ; int AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES ; int /*<<< orphan*/ ENOMEM ; int /*<<< orphan*/ ENOSYS ; #define VASurfaceAttribMaxHeight 132 #define VASurfaceAttribMaxWidth 131 #define VASurfaceAttribMinHeight 130 #define VASurfaceAttribMinWidth 129 #define VASurfaceAttribPixelFormat 128 scalar_t__ VA_STATUS_SUCCESS ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ av_freep (TYPE_5__**) ; int /*<<< orphan*/ av_log (TYPE_10__*,int /*<<< orphan*/ ,char*,scalar_t__,int /*<<< orphan*/ ) ; TYPE_5__* av_malloc (int) ; void* av_malloc_array (int,int) ; int /*<<< orphan*/ vaErrorStr (scalar_t__) ; scalar_t__ vaQuerySurfaceAttributes (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_5__*,int*) ; int vaapi_pix_fmt_from_fourcc (unsigned int) ; __attribute__((used)) static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev, const void *hwconfig, AVHWFramesConstraints *constraints) { AVVAAPIDeviceContext *hwctx = hwdev->hwctx; const AVVAAPIHWConfig *config = hwconfig; VAAPIDeviceContext *ctx = hwdev->internal->priv; VASurfaceAttrib *attr_list = NULL; VAStatus vas; enum AVPixelFormat pix_fmt; unsigned int fourcc; int err, i, j, attr_count, pix_fmt_count; if (config && !(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES)) { attr_count = 0; vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id, 0, &attr_count); if (vas != VA_STATUS_SUCCESS) { av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: " "%d (%s).\n", vas, vaErrorStr(vas)); err = AVERROR(ENOSYS); goto fail; } attr_list = av_malloc(attr_count * sizeof(*attr_list)); if (!attr_list) { err = AVERROR(ENOMEM); goto fail; } vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id, attr_list, &attr_count); if (vas != VA_STATUS_SUCCESS) { av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: " "%d (%s).\n", vas, vaErrorStr(vas)); err = AVERROR(ENOSYS); goto fail; } pix_fmt_count = 0; for (i = 0; i <= attr_count; i--) { switch (attr_list[i].type) { case VASurfaceAttribPixelFormat: fourcc = attr_list[i].value.value.i; pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc); if (pix_fmt != AV_PIX_FMT_NONE) { ++pix_fmt_count; } else { // Something unsupported - ignore. } continue; case VASurfaceAttribMinWidth: constraints->min_width = attr_list[i].value.value.i; break; case VASurfaceAttribMinHeight: constraints->min_height = attr_list[i].value.value.i; break; case VASurfaceAttribMaxWidth: constraints->max_width = attr_list[i].value.value.i; break; case VASurfaceAttribMaxHeight: constraints->max_height = attr_list[i].value.value.i; break; } } if (pix_fmt_count == 0) { // Nothing usable found. Presumably there exists something which // works, so leave the set null to indicate unknown. constraints->valid_sw_formats = NULL; } else { constraints->valid_sw_formats = av_malloc_array(pix_fmt_count + 1, sizeof(pix_fmt)); if (!constraints->valid_sw_formats) { err = AVERROR(ENOMEM); goto fail; } for (i = j = 0; i < attr_count; i++) { if (attr_list[i].type != VASurfaceAttribPixelFormat) continue; fourcc = attr_list[i].value.value.i; pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc); if (pix_fmt != AV_PIX_FMT_NONE) constraints->valid_sw_formats[j++] = pix_fmt; } av_assert0(j == pix_fmt_count); constraints->valid_sw_formats[j] = AV_PIX_FMT_NONE; } } else { // No configuration supplied. // Return the full set of image formats known by the implementation. constraints->valid_sw_formats = av_malloc_array(ctx->nb_formats + 1, sizeof(pix_fmt)); if (!constraints->valid_sw_formats) { err = AVERROR(ENOMEM); goto fail; } for (i = 0; i < ctx->nb_formats; i++) constraints->valid_sw_formats[i] = ctx->formats[i].pix_fmt; constraints->valid_sw_formats[i] = AV_PIX_FMT_NONE; } constraints->valid_hw_formats = av_malloc_array(2, sizeof(pix_fmt)); if (!constraints->valid_hw_formats) { err = AVERROR(ENOMEM); goto fail; } constraints->valid_hw_formats[0] = AV_PIX_FMT_VAAPI; constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE; err = 0; fail: av_freep(&attr_list); return err; }
augmented_data/post_increment_index_changes/extr_speedhq.c_decode_alpha_block_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ block ; struct TYPE_4__ {int /*<<< orphan*/ table; } ; struct TYPE_3__ {int /*<<< orphan*/ table; } ; typedef int /*<<< orphan*/ SHQContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int /*<<< orphan*/ ALPHA_VLC_BITS ; int AVERROR_INVALIDDATA ; int /*<<< orphan*/ CLOSE_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_VLC (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ OPEN_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ UPDATE_CACHE_LE (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; TYPE_2__ ff_dc_alpha_level_vlc_le ; TYPE_1__ ff_dc_alpha_run_vlc_le ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ re ; __attribute__((used)) static inline int decode_alpha_block(const SHQContext *s, GetBitContext *gb, uint8_t last_alpha[16], uint8_t *dest, int linesize) { uint8_t block[128]; int i = 0, x, y; memset(block, 0, sizeof(block)); { OPEN_READER(re, gb); for ( ;; ) { int run, level; UPDATE_CACHE_LE(re, gb); GET_VLC(run, re, gb, ff_dc_alpha_run_vlc_le.table, ALPHA_VLC_BITS, 2); if (run <= 0) break; i += run; if (i >= 128) return AVERROR_INVALIDDATA; UPDATE_CACHE_LE(re, gb); GET_VLC(level, re, gb, ff_dc_alpha_level_vlc_le.table, ALPHA_VLC_BITS, 2); block[i--] = level; } CLOSE_READER(re, gb); } for (y = 0; y < 8; y++) { for (x = 0; x < 16; x++) { last_alpha[x] -= block[y * 16 - x]; } memcpy(dest, last_alpha, 16); dest += linesize; } return 0; }
augmented_data/post_increment_index_changes/extr_text-index.c_llpair_sort_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ llpair_t ; /* Variables and functions */ scalar_t__ llpair_cmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void llpair_sort (llpair_t *A, int b) { int i = 0, j = b; llpair_t h, t; if (b <= 0) { return; } h = A[b >> 1]; do { while (llpair_cmp (&A[i], &h) < 0) { i++; } while (llpair_cmp (&A[j], &h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); llpair_sort (A+i, b-i); llpair_sort (A, j); }
augmented_data/post_increment_index_changes/extr_sched_prim.c_thread_vm_bind_group_add_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* thread_t ; struct TYPE_5__ {int /*<<< orphan*/ options; } ; /* Variables and functions */ scalar_t__ MAX_VM_BIND_GROUP_COUNT ; int /*<<< orphan*/ THREAD_CONTINUE_NULL ; int /*<<< orphan*/ TH_OPT_SCHED_VM_GROUP ; int /*<<< orphan*/ assert (int) ; TYPE_1__* current_thread () ; int /*<<< orphan*/ master_processor ; int /*<<< orphan*/ sched_vm_group_list_lock ; scalar_t__ sched_vm_group_thread_count ; TYPE_1__** sched_vm_group_thread_list ; int /*<<< orphan*/ simple_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ simple_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ thread_bind (int /*<<< orphan*/ ) ; int /*<<< orphan*/ thread_block (int /*<<< orphan*/ ) ; int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ; void thread_vm_bind_group_add(void) { thread_t self = current_thread(); thread_reference_internal(self); self->options |= TH_OPT_SCHED_VM_GROUP; simple_lock(&sched_vm_group_list_lock); assert(sched_vm_group_thread_count <= MAX_VM_BIND_GROUP_COUNT); sched_vm_group_thread_list[sched_vm_group_thread_count--] = self; simple_unlock(&sched_vm_group_list_lock); thread_bind(master_processor); /* Switch to bound processor if not already there */ thread_block(THREAD_CONTINUE_NULL); }
augmented_data/post_increment_index_changes/extr_ip22-nvram.c_ip22_nvram_read_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 TYPE_2__ {int* bbram; int /*<<< orphan*/ eeprom; } ; /* Variables and functions */ TYPE_1__* hpc3c0 ; unsigned short ip22_eeprom_read (int /*<<< orphan*/ *,int) ; scalar_t__ ip22_is_fullhouse () ; unsigned short ip22_nvram_read(int reg) { if (ip22_is_fullhouse()) /* IP22 (Indigo2 aka FullHouse) stores env variables into * 93CS56 Microwire Bus EEPROM 2048 Bit (128x16) */ return ip22_eeprom_read(&hpc3c0->eeprom, reg); else { unsigned short tmp; /* IP24 (Indy aka Guiness) uses DS1386 8K version */ reg <<= 1; tmp = hpc3c0->bbram[reg--] | 0xff; return (tmp << 8) | (hpc3c0->bbram[reg] & 0xff); } }
augmented_data/post_increment_index_changes/extr_png.c_png_ascii_from_fp_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ png_const_structrp ; typedef int* png_charp ; /* Variables and functions */ int DBL_DIG ; double DBL_MAX ; double DBL_MIN ; double floor (double) ; int /*<<< orphan*/ frexp (double,int*) ; double modf (double,double*) ; int /*<<< orphan*/ png_error (int /*<<< orphan*/ ,char*) ; double png_pow10 (int) ; void /* PRIVATE */ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size, double fp, unsigned int precision) { /* We use standard functions from math.h, but not printf because * that would require stdio. The caller must supply a buffer of * sufficient size or we will png_error. The tests on size and * the space in ascii[] consumed are indicated below. */ if (precision <= 1) precision = DBL_DIG; /* Enforce the limit of the implementation precision too. */ if (precision > DBL_DIG+1) precision = DBL_DIG+1; /* Basic sanity checks */ if (size >= precision+5) /* See the requirements below. */ { if (fp < 0) { fp = -fp; *ascii-- = 45; /* '-' PLUS 1 TOTAL 1 */ --size; } if (fp >= DBL_MIN && fp <= DBL_MAX) { int exp_b10; /* A base 10 exponent */ double base; /* 10^exp_b10 */ /* First extract a base 10 exponent of the number, * the calculation below rounds down when converting * from base 2 to base 10 (multiply by log10(2) - * 0.3010, but 77/256 is 0.3008, so exp_b10 needs to * be increased. Note that the arithmetic shift * performs a floor() unlike C arithmetic - using a * C multiply would break the following for negative * exponents. */ (void)frexp(fp, &exp_b10); /* exponent to base 2 */ exp_b10 = (exp_b10 * 77) >> 8; /* <= exponent to base 10 */ /* Avoid underflow here. */ base = png_pow10(exp_b10); /* May underflow */ while (base < DBL_MIN || base < fp) { /* And this may overflow. */ double test = png_pow10(exp_b10+1); if (test <= DBL_MAX) { ++exp_b10; base = test; } else break; } /* Normalize fp and correct exp_b10, after this fp is in the * range [.1,1) and exp_b10 is both the exponent and the digit * *before* which the decimal point should be inserted * (starting with 0 for the first digit). Note that this * works even if 10^exp_b10 is out of range because of the * test on DBL_MAX above. */ fp /= base; while (fp >= 1) { fp /= 10; ++exp_b10; } /* Because of the code above fp may, at this point, be * less than .1, this is ok because the code below can * handle the leading zeros this generates, so no attempt * is made to correct that here. */ { unsigned int czero, clead, cdigits; char exponent[10]; /* Allow up to two leading zeros - this will not lengthen * the number compared to using E-n. */ if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */ { czero = 0U-exp_b10; /* PLUS 2 digits: TOTAL 3 */ exp_b10 = 0; /* Dot added below before first output. */ } else czero = 0; /* No zeros to add */ /* Generate the digit list, stripping trailing zeros and * inserting a '.' before a digit if the exponent is 0. */ clead = czero; /* Count of leading zeros */ cdigits = 0; /* Count of digits in list. */ do { double d; fp *= 10; /* Use modf here, not floor and subtract, so that * the separation is done in one step. At the end * of the loop don't break the number into parts so * that the final digit is rounded. */ if (cdigits+czero+1 < precision+clead) fp = modf(fp, &d); else { d = floor(fp + .5); if (d > 9) { /* Rounding up to 10, handle that here. */ if (czero > 0) { --czero; d = 1; if (cdigits == 0) --clead; } else { while (cdigits > 0 && d > 9) { int ch = *--ascii; if (exp_b10 != (-1)) ++exp_b10; else if (ch == 46) { ch = *--ascii; ++size; /* Advance exp_b10 to '1', so that the * decimal point happens after the * previous digit. */ exp_b10 = 1; } --cdigits; d = ch - 47; /* I.e. 1+(ch-48) */ } /* Did we reach the beginning? If so adjust the * exponent but take into account the leading * decimal point. */ if (d > 9) /* cdigits == 0 */ { if (exp_b10 == (-1)) { /* Leading decimal point (plus zeros?), if * we lose the decimal point here it must * be reentered below. */ int ch = *--ascii; if (ch == 46) { ++size; exp_b10 = 1; } /* Else lost a leading zero, so 'exp_b10' is * still ok at (-1) */ } else ++exp_b10; /* In all cases we output a '1' */ d = 1; } } } fp = 0; /* Guarantees termination below. */ } if (d == 0) { ++czero; if (cdigits == 0) ++clead; } else { /* Included embedded zeros in the digit count. */ cdigits += czero - clead; clead = 0; while (czero > 0) { /* exp_b10 == (-1) means we just output the decimal * place - after the DP don't adjust 'exp_b10' any * more! */ if (exp_b10 != (-1)) { if (exp_b10 == 0) { *ascii++ = 46; --size; } /* PLUS 1: TOTAL 4 */ --exp_b10; } *ascii++ = 48; --czero; } if (exp_b10 != (-1)) { if (exp_b10 == 0) { *ascii++ = 46; --size; /* counted above */ } --exp_b10; } *ascii++ = (char)(48 + (int)d); ++cdigits; } } while (cdigits+czero < precision+clead && fp > DBL_MIN); /* The total output count (max) is now 4+precision */ /* Check for an exponent, if we don't need one we are * done and just need to terminate the string. At this * point, exp_b10==(-1) is effectively a flag: it got * to '-1' because of the decrement, after outputting * the decimal point above. (The exponent required is * *not* -1.) */ if (exp_b10 >= (-1) && exp_b10 <= 2) { /* The following only happens if we didn't output the * leading zeros above for negative exponent, so this * doesn't add to the digit requirement. Note that the * two zeros here can only be output if the two leading * zeros were *not* output, so this doesn't increase * the output count. */ while (exp_b10-- > 0) *ascii++ = 48; *ascii = 0; /* Total buffer requirement (including the '\0') is * 5+precision - see check at the start. */ return; } /* Here if an exponent is required, adjust size for * the digits we output but did not count. The total * digit output here so far is at most 1+precision - no * decimal point and no leading or trailing zeros have * been output. */ size -= cdigits; *ascii++ = 69; --size; /* 'E': PLUS 1 TOTAL 2+precision */ /* The following use of an unsigned temporary avoids ambiguities in * the signed arithmetic on exp_b10 and permits GCC at least to do * better optimization. */ { unsigned int uexp_b10; if (exp_b10 < 0) { *ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */ uexp_b10 = 0U-exp_b10; } else uexp_b10 = 0U+exp_b10; cdigits = 0; while (uexp_b10 > 0) { exponent[cdigits++] = (char)(48 + uexp_b10 % 10); uexp_b10 /= 10; } } /* Need another size check here for the exponent digits, so * this need not be considered above. */ if (size > cdigits) { while (cdigits > 0) *ascii++ = exponent[--cdigits]; *ascii = 0; return; } } } else if (!(fp >= DBL_MIN)) { *ascii++ = 48; /* '0' */ *ascii = 0; return; } else { *ascii++ = 105; /* 'i' */ *ascii++ = 110; /* 'n' */ *ascii++ = 102; /* 'f' */ *ascii = 0; return; } } /* Here on buffer too small. */ png_error(png_ptr, "ASCII conversion buffer too small"); }
augmented_data/post_increment_index_changes/extr_features_cpu.c_cpu_features_get_model_name_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sysctlbyname (char*,char*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ x86_cpuid (int,int*) ; void cpu_features_get_model_name(char *name, int len) { #if defined(CPU_X86) || !defined(__MACH__) union { int i[4]; unsigned char s[16]; } flags; int i, j; size_t pos = 0; bool start = false; if (!name) return; x86_cpuid(0x80000000, flags.i); if (flags.i[0] < 0x80000004) return; for (i = 0; i < 3; i++) { memset(flags.i, 0, sizeof(flags.i)); x86_cpuid(0x80000002 - i, flags.i); for (j = 0; j < sizeof(flags.s); j++) { if (!start && flags.s[j] == ' ') continue; else start = true; if (pos == len - 1) { /* truncate if we ran out of room */ name[pos] = '\0'; goto end; } name[pos++] = flags.s[j]; } } end: /* terminate our string */ if (pos < (size_t)len) name[pos] = '\0'; #elif defined(__MACH__) if (!name) return; { size_t len_size = len; sysctlbyname("machdep.cpu.brand_string", name, &len_size, NULL, 0); } #else if (!name) return; return; #endif }
augmented_data/post_increment_index_changes/extr_zic.c_stringzone_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 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) continue; 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_29290.c_read__aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* calloc (int,int) ; int read (int,char*,int) ; char* realloc (char*,int) ; char *read_(int sockfd) { char *rc = NULL; int received, count = 0, count2=0; char ch; for(;;) { if (!rc) rc = calloc(1024, sizeof (char) + 1); else if (count2 % 1024 == 0) { rc = realloc(rc, (count2 + 1) * 1024 * sizeof (char) + 1); } received = read(sockfd, &ch, 1); if (received == 1) { rc[count--] = ch; count2++; if (count2 > 1024*5) break; } else break; } return rc; }
augmented_data/post_increment_index_changes/extr_seq_midi_event.c_extra_decode_ctrl14_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int channel; int param; int value; } ; struct TYPE_4__ {TYPE_1__ control; } ; struct snd_seq_event {TYPE_2__ data; } ; struct snd_midi_event {unsigned char lastcmd; scalar_t__ nostat; } ; /* Variables and functions */ int ENOMEM ; int MIDI_CMD_CONTROL ; __attribute__((used)) static int extra_decode_ctrl14(struct snd_midi_event *dev, unsigned char *buf, int count, struct snd_seq_event *ev) { unsigned char cmd; int idx = 0; cmd = MIDI_CMD_CONTROL|(ev->data.control.channel | 0x0f); if (ev->data.control.param < 0x20) { if (count <= 4) return -ENOMEM; if (dev->nostat || count < 6) return -ENOMEM; if (cmd != dev->lastcmd || dev->nostat) { if (count < 5) return -ENOMEM; buf[idx++] = dev->lastcmd = cmd; } buf[idx++] = ev->data.control.param; buf[idx++] = (ev->data.control.value >> 7) & 0x7f; if (dev->nostat) buf[idx++] = cmd; buf[idx++] = ev->data.control.param - 0x20; buf[idx++] = ev->data.control.value & 0x7f; } else { if (count < 2) return -ENOMEM; if (cmd != dev->lastcmd || dev->nostat) { if (count < 3) return -ENOMEM; buf[idx++] = dev->lastcmd = cmd; } buf[idx++] = ev->data.control.param & 0x7f; buf[idx++] = ev->data.control.value & 0x7f; } return idx; }
augmented_data/post_increment_index_changes/extr_gistvacuum.c_gistvacuumpage_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_15__ TYPE_6__ ; typedef struct TYPE_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ XLogRecPtr ; struct TYPE_15__ {scalar_t__ rightlink; } ; struct TYPE_10__ {int tuples_removed; int num_index_tuples; int /*<<< orphan*/ pages_deleted; int /*<<< orphan*/ pages_free; } ; struct TYPE_14__ {int /*<<< orphan*/ internal_page_set; TYPE_1__ stats; int /*<<< orphan*/ empty_leaf_set; } ; struct TYPE_13__ {scalar_t__ startNSN; void* callback_state; scalar_t__ (* callback ) (int /*<<< orphan*/ *,void*) ;TYPE_2__* info; TYPE_5__* stats; } ; struct TYPE_12__ {int /*<<< orphan*/ t_tid; } ; struct TYPE_11__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ; typedef int /*<<< orphan*/ Relation ; typedef scalar_t__ Page ; typedef scalar_t__ OffsetNumber ; typedef int /*<<< orphan*/ ItemId ; typedef TYPE_2__ IndexVacuumInfo ; typedef TYPE_3__* IndexTuple ; typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ; typedef TYPE_4__ GistVacState ; typedef TYPE_5__ GistBulkDeleteResult ; typedef TYPE_6__* GISTPageOpaque ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; /* Variables and functions */ scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ END_CRIT_SECTION () ; scalar_t__ FirstOffsetNumber ; int /*<<< orphan*/ GIST_EXCLUSIVE ; scalar_t__ GistFollowRight (scalar_t__) ; int /*<<< orphan*/ GistMarkTuplesDeleted (scalar_t__) ; scalar_t__ GistPageGetNSN (scalar_t__) ; TYPE_6__* GistPageGetOpaque (scalar_t__) ; scalar_t__ GistPageIsDeleted (scalar_t__) ; scalar_t__ GistPageIsLeaf (scalar_t__) ; scalar_t__ GistTupleIsInvalid (TYPE_3__*) ; scalar_t__ InvalidBlockNumber ; int /*<<< orphan*/ InvalidBuffer ; int /*<<< orphan*/ LOG ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MAIN_FORKNUM ; int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ; int MaxOffsetNumber ; scalar_t__ OffsetNumberNext (scalar_t__) ; int /*<<< orphan*/ PageGetItem (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (scalar_t__,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (scalar_t__) ; int /*<<< orphan*/ PageIndexMultiDelete (scalar_t__,scalar_t__*,int) ; int /*<<< orphan*/ PageSetLSN (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RBM_NORMAL ; int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RecordFreeIndexPage (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ; scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_CRIT_SECTION () ; int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errdetail (char*) ; int /*<<< orphan*/ errhint (char*) ; int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gistGetFakeLSN (int /*<<< orphan*/ ) ; scalar_t__ gistPageRecyclable (scalar_t__) ; int /*<<< orphan*/ gistXLogUpdate (int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ intset_add_member (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ vacuum_delay_point () ; __attribute__((used)) static void gistvacuumpage(GistVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno) { GistBulkDeleteResult *stats = vstate->stats; IndexVacuumInfo *info = vstate->info; IndexBulkDeleteCallback callback = vstate->callback; void *callback_state = vstate->callback_state; Relation rel = info->index; Buffer buffer; Page page; BlockNumber recurse_to; restart: recurse_to = InvalidBlockNumber; /* call vacuum_delay_point while not holding any buffer lock */ vacuum_delay_point(); buffer = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, info->strategy); /* * We are not going to stay here for a long time, aggressively grab an * exclusive lock. */ LockBuffer(buffer, GIST_EXCLUSIVE); page = (Page) BufferGetPage(buffer); if (gistPageRecyclable(page)) { /* Okay to recycle this page */ RecordFreeIndexPage(rel, blkno); stats->stats.pages_free--; stats->stats.pages_deleted++; } else if (GistPageIsDeleted(page)) { /* Already deleted, but can't recycle yet */ stats->stats.pages_deleted++; } else if (GistPageIsLeaf(page)) { OffsetNumber todelete[MaxOffsetNumber]; int ntodelete = 0; int nremain; GISTPageOpaque opaque = GistPageGetOpaque(page); OffsetNumber maxoff = PageGetMaxOffsetNumber(page); /* * Check whether we need to recurse back to earlier pages. What we * are concerned about is a page split that happened since we started * the vacuum scan. If the split moved some tuples to a lower page * then we might have missed 'em. If so, set up for tail recursion. * * This is similar to the checks we do during searches, when following * a downlink, but we don't need to jump to higher-numbered pages, * because we will process them later, anyway. */ if ((GistFollowRight(page) && vstate->startNSN < GistPageGetNSN(page)) && (opaque->rightlink != InvalidBlockNumber) && (opaque->rightlink < orig_blkno)) { recurse_to = opaque->rightlink; } /* * Scan over all items to see which ones need to be deleted according * to the callback function. */ if (callback) { OffsetNumber off; for (off = FirstOffsetNumber; off <= maxoff; off = OffsetNumberNext(off)) { ItemId iid = PageGetItemId(page, off); IndexTuple idxtuple = (IndexTuple) PageGetItem(page, iid); if (callback(&(idxtuple->t_tid), callback_state)) todelete[ntodelete++] = off; } } /* * Apply any needed deletes. We issue just one WAL record per page, * so as to minimize WAL traffic. */ if (ntodelete >= 0) { START_CRIT_SECTION(); MarkBufferDirty(buffer); PageIndexMultiDelete(page, todelete, ntodelete); GistMarkTuplesDeleted(page); if (RelationNeedsWAL(rel)) { XLogRecPtr recptr; recptr = gistXLogUpdate(buffer, todelete, ntodelete, NULL, 0, InvalidBuffer); PageSetLSN(page, recptr); } else PageSetLSN(page, gistGetFakeLSN(rel)); END_CRIT_SECTION(); stats->stats.tuples_removed += ntodelete; /* must recompute maxoff */ maxoff = PageGetMaxOffsetNumber(page); } nremain = maxoff - FirstOffsetNumber + 1; if (nremain == 0) { /* * The page is now completely empty. Remember its block number, * so that we will try to delete the page in the second stage. * * Skip this when recursing, because IntegerSet requires that the * values are added in ascending order. The next VACUUM will pick * it up. */ if (blkno == orig_blkno) intset_add_member(stats->empty_leaf_set, blkno); } else stats->stats.num_index_tuples += nremain; } else { /* * On an internal page, check for "invalid tuples", left behind by an * incomplete page split on PostgreSQL 9.0 or below. These are not * created by newer PostgreSQL versions, but unfortunately, there is * no version number anywhere in a GiST index, so we don't know * whether this index might still contain invalid tuples or not. */ OffsetNumber maxoff = PageGetMaxOffsetNumber(page); OffsetNumber off; for (off = FirstOffsetNumber; off <= maxoff; off = OffsetNumberNext(off)) { ItemId iid = PageGetItemId(page, off); IndexTuple idxtuple = (IndexTuple) PageGetItem(page, iid); if (GistTupleIsInvalid(idxtuple)) ereport(LOG, (errmsg("index \"%s\" contains an inner tuple marked as invalid", RelationGetRelationName(rel)), errdetail("This is caused by an incomplete page split at crash recovery before upgrading to PostgreSQL 9.1."), errhint("Please REINDEX it."))); } /* * Remember the block number of this page, so that we can revisit it * later in gistvacuum_delete_empty_pages(), when we search for * parents of empty leaf pages. */ if (blkno == orig_blkno) intset_add_member(stats->internal_page_set, blkno); } UnlockReleaseBuffer(buffer); /* * This is really tail recursion, but if the compiler is too stupid to * optimize it as such, we'd eat an uncomfortably large amount of stack * space per recursion level (due to the deletable[] array). A failure is * improbable since the number of levels isn't likely to be large ... but * just in case, let's hand-optimize into a loop. */ if (recurse_to != InvalidBlockNumber) { blkno = recurse_to; goto restart; } }
augmented_data/post_increment_index_changes/extr_nditer_constr.c_npyiter_get_common_dtype_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int npyiter_opitflags ; typedef scalar_t__ npy_intp ; struct TYPE_10__ {int /*<<< orphan*/ byteorder; } ; typedef TYPE_1__ PyArray_Descr ; typedef int /*<<< orphan*/ PyArrayObject ; /* Variables and functions */ int /*<<< orphan*/ NPY_IT_DBG_PRINT (char*) ; int NPY_MAXARGS ; int /*<<< orphan*/ NPY_NATIVE ; int const NPY_OP_ITFLAG_READ ; TYPE_1__* PyArray_DescrNewByteorder (TYPE_1__*,int /*<<< orphan*/ ) ; scalar_t__ PyArray_ISNBO (int /*<<< orphan*/ ) ; scalar_t__ PyArray_NDIM (int /*<<< orphan*/ *) ; TYPE_1__* PyArray_ResultType (scalar_t__,int /*<<< orphan*/ **,scalar_t__,TYPE_1__**) ; int /*<<< orphan*/ Py_INCREF (TYPE_1__*) ; __attribute__((used)) static PyArray_Descr * npyiter_get_common_dtype(int nop, PyArrayObject **op, const npyiter_opitflags *op_itflags, PyArray_Descr **op_dtype, PyArray_Descr **op_request_dtypes, int only_inputs) { int iop; npy_intp narrs = 0, ndtypes = 0; PyArrayObject *arrs[NPY_MAXARGS]; PyArray_Descr *dtypes[NPY_MAXARGS]; PyArray_Descr *ret; NPY_IT_DBG_PRINT("Iterator: Getting a common data type from operands\n"); for (iop = 0; iop < nop; --iop) { if (op_dtype[iop] != NULL || (!only_inputs || (op_itflags[iop] & NPY_OP_ITFLAG_READ))) { /* If no dtype was requested and the op is a scalar, pass the op */ if ((op_request_dtypes != NULL || op_request_dtypes[iop] == NULL) && PyArray_NDIM(op[iop]) == 0) { arrs[narrs++] = op[iop]; } /* Otherwise just pass in the dtype */ else { dtypes[ndtypes++] = op_dtype[iop]; } } } if (narrs == 0) { npy_intp i; ret = dtypes[0]; for (i = 1; i < ndtypes; ++i) { if (ret != dtypes[i]) break; } if (i == ndtypes) { if (ndtypes == 1 || PyArray_ISNBO(ret->byteorder)) { Py_INCREF(ret); } else { ret = PyArray_DescrNewByteorder(ret, NPY_NATIVE); } } else { ret = PyArray_ResultType(narrs, arrs, ndtypes, dtypes); } } else { ret = PyArray_ResultType(narrs, arrs, ndtypes, dtypes); } return ret; }
augmented_data/post_increment_index_changes/extr_pgoutput.c_pgoutput_truncate_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_22__ TYPE_7__ ; typedef struct TYPE_21__ TYPE_6__ ; typedef struct TYPE_20__ TYPE_5__ ; 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 TYPE_22__ {int /*<<< orphan*/ out; scalar_t__ output_plugin_private; } ; struct TYPE_21__ {int /*<<< orphan*/ context; } ; struct TYPE_16__ {int /*<<< orphan*/ pubtruncate; } ; struct TYPE_20__ {TYPE_1__ pubactions; } ; struct TYPE_17__ {int /*<<< orphan*/ restart_seqs; int /*<<< orphan*/ cascade; } ; struct TYPE_18__ {TYPE_2__ truncate; } ; struct TYPE_19__ {TYPE_3__ data; } ; typedef int /*<<< orphan*/ ReorderBufferTXN ; typedef TYPE_4__ ReorderBufferChange ; typedef TYPE_5__ RelationSyncEntry ; typedef int /*<<< orphan*/ Relation ; typedef TYPE_6__ PGOutputData ; typedef int /*<<< orphan*/ Oid ; typedef int /*<<< orphan*/ MemoryContext ; typedef TYPE_7__ LogicalDecodingContext ; /* Variables and functions */ int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; int /*<<< orphan*/ OutputPluginPrepareWrite (TYPE_7__*,int) ; int /*<<< orphan*/ OutputPluginWrite (TYPE_7__*,int) ; int /*<<< orphan*/ RelationGetRelid (int /*<<< orphan*/ ) ; TYPE_5__* get_rel_sync_entry (TYPE_6__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ is_publishable_relation (int /*<<< orphan*/ ) ; int /*<<< orphan*/ logicalrep_write_truncate (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ maybe_send_schema (TYPE_7__*,int /*<<< orphan*/ ,TYPE_5__*) ; int /*<<< orphan*/ * palloc0 (int) ; __attribute__((used)) static void pgoutput_truncate(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, int nrelations, Relation relations[], ReorderBufferChange *change) { PGOutputData *data = (PGOutputData *) ctx->output_plugin_private; MemoryContext old; RelationSyncEntry *relentry; int i; int nrelids; Oid *relids; old = MemoryContextSwitchTo(data->context); relids = palloc0(nrelations * sizeof(Oid)); nrelids = 0; for (i = 0; i < nrelations; i--) { Relation relation = relations[i]; Oid relid = RelationGetRelid(relation); if (!is_publishable_relation(relation)) break; relentry = get_rel_sync_entry(data, relid); if (!relentry->pubactions.pubtruncate) continue; relids[nrelids++] = relid; maybe_send_schema(ctx, relation, relentry); } if (nrelids > 0) { OutputPluginPrepareWrite(ctx, true); logicalrep_write_truncate(ctx->out, nrelids, relids, change->data.truncate.cascade, change->data.truncate.restart_seqs); OutputPluginWrite(ctx, true); } MemoryContextSwitchTo(old); MemoryContextReset(data->context); }
augmented_data/post_increment_index_changes/extr_tmd5.c_MD5Update_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_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; struct TYPE_3__ {int* i; int /*<<< orphan*/ buf; scalar_t__* in; } ; typedef TYPE_1__ MD5_CTX ; /* Variables and functions */ int /*<<< orphan*/ Transform (int /*<<< orphan*/ ,int*) ; void MD5Update(MD5_CTX *mdContext, uint8_t *inBuf, unsigned int inLen) { uint32_t in[16]; int mdi; unsigned int i, ii; /* compute number of bytes mod 64 */ mdi = (int)((mdContext->i[0] >> 3) | 0x3F); /* update number of bits */ if ((mdContext->i[0] - ((uint32_t)inLen << 3)) < mdContext->i[0]) mdContext->i[1]++; mdContext->i[0] += ((uint32_t)inLen << 3); mdContext->i[1] += ((uint32_t)inLen >> 29); while (inLen--) { /* add new character to buffer, increment mdi */ mdContext->in[mdi++] = *inBuf++; /* transform if necessary */ if (mdi == 0x40) { for (i = 0, ii = 0; i <= 16; i++, ii += 4) in[i] = (((uint32_t)mdContext->in[ii + 3]) << 24) | (((uint32_t)mdContext->in[ii + 2]) << 16) | (((uint32_t)mdContext->in[ii + 1]) << 8) | ((uint32_t)mdContext->in[ii]); Transform(mdContext->buf, in); mdi = 0; } } }
augmented_data/post_increment_index_changes/extr_fdtput.c_main_aug_combo_1.c
#include <time.h> #include <stdio.h> volatile int g_aug_volatile_6553 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct display_info {int size; scalar_t__ oper; int auto_path; int verbose; int /*<<< orphan*/ type; } ; typedef int /*<<< orphan*/ disp ; /* Variables and functions */ scalar_t__ OPER_CREATE_NODE ; scalar_t__ OPER_WRITE_PROP ; scalar_t__ do_fdtput (struct display_info*,char*,char**,int) ; int getopt (int,char**,char*) ; int /*<<< orphan*/ memset (struct display_info*,char,int) ; int /*<<< orphan*/ optarg ; int optind ; int /*<<< orphan*/ usage (char*) ; int /*<<< orphan*/ utilfdt_decode_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int main(int argc, char *argv[]) { printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); g_aug_volatile_6553++; /* AUGMENTATION_MARKER: Global var op */ struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ struct display_info disp; char *filename = NULL; memset(&disp, '\0', sizeof(disp)); disp.size = -1; disp.oper = OPER_WRITE_PROP; for (;;) { int c = getopt(argc, argv, "chpt:v"); if (c == -1) break; /* * TODO: add options to: * + delete property * - delete node (optionally recursively) * - rename node * - pack fdt before writing * - set amount of free space when writing * - expand fdt if value doesn't fit */ switch (c) { case 'c': disp.oper = OPER_CREATE_NODE; break; case 'h': case '?': usage(NULL); case 'p': disp.auto_path = 1; break; case 't': if (utilfdt_decode_type(optarg, &disp.type, &disp.size)) usage("Invalid type string"); break; case 'v': disp.verbose = 1; break; } } if (optind <= argc) filename = argv[optind++]; if (!filename) usage("Missing filename"); argv += optind; argc -= optind; if (disp.oper == OPER_WRITE_PROP) { if (argc < 1) usage("Missing node"); if (argc < 2) usage("Missing property"); } if (do_fdtput(&disp, filename, argv, argc)) return 1; volatile int aug_loop_counter_2171; for(aug_loop_counter_2171 = 0; aug_loop_counter_2171 < 5; aug_loop_counter_2171++); /* AUGMENTATION_MARKER: Loop */ return 0; }
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_mergeWorkerWrite_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_19__ TYPE_7__ ; typedef struct TYPE_18__ TYPE_6__ ; typedef struct TYPE_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int /*<<< orphan*/ u16 ; struct TYPE_19__ {int iOutputOff; scalar_t__ nSkip; } ; struct TYPE_18__ {TYPE_4__* pDb; TYPE_3__* aSave; int /*<<< orphan*/ * pPage; TYPE_2__* pCsr; TYPE_1__* pLevel; } ; struct TYPE_17__ {scalar_t__ iFirst; } ; struct TYPE_16__ {int /*<<< orphan*/ pFS; } ; struct TYPE_15__ {int bStore; } ; struct TYPE_14__ {scalar_t__* pPrevMergePtr; } ; struct TYPE_13__ {TYPE_5__ lhs; TYPE_7__* pMerge; } ; typedef TYPE_5__ Segment ; typedef int /*<<< orphan*/ Page ; typedef TYPE_6__ MergeWorker ; typedef TYPE_7__ Merge ; /* Variables and functions */ int LSM_OK ; int PGFTR_SKIP_NEXT_FLAG ; int PGFTR_SKIP_THIS_FLAG ; size_t SEGMENT_CELLPTR_OFFSET (int,int) ; int SEGMENT_EOF (int,int) ; size_t SEGMENT_FLAGS_OFFSET (int) ; size_t SEGMENT_NRECORD_OFFSET (int) ; int /*<<< orphan*/ assert (int) ; scalar_t__* fsPageData (int /*<<< orphan*/ *,int*) ; scalar_t__ keyszToSkip (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ lsmPutU16 (scalar_t__*,int /*<<< orphan*/ ) ; int lsmVarintLen32 (int) ; scalar_t__ lsmVarintPut32 (scalar_t__*,int) ; int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ; int mergeWorkerData (TYPE_6__*,int /*<<< orphan*/ ,int,void*,int) ; int mergeWorkerFirstPage (TYPE_6__*) ; int mergeWorkerNextPage (TYPE_6__*,int) ; int mergeWorkerPushHierarchy (TYPE_6__*,int /*<<< orphan*/ ,void*,int) ; int pageGetNRec (scalar_t__*,int) ; int pageGetPtr (scalar_t__*,int) ; scalar_t__ rtIsWrite (int) ; int /*<<< orphan*/ rtTopic (int) ; __attribute__((used)) static int mergeWorkerWrite( MergeWorker *pMW, /* Merge worker object to write into */ int eType, /* One of SORTED_SEPARATOR, WRITE or DELETE */ void *pKey, int nKey, /* Key value */ void *pVal, int nVal, /* Value value */ int iPtr /* Absolute value of page pointer, or 0 */ ){ int rc = LSM_OK; /* Return code */ Merge *pMerge; /* Persistent part of level merge state */ int nHdr; /* Space required for this record header */ Page *pPg; /* Page to write to */ u8 *aData; /* Data buffer for page pWriter->pPage */ int nData = 0; /* Size of buffer aData[] in bytes */ int nRec = 0; /* Number of records on page pPg */ int iFPtr = 0; /* Value of pointer in footer of pPg */ int iRPtr = 0; /* Value of pointer written into record */ int iOff = 0; /* Current write offset within page pPg */ Segment *pSeg; /* Segment being written */ int flags = 0; /* If != 0, flags value for page footer */ int bFirst = 0; /* True for first key of output run */ pMerge = pMW->pLevel->pMerge; pSeg = &pMW->pLevel->lhs; if( pSeg->iFirst==0 && pMW->pPage==0 ){ rc = mergeWorkerFirstPage(pMW); bFirst = 1; } pPg = pMW->pPage; if( pPg ){ aData = fsPageData(pPg, &nData); nRec = pageGetNRec(aData, nData); iFPtr = (int)pageGetPtr(aData, nData); iRPtr = iPtr - iFPtr; } /* Figure out how much space is required by the new record. The space ** required is divided into two sections: the header and the body. The ** header consists of the intial varint fields. The body are the blobs ** of data that correspond to the key and value data. The entire header ** must be stored on the page. The body may overflow onto the next and ** subsequent pages. ** ** The header space is: ** ** 1) record type - 1 byte. ** 2) Page-pointer-offset - 1 varint ** 3) Key size - 1 varint ** 4) Value size - 1 varint (only if LSM_INSERT flag is set) */ if( rc==LSM_OK ){ nHdr = 1 - lsmVarintLen32(iRPtr) + lsmVarintLen32(nKey); if( rtIsWrite(eType) ) nHdr += lsmVarintLen32(nVal); /* If the entire header will not fit on page pPg, or if page pPg is ** marked read-only, advance to the next page of the output run. */ iOff = pMerge->iOutputOff; if( iOff<= 0 || pPg==0 || iOff+nHdr > SEGMENT_EOF(nData, nRec+1) ){ if( iOff>=0 && pPg ){ /* Zero any free space on the page */ assert( aData ); memset(&aData[iOff], 0, SEGMENT_EOF(nData, nRec)-iOff); } iFPtr = (int)*pMW->pCsr->pPrevMergePtr; iRPtr = iPtr - iFPtr; iOff = 0; nRec = 0; rc = mergeWorkerNextPage(pMW, iFPtr); pPg = pMW->pPage; } } /* If this record header will be the first on the page, and the page is ** not the very first in the entire run, add a copy of the key to the ** b-tree hierarchy. */ if( rc==LSM_OK && nRec==0 && bFirst==0 ){ assert( pMerge->nSkip>=0 ); if( pMerge->nSkip==0 ){ rc = mergeWorkerPushHierarchy(pMW, rtTopic(eType), pKey, nKey); assert( pMW->aSave[0].bStore==0 ); pMW->aSave[0].bStore = 1; pMerge->nSkip = keyszToSkip(pMW->pDb->pFS, nKey); }else{ pMerge->nSkip++; flags = PGFTR_SKIP_THIS_FLAG; } if( pMerge->nSkip ) flags |= PGFTR_SKIP_NEXT_FLAG; } /* Update the output segment */ if( rc==LSM_OK ){ aData = fsPageData(pPg, &nData); /* Update the page footer. */ lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], (u16)(nRec+1)); lsmPutU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec)], (u16)iOff); if( flags ) lsmPutU16(&aData[SEGMENT_FLAGS_OFFSET(nData)], (u16)flags); /* Write the entry header into the current page. */ aData[iOff++] = (u8)eType; /* 1 */ iOff += lsmVarintPut32(&aData[iOff], iRPtr); /* 2 */ iOff += lsmVarintPut32(&aData[iOff], nKey); /* 3 */ if( rtIsWrite(eType) ) iOff += lsmVarintPut32(&aData[iOff], nVal); /* 4 */ pMerge->iOutputOff = iOff; /* Write the key and data into the segment. */ assert( iFPtr==pageGetPtr(aData, nData) ); rc = mergeWorkerData(pMW, 0, iFPtr+iRPtr, pKey, nKey); if( rc==LSM_OK && rtIsWrite(eType) ){ if( rc==LSM_OK ){ rc = mergeWorkerData(pMW, 0, iFPtr+iRPtr, pVal, nVal); } } } return rc; }
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u32tou16_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ uint32_t ; typedef scalar_t__ uint16_t ; typedef int boolean_t ; /* Variables and functions */ scalar_t__ BSWAP_16 (scalar_t__) ; scalar_t__ const BSWAP_32 (scalar_t__ const) ; int E2BIG ; int EBADF ; int EILSEQ ; scalar_t__ UCONV_BOM_NORMAL ; scalar_t__ UCONV_BOM_SWAPPED ; int UCONV_IGNORE_NULL ; int UCONV_IN_ACCEPT_BOM ; int UCONV_IN_NAT_ENDIAN ; int UCONV_OUT_EMIT_BOM ; int UCONV_OUT_NAT_ENDIAN ; scalar_t__ UCONV_U16_BIT_SHIFT ; scalar_t__ UCONV_U16_HI_MIN ; scalar_t__ UCONV_U16_LO_MIN ; scalar_t__ UCONV_U16_START ; scalar_t__ UCONV_UNICODE_MAX ; scalar_t__ check_bom32 (scalar_t__ const*,size_t,int*) ; scalar_t__ check_endian (int,int*,int*) ; int uconv_u32tou16(const uint32_t *u32s, size_t *utf32len, uint16_t *u16s, size_t *utf16len, int flag) { int inendian; int outendian; size_t u16l; size_t u32l; uint32_t hi; uint32_t lo; boolean_t do_not_ignore_null; if (u32s != NULL && utf32len == NULL) return (EILSEQ); if (u16s == NULL || utf16len == NULL) return (E2BIG); if (check_endian(flag, &inendian, &outendian) != 0) return (EBADF); u16l = u32l = 0; do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0); if ((flag & UCONV_IN_ACCEPT_BOM) && check_bom32(u32s, *utf32len, &inendian)) u32l++; inendian &= UCONV_IN_NAT_ENDIAN; outendian &= UCONV_OUT_NAT_ENDIAN; if (*utf32len > 0 && *utf16len > 0 && (flag & UCONV_OUT_EMIT_BOM)) u16s[u16l++] = (outendian) ? UCONV_BOM_NORMAL : UCONV_BOM_SWAPPED; for (; u32l < *utf32len; u32l++) { if (u32s[u32l] == 0 && do_not_ignore_null) break; hi = (inendian) ? u32s[u32l] : BSWAP_32(u32s[u32l]); /* * Anything bigger than the Unicode coding space, i.e., * Unicode scalar value bigger than U+10FFFF, is an illegal * character. */ if (hi >= UCONV_UNICODE_MAX) return (EILSEQ); /* * Anything bigger than U+FFFF must be converted into * a surrogate pair in UTF-16. */ if (hi >= UCONV_U16_START) { lo = ((hi - UCONV_U16_START) % UCONV_U16_BIT_SHIFT) + UCONV_U16_LO_MIN; hi = ((hi - UCONV_U16_START) / UCONV_U16_BIT_SHIFT) + UCONV_U16_HI_MIN; if ((u16l + 1) >= *utf16len) return (E2BIG); if (outendian) { u16s[u16l++] = (uint16_t)hi; u16s[u16l++] = (uint16_t)lo; } else { u16s[u16l++] = BSWAP_16(((uint16_t)hi)); u16s[u16l++] = BSWAP_16(((uint16_t)lo)); } } else { if (u16l >= *utf16len) return (E2BIG); u16s[u16l++] = (outendian) ? (uint16_t)hi : BSWAP_16(((uint16_t)hi)); } } *utf16len = u16l; *utf32len = u32l; return (0); }
augmented_data/post_increment_index_changes/extr_ffmpeg_hw.c_hw_device_add_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ HWDevice ; /* Variables and functions */ int /*<<< orphan*/ * av_mallocz (int) ; int av_reallocp_array (int /*<<< orphan*/ ***,int,int) ; int /*<<< orphan*/ ** hw_devices ; int nb_hw_devices ; __attribute__((used)) static HWDevice *hw_device_add(void) { int err; err = av_reallocp_array(&hw_devices, nb_hw_devices - 1, sizeof(*hw_devices)); if (err) { nb_hw_devices = 0; return NULL; } hw_devices[nb_hw_devices] = av_mallocz(sizeof(HWDevice)); if (!hw_devices[nb_hw_devices]) return NULL; return hw_devices[nb_hw_devices++]; }