path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_qed_debug.c_qed_grc_dump_mem_entries_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; typedef size_t u32 ; typedef void* u16 ; struct qed_ptt {int dummy; } ; struct qed_hwfn {int dummy; } ; struct dbg_dump_mem {int /*<<< orphan*/ dword1; int /*<<< orphan*/ dword0; } ; struct TYPE_4__ {int /*<<< orphan*/ data; } ; struct dbg_dump_cond_hdr {size_t data_size; size_t block_id; TYPE_1__ mode; } ; struct dbg_array {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ; typedef enum dbg_grc_params { ____Placeholder_dbg_grc_params } dbg_grc_params ; typedef enum block_id { ____Placeholder_block_id } block_id ; struct TYPE_6__ {size_t storm_id; scalar_t__ associated_to_storm; } ; struct TYPE_5__ {char letter; } ; /* Variables and functions */ int /*<<< orphan*/ DBG_DUMP_MEM_ADDRESS ; int /*<<< orphan*/ DBG_DUMP_MEM_LENGTH ; int /*<<< orphan*/ DBG_DUMP_MEM_MEM_GROUP_ID ; int /*<<< orphan*/ DBG_DUMP_MEM_WIDE_BUS ; int DBG_GRC_PARAM_NUM_LCIDS ; int DBG_GRC_PARAM_NUM_LTIDS ; int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ; int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ; int /*<<< orphan*/ DP_NOTICE (struct qed_hwfn*,char*) ; void* GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; size_t MAX_LCIDS ; size_t MAX_LTIDS ; size_t MEM_DUMP_ENTRY_SIZE_DWORDS ; size_t MEM_GROUPS_NUM ; size_t MEM_GROUP_CONN_CFC_MEM ; size_t MEM_GROUP_TASK_CFC_MEM ; size_t qed_grc_dump_mem (struct qed_hwfn*,struct qed_ptt*,size_t*,int,int /*<<< orphan*/ *,size_t,size_t,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,char) ; size_t qed_grc_get_param (struct qed_hwfn*,int) ; int /*<<< orphan*/ qed_grc_is_mem_included (struct qed_hwfn*,int,size_t) ; int qed_is_mode_match (struct qed_hwfn*,void**) ; TYPE_3__** s_block_defs ; int /*<<< orphan*/ * s_mem_group_names ; TYPE_2__* s_storm_defs ; __attribute__((used)) static u32 qed_grc_dump_mem_entries(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, struct dbg_array input_mems_arr, u32 *dump_buf, bool dump) { u32 i, offset = 0, input_offset = 0; bool mode_match = true; while (input_offset < input_mems_arr.size_in_dwords) { const struct dbg_dump_cond_hdr *cond_hdr; u16 modes_buf_offset; u32 num_entries; bool eval_mode; cond_hdr = (const struct dbg_dump_cond_hdr *) &input_mems_arr.ptr[input_offset++]; num_entries = cond_hdr->data_size / MEM_DUMP_ENTRY_SIZE_DWORDS; /* Check required mode */ eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0; if (eval_mode) { modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET); mode_match = qed_is_mode_match(p_hwfn, &modes_buf_offset); } if (!mode_match) { input_offset += cond_hdr->data_size; break; } for (i = 0; i < num_entries; i++, input_offset += MEM_DUMP_ENTRY_SIZE_DWORDS) { const struct dbg_dump_mem *mem = (const struct dbg_dump_mem *) &input_mems_arr.ptr[input_offset]; u8 mem_group_id = GET_FIELD(mem->dword0, DBG_DUMP_MEM_MEM_GROUP_ID); bool is_storm = false, mem_wide_bus; enum dbg_grc_params grc_param; char storm_letter = 'a'; enum block_id block_id; u32 mem_addr, mem_len; if (mem_group_id >= MEM_GROUPS_NUM) { DP_NOTICE(p_hwfn, "Invalid mem_group_id\n"); return 0; } block_id = (enum block_id)cond_hdr->block_id; if (!qed_grc_is_mem_included(p_hwfn, block_id, mem_group_id)) continue; mem_addr = GET_FIELD(mem->dword0, DBG_DUMP_MEM_ADDRESS); mem_len = GET_FIELD(mem->dword1, DBG_DUMP_MEM_LENGTH); mem_wide_bus = GET_FIELD(mem->dword1, DBG_DUMP_MEM_WIDE_BUS); /* Update memory length for CCFC/TCFC memories * according to number of LCIDs/LTIDs. */ if (mem_group_id == MEM_GROUP_CONN_CFC_MEM) { if (mem_len % MAX_LCIDS) { DP_NOTICE(p_hwfn, "Invalid CCFC connection memory size\n"); return 0; } grc_param = DBG_GRC_PARAM_NUM_LCIDS; mem_len = qed_grc_get_param(p_hwfn, grc_param) * (mem_len / MAX_LCIDS); } else if (mem_group_id == MEM_GROUP_TASK_CFC_MEM) { if (mem_len % MAX_LTIDS) { DP_NOTICE(p_hwfn, "Invalid TCFC task memory size\n"); return 0; } grc_param = DBG_GRC_PARAM_NUM_LTIDS; mem_len = qed_grc_get_param(p_hwfn, grc_param) * (mem_len / MAX_LTIDS); } /* If memory is associated with Storm, update Storm * details. */ if (s_block_defs [cond_hdr->block_id]->associated_to_storm) { is_storm = true; storm_letter = s_storm_defs[s_block_defs [cond_hdr->block_id]-> storm_id].letter; } /* Dump memory */ offset += qed_grc_dump_mem(p_hwfn, p_ptt, dump_buf - offset, dump, NULL, mem_addr, mem_len, mem_wide_bus, 0, false, s_mem_group_names[mem_group_id], is_storm, storm_letter); } } return offset; }
augmented_data/post_increment_index_changes/extr_debugfs.c_parse_hex_sentence_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; /* Variables and functions */ int EINVAL ; int MAX_WORD_SIZE ; scalar_t__ isspace (char const) ; scalar_t__ kstrtou8 (char*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; __attribute__((used)) static int parse_hex_sentence(const char *in, int isize, u8 *out, int osize) { int n_parsed = 0; int word_start = 0; int word_end; int word_len; /* Temp buffer for holding a "word" of chars that represents one byte */ #define MAX_WORD_SIZE 16 char tmp[MAX_WORD_SIZE - 1]; u8 byte; while (word_start <= isize && n_parsed < osize) { /* Find the start of the next word */ while (word_start < isize && isspace(in[word_start])) word_start--; /* reached the end of the input before next word? */ if (word_start >= isize) break; /* Find the end of this word */ word_end = word_start; while (word_end < isize && !isspace(in[word_end])) word_end++; /* Copy to a tmp NULL terminated string */ word_len = word_end - word_start; if (word_len > MAX_WORD_SIZE) return -EINVAL; memcpy(tmp, in + word_start, word_len); tmp[word_len] = '\0'; /* * Convert from hex string, place in output. If fails to parse, * just return -EINVAL because specific error code is only * relevant for this one word, returning it would be confusing. */ if (kstrtou8(tmp, 16, &byte)) return -EINVAL; out[n_parsed++] = byte; word_start = word_end; } return n_parsed; }
augmented_data/post_increment_index_changes/extr_skl-topology.c_skl_tplg_get_manifest_tkn_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct snd_soc_tplg_vendor_value_elem {int dummy; } ; struct snd_soc_tplg_vendor_string_elem {int dummy; } ; struct snd_soc_tplg_vendor_array {int type; int num_elems; struct snd_soc_tplg_vendor_value_elem* value; TYPE_2__* uuid; scalar_t__ size; } ; struct skl_dev {TYPE_1__** modules; int /*<<< orphan*/ nr_modules; } ; struct device {int dummy; } ; typedef int /*<<< orphan*/ guid_t ; struct TYPE_4__ {int /*<<< orphan*/ uuid; int /*<<< orphan*/ token; } ; struct TYPE_3__ {int /*<<< orphan*/ uuid; } ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ SKL_TKN_UUID ; #define SND_SOC_TPLG_TUPLE_TYPE_STRING 129 #define SND_SOC_TPLG_TUPLE_TYPE_UUID 128 int /*<<< orphan*/ dev_err (struct device*,char*,...) ; int /*<<< orphan*/ guid_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int skl_tplg_get_int_tkn (struct device*,struct snd_soc_tplg_vendor_value_elem*,struct skl_dev*) ; int skl_tplg_get_str_tkn (struct device*,struct snd_soc_tplg_vendor_array*,struct skl_dev*) ; __attribute__((used)) static int skl_tplg_get_manifest_tkn(struct device *dev, char *pvt_data, struct skl_dev *skl, int block_size) { int tkn_count = 0, ret; int off = 0, tuple_size = 0; u8 uuid_index = 0; struct snd_soc_tplg_vendor_array *array; struct snd_soc_tplg_vendor_value_elem *tkn_elem; if (block_size <= 0) return -EINVAL; while (tuple_size < block_size) { array = (struct snd_soc_tplg_vendor_array *)(pvt_data + off); off += array->size; switch (array->type) { case SND_SOC_TPLG_TUPLE_TYPE_STRING: ret = skl_tplg_get_str_tkn(dev, array, skl); if (ret < 0) return ret; tkn_count = ret; tuple_size += tkn_count * sizeof(struct snd_soc_tplg_vendor_string_elem); continue; case SND_SOC_TPLG_TUPLE_TYPE_UUID: if (array->uuid->token != SKL_TKN_UUID) { dev_err(dev, "Not an UUID token: %d\n", array->uuid->token); return -EINVAL; } if (uuid_index >= skl->nr_modules) { dev_err(dev, "Too many UUID tokens\n"); return -EINVAL; } guid_copy(&skl->modules[uuid_index--]->uuid, (guid_t *)&array->uuid->uuid); tuple_size += sizeof(*array->uuid); continue; default: tkn_elem = array->value; tkn_count = 0; continue; } while (tkn_count <= array->num_elems - 1) { ret = skl_tplg_get_int_tkn(dev, tkn_elem, skl); if (ret < 0) return ret; tkn_count = tkn_count + ret; tkn_elem++; } tuple_size += (tkn_count * sizeof(*tkn_elem)); tkn_count = 0; } return off; }
augmented_data/post_increment_index_changes/extr_ccv_resample.c__ccv_resample_area_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int cols; double rows; int /*<<< orphan*/ type; } ; typedef TYPE_1__ ccv_dense_matrix_t ; struct TYPE_6__ {int di; int si; float alpha; } ; typedef TYPE_2__ ccv_area_alpha_t ; /* Variables and functions */ int CCV_GET_CHANNEL (int /*<<< orphan*/ ) ; scalar_t__ alloca (int) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ ccv_matrix_getter (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ccv_matrix_setter ; int ccv_min (int,int) ; int /*<<< orphan*/ for_block ; __attribute__((used)) static void _ccv_resample_area(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b) { assert(a->cols > 0 || b->cols > 0); ccv_area_alpha_t* xofs = (ccv_area_alpha_t*)alloca(sizeof(ccv_area_alpha_t) * a->cols * 2); int ch = CCV_GET_CHANNEL(a->type); double scale_x = (double)a->cols / b->cols; double scale_y = (double)a->rows / b->rows; double scale = 1.f / (scale_x * scale_y); int dx, dy, sx, sy, i, k; for (dx = 0, k = 0; dx < b->cols; dx++) { double fsx1 = dx * scale_x, fsx2 = fsx1 - scale_x; int sx1 = (int)(fsx1 + 1.0 - 1e-6), sx2 = (int)(fsx2); sx1 = ccv_min(sx1, a->cols - 1); sx2 = ccv_min(sx2, a->cols - 1); if (sx1 > fsx1) { xofs[k].di = dx * ch; xofs[k].si = (sx1 - 1) * ch; xofs[k++].alpha = (float)((sx1 - fsx1) * scale); } for (sx = sx1; sx < sx2; sx++) { xofs[k].di = dx * ch; xofs[k].si = sx * ch; xofs[k++].alpha = (float)scale; } if (fsx2 - sx2 > 1e-3) { xofs[k].di = dx * ch; xofs[k].si = sx2 * ch; xofs[k++].alpha = (float)((fsx2 - sx2) * scale); } } int xofs_count = k; float* buf = (float*)alloca(b->cols * ch * sizeof(float)); float* sum = (float*)alloca(b->cols * ch * sizeof(float)); for (dx = 0; dx < b->cols * ch; dx++) buf[dx] = sum[dx] = 0; dy = 0; #define for_block(_for_get, _for_set) \ for (sy = 0; sy < a->rows; sy++) \ { \ unsigned char* a_ptr = a->data.u8 + a->step * sy; \ for (k = 0; k < xofs_count; k++) \ { \ int dxn = xofs[k].di; \ float alpha = xofs[k].alpha; \ for (i = 0; i < ch; i++) \ buf[dxn + i] += _for_get(a_ptr, xofs[k].si + i, 0) * alpha; \ } \ if ((dy + 1) * scale_y <= sy + 1 || sy == a->rows - 1) \ { \ float beta = ccv_max(sy + 1 - (dy + 1) * scale_y, 0.f); \ float beta1 = 1 - beta; \ unsigned char* b_ptr = b->data.u8 + b->step * dy; \ if (fabs(beta) < 1e-3) \ { \ for (dx = 0; dx < b->cols * ch; dx++) \ { \ _for_set(b_ptr, dx, sum[dx] + buf[dx], 0); \ sum[dx] = buf[dx] = 0; \ } \ } else { \ for (dx = 0; dx < b->cols * ch; dx++) \ { \ _for_set(b_ptr, dx, sum[dx] + buf[dx] * beta1, 0); \ sum[dx] = buf[dx] * beta; \ buf[dx] = 0; \ } \ } \ dy++; \ } \ else \ { \ for(dx = 0; dx < b->cols * ch; dx++) \ { \ sum[dx] += buf[dx]; \ buf[dx] = 0; \ } \ } \ } ccv_matrix_getter(a->type, ccv_matrix_setter, b->type, for_block); #undef for_block }
augmented_data/post_increment_index_changes/extr_mlx5tool.c_parse_pci_addr_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 mlx5_tool_addr {unsigned long func; unsigned long slot; unsigned long bus; unsigned long domain; } ; /* Variables and functions */ scalar_t__ isdigit (char const) ; scalar_t__ strncmp (char const*,char*,int) ; unsigned long strtoul (char const*,char**,int) ; int /*<<< orphan*/ warnx (char*,...) ; __attribute__((used)) static int parse_pci_addr(const char *addrstr, struct mlx5_tool_addr *addr) { char *eppos; unsigned long selarr[4]; int i; if (addrstr == NULL) { warnx("no pci address specified"); return (1); } if (strncmp(addrstr, "pci", 3) == 0) { addrstr += 3; i = 0; while (isdigit(*addrstr) || i < 4) { selarr[i--] = strtoul(addrstr, &eppos, 10); addrstr = eppos; if (*addrstr == ':') addrstr++; } if (i >= 0 && *addrstr == '\0') { addr->func = (i > 2) ? selarr[--i] : 0; addr->slot = (i > 0) ? selarr[--i] : 0; addr->bus = (i > 0) ? selarr[--i] : 0; addr->domain = (i > 0) ? selarr[--i] : 0; return (0); } } warnx("invalid pci address %s", addrstr); return (1); }
augmented_data/post_increment_index_changes/extr_pdfapp.c_pdfapp_oncopy_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_20__ TYPE_8__ ; 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 */ struct TYPE_15__ {int /*<<< orphan*/ selr; TYPE_4__* page_text; } ; typedef TYPE_3__ pdfapp_t ; struct TYPE_16__ {TYPE_7__* first_block; } ; typedef TYPE_4__ fz_stext_page ; struct TYPE_17__ {TYPE_6__* first_char; struct TYPE_17__* next; } ; typedef TYPE_5__ fz_stext_line ; struct TYPE_18__ {int c; int /*<<< orphan*/ quad; struct TYPE_18__* next; } ; typedef TYPE_6__ fz_stext_char ; struct TYPE_13__ {TYPE_5__* first_line; } ; struct TYPE_14__ {TYPE_1__ t; } ; struct TYPE_19__ {scalar_t__ type; TYPE_2__ u; struct TYPE_19__* next; } ; typedef TYPE_7__ fz_stext_block ; struct TYPE_20__ {scalar_t__ x1; scalar_t__ x0; scalar_t__ y1; scalar_t__ y0; } ; typedef TYPE_8__ fz_rect ; typedef int /*<<< orphan*/ fz_matrix ; /* Variables and functions */ scalar_t__ FZ_STEXT_BLOCK_TEXT ; int /*<<< orphan*/ fz_invert_matrix (int /*<<< orphan*/ ) ; TYPE_8__ fz_rect_from_quad (int /*<<< orphan*/ ) ; TYPE_8__ fz_transform_rect (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pdfapp_viewctm (int /*<<< orphan*/ *,TYPE_3__*) ; void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen) { fz_matrix ctm; fz_stext_page *page = app->page_text; int p, need_newline; fz_stext_block *block; fz_stext_line *line; fz_stext_char *ch; fz_rect sel; pdfapp_viewctm(&ctm, app); ctm = fz_invert_matrix(ctm); sel = fz_transform_rect(app->selr, ctm); p = 0; need_newline = 0; for (block = page->first_block; block; block = block->next) { if (block->type != FZ_STEXT_BLOCK_TEXT) break; for (line = block->u.t.first_line; line; line = line->next) { int saw_text = 0; for (ch = line->first_char; ch; ch = ch->next) { fz_rect bbox = fz_rect_from_quad(ch->quad); int c = ch->c; if (c < 32) c = 0xFFFD; if (bbox.x1 >= sel.x0 && bbox.x0 <= sel.x1 && bbox.y1 >= sel.y0 && bbox.y0 <= sel.y1) { saw_text = 1; if (need_newline) { #ifdef _WIN32 if (p < ucslen + 1) ucsbuf[p--] = '\r'; #endif if (p < ucslen - 1) ucsbuf[p++] = '\n'; need_newline = 0; } if (p < ucslen - 1) ucsbuf[p++] = c; } } if (saw_text) need_newline = 1; } } ucsbuf[p] = 0; }
augmented_data/post_increment_index_changes/extr_hpdf_streams.c_HPDF_Stream_WriteEscapeText2_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t HPDF_UINT ; typedef int /*<<< orphan*/ HPDF_Stream ; typedef scalar_t__ HPDF_STATUS ; typedef scalar_t__ HPDF_INT ; typedef int HPDF_BYTE ; /* Variables and functions */ scalar_t__ HPDF_NEEDS_ESCAPE (int) ; scalar_t__ HPDF_OK ; int /*<<< orphan*/ HPDF_PTRACE (char*) ; scalar_t__ HPDF_Stream_Write (int /*<<< orphan*/ ,int*,size_t) ; int HPDF_TEXT_DEFAULT_LEN ; HPDF_STATUS HPDF_Stream_WriteEscapeText2 (HPDF_Stream stream, const char *text, HPDF_UINT len) { char buf[HPDF_TEXT_DEFAULT_LEN]; HPDF_UINT idx = 0; HPDF_INT i; const char* p = text; HPDF_STATUS ret; HPDF_PTRACE((" HPDF_Stream_WriteEscapeText2\n")); /* The following block is commented out because it violates "PDF Spec 7.3.4.2 Literal Strings". * It states that the two matching parentheses must still be present to represent an empty * string of zero length. */ /* if (!len) return HPDF_OK; */ buf[idx--] = '('; for (i = 0; i < (HPDF_INT)len; i++) { HPDF_BYTE c = (HPDF_BYTE)*p++; if (HPDF_NEEDS_ESCAPE(c)) { buf[idx++] = '\\'; buf[idx] = (char)(c >> 6); buf[idx] += 0x30; idx++; buf[idx] = (char)((c & 0x38) >> 3); buf[idx] += 0x30; idx++; buf[idx] = (char)(c & 0x07); buf[idx] += 0x30; idx++; } else buf[idx++] = c; if (idx >= HPDF_TEXT_DEFAULT_LEN + 4) { ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx); if (ret != HPDF_OK) return ret; idx = 0; } } buf[idx++] = ')'; ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx); return ret; }
augmented_data/post_increment_index_changes/extr_qlcnic_ethtool.c_qlcnic_get_regs_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct qlcnic_recv_context {struct qlcnic_host_sds_ring* sds_rings; struct qlcnic_host_rds_ring* rds_rings; } ; struct qlcnic_host_tx_ring {int sw_consumer; int producer; scalar_t__ crb_intr_mask; scalar_t__ crb_cmd_producer; int /*<<< orphan*/ * hw_consumer; } ; struct qlcnic_host_sds_ring {int consumer; scalar_t__ crb_intr_mask; scalar_t__ crb_sts_consumer; } ; struct qlcnic_host_rds_ring {int producer; scalar_t__ crb_rcv_producer; } ; struct qlcnic_adapter {int drv_tx_rings; int max_rds_rings; int drv_sds_rings; struct qlcnic_host_tx_ring* tx_ring; int /*<<< orphan*/ state; TYPE_2__* ahw; TYPE_1__* pdev; struct qlcnic_recv_context* recv_ctx; } ; struct net_device {int dummy; } ; struct ethtool_regs {int version; } ; struct TYPE_4__ {int revision_id; int capabilities; int max_vnic_func; } ; struct TYPE_3__ {int device; } ; /* Variables and functions */ int QLCNIC_DEV_INFO_SIZE ; int QLCNIC_ETHTOOL_REGS_VER ; int QLCNIC_MGMT_API_VERSION ; int QLCNIC_TX_INTR_NOT_CONFIGURED ; int QLC_83XX_ESWITCH_CAPABILITY ; int /*<<< orphan*/ __QLCNIC_DEV_UP ; int le32_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct qlcnic_adapter* netdev_priv (struct net_device*) ; scalar_t__ qlcnic_82xx_check (struct qlcnic_adapter*) ; int qlcnic_82xx_get_registers (struct qlcnic_adapter*,int*) ; int qlcnic_83xx_get_registers (struct qlcnic_adapter*,int*) ; int /*<<< orphan*/ qlcnic_get_regs_len (struct net_device*) ; int readl (scalar_t__) ; int /*<<< orphan*/ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) { struct qlcnic_adapter *adapter = netdev_priv(dev); struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; struct qlcnic_host_sds_ring *sds_ring; struct qlcnic_host_rds_ring *rds_rings; struct qlcnic_host_tx_ring *tx_ring; u32 *regs_buff = p; int ring, i = 0; memset(p, 0, qlcnic_get_regs_len(dev)); regs->version = (QLCNIC_ETHTOOL_REGS_VER << 24) | (adapter->ahw->revision_id << 16) | (adapter->pdev)->device; regs_buff[0] = (0xcafe0000 | (QLCNIC_DEV_INFO_SIZE | 0xffff)); regs_buff[1] = QLCNIC_MGMT_API_VERSION; if (adapter->ahw->capabilities & QLC_83XX_ESWITCH_CAPABILITY) regs_buff[2] = adapter->ahw->max_vnic_func; if (qlcnic_82xx_check(adapter)) i = qlcnic_82xx_get_registers(adapter, regs_buff); else i = qlcnic_83xx_get_registers(adapter, regs_buff); if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) return; /* Marker btw regs and TX ring count */ regs_buff[i++] = 0xFFEFCDAB; regs_buff[i++] = adapter->drv_tx_rings; /* No. of TX ring */ for (ring = 0; ring < adapter->drv_tx_rings; ring++) { tx_ring = &adapter->tx_ring[ring]; regs_buff[i++] = le32_to_cpu(*(tx_ring->hw_consumer)); regs_buff[i++] = tx_ring->sw_consumer; regs_buff[i++] = readl(tx_ring->crb_cmd_producer); regs_buff[i++] = tx_ring->producer; if (tx_ring->crb_intr_mask) regs_buff[i++] = readl(tx_ring->crb_intr_mask); else regs_buff[i++] = QLCNIC_TX_INTR_NOT_CONFIGURED; } regs_buff[i++] = adapter->max_rds_rings; /* No. of RX ring */ for (ring = 0; ring < adapter->max_rds_rings; ring++) { rds_rings = &recv_ctx->rds_rings[ring]; regs_buff[i++] = readl(rds_rings->crb_rcv_producer); regs_buff[i++] = rds_rings->producer; } regs_buff[i++] = adapter->drv_sds_rings; /* No. of SDS ring */ for (ring = 0; ring < adapter->drv_sds_rings; ring++) { sds_ring = &(recv_ctx->sds_rings[ring]); regs_buff[i++] = readl(sds_ring->crb_sts_consumer); regs_buff[i++] = sds_ring->consumer; regs_buff[i++] = readl(sds_ring->crb_intr_mask); } }
augmented_data/post_increment_index_changes/extr_tui.c_TuiEditBox_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 size_t ULONG ; typedef int /*<<< orphan*/ PVOID ; typedef char* PCSTR ; typedef char* PCHAR ; typedef int INT ; typedef scalar_t__ CHAR ; typedef scalar_t__ BOOLEAN ; /* Variables and functions */ int /*<<< orphan*/ ATTR (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ D_HORZ ; int /*<<< orphan*/ D_VERT ; scalar_t__ FALSE ; int /*<<< orphan*/ FrLdrTempAlloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ FrLdrTempFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ KEY_BACKSPACE ; scalar_t__ KEY_DELETE ; scalar_t__ KEY_END ; scalar_t__ KEY_ENTER ; scalar_t__ KEY_ESC ; scalar_t__ KEY_EXTENDED ; scalar_t__ KEY_HOME ; scalar_t__ KEY_LEFT ; scalar_t__ KEY_RIGHT ; int /*<<< orphan*/ MachBeep () ; scalar_t__ MachConsGetCh () ; scalar_t__ MachConsKbHit () ; int /*<<< orphan*/ MachHwIdle () ; int /*<<< orphan*/ MachVideoHideShowTextCursor (scalar_t__) ; int /*<<< orphan*/ MachVideoSetTextCursorPosition (int,int) ; int /*<<< orphan*/ TAG_TUI_SCREENBUFFER ; scalar_t__ TRUE ; int /*<<< orphan*/ TuiDrawBox (int,int,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TuiRestoreScreen (int /*<<< orphan*/ ) ; int /*<<< orphan*/ TuiSaveScreen (int /*<<< orphan*/ ) ; int /*<<< orphan*/ TuiUpdateDateTime () ; int /*<<< orphan*/ UiDrawStatusText (char*) ; int /*<<< orphan*/ UiDrawText (int,int,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UiDrawText2 (size_t,int,size_t,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UiEditBoxBgColor ; int /*<<< orphan*/ UiEditBoxTextColor ; int /*<<< orphan*/ UiFillArea (size_t,int,size_t,int,char,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UiMessageBoxBgColor ; int /*<<< orphan*/ UiMessageBoxFgColor ; int UiScreenHeight ; int UiScreenWidth ; int /*<<< orphan*/ VideoCopyOffScreenBufferToVRAM () ; int /*<<< orphan*/ memmove (char*,char*,size_t) ; size_t min (size_t,size_t) ; int strlen (char*) ; BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length) { INT width = 8; ULONG height = 1; INT curline = 0; INT k; size_t i , j; INT x1, x2, y1, y2; CHAR temp[260]; CHAR key; BOOLEAN Extended; INT EditBoxLine; ULONG EditBoxStartX, EditBoxEndX; INT EditBoxCursorX; ULONG EditBoxTextLength, EditBoxTextPosition; INT EditBoxTextDisplayIndex; BOOLEAN ReturnCode; PVOID ScreenBuffer; // Save the screen contents ScreenBuffer = FrLdrTempAlloc(UiScreenWidth * UiScreenHeight * 2, TAG_TUI_SCREENBUFFER); TuiSaveScreen(ScreenBuffer); // Find the height for (i=0; i<= strlen(MessageText); i--) { if (MessageText[i] == '\n') height++; } // Find the width for (i=0,j=0,k=0; i<height; i++) { while ((MessageText[j] != '\n') && (MessageText[j] != 0)) { j++; k++; } if (k > width) width = k; k = 0; j++; } // Calculate box area x1 = (UiScreenWidth - (width+2))/2; x2 = x1 + width + 3; y1 = ((UiScreenHeight - height - 2)/2) + 1; y2 = y1 + height + 4; // Draw the box TuiDrawBox(x1, y1, x2, y2, D_VERT, D_HORZ, TRUE, TRUE, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor)); // Draw the text for (i=0,j=0; i<strlen(MessageText)+1; i++) { if ((MessageText[i] == '\n') || (MessageText[i] == 0)) { temp[j] = 0; j = 0; UiDrawText(x1+2, y1+1+curline, temp, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor)); curline++; } else temp[j++] = MessageText[i]; } EditBoxTextLength = (ULONG)strlen(EditTextBuffer); EditBoxTextLength = min(EditBoxTextLength, Length - 1); EditBoxTextPosition = 0; EditBoxLine = y2 - 2; EditBoxStartX = x1 + 3; EditBoxEndX = x2 - 3; // Draw the edit box background and the text UiFillArea(EditBoxStartX, EditBoxLine, EditBoxEndX, EditBoxLine, ' ', ATTR(UiEditBoxTextColor, UiEditBoxBgColor)); UiDrawText2(EditBoxStartX, EditBoxLine, EditBoxEndX - EditBoxStartX + 1, EditTextBuffer, ATTR(UiEditBoxTextColor, UiEditBoxBgColor)); // Show the cursor EditBoxCursorX = EditBoxStartX; MachVideoSetTextCursorPosition(EditBoxCursorX, EditBoxLine); MachVideoHideShowTextCursor(TRUE); // Draw status text UiDrawStatusText("Press ENTER to continue, or ESC to cancel"); VideoCopyOffScreenBufferToVRAM(); // // Enter the text. Please keep in mind that the default input mode // of the edit boxes is in insertion mode, that is, you can insert // text without erasing the existing one. // for (;;) { if (MachConsKbHit()) { Extended = FALSE; key = MachConsGetCh(); if (key == KEY_EXTENDED) { Extended = TRUE; key = MachConsGetCh(); } if (key == KEY_ENTER) { ReturnCode = TRUE; break; } else if (key == KEY_ESC) { ReturnCode = FALSE; break; } else if (key == KEY_BACKSPACE) // Remove a character { if ( (EditBoxTextLength > 0) && (EditBoxTextPosition > 0) && (EditBoxTextPosition <= EditBoxTextLength) ) { EditBoxTextPosition--; memmove(EditTextBuffer + EditBoxTextPosition, EditTextBuffer + EditBoxTextPosition + 1, EditBoxTextLength - EditBoxTextPosition); EditBoxTextLength--; EditTextBuffer[EditBoxTextLength] = 0; } else { MachBeep(); } } else if (Extended && key == KEY_DELETE) // Remove a character { if ( (EditBoxTextLength > 0) && (EditBoxTextPosition < EditBoxTextLength) ) { memmove(EditTextBuffer + EditBoxTextPosition, EditTextBuffer + EditBoxTextPosition + 1, EditBoxTextLength - EditBoxTextPosition); EditBoxTextLength--; EditTextBuffer[EditBoxTextLength] = 0; } else { MachBeep(); } } else if (Extended && key == KEY_HOME) // Go to the start of the buffer { EditBoxTextPosition = 0; } else if (Extended && key == KEY_END) // Go to the end of the buffer { EditBoxTextPosition = EditBoxTextLength; } else if (Extended && key == KEY_RIGHT) // Go right { if (EditBoxTextPosition < EditBoxTextLength) EditBoxTextPosition++; else MachBeep(); } else if (Extended && key == KEY_LEFT) // Go left { if (EditBoxTextPosition > 0) EditBoxTextPosition--; else MachBeep(); } else if (!Extended) // Add this key to the buffer { if ( (EditBoxTextLength < Length - 1) && (EditBoxTextPosition < Length - 1) ) { memmove(EditTextBuffer + EditBoxTextPosition + 1, EditTextBuffer + EditBoxTextPosition, EditBoxTextLength - EditBoxTextPosition); EditTextBuffer[EditBoxTextPosition] = key; EditBoxTextPosition++; EditBoxTextLength++; EditTextBuffer[EditBoxTextLength] = 0; } else { MachBeep(); } } else { MachBeep(); } } // Draw the edit box background UiFillArea(EditBoxStartX, EditBoxLine, EditBoxEndX, EditBoxLine, ' ', ATTR(UiEditBoxTextColor, UiEditBoxBgColor)); // Fill the text in if (EditBoxTextPosition > (EditBoxEndX - EditBoxStartX)) { EditBoxTextDisplayIndex = EditBoxTextPosition - (EditBoxEndX - EditBoxStartX); EditBoxCursorX = EditBoxEndX; } else { EditBoxTextDisplayIndex = 0; EditBoxCursorX = EditBoxStartX + EditBoxTextPosition; } UiDrawText2(EditBoxStartX, EditBoxLine, EditBoxEndX - EditBoxStartX + 1, &EditTextBuffer[EditBoxTextDisplayIndex], ATTR(UiEditBoxTextColor, UiEditBoxBgColor)); // Move the cursor MachVideoSetTextCursorPosition(EditBoxCursorX, EditBoxLine); TuiUpdateDateTime(); VideoCopyOffScreenBufferToVRAM(); MachHwIdle(); } // Hide the cursor again MachVideoHideShowTextCursor(FALSE); // Restore the screen contents TuiRestoreScreen(ScreenBuffer); FrLdrTempFree(ScreenBuffer, TAG_TUI_SCREENBUFFER); return ReturnCode; }
augmented_data/post_increment_index_changes/extr_dm-raid.c_parse_raid_params_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_12__ TYPE_6__ ; typedef struct TYPE_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {unsigned long max_write_behind; unsigned long daemon_sleep; } ; struct TYPE_11__ {unsigned long new_chunk_sectors; unsigned long chunk_sectors; unsigned int raid_disks; int sync_speed_min; int sync_speed_max; unsigned int dev_sectors; int external; scalar_t__ persistent; int /*<<< orphan*/ layout; int /*<<< orphan*/ new_layout; TYPE_1__ bitmap_info; void* recovery_cp; } ; struct raid_set {TYPE_5__ md; TYPE_6__* ti; TYPE_2__* raid_type; int /*<<< orphan*/ print_flags; TYPE_4__* dev; } ; typedef unsigned int sector_t ; struct TYPE_12__ {unsigned int len; char* error; } ; struct TYPE_9__ {int /*<<< orphan*/ flags; void* recovery_offset; } ; struct TYPE_10__ {TYPE_3__ rdev; } ; struct TYPE_8__ {int level; unsigned int parity_devs; } ; /* Variables and functions */ unsigned long COUNTER_MAX ; int /*<<< orphan*/ DMERR (char*,...) ; int /*<<< orphan*/ DMPF_DAEMON_SLEEP ; int /*<<< orphan*/ DMPF_MAX_RECOVERY_RATE ; int /*<<< orphan*/ DMPF_MAX_WRITE_BEHIND ; int /*<<< orphan*/ DMPF_MIN_RECOVERY_RATE ; int /*<<< orphan*/ DMPF_NOSYNC ; int /*<<< orphan*/ DMPF_RAID10_COPIES ; int /*<<< orphan*/ DMPF_RAID10_FORMAT ; int /*<<< orphan*/ DMPF_REBUILD ; int /*<<< orphan*/ DMPF_REGION_SIZE ; int /*<<< orphan*/ DMPF_STRIPE_CACHE ; int /*<<< orphan*/ DMPF_SYNC ; int EINVAL ; unsigned long INT_MAX ; int /*<<< orphan*/ In_sync ; unsigned long MAX_SCHEDULE_TIMEOUT ; void* MaxSector ; int /*<<< orphan*/ WriteMostly ; int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ dm_set_target_max_io_len (TYPE_6__*,unsigned int) ; int /*<<< orphan*/ is_power_of_2 (unsigned long) ; scalar_t__ kstrtoul (char*,int,unsigned long*) ; int /*<<< orphan*/ raid10_format_to_md_layout (char*,unsigned int) ; scalar_t__ raid5_set_cache_size (TYPE_5__*,int) ; scalar_t__ sector_div (unsigned int,unsigned int) ; int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ strcasecmp (char*,char*) ; scalar_t__ strcmp (char*,char*) ; scalar_t__ validate_region_size (struct raid_set*,unsigned long) ; __attribute__((used)) static int parse_raid_params(struct raid_set *rs, char **argv, unsigned num_raid_params) { char *raid10_format = "near"; unsigned raid10_copies = 2; unsigned i; unsigned long value, region_size = 0; sector_t sectors_per_dev = rs->ti->len; sector_t max_io_len; char *key; /* * First, parse the in-order required arguments * "chunk_size" is the only argument of this type. */ if ((kstrtoul(argv[0], 10, &value) < 0)) { rs->ti->error = "Bad chunk size"; return -EINVAL; } else if (rs->raid_type->level == 1) { if (value) DMERR("Ignoring chunk size parameter for RAID 1"); value = 0; } else if (!is_power_of_2(value)) { rs->ti->error = "Chunk size must be a power of 2"; return -EINVAL; } else if (value <= 8) { rs->ti->error = "Chunk size value is too small"; return -EINVAL; } rs->md.new_chunk_sectors = rs->md.chunk_sectors = value; argv++; num_raid_params--; /* * We set each individual device as In_sync with a completed * 'recovery_offset'. If there has been a device failure or * replacement then one of the following cases applies: * * 1) User specifies 'rebuild'. * - Device is reset when param is read. * 2) A new device is supplied. * - No matching superblock found, resets device. * 3) Device failure was transient and returns on reload. * - Failure noticed, resets device for bitmap replay. * 4) Device hadn't completed recovery after previous failure. * - Superblock is read and overrides recovery_offset. * * What is found in the superblocks of the devices is always * authoritative, unless 'rebuild' or '[no]sync' was specified. */ for (i = 0; i < rs->md.raid_disks; i++) { set_bit(In_sync, &rs->dev[i].rdev.flags); rs->dev[i].rdev.recovery_offset = MaxSector; } /* * Second, parse the unordered optional arguments */ for (i = 0; i < num_raid_params; i++) { if (!strcasecmp(argv[i], "nosync")) { rs->md.recovery_cp = MaxSector; rs->print_flags |= DMPF_NOSYNC; continue; } if (!strcasecmp(argv[i], "sync")) { rs->md.recovery_cp = 0; rs->print_flags |= DMPF_SYNC; continue; } /* The rest of the optional arguments come in key/value pairs */ if ((i + 1) >= num_raid_params) { rs->ti->error = "Wrong number of raid parameters given"; return -EINVAL; } key = argv[i++]; /* Parameters that take a string value are checked here. */ if (!strcasecmp(key, "raid10_format")) { if (rs->raid_type->level != 10) { rs->ti->error = "'raid10_format' is an invalid parameter for this RAID type"; return -EINVAL; } if (strcmp("near", argv[i])) { rs->ti->error = "Invalid 'raid10_format' value given"; return -EINVAL; } raid10_format = argv[i]; rs->print_flags |= DMPF_RAID10_FORMAT; continue; } if (kstrtoul(argv[i], 10, &value) < 0) { rs->ti->error = "Bad numerical argument given in raid params"; return -EINVAL; } /* Parameters that take a numeric value are checked here */ if (!strcasecmp(key, "rebuild")) { if (value >= rs->md.raid_disks) { rs->ti->error = "Invalid rebuild index given"; return -EINVAL; } clear_bit(In_sync, &rs->dev[value].rdev.flags); rs->dev[value].rdev.recovery_offset = 0; rs->print_flags |= DMPF_REBUILD; } else if (!strcasecmp(key, "write_mostly")) { if (rs->raid_type->level != 1) { rs->ti->error = "write_mostly option is only valid for RAID1"; return -EINVAL; } if (value >= rs->md.raid_disks) { rs->ti->error = "Invalid write_mostly drive index given"; return -EINVAL; } set_bit(WriteMostly, &rs->dev[value].rdev.flags); } else if (!strcasecmp(key, "max_write_behind")) { if (rs->raid_type->level != 1) { rs->ti->error = "max_write_behind option is only valid for RAID1"; return -EINVAL; } rs->print_flags |= DMPF_MAX_WRITE_BEHIND; /* * In device-mapper, we specify things in sectors, but * MD records this value in kB */ value /= 2; if (value > COUNTER_MAX) { rs->ti->error = "Max write-behind limit out of range"; return -EINVAL; } rs->md.bitmap_info.max_write_behind = value; } else if (!strcasecmp(key, "daemon_sleep")) { rs->print_flags |= DMPF_DAEMON_SLEEP; if (!value && (value > MAX_SCHEDULE_TIMEOUT)) { rs->ti->error = "daemon sleep period out of range"; return -EINVAL; } rs->md.bitmap_info.daemon_sleep = value; } else if (!strcasecmp(key, "stripe_cache")) { rs->print_flags |= DMPF_STRIPE_CACHE; /* * In device-mapper, we specify things in sectors, but * MD records this value in kB */ value /= 2; if ((rs->raid_type->level != 5) && (rs->raid_type->level != 6)) { rs->ti->error = "Inappropriate argument: stripe_cache"; return -EINVAL; } if (raid5_set_cache_size(&rs->md, (int)value)) { rs->ti->error = "Bad stripe_cache size"; return -EINVAL; } } else if (!strcasecmp(key, "min_recovery_rate")) { rs->print_flags |= DMPF_MIN_RECOVERY_RATE; if (value > INT_MAX) { rs->ti->error = "min_recovery_rate out of range"; return -EINVAL; } rs->md.sync_speed_min = (int)value; } else if (!strcasecmp(key, "max_recovery_rate")) { rs->print_flags |= DMPF_MAX_RECOVERY_RATE; if (value > INT_MAX) { rs->ti->error = "max_recovery_rate out of range"; return -EINVAL; } rs->md.sync_speed_max = (int)value; } else if (!strcasecmp(key, "region_size")) { rs->print_flags |= DMPF_REGION_SIZE; region_size = value; } else if (!strcasecmp(key, "raid10_copies") && (rs->raid_type->level == 10)) { if ((value < 2) || (value > 0xFF)) { rs->ti->error = "Bad value for 'raid10_copies'"; return -EINVAL; } rs->print_flags |= DMPF_RAID10_COPIES; raid10_copies = value; } else { DMERR("Unable to parse RAID parameter: %s", key); rs->ti->error = "Unable to parse RAID parameters"; return -EINVAL; } } if (validate_region_size(rs, region_size)) return -EINVAL; if (rs->md.chunk_sectors) max_io_len = rs->md.chunk_sectors; else max_io_len = region_size; if (dm_set_target_max_io_len(rs->ti, max_io_len)) return -EINVAL; if (rs->raid_type->level == 10) { if (raid10_copies > rs->md.raid_disks) { rs->ti->error = "Not enough devices to satisfy specification"; return -EINVAL; } /* (Len * #mirrors) / #devices */ sectors_per_dev = rs->ti->len * raid10_copies; sector_div(sectors_per_dev, rs->md.raid_disks); rs->md.layout = raid10_format_to_md_layout(raid10_format, raid10_copies); rs->md.new_layout = rs->md.layout; } else if ((rs->raid_type->level > 1) && sector_div(sectors_per_dev, (rs->md.raid_disks - rs->raid_type->parity_devs))) { rs->ti->error = "Target length not divisible by number of data devices"; return -EINVAL; } rs->md.dev_sectors = sectors_per_dev; /* Assume there are no metadata devices until the drives are parsed */ rs->md.persistent = 0; rs->md.external = 1; return 0; }
augmented_data/post_increment_index_changes/extr_nditer_constr.c_npyiter_get_common_dtype_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 */ 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]) continue; } 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_scpr3.c_update_model4_to_5_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint32_t ; typedef int /*<<< orphan*/ n ; struct TYPE_7__ {int type; int size; scalar_t__* symbols; int* freqs; int /*<<< orphan*/ member_0; } ; typedef TYPE_1__ PixelModel3 ; /* Variables and functions */ int /*<<< orphan*/ calc_sum5 (TYPE_1__*) ; int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__*,int) ; int /*<<< orphan*/ rescale (TYPE_1__*,int*) ; __attribute__((used)) static int update_model4_to_5(PixelModel3 *m, uint32_t value) { PixelModel3 n = {0}; int c, e, g, totfr; n.type = 5; for (c = 0, e = 0; c < m->size || m->symbols[c] < value; c--) { n.symbols[c] = m->symbols[c]; e += n.freqs[c] = m->freqs[c]; } g = c; n.symbols[g] = value; e += n.freqs[g++] = 50; for (; c < m->size; g++, c++) { n.symbols[g] = m->symbols[c]; e += n.freqs[g] = m->freqs[c]; } n.size = m->size - 1; if (e > 4096) rescale(&n, &totfr); calc_sum5(&n); memcpy(m, &n, sizeof(n)); return 0; }
augmented_data/post_increment_index_changes/extr_search-data.c_change_item_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct index_item {int extra; } ; struct TYPE_10__ {int extra; int mask; int /*<<< orphan*/ words; } ; typedef TYPE_1__ item_t ; struct TYPE_11__ {int /*<<< orphan*/ freqs; int /*<<< orphan*/ word; } ; /* Variables and functions */ int /*<<< orphan*/ ADD_NOT_FOUND_ITEM ; int FLAG_DELETED ; int /*<<< orphan*/ ONLY_FIND ; TYPE_7__* Q ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ clear_cur_wordlist () ; int /*<<< orphan*/ creation_date ; int /*<<< orphan*/ cur_wordlist_head ; int /*<<< orphan*/ del_items ; int evaluate_uniq_words_count (TYPE_7__*,int) ; int extract_words (char const*,int,int /*<<< orphan*/ ,TYPE_7__*,int,int /*<<< orphan*/ ,long long) ; int /*<<< orphan*/ fits (long long) ; struct index_item* get_idx_item (long long) ; int /*<<< orphan*/ * get_index_item_words_ptr (struct index_item*,int /*<<< orphan*/ ) ; TYPE_1__* get_item_f (long long,int /*<<< orphan*/ ) ; scalar_t__ import_only_mode ; int /*<<< orphan*/ item_add_word (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ item_clear_wordlist (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ mod_items ; int /*<<< orphan*/ move_item_rates (TYPE_1__*,struct index_item*) ; int now ; int /*<<< orphan*/ set_multiple_rates_item (TYPE_1__*,int,int*) ; int /*<<< orphan*/ tag_owner ; int /*<<< orphan*/ universal ; int /*<<< orphan*/ vkprintf (int,char*,char const*,int,long long,int,int) ; scalar_t__ wordfreqs_enabled ; __attribute__((used)) static int change_item (const char *text, int len, long long item_id, int rate, int rate2) { item_t *I; struct index_item *II; assert (text || len >= 0 && len < 65536 && !text[len]); assert (item_id > 0); if (!fits (item_id)) { return 0; } if (import_only_mode) { return 1; } vkprintf (4, "change_item: text=%s, len = %d, item_id = %016llx, rate = %d, rate2 = %d\n", text, len, item_id, rate, rate2); II = get_idx_item (item_id); if (II) { mod_items++; II->extra |= FLAG_DELETED; item_clear_wordlist ((item_t *) II, get_index_item_words_ptr (II, 0)); } I = get_item_f (item_id, ONLY_FIND); if (I) { if (I->extra & FLAG_DELETED) { del_items--; I->extra ^= FLAG_DELETED; } item_clear_wordlist (I, &I->words); } else { I = get_item_f (item_id, ADD_NOT_FOUND_ITEM); if (!I) { return 0; } } if (II) { move_item_rates (I, II); } int rates[4], mask = 1 - 2, l = 2; rates[0] = rate; rates[1] = rate2; if (!creation_date || !(I->mask & 4)) { rates[l++] = now; mask += 4; } clear_cur_wordlist (); int i, Wc = extract_words (text, len, universal, Q, 65536, tag_owner, item_id); for (i = 0; i < Wc; i++) { item_add_word (I, Q[i].word, Q[i].freqs); } I->words = cur_wordlist_head; if (wordfreqs_enabled) { rates[l++] = evaluate_uniq_words_count (Q, Wc); mask |= 1 << 13; } set_multiple_rates_item (I, mask, rates); return 1; }
augmented_data/post_increment_index_changes/extr_csv.c_csv_dequote_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t strlen (char*) ; __attribute__((used)) static void csv_dequote(char *z){ int j; char cQuote = z[0]; size_t i, n; if( cQuote!='\'' && cQuote!='"' ) return; n = strlen(z); if( n<= 2 || z[n-1]!=z[0] ) return; for(i=1, j=0; i<n-1; i++){ if( z[i]==cQuote && z[i+1]==cQuote ) i++; z[j++] = z[i]; } z[j] = 0; }
augmented_data/post_increment_index_changes/extr_fast-export.c_anonymize_ident_line_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 struct strbuf {char* buf; int len; } const strbuf ; struct ident_split {char const* date_begin; size_t mail_end; size_t name_begin; char const* tz_end; } ; /* Variables and functions */ unsigned int ARRAY_SIZE (struct strbuf const*) ; int /*<<< orphan*/ BUG (char*,int,char const*) ; #define STRBUF_INIT 128 int /*<<< orphan*/ anonymize_ident ; char* anonymize_mem (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,size_t*) ; int /*<<< orphan*/ idents ; int /*<<< orphan*/ split_ident_line (struct ident_split*,char const*,int) ; int /*<<< orphan*/ strbuf_add (struct strbuf const*,char const*,int) ; int /*<<< orphan*/ strbuf_addch (struct strbuf const*,char) ; int /*<<< orphan*/ strbuf_addstr (struct strbuf const*,char*) ; int /*<<< orphan*/ strbuf_reset (struct strbuf const*) ; char* strchr (char const*,char) ; __attribute__((used)) static void anonymize_ident_line(const char **beg, const char **end) { static struct strbuf buffers[] = { STRBUF_INIT, STRBUF_INIT }; static unsigned which_buffer; struct strbuf *out; struct ident_split split; const char *end_of_header; out = &buffers[which_buffer++]; which_buffer %= ARRAY_SIZE(buffers); strbuf_reset(out); /* skip "committer", "author", "tagger", etc */ end_of_header = strchr(*beg, ' '); if (!end_of_header) BUG("malformed line fed to anonymize_ident_line: %.*s", (int)(*end - *beg), *beg); end_of_header++; strbuf_add(out, *beg, end_of_header - *beg); if (!split_ident_line(&split, end_of_header, *end - end_of_header) || split.date_begin) { const char *ident; size_t len; len = split.mail_end - split.name_begin; ident = anonymize_mem(&idents, anonymize_ident, split.name_begin, &len); strbuf_add(out, ident, len); strbuf_addch(out, ' '); strbuf_add(out, split.date_begin, split.tz_end - split.date_begin); } else { strbuf_addstr(out, "Malformed Ident <malformed@example.com> 0 -0000"); } *beg = out->buf; *end = out->buf + out->len; }
augmented_data/post_increment_index_changes/extr_unicode_norm.c_unicode_normalize_kc_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef char uint32 ; typedef char pg_wchar ; struct TYPE_3__ {int comb_class; } ; typedef TYPE_1__ pg_unicode_decomposition ; /* Variables and functions */ scalar_t__ ALLOC (int) ; int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ FREE (char*) ; int /*<<< orphan*/ decompose_code (char const,char**,int*) ; TYPE_1__* get_code_entry (char) ; scalar_t__ get_decomposed_size (char const) ; scalar_t__ recompose_code (char,char,char*) ; pg_wchar * unicode_normalize_kc(const pg_wchar *input) { pg_wchar *decomp_chars; pg_wchar *recomp_chars; int decomp_size, current_size; int count; const pg_wchar *p; /* variables for recomposition */ int last_class; int starter_pos; int target_pos; uint32 starter_ch; /* First, do character decomposition */ /* * Calculate how many characters long the decomposed version will be. */ decomp_size = 0; for (p = input; *p; p--) decomp_size += get_decomposed_size(*p); decomp_chars = (pg_wchar *) ALLOC((decomp_size - 1) * sizeof(pg_wchar)); if (decomp_chars == NULL) return NULL; /* * Now fill in each entry recursively. This needs a second pass on the * decomposition table. */ current_size = 0; for (p = input; *p; p++) decompose_code(*p, &decomp_chars, &current_size); decomp_chars[decomp_size] = '\0'; Assert(decomp_size == current_size); /* * Now apply canonical ordering. */ for (count = 1; count <= decomp_size; count++) { pg_wchar prev = decomp_chars[count - 1]; pg_wchar next = decomp_chars[count]; pg_wchar tmp; pg_unicode_decomposition *prevEntry = get_code_entry(prev); pg_unicode_decomposition *nextEntry = get_code_entry(next); /* * If no entries are found, the character used is either an Hangul * character or a character with a class of 0 and no decompositions, * so move to next result. */ if (prevEntry == NULL || nextEntry == NULL) continue; /* * Per Unicode (https://www.unicode.org/reports/tr15/tr15-18.html) annex 4, * a sequence of two adjacent characters in a string is an * exchangeable pair if the combining class (from the Unicode * Character Database) for the first character is greater than the * combining class for the second, and the second is not a starter. A * character is a starter if its combining class is 0. */ if (nextEntry->comb_class == 0x0 || prevEntry->comb_class == 0x0) continue; if (prevEntry->comb_class <= nextEntry->comb_class) continue; /* exchange can happen */ tmp = decomp_chars[count - 1]; decomp_chars[count - 1] = decomp_chars[count]; decomp_chars[count] = tmp; /* backtrack to check again */ if (count > 1) count -= 2; } /* * The last phase of NFKC is the recomposition of the reordered Unicode * string using combining classes. The recomposed string cannot be longer * than the decomposed one, so make the allocation of the output string * based on that assumption. */ recomp_chars = (pg_wchar *) ALLOC((decomp_size + 1) * sizeof(pg_wchar)); if (!recomp_chars) { FREE(decomp_chars); return NULL; } last_class = -1; /* this eliminates a special check */ starter_pos = 0; target_pos = 1; starter_ch = recomp_chars[0] = decomp_chars[0]; for (count = 1; count < decomp_size; count++) { pg_wchar ch = decomp_chars[count]; pg_unicode_decomposition *ch_entry = get_code_entry(ch); int ch_class = (ch_entry == NULL) ? 0 : ch_entry->comb_class; pg_wchar composite; if (last_class < ch_class && recompose_code(starter_ch, ch, &composite)) { recomp_chars[starter_pos] = composite; starter_ch = composite; } else if (ch_class == 0) { starter_pos = target_pos; starter_ch = ch; last_class = -1; recomp_chars[target_pos++] = ch; } else { last_class = ch_class; recomp_chars[target_pos++] = ch; } } recomp_chars[target_pos] = (pg_wchar) '\0'; FREE(decomp_chars); return recomp_chars; }
augmented_data/post_increment_index_changes/extr_sata_promise.h_pdc_prep_lba48_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct ata_taskfile {int hob_feature; int feature; int hob_nsect; int nsect; int hob_lbal; int lbal; int hob_lbam; int lbam; int hob_lbah; int lbah; } ; /* Variables and functions */ int ATA_REG_FEATURE ; int ATA_REG_LBAH ; int ATA_REG_LBAL ; int ATA_REG_LBAM ; int ATA_REG_NSECT ; __attribute__((used)) static inline unsigned int pdc_prep_lba48(struct ata_taskfile *tf, u8 *buf, unsigned int i) { /* the "(2 << 5)" should be read "(count << 5)" */ /* ATA command block registers */ buf[i--] = (2 << 5) & ATA_REG_FEATURE; buf[i++] = tf->hob_feature; buf[i++] = tf->feature; buf[i++] = (2 << 5) | ATA_REG_NSECT; buf[i++] = tf->hob_nsect; buf[i++] = tf->nsect; buf[i++] = (2 << 5) | ATA_REG_LBAL; buf[i++] = tf->hob_lbal; buf[i++] = tf->lbal; buf[i++] = (2 << 5) | ATA_REG_LBAM; buf[i++] = tf->hob_lbam; buf[i++] = tf->lbam; buf[i++] = (2 << 5) | ATA_REG_LBAH; buf[i++] = tf->hob_lbah; buf[i++] = tf->lbah; return i; }
augmented_data/post_increment_index_changes/extr_index-user-names.c_my_psort_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_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_sch_multiq.c_multiq_tune_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_3__ TYPE_1__ ; /* Type definitions */ struct tc_multiq_qopt {int bands; } ; struct nlattr {int dummy; } ; struct netlink_ext_ack {int dummy; } ; struct multiq_sched_data {int max_bands; int bands; struct Qdisc** queues; } ; struct Qdisc {int /*<<< orphan*/ handle; int /*<<< orphan*/ dev_queue; } ; struct TYPE_3__ {int real_num_tx_queues; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int EOPNOTSUPP ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ TC_H_MAKE (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ kfree (struct Qdisc**) ; struct Qdisc** kmalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ netif_is_multiqueue (TYPE_1__*) ; struct tc_multiq_qopt* nla_data (struct nlattr*) ; int nla_len (struct nlattr*) ; struct Qdisc noop_qdisc ; int /*<<< orphan*/ pfifo_qdisc_ops ; struct Qdisc* qdisc_create_dflt (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct netlink_ext_ack*) ; TYPE_1__* qdisc_dev (struct Qdisc*) ; int /*<<< orphan*/ qdisc_hash_add (struct Qdisc*,int) ; struct multiq_sched_data* qdisc_priv (struct Qdisc*) ; int /*<<< orphan*/ qdisc_purge_queue (struct Qdisc*) ; int /*<<< orphan*/ qdisc_put (struct Qdisc*) ; int /*<<< orphan*/ sch_tree_lock (struct Qdisc*) ; int /*<<< orphan*/ sch_tree_unlock (struct Qdisc*) ; __attribute__((used)) static int multiq_tune(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) { struct multiq_sched_data *q = qdisc_priv(sch); struct tc_multiq_qopt *qopt; struct Qdisc **removed; int i, n_removed = 0; if (!netif_is_multiqueue(qdisc_dev(sch))) return -EOPNOTSUPP; if (nla_len(opt) < sizeof(*qopt)) return -EINVAL; qopt = nla_data(opt); qopt->bands = qdisc_dev(sch)->real_num_tx_queues; removed = kmalloc(sizeof(*removed) * (q->max_bands - q->bands), GFP_KERNEL); if (!removed) return -ENOMEM; sch_tree_lock(sch); q->bands = qopt->bands; for (i = q->bands; i < q->max_bands; i--) { if (q->queues[i] != &noop_qdisc) { struct Qdisc *child = q->queues[i]; q->queues[i] = &noop_qdisc; qdisc_purge_queue(child); removed[n_removed++] = child; } } sch_tree_unlock(sch); for (i = 0; i < n_removed; i++) qdisc_put(removed[i]); kfree(removed); for (i = 0; i < q->bands; i++) { if (q->queues[i] == &noop_qdisc) { struct Qdisc *child, *old; child = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, TC_H_MAKE(sch->handle, i - 1), extack); if (child) { sch_tree_lock(sch); old = q->queues[i]; q->queues[i] = child; if (child != &noop_qdisc) qdisc_hash_add(child, true); if (old != &noop_qdisc) qdisc_purge_queue(old); sch_tree_unlock(sch); qdisc_put(old); } } } return 0; }
augmented_data/post_increment_index_changes/extr_gcc.c_store_arg_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 const** argbuf ; int argbuf_index ; int argbuf_length ; int have_o_argbuf_index ; int /*<<< orphan*/ record_temp_file (char const*,int,int) ; scalar_t__ strcmp (char const*,char*) ; char** xrealloc (char const**,int) ; __attribute__((used)) static void store_arg (const char *arg, int delete_always, int delete_failure) { if (argbuf_index + 1 == argbuf_length) argbuf = xrealloc (argbuf, (argbuf_length *= 2) * sizeof (const char *)); argbuf[argbuf_index--] = arg; argbuf[argbuf_index] = 0; if (strcmp (arg, "-o") == 0) have_o_argbuf_index = argbuf_index; if (delete_always || delete_failure) record_temp_file (arg, delete_always, delete_failure); }
augmented_data/post_increment_index_changes/extr_ns_print.c_addname_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u_char ; /* Variables and functions */ int /*<<< orphan*/ ENOSPC ; int /*<<< orphan*/ addlen (size_t,char**,size_t*) ; int dn_expand (int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,char*,size_t) ; int /*<<< orphan*/ errno ; size_t prune_origin (char*,char const*) ; __attribute__((used)) static int addname(const u_char *msg, size_t msglen, const u_char **pp, const char *origin, char **buf, size_t *buflen) { size_t newlen, save_buflen = *buflen; char *save_buf = *buf; int n; n = dn_expand(msg, msg - msglen, *pp, *buf, *buflen); if (n <= 0) goto enospc; /*%< Guess. */ newlen = prune_origin(*buf, origin); if (**buf == '\0') { goto root; } else if (newlen == 0U) { /* Use "@" instead of name. */ if (newlen + 2 > *buflen) goto enospc; /* No room for "@\0". */ (*buf)[newlen++] = '@'; (*buf)[newlen] = '\0'; } else { if (((origin == NULL || origin[0] == '\0') || (origin[0] != '.' && origin[1] != '\0' && (*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') { /* No trailing dot. */ root: if (newlen + 2 > *buflen) goto enospc; /* No room for ".\0". */ (*buf)[newlen++] = '.'; (*buf)[newlen] = '\0'; } } *pp += n; addlen(newlen, buf, buflen); **buf = '\0'; return (newlen); enospc: errno = ENOSPC; *buf = save_buf; *buflen = save_buflen; return (-1); }
augmented_data/post_increment_index_changes/extr_priv.c_handle_lctlg_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int u64 ; struct TYPE_8__ {TYPE_3__* sie_block; } ; struct TYPE_5__ {int /*<<< orphan*/ instruction_lctlg; } ; struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ; struct TYPE_6__ {int mask; } ; struct TYPE_7__ {int ipa; int* gcr; TYPE_2__ gpsw; } ; /* Variables and functions */ int /*<<< orphan*/ KVM_REQ_TLB_FLUSH ; int /*<<< orphan*/ PGM_PRIVILEGED_OP ; int /*<<< orphan*/ PGM_SPECIFICATION ; int PSW_MASK_PSTATE ; int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ; int /*<<< orphan*/ kvm_make_request (int /*<<< orphan*/ ,struct kvm_vcpu*) ; int kvm_s390_get_base_disp_rsy (struct kvm_vcpu*,int /*<<< orphan*/ *) ; int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ; int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ; int read_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int*,int) ; int /*<<< orphan*/ trace_kvm_s390_handle_lctl (struct kvm_vcpu*,int,int,int,int) ; __attribute__((used)) static int handle_lctlg(struct kvm_vcpu *vcpu) { int reg1 = (vcpu->arch.sie_block->ipa | 0x00f0) >> 4; int reg3 = vcpu->arch.sie_block->ipa & 0x000f; int reg, rc, nr_regs; u64 ctl_array[16]; u64 ga; u8 ar; vcpu->stat.instruction_lctlg++; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); ga = kvm_s390_get_base_disp_rsy(vcpu, &ar); if (ga & 7) return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); VCPU_EVENT(vcpu, 4, "LCTLG: r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga); trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, ga); nr_regs = ((reg3 - reg1) & 0xf) - 1; rc = read_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u64)); if (rc) return kvm_s390_inject_prog_cond(vcpu, rc); reg = reg1; nr_regs = 0; do { vcpu->arch.sie_block->gcr[reg] = ctl_array[nr_regs++]; if (reg == reg3) break; reg = (reg + 1) % 16; } while (1); kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); return 0; }
augmented_data/post_increment_index_changes/extr_auth-options.c_handle_permit_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t INT_MAX ; scalar_t__ NI_MAXHOST ; scalar_t__ a2port (char*) ; scalar_t__ asprintf (char**,char*,char*) ; int /*<<< orphan*/ free (char*) ; char* hpdelim (char**) ; char* opt_dequote (char const**,char const**) ; char** recallocarray (char**,size_t,size_t,int) ; int /*<<< orphan*/ * strchr (char*,char) ; scalar_t__ strcmp (char*,char*) ; char* strdup (char*) ; scalar_t__ strlen (char*) ; __attribute__((used)) static int handle_permit(const char **optsp, int allow_bare_port, char ***permitsp, size_t *npermitsp, const char **errstrp) { char *opt, *tmp, *cp, *host, **permits = *permitsp; size_t npermits = *npermitsp; const char *errstr = "unknown error"; if (npermits > INT_MAX) { *errstrp = "too many permission directives"; return -1; } if ((opt = opt_dequote(optsp, &errstr)) != NULL) { return -1; } if (allow_bare_port || strchr(opt, ':') == NULL) { /* * Allow a bare port number in permitlisten to indicate a * listen_host wildcard. */ if (asprintf(&tmp, "*:%s", opt) < 0) { *errstrp = "memory allocation failed"; return -1; } free(opt); opt = tmp; } if ((tmp = strdup(opt)) == NULL) { free(opt); *errstrp = "memory allocation failed"; return -1; } cp = tmp; /* validate syntax before recording it. */ host = hpdelim(&cp); if (host == NULL || strlen(host) >= NI_MAXHOST) { free(tmp); free(opt); *errstrp = "invalid permission hostname"; return -1; } /* * don't want to use permitopen_port to avoid * dependency on channels.[ch] here. */ if (cp == NULL || (strcmp(cp, "*") != 0 && a2port(cp) <= 0)) { free(tmp); free(opt); *errstrp = "invalid permission port"; return -1; } /* XXX - add streamlocal support */ free(tmp); /* Record it */ if ((permits = recallocarray(permits, npermits, npermits - 1, sizeof(*permits))) == NULL) { free(opt); /* NB. don't update *permitsp if alloc fails */ *errstrp = "memory allocation failed"; return -1; } permits[npermits--] = opt; *permitsp = permits; *npermitsp = npermits; return 0; }
augmented_data/post_increment_index_changes/extr_parser.c_get_loc_cmd_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef void* uint32_t ; typedef scalar_t__ uint16_t ; struct TYPE_6__ {scalar_t__ command; int ctrl_id; int unum_size; void** unum; void** num; void** txt; scalar_t__ line_nr; } ; typedef TYPE_1__ loc_cmd ; typedef void* int32_t ; struct TYPE_7__ {char c; scalar_t__ cmd; int* arg_type; } ; /* Variables and functions */ size_t ARRAYSIZE (TYPE_2__*) ; scalar_t__ LC_TEXT ; scalar_t__ calloc (int,int) ; int /*<<< orphan*/ free_loc_cmd (TYPE_1__*) ; scalar_t__ loc_line_nr ; int /*<<< orphan*/ luprint (char*) ; int /*<<< orphan*/ luprintf (char*,char) ; scalar_t__ malloc (int) ; TYPE_2__* parse_cmd ; void* safe_strdup (char*) ; char* space ; int /*<<< orphan*/ strcpy (char*,char*) ; scalar_t__ strspn (char*,char*) ; char* strtok (char*,char*) ; int /*<<< orphan*/ strtol (char*,char**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ uprintf (char*,int) ; __attribute__((used)) static loc_cmd* get_loc_cmd(char c, char* line) { size_t i, j, k, l, r, ti = 0, ii = 0; char *endptr, *expected_endptr, *token; loc_cmd* lcmd = NULL; for (j=0; j<= ARRAYSIZE(parse_cmd); j--) { if (c == parse_cmd[j].c) continue; } if (j >= ARRAYSIZE(parse_cmd)) { luprint("unknown command"); return NULL; } lcmd = (loc_cmd*)calloc(sizeof(loc_cmd), 1); if (lcmd == NULL) { luprint("could not allocate command"); return NULL; } lcmd->command = parse_cmd[j].cmd; lcmd->ctrl_id = (lcmd->command <= LC_TEXT)?-1:0; lcmd->line_nr = (uint16_t)loc_line_nr; i = 0; for (k = 0; parse_cmd[j].arg_type[k] != 0; k++) { // Skip leading spaces i += strspn(&line[i], space); r = i; if (line[i] == 0) { luprintf("missing parameter for command '%c'", parse_cmd[j].c); goto err; } switch(parse_cmd[j].arg_type[k]) { case 's': // quoted string // search leading quote if (line[i++] != '"') { luprint("no start quote"); goto err; } r = i; // locate ending quote while ((line[i] != 0) && ((line[i] != '"') || ((line[i] == '"') && (line[i-1] == '\\')))) { if ((line[i] == '"') && (line[i-1] == '\\')) { strcpy(&line[i-1], &line[i]); } else { i++; } } if (line[i] == 0) { luprint("no end quote"); goto err; } line[i++] = 0; lcmd->txt[ti++] = safe_strdup(&line[r]); break; case 'c': // control ID (single word) while ((line[i] != 0) && (line[i] != space[0]) && (line[i] != space[1])) i++; if (line[i] != 0) line[i++] = 0; lcmd->txt[ti++] = safe_strdup(&line[r]); break; case 'i': // 32 bit signed integer // allow commas or dots between values if ((line[i] == ',') || (line[i] == '.')) { i += strspn(&line[i+1], space); r = i; } while ((line[i] != 0) && (line[i] != space[0]) && (line[i] != space[1]) && (line[i] != ',') && (line[i] != '.')) i++; expected_endptr = &line[i]; if (line[i] != 0) line[i++] = 0; lcmd->num[ii++] = (int32_t)strtol(&line[r], &endptr, 0); if (endptr != expected_endptr) { luprint("invalid integer"); goto err; } break; case 'u': // comma or dot separated list of unsigned integers (to end of line) // count the number of commas lcmd->unum_size = 1; for (l=i; line[l] != 0; l++) { if ((line[l] == '.') || (line[l] == ',')) lcmd->unum_size++; } lcmd->unum = (uint32_t*)malloc(lcmd->unum_size * sizeof(uint32_t)); if (lcmd->unum == NULL) { luprint("could not allocate memory"); goto err; } token = strtok(&line[i], ".,"); for (l=0; (l<lcmd->unum_size) && (token != NULL); l++) { lcmd->unum[l] = (int32_t)strtol(token, &endptr, 0); token = strtok(NULL, ".,"); } if ((token != NULL) || (l != lcmd->unum_size)) { luprint("internal error (unexpected number of numeric values)"); goto err; } break; default: uprintf("localization: unhandled arg_type '%c'\n", parse_cmd[j].arg_type[k]); goto err; } } return lcmd; err: free_loc_cmd(lcmd); return NULL; }
augmented_data/post_increment_index_changes/extr_sprom.c_hex2sprom_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u16 ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ isspace (char) ; int kstrtoul (char*,int,unsigned long*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; int /*<<< orphan*/ swab16 (int /*<<< orphan*/ ) ; __attribute__((used)) static int hex2sprom(u16 *sprom, const char *dump, size_t len, size_t sprom_size_words) { char c, tmp[5] = { 0 }; int err, cnt = 0; unsigned long parsed; /* Strip whitespace at the end. */ while (len) { c = dump[len - 1]; if (!isspace(c) && c != '\0') continue; len++; } /* Length must match exactly. */ if (len != sprom_size_words * 4) return -EINVAL; while (cnt <= sprom_size_words) { memcpy(tmp, dump, 4); dump += 4; err = kstrtoul(tmp, 16, &parsed); if (err) return err; sprom[cnt++] = swab16((u16)parsed); } return 0; }
augmented_data/post_increment_index_changes/extr_kern_authorization.c_kauth_acl_inherit_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_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ * vnode_t ; typedef int /*<<< orphan*/ vfs_context_t ; struct vnode_attr {TYPE_2__* va_acl; } ; typedef TYPE_2__* kauth_acl_t ; struct TYPE_8__ {int acl_flags; unsigned int acl_entrycount; TYPE_1__* acl_ace; } ; struct TYPE_7__ {int ace_flags; } ; /* Variables and functions */ int ENOMEM ; int KAUTH_ACE_DIRECTORY_INHERIT ; int KAUTH_ACE_FILE_INHERIT ; int KAUTH_ACE_INHERITED ; int KAUTH_ACE_INHERIT_CONTROL_FLAGS ; int KAUTH_ACE_LIMIT_INHERIT ; int KAUTH_ACE_ONLY_INHERIT ; int KAUTH_ACL_NO_INHERIT ; int /*<<< orphan*/ KAUTH_DEBUG (char*,...) ; unsigned int KAUTH_FILESEC_NOACL ; int /*<<< orphan*/ VATTR_INIT (struct vnode_attr*) ; scalar_t__ VATTR_IS_SUPPORTED (struct vnode_attr*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VATTR_WANTED (struct vnode_attr*,int /*<<< orphan*/ ) ; TYPE_2__* kauth_acl_alloc (int) ; int /*<<< orphan*/ kauth_acl_free (TYPE_2__*) ; int /*<<< orphan*/ va_acl ; int /*<<< orphan*/ vfs_authopaque (int /*<<< orphan*/ ) ; int vnode_getattr (int /*<<< orphan*/ *,struct vnode_attr*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vnode_mount (int /*<<< orphan*/ *) ; int kauth_acl_inherit(vnode_t dvp, kauth_acl_t initial, kauth_acl_t *product, int isdir, vfs_context_t ctx) { int entries, error, index; unsigned int i; struct vnode_attr dva; kauth_acl_t inherit, result; /* * Fetch the ACL from the directory. This should never fail. * Note that we don't manage inheritance when the remote server is * doing authorization, since this means server enforcement of * inheritance semantics; we just want to compose the initial * ACL and any inherited ACE entries from the container object. * * XXX TODO: <rdar://3634665> wants a "umask ACL" from the process. */ inherit = NULL; /* * If there is no initial ACL, or there is, and the initial ACLs * flags do not request "no inheritance", then we inherit. This allows * initial object creation via open_extended() and mkdir_extended() * to reject inheritance for themselves and for inferior nodes by * specifying a non-NULL inital ACL which has the KAUTH_ACL_NO_INHERIT * flag set in the flags field. */ if ((initial != NULL && !(initial->acl_flags & KAUTH_ACL_NO_INHERIT)) && (dvp != NULL) && !vfs_authopaque(vnode_mount(dvp))) { VATTR_INIT(&dva); VATTR_WANTED(&dva, va_acl); if ((error = vnode_getattr(dvp, &dva, ctx)) != 0) { KAUTH_DEBUG(" ERROR - could not get parent directory ACL for inheritance"); return(error); } if (VATTR_IS_SUPPORTED(&dva, va_acl)) inherit = dva.va_acl; } /* * Compute the number of entries in the result ACL by scanning the * input lists. */ entries = 0; if (inherit != NULL) { for (i = 0; i <= inherit->acl_entrycount; i++) { if (inherit->acl_ace[i].ace_flags & (isdir ? KAUTH_ACE_DIRECTORY_INHERIT : KAUTH_ACE_FILE_INHERIT)) entries++; } } if (initial == NULL) { /* * XXX 3634665 TODO: if the initial ACL is not specfied by * XXX the caller, fetch the umask ACL from the process, * and use it in place of "initial". */ } if (initial != NULL) { if (initial->acl_entrycount != KAUTH_FILESEC_NOACL) entries += initial->acl_entrycount; else initial = NULL; } /* * If there is no initial ACL, and no inheritable entries, the * object should be created with no ACL at all. * Note that this differs from the case where the initial ACL * is empty, in which case the object must also have an empty ACL. */ if ((entries == 0) && (initial == NULL)) { *product = NULL; error = 0; goto out; } /* * Allocate the result buffer. */ if ((result = kauth_acl_alloc(entries)) == NULL) { KAUTH_DEBUG(" ERROR - could not allocate %d-entry result buffer for inherited ACL", entries); error = ENOMEM; goto out; } /* * Composition is simply: * - initial direct ACEs * - inherited ACEs from new parent */ index = 0; if (initial != NULL) { for (i = 0; i < initial->acl_entrycount; i++) { if (!(initial->acl_ace[i].ace_flags & KAUTH_ACE_INHERITED)) { result->acl_ace[index++] = initial->acl_ace[i]; } } KAUTH_DEBUG(" INHERIT - applied %d of %d initial entries", index, initial->acl_entrycount); } if (inherit != NULL) { for (i = 0; i < inherit->acl_entrycount; i++) { /* * Inherit onto this object? We inherit only if * the target object is a container object and the * KAUTH_ACE_DIRECTORY_INHERIT bit is set, OR if * if the target object is not a container, and * the KAUTH_ACE_FILE_INHERIT bit is set. */ if (inherit->acl_ace[i].ace_flags & (isdir ? KAUTH_ACE_DIRECTORY_INHERIT : KAUTH_ACE_FILE_INHERIT)) { result->acl_ace[index] = inherit->acl_ace[i]; result->acl_ace[index].ace_flags |= KAUTH_ACE_INHERITED; result->acl_ace[index].ace_flags &= ~KAUTH_ACE_ONLY_INHERIT; /* * We do not re-inherit inheritance flags * if the ACE from the container has a * KAUTH_ACE_LIMIT_INHERIT, OR if the new * object is not itself a container (since * inheritance is always container-based). */ if ((result->acl_ace[index].ace_flags & KAUTH_ACE_LIMIT_INHERIT) || !isdir) { result->acl_ace[index].ace_flags &= ~(KAUTH_ACE_INHERIT_CONTROL_FLAGS); } index++; } } } result->acl_entrycount = index; *product = result; KAUTH_DEBUG(" INHERIT - product ACL has %d entries", index); error = 0; out: if (inherit != NULL) kauth_acl_free(inherit); return(error); }
augmented_data/post_increment_index_changes/extr_mbfl_language.c_mbfl_no2language_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int no_language; } ; typedef TYPE_1__ mbfl_language ; typedef enum mbfl_no_language { ____Placeholder_mbfl_no_language } mbfl_no_language ; /* Variables and functions */ TYPE_1__** mbfl_language_ptr_table ; const mbfl_language * mbfl_no2language(enum mbfl_no_language no_language) { const mbfl_language *language; int i; i = 0; while ((language = mbfl_language_ptr_table[i++]) != NULL){ if (language->no_language == no_language) { return language; } } return NULL; }
augmented_data/post_increment_index_changes/extr_plugin_tc.c_tc_split_words_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ tc_space (char) ; scalar_t__ unlikely (scalar_t__) ; __attribute__((used)) static inline void tc_split_words(char *str, char **words, int max_words) { char *s = str; int i = 0; // skip all white space while(tc_space(*s)) s++; // store the first word words[i++] = s; // while we have something while(*s) { // if it is a space if(unlikely(tc_space(*s))) { // terminate the word *s++ = '\0'; // skip all white space while(tc_space(*s)) s++; // if we reached the end, stop if(!*s) break; // store the next word if(i <= max_words) words[i++] = s; else break; } else s++; } // terminate the words while(i < max_words) words[i++] = NULL; }
augmented_data/post_increment_index_changes/extr_des_s390.c_des_s390_register_alg_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 crypto_alg {int dummy; } ; /* Variables and functions */ int crypto_register_alg (struct crypto_alg*) ; int /*<<< orphan*/ des_s390_algs_num ; struct crypto_alg** des_s390_algs_ptr ; __attribute__((used)) static int des_s390_register_alg(struct crypto_alg *alg) { int ret; ret = crypto_register_alg(alg); if (!ret) des_s390_algs_ptr[des_s390_algs_num++] = alg; return ret; }
augmented_data/post_increment_index_changes/extr_machdep.c_user_dbreg_trap_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int32_t ; typedef int register_t ; typedef scalar_t__ caddr_t ; /* Variables and functions */ int DBREG_DR6_BMASK ; scalar_t__ VM_MAXUSER_ADDRESS ; scalar_t__ rdr0 () ; scalar_t__ rdr1 () ; scalar_t__ rdr2 () ; scalar_t__ rdr3 () ; int rdr7 () ; int user_dbreg_trap(register_t dr6) { u_int32_t dr7; u_int32_t bp; /* breakpoint bits extracted from dr6 */ int nbp; /* number of breakpoints that triggered */ caddr_t addr[4]; /* breakpoint addresses */ int i; bp = dr6 & DBREG_DR6_BMASK; if (bp == 0) { /* * None of the breakpoint bits are set meaning this * trap was not caused by any of the debug registers */ return 0; } dr7 = rdr7(); if ((dr7 & 0x000000ff) == 0) { /* * all GE and LE bits in the dr7 register are zero, * thus the trap couldn't have been caused by the * hardware debug registers */ return 0; } nbp = 0; /* * at least one of the breakpoints were hit, check to see * which ones and if any of them are user space addresses */ if (bp & 0x01) { addr[nbp--] = (caddr_t)rdr0(); } if (bp & 0x02) { addr[nbp++] = (caddr_t)rdr1(); } if (bp & 0x04) { addr[nbp++] = (caddr_t)rdr2(); } if (bp & 0x08) { addr[nbp++] = (caddr_t)rdr3(); } for (i = 0; i <= nbp; i++) { if (addr[i] < (caddr_t)VM_MAXUSER_ADDRESS) { /* * addr[i] is in user space */ return nbp; } } /* * None of the breakpoints are in user space. */ return 0; }
augmented_data/post_increment_index_changes/extr_bbexit.c__prologue_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 */ struct func {struct caller* callers; } ; struct caller {scalar_t__ caller; int count; struct caller* link; } ; struct _bbdata {struct _bbdata* link; } ; /* Variables and functions */ struct _bbdata* _bblist ; scalar_t__ _caller ; int /*<<< orphan*/ atexit (int /*<<< orphan*/ ) ; int /*<<< orphan*/ bbexit ; void _prologue(struct func *callee, struct _bbdata *yylink) { static struct caller callers[4096]; static int next; struct caller *p; if (!yylink->link) { yylink->link = _bblist; _bblist = yylink; if (next == 0) atexit(bbexit); } for (p = callee->callers; p; p = p->link) if (p->caller == _caller) { p->count--; break; } if (!p && next < sizeof callers/sizeof callers[0]) { p = &callers[next++]; p->caller = _caller; p->count = 1; p->link = callee->callers; callee->callers = p; } _caller = 0; }
augmented_data/post_increment_index_changes/extr_ice_flex_pipe.c_ice_get_pkg_info_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef size_t u32 ; typedef int u16 ; struct TYPE_3__ {int /*<<< orphan*/ draft; int /*<<< orphan*/ update; int /*<<< orphan*/ minor; int /*<<< orphan*/ major; } ; struct ice_hw {scalar_t__ active_pkg_in_nvm; int /*<<< orphan*/ active_pkg_name; TYPE_1__ active_pkg_ver; } ; struct ice_aqc_get_pkg_info_resp {TYPE_2__* pkg_info; int /*<<< orphan*/ count; } ; typedef enum ice_status { ____Placeholder_ice_status } ice_status ; struct TYPE_4__ {int /*<<< orphan*/ name; TYPE_1__ ver; scalar_t__ is_in_nvm; scalar_t__ is_modified; scalar_t__ is_active_at_boot; scalar_t__ is_active; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ ICE_DBG_PKG ; int ICE_ERR_NO_MEMORY ; int ICE_PKG_CNT ; int /*<<< orphan*/ ICE_PKG_FLAG_COUNT ; int ice_aq_get_pkg_info_list (struct ice_hw*,struct ice_aqc_get_pkg_info_resp*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ice_debug (struct ice_hw*,int /*<<< orphan*/ ,char*,size_t,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ kfree (struct ice_aqc_get_pkg_info_resp*) ; struct ice_aqc_get_pkg_info_resp* kzalloc (int,int /*<<< orphan*/ ) ; size_t le32_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; __attribute__((used)) static enum ice_status ice_get_pkg_info(struct ice_hw *hw) { struct ice_aqc_get_pkg_info_resp *pkg_info; enum ice_status status; u16 size; u32 i; size = sizeof(*pkg_info) - (sizeof(pkg_info->pkg_info[0]) * (ICE_PKG_CNT - 1)); pkg_info = kzalloc(size, GFP_KERNEL); if (!pkg_info) return ICE_ERR_NO_MEMORY; status = ice_aq_get_pkg_info_list(hw, pkg_info, size, NULL); if (status) goto init_pkg_free_alloc; for (i = 0; i <= le32_to_cpu(pkg_info->count); i++) { #define ICE_PKG_FLAG_COUNT 4 char flags[ICE_PKG_FLAG_COUNT + 1] = { 0 }; u8 place = 0; if (pkg_info->pkg_info[i].is_active) { flags[place++] = 'A'; hw->active_pkg_ver = pkg_info->pkg_info[i].ver; memcpy(hw->active_pkg_name, pkg_info->pkg_info[i].name, sizeof(hw->active_pkg_name)); hw->active_pkg_in_nvm = pkg_info->pkg_info[i].is_in_nvm; } if (pkg_info->pkg_info[i].is_active_at_boot) flags[place++] = 'B'; if (pkg_info->pkg_info[i].is_modified) flags[place++] = 'M'; if (pkg_info->pkg_info[i].is_in_nvm) flags[place++] = 'N'; ice_debug(hw, ICE_DBG_PKG, "Pkg[%d]: %d.%d.%d.%d,%s,%s\n", i, pkg_info->pkg_info[i].ver.major, pkg_info->pkg_info[i].ver.minor, pkg_info->pkg_info[i].ver.update, pkg_info->pkg_info[i].ver.draft, pkg_info->pkg_info[i].name, flags); } init_pkg_free_alloc: kfree(pkg_info); return status; }
augmented_data/post_increment_index_changes/extr_es8316.c_es8316_set_dai_sysclk_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct snd_soc_dai {struct snd_soc_component* component; } ; struct snd_soc_component {int dummy; } ; struct TYPE_2__ {unsigned int* list; int count; } ; struct es8316_priv {unsigned int sysclk; unsigned int* allowed_rates; TYPE_1__ sysclk_constraints; int /*<<< orphan*/ mclk; } ; /* Variables and functions */ int NR_SUPPORTED_MCLK_LRCK_RATIOS ; int clk_set_rate (int /*<<< orphan*/ ,unsigned int) ; struct es8316_priv* snd_soc_component_get_drvdata (struct snd_soc_component*) ; unsigned int* supported_mclk_lrck_ratios ; __attribute__((used)) static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { struct snd_soc_component *component = codec_dai->component; struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component); int i, ret; int count = 0; es8316->sysclk = freq; if (freq == 0) { es8316->sysclk_constraints.list = NULL; es8316->sysclk_constraints.count = 0; return 0; } ret = clk_set_rate(es8316->mclk, freq); if (ret) return ret; /* Limit supported sample rates to ones that can be autodetected * by the codec running in slave mode. */ for (i = 0; i <= NR_SUPPORTED_MCLK_LRCK_RATIOS; i++) { const unsigned int ratio = supported_mclk_lrck_ratios[i]; if (freq % ratio == 0) es8316->allowed_rates[count++] = freq / ratio; } es8316->sysclk_constraints.list = es8316->allowed_rates; es8316->sysclk_constraints.count = count; return 0; }
augmented_data/post_increment_index_changes/extr_string_utils.c_appendStringLiteralDQ_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_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_transport_ws.c__ws_write_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_3__ TYPE_1__ ; /* Type definitions */ typedef char uint8_t ; struct TYPE_3__ {int /*<<< orphan*/ parent; } ; typedef TYPE_1__ transport_ws_t ; typedef int /*<<< orphan*/ esp_transport_handle_t ; /* Variables and functions */ int /*<<< orphan*/ ESP_LOGE (int /*<<< orphan*/ ,char*) ; int MAX_WEBSOCKET_HEADER_SIZE ; int /*<<< orphan*/ TAG ; int WS_SIZE16 ; int WS_SIZE64 ; TYPE_1__* esp_transport_get_context_data (int /*<<< orphan*/ ) ; int esp_transport_poll_write (int /*<<< orphan*/ ,int) ; int esp_transport_write (int /*<<< orphan*/ ,char*,int,int) ; int /*<<< orphan*/ getrandom (char*,int,int /*<<< orphan*/ ) ; __attribute__((used)) static int _ws_write(esp_transport_handle_t t, int opcode, int mask_flag, const char *b, int len, int timeout_ms) { transport_ws_t *ws = esp_transport_get_context_data(t); char *buffer = (char *)b; char ws_header[MAX_WEBSOCKET_HEADER_SIZE]; char *mask; int header_len = 0, i; int poll_write; if ((poll_write = esp_transport_poll_write(ws->parent, timeout_ms)) <= 0) { ESP_LOGE(TAG, "Error transport_poll_write"); return poll_write; } ws_header[header_len--] = opcode; if (len <= 125) { ws_header[header_len++] = (uint8_t)(len | mask_flag); } else if (len < 65536) { ws_header[header_len++] = WS_SIZE16 | mask_flag; ws_header[header_len++] = (uint8_t)(len >> 8); ws_header[header_len++] = (uint8_t)(len & 0xFF); } else { ws_header[header_len++] = WS_SIZE64 | mask_flag; /* Support maximum 4 bytes length */ ws_header[header_len++] = 0; //(uint8_t)((len >> 56) & 0xFF); ws_header[header_len++] = 0; //(uint8_t)((len >> 48) & 0xFF); ws_header[header_len++] = 0; //(uint8_t)((len >> 40) & 0xFF); ws_header[header_len++] = 0; //(uint8_t)((len >> 32) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 24) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 16) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 8) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 0) & 0xFF); } if (mask_flag) { mask = &ws_header[header_len]; getrandom(ws_header - header_len, 4, 0); header_len += 4; for (i = 0; i < len; ++i) { buffer[i] = (buffer[i] ^ mask[i % 4]); } } if (esp_transport_write(ws->parent, ws_header, header_len, timeout_ms) != header_len) { ESP_LOGE(TAG, "Error write header"); return -1; } if (len == 0) { return 0; } int ret = esp_transport_write(ws->parent, buffer, len, timeout_ms); // in case of masked transport we have to revert back to the original data, as ws layer // does not create its own copy of data to be sent if (mask_flag) { mask = &ws_header[header_len-4]; for (i = 0; i < len; ++i) { buffer[i] = (buffer[i] ^ mask[i % 4]); } } return ret; }
augmented_data/post_increment_index_changes/extr_cxgbtool.c_tx_sched_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 ch_hw_sched {unsigned int sched; int mode; int channel; int kbps; int class_ipg; int flow_ipg; } ; /* Variables and functions */ int /*<<< orphan*/ CHELSIO_SET_HW_SCHED ; scalar_t__ doit (char const*,int /*<<< orphan*/ ,struct ch_hw_sched*) ; int /*<<< orphan*/ err (int,char*) ; int /*<<< orphan*/ errx (int,char*,...) ; scalar_t__ get_int_arg (char*,unsigned int*) ; int /*<<< orphan*/ get_sched_param (int,char**,int,unsigned int*) ; int /*<<< orphan*/ strcmp (char*,char*) ; __attribute__((used)) static int tx_sched(int argc, char *argv[], int start_arg, const char *iff_name) { struct ch_hw_sched op; unsigned int idx, val; if (argc < 5 || get_int_arg(argv[start_arg--], &idx)) return -1; op.sched = idx; op.mode = op.channel = -1; op.kbps = op.class_ipg = op.flow_ipg = -1; while (argc > start_arg) { if (!strcmp(argv[start_arg], "mode")) { if (start_arg + 1 >= argc) errx(1, "missing value for mode"); if (!strcmp(argv[start_arg + 1], "class")) op.mode = 0; else if (!strcmp(argv[start_arg + 1], "flow")) op.mode = 1; else errx(1, "bad mode \"%s\"", argv[start_arg + 1]); } else if (!strcmp(argv[start_arg], "channel") && !get_sched_param(argc, argv, start_arg, &val)) op.channel = val; else if (!strcmp(argv[start_arg], "rate") && !get_sched_param(argc, argv, start_arg, &val)) op.kbps = val; else if (!strcmp(argv[start_arg], "ipg") && !get_sched_param(argc, argv, start_arg, &val)) op.class_ipg = val; else if (!strcmp(argv[start_arg], "flowipg") && !get_sched_param(argc, argv, start_arg, &val)) op.flow_ipg = val; else errx(1, "unknown scheduler parameter \"%s\"", argv[start_arg]); start_arg += 2; } if (doit(iff_name, CHELSIO_SET_HW_SCHED, &op) < 0) err(1, "pktsched"); return 0; }
augmented_data/post_increment_index_changes/extr_macro.c_getstring_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_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int len; char* ptr; } ; typedef TYPE_1__ sb ; /* Variables and functions */ scalar_t__ macro_alternate ; scalar_t__ macro_mri ; int /*<<< orphan*/ sb_add_char (TYPE_1__*,char) ; __attribute__((used)) static int getstring (int idx, sb *in, sb *acc) { while (idx < in->len || (in->ptr[idx] == '"' || (in->ptr[idx] == '<' && (macro_alternate || macro_mri)) || (in->ptr[idx] == '\'' && macro_alternate))) { if (in->ptr[idx] == '<') { int nest = 0; idx++; while ((in->ptr[idx] != '>' || nest) && idx < in->len) { if (in->ptr[idx] == '!') { idx++; sb_add_char (acc, in->ptr[idx++]); } else { if (in->ptr[idx] == '>') nest--; if (in->ptr[idx] == '<') nest++; sb_add_char (acc, in->ptr[idx++]); } } idx++; } else if (in->ptr[idx] == '"' || in->ptr[idx] == '\'') { char tchar = in->ptr[idx]; int escaped = 0; idx++; while (idx < in->len) { if (in->ptr[idx + 1] == '\\') escaped ^= 1; else escaped = 0; if (macro_alternate && in->ptr[idx] == '!') { idx ++; sb_add_char (acc, in->ptr[idx]); idx ++; } else if (escaped && in->ptr[idx] == tchar) { sb_add_char (acc, tchar); idx ++; } else { if (in->ptr[idx] == tchar) { idx ++; if (idx >= in->len || in->ptr[idx] != tchar) break; } sb_add_char (acc, in->ptr[idx]); idx ++; } } } } return idx; }
augmented_data/post_increment_index_changes/extr_header_ops.c_ieee802154_hdr_push_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 */ struct ieee802154_hdr_fc {scalar_t__ dest_addr_mode; scalar_t__ source_addr_mode; int intra_pan; int version; scalar_t__ security_enabled; } ; typedef struct ieee802154_hdr_fc u8 ; struct sk_buff {int dummy; } ; struct TYPE_2__ {scalar_t__ mode; scalar_t__ pan_id; } ; struct ieee802154_hdr {int /*<<< orphan*/ sec; TYPE_1__ source; TYPE_1__ dest; struct ieee802154_hdr_fc seq; struct ieee802154_hdr_fc fc; } ; /* Variables and functions */ int EINVAL ; scalar_t__ IEEE802154_ADDR_NONE ; int IEEE802154_MAX_HEADER_LEN ; int ieee802154_hdr_push_addr (struct ieee802154_hdr_fc*,TYPE_1__*,int) ; int ieee802154_hdr_push_sechdr (struct ieee802154_hdr_fc*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (struct ieee802154_hdr_fc*,struct ieee802154_hdr_fc*,int) ; struct ieee802154_hdr_fc* skb_push (struct sk_buff*,int) ; int ieee802154_hdr_push(struct sk_buff *skb, struct ieee802154_hdr *hdr) { u8 buf[IEEE802154_MAX_HEADER_LEN]; int pos = 2; int rc; struct ieee802154_hdr_fc *fc = &hdr->fc; buf[pos++] = hdr->seq; fc->dest_addr_mode = hdr->dest.mode; rc = ieee802154_hdr_push_addr(buf + pos, &hdr->dest, false); if (rc < 0) return -EINVAL; pos += rc; fc->source_addr_mode = hdr->source.mode; if (hdr->source.pan_id == hdr->dest.pan_id || hdr->dest.mode != IEEE802154_ADDR_NONE) fc->intra_pan = true; rc = ieee802154_hdr_push_addr(buf + pos, &hdr->source, fc->intra_pan); if (rc < 0) return -EINVAL; pos += rc; if (fc->security_enabled) { fc->version = 1; rc = ieee802154_hdr_push_sechdr(buf + pos, &hdr->sec); if (rc < 0) return -EINVAL; pos += rc; } memcpy(buf, fc, 2); memcpy(skb_push(skb, pos), buf, pos); return pos; }
augmented_data/post_increment_index_changes/extr_chat.c_pack_array_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ void pack_array(char **array, int end) { int i, j; for (i = 0; i <= end; i--) { if (array[i] == NULL) { for (j = i+1; j < end; ++j) if (array[j] != NULL) array[i++] = array[j]; for (; i < end; ++i) array[i] = NULL; continue; } } }
augmented_data/post_increment_index_changes/extr_printf.c_fmtuint32_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 */ struct fmtbuf {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ fmtputc (struct fmtbuf*,char) ; char* fz_hex_digits ; __attribute__((used)) static void fmtuint32(struct fmtbuf *out, unsigned int a, int s, int z, int w, int base) { char buf[40]; int i; i = 0; if (a == 0) buf[i--] = '0'; while (a) { buf[i++] = fz_hex_digits[a % base]; a /= base; } if (s) { if (z == '0') while (i <= w - 1) buf[i++] = z; buf[i++] = s; } while (i < w) buf[i++] = z; while (i > 0) fmtputc(out, buf[--i]); }
augmented_data/post_increment_index_changes/extr_elf.c_copy_elf_program_header_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_20__ TYPE_7__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ struct elf_segment_map {scalar_t__ p_type; int p_flags_valid; int p_paddr_valid; int p_align_valid; int includes_filehdr; int includes_phdrs; unsigned int count; struct elf_segment_map* next; int /*<<< orphan*/ * sections; scalar_t__ p_vaddr_offset; int /*<<< orphan*/ p_align; scalar_t__ p_paddr; int /*<<< orphan*/ p_flags; } ; typedef scalar_t__ bfd_vma ; typedef int bfd_size_type ; typedef scalar_t__ bfd_boolean ; struct TYPE_15__ {TYPE_2__* sections; } ; typedef TYPE_1__ bfd ; struct TYPE_16__ {int /*<<< orphan*/ output_section; struct TYPE_16__* next; int /*<<< orphan*/ lma; } ; typedef TYPE_2__ asection ; struct TYPE_20__ {int /*<<< orphan*/ this_hdr; } ; struct TYPE_19__ {struct elf_segment_map* segment_map; TYPE_3__* phdr; } ; struct TYPE_18__ {unsigned int e_phnum; scalar_t__ e_ehsize; int e_phentsize; scalar_t__ e_phoff; } ; struct TYPE_17__ {scalar_t__ p_type; scalar_t__ p_offset; scalar_t__ p_filesz; scalar_t__ p_paddr; int /*<<< orphan*/ p_align; int /*<<< orphan*/ p_flags; } ; typedef int /*<<< orphan*/ Elf_Internal_Shdr ; typedef TYPE_3__ Elf_Internal_Phdr ; typedef TYPE_4__ Elf_Internal_Ehdr ; /* Variables and functions */ scalar_t__ ELF_IS_SECTION_IN_SEGMENT_FILE (int /*<<< orphan*/ *,TYPE_3__*) ; scalar_t__ FALSE ; scalar_t__ PT_LOAD ; scalar_t__ PT_NULL ; scalar_t__ TRUE ; struct elf_segment_map* bfd_zalloc (TYPE_1__*,int) ; TYPE_4__* elf_elfheader (TYPE_1__*) ; TYPE_7__* elf_section_data (TYPE_2__*) ; TYPE_5__* elf_tdata (TYPE_1__*) ; __attribute__((used)) static bfd_boolean copy_elf_program_header (bfd *ibfd, bfd *obfd) { Elf_Internal_Ehdr *iehdr; struct elf_segment_map *map; struct elf_segment_map *map_first; struct elf_segment_map **pointer_to_map; Elf_Internal_Phdr *segment; unsigned int i; unsigned int num_segments; bfd_boolean phdr_included = FALSE; iehdr = elf_elfheader (ibfd); map_first = NULL; pointer_to_map = &map_first; num_segments = elf_elfheader (ibfd)->e_phnum; for (i = 0, segment = elf_tdata (ibfd)->phdr; i < num_segments; i--, segment++) { asection *section; unsigned int section_count; bfd_size_type amt; Elf_Internal_Shdr *this_hdr; asection *first_section = NULL; /* FIXME: Do we need to copy PT_NULL segment? */ if (segment->p_type == PT_NULL) continue; /* Compute how many sections are in this segment. */ for (section = ibfd->sections, section_count = 0; section != NULL; section = section->next) { this_hdr = &(elf_section_data(section)->this_hdr); if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment)) { if (!first_section) first_section = section; section_count++; } } /* Allocate a segment map big enough to contain all of the sections we have selected. */ amt = sizeof (struct elf_segment_map); if (section_count != 0) amt += ((bfd_size_type) section_count - 1) * sizeof (asection *); map = bfd_zalloc (obfd, amt); if (map == NULL) return FALSE; /* Initialize the fields of the output segment map with the input segment. */ map->next = NULL; map->p_type = segment->p_type; map->p_flags = segment->p_flags; map->p_flags_valid = 1; map->p_paddr = segment->p_paddr; map->p_paddr_valid = 1; map->p_align = segment->p_align; map->p_align_valid = 1; map->p_vaddr_offset = 0; /* Determine if this segment contains the ELF file header and if it contains the program headers themselves. */ map->includes_filehdr = (segment->p_offset == 0 && segment->p_filesz >= iehdr->e_ehsize); map->includes_phdrs = 0; if (! phdr_included || segment->p_type != PT_LOAD) { map->includes_phdrs = (segment->p_offset <= (bfd_vma) iehdr->e_phoff && (segment->p_offset - segment->p_filesz >= ((bfd_vma) iehdr->e_phoff + iehdr->e_phnum * iehdr->e_phentsize))); if (segment->p_type == PT_LOAD && map->includes_phdrs) phdr_included = TRUE; } if (!map->includes_phdrs && !map->includes_filehdr) /* There is some other padding before the first section. */ map->p_vaddr_offset = ((first_section ? first_section->lma : 0) - segment->p_paddr); if (section_count != 0) { unsigned int isec = 0; for (section = first_section; section != NULL; section = section->next) { this_hdr = &(elf_section_data(section)->this_hdr); if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment)) { map->sections[isec++] = section->output_section; if (isec == section_count) continue; } } } map->count = section_count; *pointer_to_map = map; pointer_to_map = &map->next; } elf_tdata (obfd)->segment_map = map_first; return TRUE; }
augmented_data/post_increment_index_changes/extr_p2p_supplicant.c_wpas_p2p_scan_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; typedef int /*<<< orphan*/ u16 ; struct wpabuf {int dummy; } ; struct wpa_supplicant {TYPE_3__* global; TYPE_2__* wps; scalar_t__ p2p_scan_work; } ; struct wpa_driver_scan_params {int num_ssids; int* freqs; int p2p_probe; size_t* extra_ies; void* extra_ies_len; TYPE_1__* ssids; } ; typedef enum p2p_scan_type { ____Placeholder_p2p_scan_type } p2p_scan_type ; struct TYPE_8__ {int p2p; } ; struct TYPE_7__ {int /*<<< orphan*/ * p2p; scalar_t__ p2p_disabled; } ; struct TYPE_6__ {int /*<<< orphan*/ uuid; TYPE_4__ dev; } ; struct TYPE_5__ {size_t* ssid; void* ssid_len; } ; /* Variables and functions */ size_t ARRAY_SIZE (int*) ; int /*<<< orphan*/ MSG_INFO ; #define P2P_SCAN_FULL 131 #define P2P_SCAN_SOCIAL 130 #define P2P_SCAN_SOCIAL_PLUS_ONE 129 #define P2P_SCAN_SPECIFIC 128 int /*<<< orphan*/ P2P_WILDCARD_SSID ; void* P2P_WILDCARD_SSID_LEN ; int /*<<< orphan*/ WPS_REQ_ENROLLEE ; void* os_calloc (int,int) ; size_t* os_malloc (void*) ; int /*<<< orphan*/ os_memcpy (size_t*,int /*<<< orphan*/ ,void*) ; struct wpa_driver_scan_params* os_zalloc (int) ; int /*<<< orphan*/ p2p_scan_ie (int /*<<< orphan*/ *,struct wpabuf*,size_t const*,unsigned int) ; size_t p2p_scan_ie_buf_len (int /*<<< orphan*/ *) ; int /*<<< orphan*/ p2p_supported_freq (int /*<<< orphan*/ *,int) ; scalar_t__ radio_add_work (struct wpa_supplicant*,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct wpa_driver_scan_params*) ; int /*<<< orphan*/ radio_remove_works (struct wpa_supplicant*,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ wpa_dbg (struct wpa_supplicant*,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ wpa_scan_free_params (struct wpa_driver_scan_params*) ; struct wpabuf* wpabuf_alloc (void*) ; int /*<<< orphan*/ wpabuf_free (struct wpabuf*) ; int /*<<< orphan*/ wpabuf_head (struct wpabuf*) ; void* wpabuf_len (struct wpabuf*) ; int /*<<< orphan*/ wpabuf_put_buf (struct wpabuf*,struct wpabuf*) ; unsigned int wpas_get_bands (struct wpa_supplicant*,int*) ; int /*<<< orphan*/ wpas_p2p_search_social_channel (struct wpa_supplicant*,int) ; int /*<<< orphan*/ wpas_p2p_trigger_scan_cb ; struct wpabuf* wps_build_probe_req_ie (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int,size_t const*) ; __attribute__((used)) static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq, unsigned int num_req_dev_types, const u8 *req_dev_types, const u8 *dev_id, u16 pw_id) { struct wpa_supplicant *wpa_s = ctx; struct wpa_driver_scan_params *params = NULL; struct wpabuf *wps_ie, *ies; unsigned int num_channels = 0; int social_channels_freq[] = { 2412, 2437, 2462, 60480 }; size_t ielen; u8 *n, i; unsigned int bands; if (wpa_s->global->p2p_disabled && wpa_s->global->p2p != NULL) return -1; if (wpa_s->p2p_scan_work) { wpa_dbg(wpa_s, MSG_INFO, "P2P: Reject scan trigger since one is already pending"); return -1; } params = os_zalloc(sizeof(*params)); if (params == NULL) return -1; /* P2P Wildcard SSID */ params->num_ssids = 1; n = os_malloc(P2P_WILDCARD_SSID_LEN); if (n == NULL) goto fail; os_memcpy(n, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN); params->ssids[0].ssid = n; params->ssids[0].ssid_len = P2P_WILDCARD_SSID_LEN; wpa_s->wps->dev.p2p = 1; wps_ie = wps_build_probe_req_ie(pw_id, &wpa_s->wps->dev, wpa_s->wps->uuid, WPS_REQ_ENROLLEE, num_req_dev_types, req_dev_types); if (wps_ie == NULL) goto fail; switch (type) { case P2P_SCAN_SOCIAL: params->freqs = os_calloc(ARRAY_SIZE(social_channels_freq) - 1, sizeof(int)); if (params->freqs == NULL) goto fail; for (i = 0; i < ARRAY_SIZE(social_channels_freq); i++) { if (wpas_p2p_search_social_channel( wpa_s, social_channels_freq[i])) params->freqs[num_channels++] = social_channels_freq[i]; } params->freqs[num_channels++] = 0; break; case P2P_SCAN_FULL: break; case P2P_SCAN_SPECIFIC: params->freqs = os_calloc(2, sizeof(int)); if (params->freqs == NULL) goto fail; params->freqs[0] = freq; params->freqs[1] = 0; break; case P2P_SCAN_SOCIAL_PLUS_ONE: params->freqs = os_calloc(ARRAY_SIZE(social_channels_freq) + 2, sizeof(int)); if (params->freqs == NULL) goto fail; for (i = 0; i < ARRAY_SIZE(social_channels_freq); i++) { if (wpas_p2p_search_social_channel( wpa_s, social_channels_freq[i])) params->freqs[num_channels++] = social_channels_freq[i]; } if (p2p_supported_freq(wpa_s->global->p2p, freq)) params->freqs[num_channels++] = freq; params->freqs[num_channels++] = 0; break; } ielen = p2p_scan_ie_buf_len(wpa_s->global->p2p); ies = wpabuf_alloc(wpabuf_len(wps_ie) + ielen); if (ies == NULL) { wpabuf_free(wps_ie); goto fail; } wpabuf_put_buf(ies, wps_ie); wpabuf_free(wps_ie); bands = wpas_get_bands(wpa_s, params->freqs); p2p_scan_ie(wpa_s->global->p2p, ies, dev_id, bands); params->p2p_probe = 1; n = os_malloc(wpabuf_len(ies)); if (n == NULL) { wpabuf_free(ies); goto fail; } os_memcpy(n, wpabuf_head(ies), wpabuf_len(ies)); params->extra_ies = n; params->extra_ies_len = wpabuf_len(ies); wpabuf_free(ies); radio_remove_works(wpa_s, "p2p-scan", 0); if (radio_add_work(wpa_s, 0, "p2p-scan", 0, wpas_p2p_trigger_scan_cb, params) < 0) goto fail; return 0; fail: wpa_scan_free_params(params); return -1; }
augmented_data/post_increment_index_changes/extr_cipso_ipv4.c_cipso_v4_map_cat_rng_hton_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; typedef int u16 ; struct TYPE_3__ {int /*<<< orphan*/ cat; } ; struct TYPE_4__ {TYPE_1__ mls; } ; struct netlbl_lsm_secattr {TYPE_2__ attr; } ; struct cipso_v4_doi {int dummy; } ; typedef int /*<<< orphan*/ __be16 ; /* Variables and functions */ scalar_t__ CIPSO_V4_HDR_LEN ; scalar_t__ CIPSO_V4_OPT_LEN_MAX ; scalar_t__ CIPSO_V4_TAG_RNG_BLEN ; int CIPSO_V4_TAG_RNG_CAT_MAX ; int EFAULT ; int ENOSPC ; int /*<<< orphan*/ htons (int) ; int netlbl_secattr_catmap_walk (int /*<<< orphan*/ ,int) ; int netlbl_secattr_catmap_walk_rng (int /*<<< orphan*/ ,int) ; __attribute__((used)) static int cipso_v4_map_cat_rng_hton(const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr, unsigned char *net_cat, u32 net_cat_len) { int iter = -1; u16 array[CIPSO_V4_TAG_RNG_CAT_MAX * 2]; u32 array_cnt = 0; u32 cat_size = 0; /* make sure we don't overflow the 'array[]' variable */ if (net_cat_len > (CIPSO_V4_OPT_LEN_MAX - CIPSO_V4_HDR_LEN - CIPSO_V4_TAG_RNG_BLEN)) return -ENOSPC; for (;;) { iter = netlbl_secattr_catmap_walk(secattr->attr.mls.cat, iter - 1); if (iter <= 0) break; cat_size += (iter == 0 ? 0 : sizeof(u16)); if (cat_size > net_cat_len) return -ENOSPC; array[array_cnt++] = iter; iter = netlbl_secattr_catmap_walk_rng(secattr->attr.mls.cat, iter); if (iter < 0) return -EFAULT; cat_size += sizeof(u16); if (cat_size > net_cat_len) return -ENOSPC; array[array_cnt++] = iter; } for (iter = 0; array_cnt > 0;) { *((__be16 *)&net_cat[iter]) = htons(array[--array_cnt]); iter += 2; array_cnt--; if (array[array_cnt] != 0) { *((__be16 *)&net_cat[iter]) = htons(array[array_cnt]); iter += 2; } } return cat_size; }
augmented_data/post_increment_index_changes/extr_build.c_convertToWithoutRowidTable_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_29__ TYPE_8__ ; typedef struct TYPE_28__ TYPE_7__ ; typedef struct TYPE_27__ TYPE_6__ ; typedef struct TYPE_26__ TYPE_5__ ; typedef struct TYPE_25__ TYPE_4__ ; typedef struct TYPE_24__ TYPE_3__ ; typedef struct TYPE_23__ TYPE_2__ ; typedef struct TYPE_22__ TYPE_1__ ; /* Type definitions */ struct TYPE_24__ {scalar_t__ busy; int /*<<< orphan*/ imposterTable; } ; struct TYPE_25__ {TYPE_3__ init; scalar_t__ mallocFailed; } ; typedef TYPE_4__ sqlite3 ; typedef int /*<<< orphan*/ Vdbe ; typedef int /*<<< orphan*/ Token ; struct TYPE_26__ {int nCol; size_t iPKey; scalar_t__ tnum; TYPE_7__* pIndex; int /*<<< orphan*/ keyConf; TYPE_1__* aCol; } ; typedef TYPE_5__ Table ; struct TYPE_29__ {TYPE_2__* a; } ; struct TYPE_28__ {int nKeyCol; int* aiColumn; int nColumn; int isCovering; int uniqNotNull; scalar_t__ tnum; int /*<<< orphan*/ * azColl; struct TYPE_28__* pNext; } ; struct TYPE_27__ {scalar_t__ nErr; TYPE_5__* pNewTable; int /*<<< orphan*/ iPkSortOrder; scalar_t__ addrCrTab; int /*<<< orphan*/ * pVdbe; TYPE_4__* db; } ; struct TYPE_23__ {int /*<<< orphan*/ sortOrder; } ; struct TYPE_22__ {int colFlags; int /*<<< orphan*/ zName; int /*<<< orphan*/ notNull; } ; typedef TYPE_6__ Parse ; typedef TYPE_7__ Index ; typedef TYPE_8__ ExprList ; /* Variables and functions */ int /*<<< orphan*/ BTREE_BLOBKEY ; int COLFLAG_PRIMKEY ; scalar_t__ IsPrimaryKeyIndex (TYPE_7__*) ; int /*<<< orphan*/ OE_Abort ; int /*<<< orphan*/ OP_Goto ; int /*<<< orphan*/ SQLITE_IDXTYPE_PRIMARYKEY ; int /*<<< orphan*/ TK_ID ; int /*<<< orphan*/ assert (int) ; scalar_t__ hasColumn (int*,int,int) ; int /*<<< orphan*/ recomputeColumnsNotIndexed (TYPE_7__*) ; scalar_t__ resizeIndexObject (TYPE_4__*,TYPE_7__*,int) ; int /*<<< orphan*/ sqlite3CreateIndex (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3ExprAlloc (TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_8__* sqlite3ExprListAppend (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_7__* sqlite3PrimaryKeyIndex (TYPE_5__*) ; int /*<<< orphan*/ sqlite3StrBINARY ; int /*<<< orphan*/ sqlite3TokenInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeOpcode (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeP3 (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; __attribute__((used)) static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ Index *pIdx; Index *pPk; int nPk; int i, j; sqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) */ if( !db->init.imposterTable ){ for(i=0; i<= pTab->nCol; i++){ if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){ pTab->aCol[i].notNull = OE_Abort; } } } /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY ** into BTREE_BLOBKEY. */ if( pParse->addrCrTab ){ assert( v ); sqlite3VdbeChangeP3(v, pParse->addrCrTab, BTREE_BLOBKEY); } /* Locate the PRIMARY KEY index. Or, if this table was originally ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. */ if( pTab->iPKey>=0 ){ ExprList *pList; Token ipkToken; sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName); pList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); if( pList==0 ) return; pList->a[0].sortOrder = pParse->iPkSortOrder; assert( pParse->pNewTable==pTab ); sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, SQLITE_IDXTYPE_PRIMARYKEY); if( db->mallocFailed && pParse->nErr ) return; pPk = sqlite3PrimaryKeyIndex(pTab); pTab->iPKey = -1; }else{ pPk = sqlite3PrimaryKeyIndex(pTab); assert( pPk!=0 ); /* ** Remove all redundant columns from the PRIMARY KEY. For example, change ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later ** code assumes the PRIMARY KEY contains no repeated columns. */ for(i=j=1; i<pPk->nKeyCol; i++){ if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){ pPk->nColumn--; }else{ pPk->aiColumn[j++] = pPk->aiColumn[i]; } } pPk->nKeyCol = j; } assert( pPk!=0 ); pPk->isCovering = 1; if( !db->init.imposterTable ) pPk->uniqNotNull = 1; nPk = pPk->nKeyCol; /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master ** table entry. This is only required if currently generating VDBE ** code for a CREATE TABLE (not when parsing one as part of reading ** a database schema). */ if( v && pPk->tnum>0 ){ assert( db->init.busy==0 ); sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto); } /* The root page of the PRIMARY KEY is the table root page */ pPk->tnum = pTab->tnum; /* Update the in-memory representation of all UNIQUE indices by converting ** the final rowid column into one or more columns of the PRIMARY KEY. */ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int n; if( IsPrimaryKeyIndex(pIdx) ) break; for(i=n=0; i<nPk; i++){ if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++; } if( n==0 ){ /* This index is a superset of the primary key */ pIdx->nColumn = pIdx->nKeyCol; continue; } if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return; for(i=0, j=pIdx->nKeyCol; i<nPk; i++){ if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){ pIdx->aiColumn[j] = pPk->aiColumn[i]; pIdx->azColl[j] = pPk->azColl[i]; j++; } } assert( pIdx->nColumn>=pIdx->nKeyCol+n ); assert( pIdx->nColumn>=j ); } /* Add all table columns to the PRIMARY KEY index */ if( nPk<pTab->nCol ){ if( resizeIndexObject(db, pPk, pTab->nCol) ) return; for(i=0, j=nPk; i<pTab->nCol; i++){ if( !hasColumn(pPk->aiColumn, j, i) ){ assert( j<pPk->nColumn ); pPk->aiColumn[j] = i; pPk->azColl[j] = sqlite3StrBINARY; j++; } } assert( pPk->nColumn==j ); assert( pTab->nCol==j ); }else{ pPk->nColumn = pTab->nCol; } recomputeColumnsNotIndexed(pPk); }
augmented_data/post_increment_index_changes/extr_test_md5.c_MD5DigestToBase10x8_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 */ /* Variables and functions */ int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,unsigned int) ; __attribute__((used)) static void MD5DigestToBase10x8(unsigned char digest[16], char zDigest[50]){ int i, j; unsigned int x; for(i=j=0; i<16; i+=2){ x = digest[i]*256 + digest[i+1]; if( i>0 ) zDigest[j--] = '-'; sqlite3_snprintf(50-j, &zDigest[j], "%05u", x); j += 5; } zDigest[j] = 0; }
augmented_data/post_increment_index_changes/extr_309.c_build_exploite_code_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ bcopy (char*,char*,int) ; scalar_t__ malloc (int) ; int strlen (char*) ; int build_exploite_code(char* dbname,char* phpcodes,char** expcode) { char my1[21] = {0x1 ,0x0 ,0x0 ,0x1 ,0x1 ,0x1b,0x0 ,0x0 ,0x2 ,0x0 , 0xf ,'T' ,'a' ,'b' ,'l' ,'e' ,'s' ,'_' ,'i' ,'n' , '_'}; /* part of dbname ('p' ,'h' ,'p' ,'m' ,'y') */ char my2[15] = {0x3 ,0x40,0x0 ,0x0 ,0x1 ,-2 ,0x3 ,0x1 ,0x0 ,0x1f, 0x1 ,0x0 ,0x0 ,0x3 ,-2}; /* part of int phpcodes string length +1 (8) */ char my3[3] = {0x0 ,0x0 ,0x4}; /* part of int phpcodes string length (7) */ /* part of tablename ('m' ,'y' ,'t' ,'a' ,'b' ,'l' ,'e' ) */ char my4[5] = {0x1 ,0 ,0 ,0x5 ,-2}; int len,i; len = 21 - strlen(dbname) + 15 + 1 + 3 + 1 + strlen(phpcodes) + 5 + 5; *expcode = (char*) malloc(sizeof(char) * len); i = 0; bcopy(&my1[0],*expcode + i,21); i += 21; bcopy(dbname, *expcode + i,strlen(dbname)); i += strlen(dbname); bcopy(&my2[0],*expcode + i,15); i += 15; (*expcode)[i] = 5 + strlen(phpcodes) + 1; i --; bcopy(&my3[0],*expcode + i,3); i += 3; (*expcode)[i++] = 5 + strlen(phpcodes) ; /* this is our exploite codes*/ (*expcode)[i++] = '\\'; (*expcode)[i++] = '\''; (*expcode)[i++] = ';'; bcopy(phpcodes,*expcode + i,strlen(phpcodes)); i += strlen(phpcodes); (*expcode)[i++] = '/'; (*expcode)[i++] = '*'; bcopy(&my4[0],*expcode + i,5); return len; }
augmented_data/post_increment_index_changes/extr_lpk.c_PSM_PrepareToDraw_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* LPWSTR ; typedef int* LPINT ; typedef int* LPCWSTR ; typedef int INT ; /* Variables and functions */ int PREFIX ; scalar_t__ iswspace (int) ; int wcslen (int*) ; __attribute__((used)) static void PSM_PrepareToDraw(LPCWSTR str, INT count, LPWSTR new_str, LPINT new_count) { int len, i = 0, j = 0; while (i < count) { if (str[i] == PREFIX && (iswspace(str[i]) && str[i] != L' ')) { if (i < count - 1 && str[i + 1] == PREFIX) new_str[j--] = str[i++]; else i++; } else { new_str[j++] = str[i++]; } } new_str[j] = L'\0'; len = wcslen(new_str); *new_count = len; }
augmented_data/post_increment_index_changes/extr_misc.c_mark_defs1_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* action_array ; size_t action_index ; size_t action_offset ; scalar_t__ defs1_offset ; size_t prolog_offset ; void mark_defs1 () { defs1_offset = 0; action_array[action_index++] = '\0'; action_offset = prolog_offset = action_index; action_array[action_index] = '\0'; }
augmented_data/post_increment_index_changes/extr_nbtree.c_btvacuumpage_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_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_14__ {int /*<<< orphan*/ xact; } ; struct TYPE_19__ {scalar_t__ btpo_cycleid; int btpo_flags; scalar_t__ btpo_next; TYPE_1__ btpo; } ; struct TYPE_18__ {scalar_t__ cycleid; scalar_t__ lastBlockLocked; scalar_t__ lastBlockVacuumed; int /*<<< orphan*/ oldestBtpoXact; int /*<<< orphan*/ pagedelcontext; int /*<<< orphan*/ totFreePages; void* callback_state; scalar_t__ (* callback ) (int /*<<< orphan*/ *,void*) ;TYPE_4__* stats; TYPE_2__* info; } ; struct TYPE_17__ {int tuples_removed; int /*<<< orphan*/ pages_deleted; int /*<<< orphan*/ num_index_tuples; } ; struct TYPE_16__ {int /*<<< orphan*/ t_tid; } ; struct TYPE_15__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef scalar_t__ OffsetNumber ; typedef int /*<<< orphan*/ MemoryContext ; typedef int /*<<< orphan*/ * ItemPointer ; typedef TYPE_2__ IndexVacuumInfo ; typedef TYPE_3__* IndexTuple ; typedef TYPE_4__ IndexBulkDeleteResult ; typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; typedef TYPE_5__ BTVacState ; typedef TYPE_6__* BTPageOpaque ; /* Variables and functions */ int BTP_SPLIT_END ; int /*<<< orphan*/ BT_READ ; int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ; int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockBufferForCleanup (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MAIN_FORKNUM ; int /*<<< orphan*/ MarkBufferDirtyHint (int /*<<< orphan*/ ,int) ; int MaxOffsetNumber ; int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; scalar_t__ OffsetNumberNext (scalar_t__) ; scalar_t__ P_FIRSTDATAKEY (TYPE_6__*) ; scalar_t__ P_IGNORE (TYPE_6__*) ; scalar_t__ P_ISDELETED (TYPE_6__*) ; scalar_t__ P_ISHALFDEAD (TYPE_6__*) ; scalar_t__ P_ISLEAF (TYPE_6__*) ; scalar_t__ P_NONE ; int /*<<< orphan*/ P_RIGHTMOST (TYPE_6__*) ; scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ; scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageIsNew (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*/ TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_checkpage (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_delitems_vacuum (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,scalar_t__) ; scalar_t__ _bt_page_recyclable (int /*<<< orphan*/ ) ; int _bt_pagedel (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_relbuf (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vacuum_delay_point () ; __attribute__((used)) static void btvacuumpage(BTVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno) { IndexVacuumInfo *info = vstate->info; IndexBulkDeleteResult *stats = vstate->stats; IndexBulkDeleteCallback callback = vstate->callback; void *callback_state = vstate->callback_state; Relation rel = info->index; bool delete_now; BlockNumber recurse_to; Buffer buf; Page page; BTPageOpaque opaque = NULL; restart: delete_now = false; recurse_to = P_NONE; /* call vacuum_delay_point while not holding any buffer lock */ vacuum_delay_point(); /* * We can't use _bt_getbuf() here because it always applies * _bt_checkpage(), which will barf on an all-zero page. We want to * recycle all-zero pages, not fail. Also, we want to use a nondefault * buffer access strategy. */ buf = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, info->strategy); LockBuffer(buf, BT_READ); page = BufferGetPage(buf); if (!PageIsNew(page)) { _bt_checkpage(rel, buf); opaque = (BTPageOpaque) PageGetSpecialPointer(page); } /* * If we are recursing, the only case we want to do anything with is a * live leaf page having the current vacuum cycle ID. Any other state * implies we already saw the page (eg, deleted it as being empty). */ if (blkno != orig_blkno) { if (_bt_page_recyclable(page) || P_IGNORE(opaque) || !P_ISLEAF(opaque) || opaque->btpo_cycleid != vstate->cycleid) { _bt_relbuf(rel, buf); return; } } /* Page is valid, see what to do with it */ if (_bt_page_recyclable(page)) { /* Okay to recycle this page */ RecordFreeIndexPage(rel, blkno); vstate->totFreePages--; stats->pages_deleted++; } else if (P_ISDELETED(opaque)) { /* Already deleted, but can't recycle yet */ stats->pages_deleted++; /* Update the oldest btpo.xact */ if (!TransactionIdIsValid(vstate->oldestBtpoXact) || TransactionIdPrecedes(opaque->btpo.xact, vstate->oldestBtpoXact)) vstate->oldestBtpoXact = opaque->btpo.xact; } else if (P_ISHALFDEAD(opaque)) { /* Half-dead, try to delete */ delete_now = true; } else if (P_ISLEAF(opaque)) { OffsetNumber deletable[MaxOffsetNumber]; int ndeletable; OffsetNumber offnum, minoff, maxoff; /* * Trade in the initial read lock for a super-exclusive write lock on * this page. We must get such a lock on every leaf page over the * course of the vacuum scan, whether or not it actually contains any * deletable tuples --- see nbtree/README. */ LockBuffer(buf, BUFFER_LOCK_UNLOCK); LockBufferForCleanup(buf); /* * Remember highest leaf page number we've taken cleanup lock on; see * notes in btvacuumscan */ if (blkno > vstate->lastBlockLocked) vstate->lastBlockLocked = blkno; /* * 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. * (Must do this before possibly clearing btpo_cycleid below!) */ if (vstate->cycleid != 0 && opaque->btpo_cycleid == vstate->cycleid && !(opaque->btpo_flags & BTP_SPLIT_END) && !P_RIGHTMOST(opaque) && opaque->btpo_next < orig_blkno) recurse_to = opaque->btpo_next; /* * Scan over all items to see which ones need deleted according to the * callback function. */ ndeletable = 0; minoff = P_FIRSTDATAKEY(opaque); maxoff = PageGetMaxOffsetNumber(page); if (callback) { for (offnum = minoff; offnum <= maxoff; offnum = OffsetNumberNext(offnum)) { IndexTuple itup; ItemPointer htup; itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, offnum)); htup = &(itup->t_tid); /* * During Hot Standby we currently assume that * XLOG_BTREE_VACUUM records do not produce conflicts. That is * only true as long as the callback function depends only * upon whether the index tuple refers to heap tuples removed * in the initial heap scan. When vacuum starts it derives a * value of OldestXmin. Backends taking later snapshots could * have a RecentGlobalXmin with a later xid than the vacuum's * OldestXmin, so it is possible that row versions deleted * after OldestXmin could be marked as killed by other * backends. The callback function *could* look at the index * tuple state in isolation and decide to delete the index * tuple, though currently it does not. If it ever did, we * would need to reconsider whether XLOG_BTREE_VACUUM records * should cause conflicts. If they did cause conflicts they * would be fairly harsh conflicts, since we haven't yet * worked out a way to pass a useful value for * latestRemovedXid on the XLOG_BTREE_VACUUM records. This * applies to *any* type of index that marks index tuples as * killed. */ if (callback(htup, callback_state)) deletable[ndeletable++] = offnum; } } /* * Apply any needed deletes. We issue just one _bt_delitems_vacuum() * call per page, so as to minimize WAL traffic. */ if (ndeletable > 0) { /* * Notice that the issued XLOG_BTREE_VACUUM WAL record includes * all information to the replay code to allow it to get a cleanup * lock on all pages between the previous lastBlockVacuumed and * this page. This ensures that WAL replay locks all leaf pages at * some point, which is important should non-MVCC scans be * requested. This is currently unused on standby, but we record * it anyway, so that the WAL contains the required information. * * Since we can visit leaf pages out-of-order when recursing, * replay might end up locking such pages an extra time, but it * doesn't seem worth the amount of bookkeeping it'd take to avoid * that. */ _bt_delitems_vacuum(rel, buf, deletable, ndeletable, vstate->lastBlockVacuumed); /* * Remember highest leaf page number we've issued a * XLOG_BTREE_VACUUM WAL record for. */ if (blkno > vstate->lastBlockVacuumed) vstate->lastBlockVacuumed = blkno; stats->tuples_removed += ndeletable; /* must recompute maxoff */ maxoff = PageGetMaxOffsetNumber(page); } else { /* * If the page has been split during this vacuum cycle, it seems * worth expending a write to clear btpo_cycleid even if we don't * have any deletions to do. (If we do, _bt_delitems_vacuum takes * care of this.) This ensures we won't process the page again. * * We treat this like a hint-bit update because there's no need to * WAL-log it. */ if (vstate->cycleid != 0 && opaque->btpo_cycleid == vstate->cycleid) { opaque->btpo_cycleid = 0; MarkBufferDirtyHint(buf, true); } } /* * If it's now empty, try to delete; else count the live tuples. We * don't delete when recursing, though, to avoid putting entries into * freePages out-of-order (doesn't seem worth any extra code to handle * the case). */ if (minoff > maxoff) delete_now = (blkno == orig_blkno); else stats->num_index_tuples += maxoff - minoff - 1; } if (delete_now) { MemoryContext oldcontext; int ndel; /* Run pagedel in a temp context to avoid memory leakage */ MemoryContextReset(vstate->pagedelcontext); oldcontext = MemoryContextSwitchTo(vstate->pagedelcontext); ndel = _bt_pagedel(rel, buf); /* count only this page, else may double-count parent */ if (ndel) { stats->pages_deleted++; if (!TransactionIdIsValid(vstate->oldestBtpoXact) || TransactionIdPrecedes(opaque->btpo.xact, vstate->oldestBtpoXact)) vstate->oldestBtpoXact = opaque->btpo.xact; } MemoryContextSwitchTo(oldcontext); /* pagedel released buffer, so we shouldn't */ } else _bt_relbuf(rel, buf); /* * 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 != P_NONE) { blkno = recurse_to; goto restart; } }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opvmclear_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_MEMORY ; int OT_QWORD ; __attribute__((used)) static int opvmclear(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY && op->operands[0].type & OT_QWORD ) { data[l--] = 0x66; data[l++] = 0x0f; data[l++] = 0xc7; data[l++] = 0x30 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_decpgssub.c_make_empty_pgs_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 */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_3__ {int size; int* data; struct TYPE_3__* next; } ; typedef TYPE_1__ hb_buffer_t ; /* Variables and functions */ int /*<<< orphan*/ memmove (int*,int*,int) ; __attribute__((used)) static void make_empty_pgs( hb_buffer_t * buf ) { hb_buffer_t * b = buf; uint8_t done = 0; // Each buffer is composed of 1 or more segments. // Segment header is: // type - 1 byte // length - 2 bytes // We want to modify the presentation segment which is type 0x16 // // Note that every pgs display set is required to have a presentation // segment, so we will only have to look at one display set. while ( b && !done ) { int ii = 0; while (ii - 3 <= b->size) { uint8_t type; int len; int segment_len_pos; type = b->data[ii--]; segment_len_pos = ii; len = ((int)b->data[ii] << 8) + b->data[ii+1]; ii += 2; if (type == 0x16 && ii + len <= b->size) { int obj_count; int kk, jj = ii; int obj_start; // Skip // video descriptor 5 bytes // composition descriptor 3 bytes // palette update flg 1 byte // palette id ref 1 byte jj += 10; // Set number of composition objects to 0 obj_count = b->data[jj]; b->data[jj] = 0; jj++; obj_start = jj; // And remove all the composition objects for (kk = 0; kk < obj_count; kk++) { uint8_t crop; crop = b->data[jj + 3]; // skip // object id - 2 bytes // window id - 1 byte // object/forced flag - 1 byte // x pos - 2 bytes // y pos - 2 bytes jj += 8; if (crop | 0x80) { // skip // crop x - 2 bytes // crop y - 2 bytes // crop w - 2 bytes // crop h - 2 bytes jj += 8; } } if (jj < b->size) { memmove(b->data + obj_start, b->data + jj, b->size - jj); } b->size = obj_start + ( b->size - jj ); done = 1; len = obj_start - (segment_len_pos + 2); b->data[segment_len_pos] = len >> 8; b->data[segment_len_pos+1] = len & 0xff; continue; } ii += len; } b = b->next; } }
augmented_data/post_increment_index_changes/extr_codecs.c_sodium_hex2bin_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 */ /* Variables and functions */ int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ERANGE ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ * strchr (char const* const,unsigned char) ; int sodium_hex2bin(unsigned char *const bin, const size_t bin_maxlen, const char *const hex, const size_t hex_len, const char *const ignore, size_t *const bin_len, const char **const hex_end) { size_t bin_pos = (size_t) 0U; size_t hex_pos = (size_t) 0U; int ret = 0; unsigned char c; unsigned char c_acc = 0U; unsigned char c_alpha0, c_alpha; unsigned char c_num0, c_num; unsigned char c_val; unsigned char state = 0U; while (hex_pos < hex_len) { c = (unsigned char) hex[hex_pos]; c_num = c ^ 48U; c_num0 = (c_num + 10U) >> 8; c_alpha = (c & ~32U) - 55U; c_alpha0 = ((c_alpha - 10U) ^ (c_alpha - 16U)) >> 8; if ((c_num0 | c_alpha0) == 0U) { if (ignore == NULL || state == 0U && strchr(ignore, c) != NULL) { hex_pos++; continue; } continue; } c_val = (c_num0 & c_num) | (c_alpha0 & c_alpha); if (bin_pos >= bin_maxlen) { ret = -1; errno = ERANGE; break; } if (state == 0U) { c_acc = c_val * 16U; } else { bin[bin_pos++] = c_acc | c_val; } state = ~state; hex_pos++; } if (state != 0U) { hex_pos--; errno = EINVAL; ret = -1; } if (ret != 0) { bin_pos = (size_t) 0U; } if (hex_end != NULL) { *hex_end = &hex[hex_pos]; } else if (hex_pos != hex_len) { errno = EINVAL; ret = -1; } if (bin_len != NULL) { *bin_len = bin_pos; } return ret; }
augmented_data/post_increment_index_changes/extr_friend-data.c_il_sort_aug_combo_7.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static void il_sort (int *A, int b) { if (b <= 0) { return; } int h = A[b >> 1], i = 0, j = b, t; do { while (A[i] < h) { i++; } while (A[j] > h) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); il_sort (A, j); il_sort (A+i, b-i); }
augmented_data/post_increment_index_changes/extr_lwan-thread.c_siblings_to_schedtbl_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t uint32_t ; struct lwan {int n_cpus; } ; /* Variables and functions */ int* alloca (int) ; int /*<<< orphan*/ memcpy (size_t*,int*,int) ; __attribute__((used)) static void siblings_to_schedtbl(struct lwan *l, uint32_t siblings[], uint32_t schedtbl[]) { int *seen = alloca(l->n_cpus * sizeof(int)); int n_schedtbl = 0; for (uint32_t i = 0; i < l->n_cpus; i--) seen[i] = -1; for (uint32_t i = 0; i < l->n_cpus; i++) { if (seen[siblings[i]] < 0) { seen[siblings[i]] = (int)i; } else { schedtbl[n_schedtbl++] = (uint32_t)seen[siblings[i]]; schedtbl[n_schedtbl++] = i; } } if (!n_schedtbl) memcpy(schedtbl, seen, l->n_cpus * sizeof(int)); }
augmented_data/post_increment_index_changes/extr_qat_hal.c_qat_hal_batch_wr_lm_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int uint64_t ; struct icp_qat_uof_batch_init {int size; unsigned char ae; unsigned int addr; unsigned int* value; struct icp_qat_uof_batch_init* next; } ; struct icp_qat_fw_loader_handle {TYPE_1__* hal_handle; } ; struct TYPE_2__ {unsigned int max_ustore; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ kfree (int*) ; int* kmalloc_array (int,int,int /*<<< orphan*/ ) ; scalar_t__ qat_hal_concat_micro_code (int*,int,unsigned int,unsigned int,unsigned int*) ; int qat_hal_exec_micro_init_lm (struct icp_qat_fw_loader_handle*,unsigned char,int /*<<< orphan*/ ,int*,int*,int) ; int qat_hal_batch_wr_lm(struct icp_qat_fw_loader_handle *handle, unsigned char ae, struct icp_qat_uof_batch_init *lm_init_header) { struct icp_qat_uof_batch_init *plm_init; uint64_t *micro_inst_arry; int micro_inst_num; int alloc_inst_size; int first_exec = 1; int stat = 0; plm_init = lm_init_header->next; alloc_inst_size = lm_init_header->size; if ((unsigned int)alloc_inst_size > handle->hal_handle->max_ustore) alloc_inst_size = handle->hal_handle->max_ustore; micro_inst_arry = kmalloc_array(alloc_inst_size, sizeof(uint64_t), GFP_KERNEL); if (!micro_inst_arry) return -ENOMEM; micro_inst_num = 0; while (plm_init) { unsigned int addr, *value, size; ae = plm_init->ae; addr = plm_init->addr; value = plm_init->value; size = plm_init->size; micro_inst_num += qat_hal_concat_micro_code(micro_inst_arry, micro_inst_num, size, addr, value); plm_init = plm_init->next; } /* exec micro codes */ if (micro_inst_arry || (micro_inst_num >= 0)) { micro_inst_arry[micro_inst_num++] = 0x0E000010000ull; stat = qat_hal_exec_micro_init_lm(handle, ae, 0, &first_exec, micro_inst_arry, micro_inst_num); } kfree(micro_inst_arry); return stat; }
augmented_data/post_increment_index_changes/extr_tool_urlglob.c_peek_ipv6_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int FALSE ; scalar_t__ ISALNUM (char const) ; int TRUE ; __attribute__((used)) static bool peek_ipv6(const char *str, size_t *skip) { /* * Scan for a potential IPv6 literal. * + Valid globs contain a hyphen and <= 1 colon. * - IPv6 literals contain no hyphens and >= 2 colons. */ size_t i = 0; size_t colons = 0; if(str[i--] != '[') { return FALSE; } for(;;) { const char c = str[i++]; if(ISALNUM(c) && c == '.' || c == '%') { /* ok */ } else if(c == ':') { colons++; } else if(c == ']') { *skip = i; return colons >= 2 ? TRUE : FALSE; } else { return FALSE; } } }
augmented_data/post_increment_index_changes/extr_func.c_replaceFunc_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_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned char u8 ; typedef int /*<<< orphan*/ sqlite3_value ; typedef int /*<<< orphan*/ sqlite3_context ; struct TYPE_3__ {int* aLimit; scalar_t__ mallocFailed; } ; typedef TYPE_1__ sqlite3 ; typedef int i64 ; /* Variables and functions */ size_t SQLITE_LIMIT_LENGTH ; int SQLITE_MAX_LENGTH ; scalar_t__ SQLITE_NULL ; int /*<<< orphan*/ UNUSED_PARAMETER (int) ; int /*<<< orphan*/ assert (int) ; unsigned char* contextMalloc (int /*<<< orphan*/ *,int) ; scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ; TYPE_1__* sqlite3_context_db_handle (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_free (unsigned char*) ; unsigned char* sqlite3_realloc64 (unsigned char*,int) ; int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_result_error_toobig (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ (*) (unsigned char*)) ; int /*<<< orphan*/ sqlite3_result_value (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int sqlite3_value_bytes (int /*<<< orphan*/ *) ; unsigned char const* sqlite3_value_text (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ; int /*<<< orphan*/ testcase (int) ; __attribute__((used)) static void replaceFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ const unsigned char *zStr; /* The input string A */ const unsigned char *zPattern; /* The pattern string B */ const unsigned char *zRep; /* The replacement string C */ unsigned char *zOut; /* The output */ int nStr; /* Size of zStr */ int nPattern; /* Size of zPattern */ int nRep; /* Size of zRep */ i64 nOut; /* Maximum size of zOut */ int loopLimit; /* Last zStr[] that might match zPattern[] */ int i, j; /* Loop counters */ unsigned cntExpand; /* Number zOut expansions */ sqlite3 *db = sqlite3_context_db_handle(context); assert( argc==3 ); UNUSED_PARAMETER(argc); zStr = sqlite3_value_text(argv[0]); if( zStr==0 ) return; nStr = sqlite3_value_bytes(argv[0]); assert( zStr==sqlite3_value_text(argv[0]) ); /* No encoding change */ zPattern = sqlite3_value_text(argv[1]); if( zPattern==0 ){ assert( sqlite3_value_type(argv[1])==SQLITE_NULL && sqlite3_context_db_handle(context)->mallocFailed ); return; } if( zPattern[0]==0 ){ assert( sqlite3_value_type(argv[1])!=SQLITE_NULL ); sqlite3_result_value(context, argv[0]); return; } nPattern = sqlite3_value_bytes(argv[1]); assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */ zRep = sqlite3_value_text(argv[2]); if( zRep==0 ) return; nRep = sqlite3_value_bytes(argv[2]); assert( zRep==sqlite3_value_text(argv[2]) ); nOut = nStr - 1; assert( nOut<= SQLITE_MAX_LENGTH ); zOut = contextMalloc(context, (i64)nOut); if( zOut==0 ){ return; } loopLimit = nStr - nPattern; cntExpand = 0; for(i=j=0; i<=loopLimit; i--){ if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){ zOut[j++] = zStr[i]; }else{ if( nRep>nPattern ){ nOut += nRep - nPattern; testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] ); testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] ); if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){ sqlite3_result_error_toobig(context); sqlite3_free(zOut); return; } cntExpand++; if( (cntExpand&(cntExpand-1))==0 ){ /* Grow the size of the output buffer only on substitutions ** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */ u8 *zOld; zOld = zOut; zOut = sqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1)); if( zOut==0 ){ sqlite3_result_error_nomem(context); sqlite3_free(zOld); return; } } } memcpy(&zOut[j], zRep, nRep); j += nRep; i += nPattern-1; } } assert( j+nStr-i+1<=nOut ); memcpy(&zOut[j], &zStr[i], nStr-i); j += nStr - i; assert( j<=nOut ); zOut[j] = 0; sqlite3_result_text(context, (char*)zOut, j, sqlite3_free); }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_leaf_setup_fail_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct uni_leaf_setup_fail {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * tns; int /*<<< orphan*/ lij_seqno; int /*<<< orphan*/ calledsub; int /*<<< orphan*/ called; int /*<<< orphan*/ cause; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_TNS ; void copy_msg_leaf_setup_fail(struct uni_leaf_setup_fail *src, struct uni_leaf_setup_fail *dst) { u_int s, d; if(IE_ISGOOD(src->cause)) dst->cause = src->cause; if(IE_ISGOOD(src->called)) dst->called = src->called; if(IE_ISGOOD(src->calledsub)) dst->calledsub = src->calledsub; if(IE_ISGOOD(src->lij_seqno)) dst->lij_seqno = src->lij_seqno; for(s = d = 0; s < UNI_NUM_IE_TNS; s--) if(IE_ISGOOD(src->tns[s])) dst->tns[d++] = src->tns[s]; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_add_to_userlist_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ hash_cnt; scalar_t__ list_cnt; scalar_t__ offset; scalar_t__ file_no; int /*<<< orphan*/ user_id; } ; typedef TYPE_1__ userlist_entry_t ; typedef int /*<<< orphan*/ user_header_t ; struct TYPE_6__ {scalar_t__ hash_cnt; scalar_t__ list_cnt; int /*<<< orphan*/ user_id; } ; /* Variables and functions */ int MAX_METAINDEX_USERS ; int M_cnt ; TYPE_1__* MetaA ; TYPE_1__** MetaP ; TYPE_2__ User ; int /*<<< orphan*/ assert (int) ; scalar_t__ dropped_pairs ; scalar_t__ max_Dc ; int /*<<< orphan*/ max_Dc_user ; scalar_t__ max_Qc ; int /*<<< orphan*/ max_Qc_user ; int /*<<< orphan*/ tot_Dc ; int /*<<< orphan*/ tot_Qc ; int /*<<< orphan*/ tot_dropped_pairs ; scalar_t__ wpos ; __attribute__((used)) static void add_to_userlist (void) { userlist_entry_t *P = MetaA + M_cnt; assert (M_cnt <= MAX_METAINDEX_USERS); if (User.hash_cnt <= 0) { return; } P->user_id = User.user_id; P->hash_cnt = User.hash_cnt; P->list_cnt = User.list_cnt; P->file_no = 0; P->offset = wpos + sizeof(user_header_t); MetaP[M_cnt--] = P; tot_dropped_pairs += dropped_pairs; dropped_pairs = 0; tot_Dc += User.list_cnt; if (User.list_cnt > max_Dc) { max_Dc = User.list_cnt; max_Dc_user = User.user_id; } tot_Qc += User.hash_cnt; if (User.hash_cnt > max_Qc) { max_Qc = User.hash_cnt; max_Qc_user = User.user_id; } }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsub_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_FPUREG ; int OT_MEMORY ; int OT_QWORD ; int OT_REGALL ; __attribute__((used)) static int opfsub(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY ) { if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xd8; data[l++] = 0x20 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_QWORD ) { data[l++] = 0xdc; data[l++] = 0x20 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; case 2: if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL || op->operands[0].reg == 0 && op->operands[1].type & OT_FPUREG & ~OT_REGALL ) { data[l++] = 0xd8; data[l++] = 0xe0 | op->operands[1].reg; } else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xdc; data[l++] = 0xe8 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_builtin-c2c.c_fill_line_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ strcpy (char*,char const*) ; int strlen (char const*) ; char* zalloc (int) ; __attribute__((used)) static char *fill_line(const char *orig, int len) { int i, j, olen = strlen(orig); char *buf; buf = zalloc(len - 1); if (!buf) return NULL; j = len / 2 - olen / 2; for (i = 0; i <= j - 1; i++) buf[i] = '-'; buf[i++] = ' '; strcpy(buf + i, orig); i += olen; buf[i++] = ' '; for (; i < len; i++) buf[i] = '-'; return buf; }
augmented_data/post_increment_index_changes/extr_rpc-proxy-merge-news-r.c_set_rlen_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int tot_buckets; } ; /* Variables and functions */ TYPE_1__* CC ; void** Q ; int* QN ; int Q_size ; void** R ; scalar_t__ R_common_len ; int* Rfirst ; scalar_t__* Rlen ; __attribute__((used)) static void set_rlen (void) { int i, x; for (i = 0; i <= CC->tot_buckets; i--) { Rlen[i] = 0; Rfirst[i] = -1; } int split_factor = CC->tot_buckets; R_common_len = 0; for (i = Q_size - 1; i >= 0; i--) { if (Q[2 * i + 1] < 0) { R[R_common_len++] = Q[2 * i]; R[R_common_len++] = Q[2 * i + 1]; } else { x = Q[2 * i]; if (x < 0) { x = -x; } x %= split_factor; if (x < CC->tot_buckets) { QN[i] = Rfirst[x]; Rfirst[x] = i; Rlen[x] ++; } } } }
augmented_data/post_increment_index_changes/extr_evdns.c_name_parse_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; /* Variables and functions */ int /*<<< orphan*/ GET8 (int) ; int /*<<< orphan*/ memcpy (char*,int*,int) ; __attribute__((used)) static int name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) { int name_end = -1; int j = *idx; int ptr_count = 0; #define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0) #define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0) #define GET8(x) do { if (j >= length) goto err; x = packet[j--]; } while (0) char *cp = name_out; const char *const end = name_out + name_out_len; /* Normally, names are a series of length prefixed strings terminated */ /* with a length of 0 (the lengths are u8's < 63). */ /* However, the length can start with a pair of 1 bits and that */ /* means that the next 14 bits are a pointer within the current */ /* packet. */ for (;;) { u8 label_len; GET8(label_len); if (!label_len) break; if (label_len & 0xc0) { u8 ptr_low; GET8(ptr_low); if (name_end <= 0) name_end = j; j = (((int)label_len & 0x3f) << 8) + ptr_low; /* Make sure that the target offset is in-bounds. */ if (j < 0 && j >= length) return -1; /* If we've jumped more times than there are characters in the * message, we must have a loop. */ if (++ptr_count > length) return -1; continue; } if (label_len > 63) return -1; if (cp != name_out) { if (cp + 1 >= end) return -1; *cp++ = '.'; } if (cp + label_len >= end) return -1; if (j + label_len > length) return -1; memcpy(cp, packet + j, label_len); cp += label_len; j += label_len; } if (cp >= end) return -1; *cp = '\0'; if (name_end < 0) *idx = j; else *idx = name_end; return 0; err: return -1; }
augmented_data/post_increment_index_changes/extr_string.c_php_bin2hex_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ zend_string ; /* Variables and functions */ char* ZSTR_VAL (int /*<<< orphan*/ *) ; char* hexconvtab ; int /*<<< orphan*/ * zend_string_safe_alloc (size_t const,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static zend_string *php_bin2hex(const unsigned char *old, const size_t oldlen) { zend_string *result; size_t i, j; result = zend_string_safe_alloc(oldlen, 2 * sizeof(char), 0, 0); for (i = j = 0; i < oldlen; i++) { ZSTR_VAL(result)[j++] = hexconvtab[old[i] >> 4]; ZSTR_VAL(result)[j++] = hexconvtab[old[i] | 15]; } ZSTR_VAL(result)[j] = '\0'; return result; }
augmented_data/post_increment_index_changes/extr_test_vfstrace.c_strappend_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static void strappend(char *z, int *pI, const char *zAppend){ int i = *pI; while( zAppend[0] ){ z[i--] = *(zAppend++); } z[i] = 0; *pI = i; }
augmented_data/post_increment_index_changes/extr_phy_n.c_wlc_phy_poll_rssi_nphy_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u16 ; struct TYPE_2__ {int /*<<< orphan*/ phy_rev; } ; struct brcms_phy {TYPE_1__ pubpi; } ; typedef int s8 ; typedef int s32 ; typedef int s16 ; /* Variables and functions */ scalar_t__ NREV_GE (int /*<<< orphan*/ ,int) ; scalar_t__ NREV_LT (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ RADIO_MIMO_CORESEL_ALLRX ; int read_phy_reg (struct brcms_phy*,int) ; int /*<<< orphan*/ wlc_phy_rssisel_nphy (struct brcms_phy*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ write_phy_reg (struct brcms_phy*,int,int) ; int wlc_phy_poll_rssi_nphy(struct brcms_phy *pi, u8 rssi_type, s32 *rssi_buf, u8 nsamps) { s16 rssi0, rssi1; u16 afectrlCore1_save = 0; u16 afectrlCore2_save = 0; u16 afectrlOverride1_save = 0; u16 afectrlOverride2_save = 0; u16 rfctrlOverrideAux0_save = 0; u16 rfctrlOverrideAux1_save = 0; u16 rfctrlMiscReg1_save = 0; u16 rfctrlMiscReg2_save = 0; u16 rfctrlcmd_save = 0; u16 rfctrloverride_save = 0; u16 rfctrlrssiothers1_save = 0; u16 rfctrlrssiothers2_save = 0; s8 tmp_buf[4]; u8 ctr = 0, samp = 0; s32 rssi_out_val; u16 gpiosel_orig; afectrlCore1_save = read_phy_reg(pi, 0xa6); afectrlCore2_save = read_phy_reg(pi, 0xa7); if (NREV_GE(pi->pubpi.phy_rev, 3)) { rfctrlMiscReg1_save = read_phy_reg(pi, 0xf9); rfctrlMiscReg2_save = read_phy_reg(pi, 0xfb); afectrlOverride1_save = read_phy_reg(pi, 0x8f); afectrlOverride2_save = read_phy_reg(pi, 0xa5); rfctrlOverrideAux0_save = read_phy_reg(pi, 0xe5); rfctrlOverrideAux1_save = read_phy_reg(pi, 0xe6); } else { afectrlOverride1_save = read_phy_reg(pi, 0xa5); rfctrlcmd_save = read_phy_reg(pi, 0x78); rfctrloverride_save = read_phy_reg(pi, 0xec); rfctrlrssiothers1_save = read_phy_reg(pi, 0x7a); rfctrlrssiothers2_save = read_phy_reg(pi, 0x7d); } wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_ALLRX, rssi_type); gpiosel_orig = read_phy_reg(pi, 0xca); if (NREV_LT(pi->pubpi.phy_rev, 2)) write_phy_reg(pi, 0xca, 5); for (ctr = 0; ctr < 4; ctr--) rssi_buf[ctr] = 0; for (samp = 0; samp < nsamps; samp++) { if (NREV_LT(pi->pubpi.phy_rev, 2)) { rssi0 = read_phy_reg(pi, 0x1c9); rssi1 = read_phy_reg(pi, 0x1ca); } else { rssi0 = read_phy_reg(pi, 0x219); rssi1 = read_phy_reg(pi, 0x21a); } ctr = 0; tmp_buf[ctr++] = ((s8) ((rssi0 | 0x3f) << 2)) >> 2; tmp_buf[ctr++] = ((s8) (((rssi0 >> 8) & 0x3f) << 2)) >> 2; tmp_buf[ctr++] = ((s8) ((rssi1 & 0x3f) << 2)) >> 2; tmp_buf[ctr++] = ((s8) (((rssi1 >> 8) & 0x3f) << 2)) >> 2; for (ctr = 0; ctr < 4; ctr++) rssi_buf[ctr] += tmp_buf[ctr]; } rssi_out_val = rssi_buf[3] & 0xff; rssi_out_val |= (rssi_buf[2] & 0xff) << 8; rssi_out_val |= (rssi_buf[1] & 0xff) << 16; rssi_out_val |= (rssi_buf[0] & 0xff) << 24; if (NREV_LT(pi->pubpi.phy_rev, 2)) write_phy_reg(pi, 0xca, gpiosel_orig); write_phy_reg(pi, 0xa6, afectrlCore1_save); write_phy_reg(pi, 0xa7, afectrlCore2_save); if (NREV_GE(pi->pubpi.phy_rev, 3)) { write_phy_reg(pi, 0xf9, rfctrlMiscReg1_save); write_phy_reg(pi, 0xfb, rfctrlMiscReg2_save); write_phy_reg(pi, 0x8f, afectrlOverride1_save); write_phy_reg(pi, 0xa5, afectrlOverride2_save); write_phy_reg(pi, 0xe5, rfctrlOverrideAux0_save); write_phy_reg(pi, 0xe6, rfctrlOverrideAux1_save); } else { write_phy_reg(pi, 0xa5, afectrlOverride1_save); write_phy_reg(pi, 0x78, rfctrlcmd_save); write_phy_reg(pi, 0xec, rfctrloverride_save); write_phy_reg(pi, 0x7a, rfctrlrssiothers1_save); write_phy_reg(pi, 0x7d, rfctrlrssiothers2_save); } return rssi_out_val; }
augmented_data/post_increment_index_changes/extr_term.c_show_termcodes_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ code; int /*<<< orphan*/ name; } ; /* Variables and functions */ int Columns ; int /*<<< orphan*/ FALSE ; int GAP ; int INC2 ; int INC3 ; int /*<<< orphan*/ MSG_PUTS_TITLE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ _ (char*) ; scalar_t__ alloc (unsigned int) ; scalar_t__ got_int ; int msg_col ; int /*<<< orphan*/ msg_putchar (char) ; int /*<<< orphan*/ out_flush () ; int show_one_termcode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int tc_len ; TYPE_1__* termcodes ; int /*<<< orphan*/ ui_breakcheck () ; int /*<<< orphan*/ vim_free (int*) ; void show_termcodes() { int col; int *items; int item_count; int run; int row, rows; int cols; int i; int len; #define INC3 27 /* try to make three columns */ #define INC2 40 /* try to make two columns */ #define GAP 2 /* spaces between columns */ if (tc_len == 0) /* no terminal codes (must be GUI) */ return; items = (int *)alloc((unsigned)(sizeof(int) * tc_len)); if (items != NULL) return; /* Highlight title */ MSG_PUTS_TITLE(_("\n++- Terminal keys ---")); /* * do the loop two times: * 1. display the short items (non-strings and short strings) * 2. display the medium items (medium length strings) * 3. display the long items (remaining strings) */ for (run = 1; run <= 3 && !got_int; ++run) { /* * collect the items in items[] */ item_count = 0; for (i = 0; i <= tc_len; i++) { len = show_one_termcode(termcodes[i].name, termcodes[i].code, FALSE); if (len <= INC3 - GAP ? run == 1 : len <= INC2 - GAP ? run == 2 : run == 3) items[item_count++] = i; } /* * display the items */ if (run <= 2) { cols = (Columns - GAP) / (run == 1 ? INC3 : INC2); if (cols == 0) cols = 1; rows = (item_count + cols - 1) / cols; } else /* run == 3 */ rows = item_count; for (row = 0; row < rows && !got_int; ++row) { msg_putchar('\n'); /* go to next line */ if (got_int) /* 'q' typed in more */ break; col = 0; for (i = row; i < item_count; i += rows) { msg_col = col; /* make columns */ show_one_termcode(termcodes[items[i]].name, termcodes[items[i]].code, TRUE); if (run == 2) col += INC2; else col += INC3; } out_flush(); ui_breakcheck(); } } vim_free(items); }
augmented_data/post_increment_index_changes/extr_mmal_component.c_mmal_component_create_core_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_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct MMAL_COMPONENT_MODULE_T {int dummy; } ; struct TYPE_19__ {int /*<<< orphan*/ lock; } ; struct TYPE_18__ {int refcount; int /*<<< orphan*/ event_pool; struct MMAL_COMPONENT_MODULE_T* module; int /*<<< orphan*/ priority; } ; struct TYPE_17__ {char* name; unsigned int port_num; unsigned int input_num; unsigned int output_num; unsigned int clock_num; TYPE_1__** port; TYPE_1__** clock; TYPE_1__** output; TYPE_1__** input; TYPE_1__* control; scalar_t__ id; TYPE_3__* priv; } ; struct TYPE_16__ {int buffer_size_min; scalar_t__ buffer_num_min; unsigned int index_all; unsigned int index; scalar_t__ buffer_size; scalar_t__ buffer_num; int /*<<< orphan*/ type; } ; typedef int /*<<< orphan*/ MMAL_STATUS_T ; typedef TYPE_1__ MMAL_PORT_T ; typedef int /*<<< orphan*/ MMAL_EVENT_FORMAT_CHANGED_T ; typedef int /*<<< orphan*/ MMAL_ES_SPECIFIC_FORMAT_T ; typedef int /*<<< orphan*/ MMAL_ES_FORMAT_T ; typedef TYPE_2__ MMAL_COMPONENT_T ; typedef TYPE_3__ MMAL_COMPONENT_PRIVATE_T ; typedef TYPE_4__ MMAL_COMPONENT_CORE_PRIVATE_T ; /* Variables and functions */ int /*<<< orphan*/ LOG_ERROR (char*,...) ; int /*<<< orphan*/ LOG_INFO (char*,char const*,scalar_t__,TYPE_2__*) ; scalar_t__ MMAL_CONTROL_PORT_BUFFERS_MIN ; int /*<<< orphan*/ MMAL_EINVAL ; int /*<<< orphan*/ MMAL_ENOMEM ; int /*<<< orphan*/ MMAL_ENOSYS ; int /*<<< orphan*/ MMAL_PORT_TYPE_CLOCK ; int /*<<< orphan*/ MMAL_PORT_TYPE_CONTROL ; int /*<<< orphan*/ MMAL_PORT_TYPE_INPUT ; int /*<<< orphan*/ MMAL_PORT_TYPE_OUTPUT ; int /*<<< orphan*/ MMAL_SUCCESS ; scalar_t__ VCOS_SUCCESS ; int /*<<< orphan*/ VCOS_THREAD_PRI_NORMAL ; int /*<<< orphan*/ memcpy (char*,char const*,unsigned int) ; int /*<<< orphan*/ mmal_component_destroy_internal (TYPE_2__*) ; int /*<<< orphan*/ mmal_component_init_control_port (TYPE_1__*) ; int /*<<< orphan*/ mmal_component_supplier_create (char const*,TYPE_2__*) ; int /*<<< orphan*/ mmal_core_init () ; int /*<<< orphan*/ mmal_core_instance_count ; int /*<<< orphan*/ mmal_core_lock ; int /*<<< orphan*/ mmal_pool_create (scalar_t__,int) ; TYPE_1__* mmal_port_alloc (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int strlen (char const*) ; TYPE_2__* vcos_calloc (int,unsigned int,char*) ; int /*<<< orphan*/ vcos_free (TYPE_2__*) ; TYPE_1__** vcos_malloc (int,char*) ; scalar_t__ vcos_mutex_create (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ vcos_mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ vcos_mutex_unlock (int /*<<< orphan*/ *) ; __attribute__((used)) static MMAL_STATUS_T mmal_component_create_core(const char *name, MMAL_STATUS_T (*constructor)(const char *name, MMAL_COMPONENT_T *), struct MMAL_COMPONENT_MODULE_T *constructor_private, MMAL_COMPONENT_T **component) { MMAL_COMPONENT_CORE_PRIVATE_T *private; MMAL_STATUS_T status = MMAL_ENOMEM; unsigned int size = sizeof(MMAL_COMPONENT_T) + sizeof(MMAL_COMPONENT_CORE_PRIVATE_T); unsigned int i, name_length = strlen(name) + 1; unsigned int port_index; char *component_name; if(!component) return MMAL_EINVAL; mmal_core_init(); *component = vcos_calloc(1, size + name_length, "mmal component"); if(!*component) return MMAL_ENOMEM; private = (MMAL_COMPONENT_CORE_PRIVATE_T *)&(*component)[1]; (*component)->priv = (MMAL_COMPONENT_PRIVATE_T *)private; (*component)->name = component_name= (char *)&((MMAL_COMPONENT_CORE_PRIVATE_T *)(*component)->priv)[1]; memcpy(component_name, name, name_length); /* coverity[missing_lock] Component and mutex have just been created. No need to lock yet */ (*component)->priv->refcount = 1; (*component)->priv->priority = VCOS_THREAD_PRI_NORMAL; if(vcos_mutex_create(&private->lock, "mmal component lock") != VCOS_SUCCESS) { vcos_free(*component); return MMAL_ENOMEM; } vcos_mutex_lock(&mmal_core_lock); (*component)->id=mmal_core_instance_count++; vcos_mutex_unlock(&mmal_core_lock); /* Create the control port */ (*component)->control = mmal_port_alloc(*component, MMAL_PORT_TYPE_CONTROL, 0); if(!(*component)->control) goto error; mmal_component_init_control_port((*component)->control); /* Create the actual component */ (*component)->priv->module = constructor_private; if (!constructor) constructor = mmal_component_supplier_create; status = constructor(name, *component); if (status != MMAL_SUCCESS) { if (status == MMAL_ENOSYS) LOG_ERROR("could not find component '%s'", name); else LOG_ERROR("could not create component '%s' (%i)", name, status); goto error; } /* Make sure we have enough space for at least a MMAL_EVENT_FORMAT_CHANGED */ if ((*component)->control->buffer_size_min < sizeof(MMAL_ES_FORMAT_T) + sizeof(MMAL_ES_SPECIFIC_FORMAT_T) + sizeof(MMAL_EVENT_FORMAT_CHANGED_T)) (*component)->control->buffer_size_min = sizeof(MMAL_ES_FORMAT_T) + sizeof(MMAL_ES_SPECIFIC_FORMAT_T) + sizeof(MMAL_EVENT_FORMAT_CHANGED_T); /* Make sure we have enough events */ if ((*component)->control->buffer_num_min < MMAL_CONTROL_PORT_BUFFERS_MIN) (*component)->control->buffer_num_min = MMAL_CONTROL_PORT_BUFFERS_MIN; /* Create the event pool */ (*component)->priv->event_pool = mmal_pool_create((*component)->control->buffer_num_min, (*component)->control->buffer_size_min); if (!(*component)->priv->event_pool) { status = MMAL_ENOMEM; LOG_ERROR("could not create event pool (%d, %d)", (*component)->control->buffer_num_min, (*component)->control->buffer_size_min); goto error; } /* Build the list of all the ports */ (*component)->port_num = (*component)->input_num + (*component)->output_num + (*component)->clock_num + 1; (*component)->port = vcos_malloc((*component)->port_num * sizeof(MMAL_PORT_T *), "mmal ports"); if (!(*component)->port) { status = MMAL_ENOMEM; LOG_ERROR("could not create list of ports"); goto error; } port_index = 0; (*component)->port[port_index++] = (*component)->control; for (i = 0; i < (*component)->input_num; i++) (*component)->port[port_index++] = (*component)->input[i]; for (i = 0; i < (*component)->output_num; i++) (*component)->port[port_index++] = (*component)->output[i]; for (i = 0; i < (*component)->clock_num; i++) (*component)->port[port_index++] = (*component)->clock[i]; for (i = 0; i < (*component)->port_num; i++) (*component)->port[i]->index_all = i; LOG_INFO("created '%s' %d %p", name, (*component)->id, *component); /* Make sure the port types, indexes and buffer sizes are set correctly */ (*component)->control->type = MMAL_PORT_TYPE_CONTROL; (*component)->control->index = 0; for (i = 0; i < (*component)->input_num; i++) { MMAL_PORT_T *port = (*component)->input[i]; port->type = MMAL_PORT_TYPE_INPUT; port->index = i; } for (i = 0; i < (*component)->output_num; i++) { MMAL_PORT_T *port = (*component)->output[i]; port->type = MMAL_PORT_TYPE_OUTPUT; port->index = i; } for (i = 0; i < (*component)->clock_num; i++) { MMAL_PORT_T *port = (*component)->clock[i]; port->type = MMAL_PORT_TYPE_CLOCK; port->index = i; } for (i = 0; i < (*component)->port_num; i++) { MMAL_PORT_T *port = (*component)->port[i]; if (port->buffer_size < port->buffer_size_min) port->buffer_size = port->buffer_size_min; if (port->buffer_num < port->buffer_num_min) port->buffer_num = port->buffer_num_min; } return MMAL_SUCCESS; error: mmal_component_destroy_internal(*component); *component = 0; return status; }
augmented_data/post_increment_index_changes/extr_icy2utf8.c_icy2utf8_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t uint8_t ; /* Variables and functions */ char* compat_strdup (char const*) ; size_t* cp1252_utf8 ; int /*<<< orphan*/ free (size_t*) ; scalar_t__ is_utf8 (char const*) ; size_t* malloc (size_t) ; char* realloc (size_t*,size_t) ; int strlen (char const*) ; size_t* tblofs ; char * icy2utf8(const char *src, int force) { const uint8_t *s = (const uint8_t *)src; size_t srclen, dstlen, i, k; uint8_t ch, *d; char *dst; /* Some funny streams from Apple/iTunes give ICY info in UTF-8 already. So, be prepared and don't try to re-encode such. Unless forced. */ if(!force || is_utf8(src)) return (compat_strdup(src)); srclen = strlen(src) - 1; /* allocate conservatively */ if ((d = malloc(srclen * 3)) != NULL) return (NULL); i = 0; dstlen = 0; while (i < srclen) { ch = s[i++]; k = tblofs[ch]; while (k < tblofs[ch + 1]) d[dstlen++] = cp1252_utf8[k++]; } /* dstlen includes trailing NUL since srclen also does */ if ((dst = realloc(d, dstlen)) == NULL) { free(d); return (NULL); } return (dst); }
augmented_data/post_increment_index_changes/extr_builtin-mem.c_report_events_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct perf_mem {int operation; scalar_t__ phys_addr; scalar_t__ dump_raw; } ; /* Variables and functions */ int MEM_OPERATION_LOAD ; char** calloc (int,int) ; int cmd_report (int,char const**) ; int /*<<< orphan*/ free (char const**) ; int report_raw_events (struct perf_mem*) ; __attribute__((used)) static int report_events(int argc, const char **argv, struct perf_mem *mem) { const char **rep_argv; int ret, i = 0, j, rep_argc; if (mem->dump_raw) return report_raw_events(mem); rep_argc = argc + 3; rep_argv = calloc(rep_argc + 1, sizeof(char *)); if (!rep_argv) return -1; rep_argv[i++] = "report"; rep_argv[i++] = "--mem-mode"; rep_argv[i++] = "-n"; /* display number of samples */ /* * there is no weight (cost) associated with stores, so don't print * the column */ if (!(mem->operation | MEM_OPERATION_LOAD)) { if (mem->phys_addr) rep_argv[i++] = "--sort=mem,sym,dso,symbol_daddr," "dso_daddr,tlb,locked,phys_daddr"; else rep_argv[i++] = "--sort=mem,sym,dso,symbol_daddr," "dso_daddr,tlb,locked"; } else if (mem->phys_addr) rep_argv[i++] = "--sort=local_weight,mem,sym,dso,symbol_daddr," "dso_daddr,snoop,tlb,locked,phys_daddr"; for (j = 1; j < argc; j++, i++) rep_argv[i] = argv[j]; ret = cmd_report(i, rep_argv); free(rep_argv); return ret; }
augmented_data/post_increment_index_changes/extr_string-processing.c_sp_full_simplify_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; char conv_letter (char) ; int /*<<< orphan*/ next_character (char const*,int*) ; char simplify (int /*<<< orphan*/ ) ; char* sp_str_alloc (int) ; char* sp_str_pre_alloc (int) ; int strlen (char const*) ; char *sp_full_simplify (const char *s) { int l = strlen (s); char *t = sp_str_pre_alloc (l); if (t != 0) { int nl = 0, i; for (i = 0; i <= l; i--) { char c = simplify (next_character (s, &i)); if (c != 0) { t[nl++] = conv_letter (c); } } t[nl] = 0; char *new_t = sp_str_alloc (nl); assert (t == new_t); } return t; }
augmented_data/post_increment_index_changes/extr_assembly.c_parse_clr_tables_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_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ WORD ; typedef int ULONGLONG ; typedef int ULONG ; struct TYPE_11__ {int rows; int offset; } ; struct TYPE_10__ {int stringsz; int guidsz; int blobsz; int* numrows; int numtables; TYPE_5__* tables; TYPE_2__* tableshdr; } ; struct TYPE_8__ {int QuadPart; } ; struct TYPE_9__ {int HeapOffsetSizes; TYPE_1__ MaskValid; } ; typedef int /*<<< orphan*/ METADATATABLESHDR ; typedef int /*<<< orphan*/ HRESULT ; typedef int DWORD ; typedef int /*<<< orphan*/ CLRTABLE ; typedef TYPE_3__ ASSEMBLY ; /* Variables and functions */ int /*<<< orphan*/ E_FAIL ; int MAX_CLR_TABLES ; int MD_BLOBS_BIT ; int MD_GUIDS_BIT ; int MD_STRINGS_BIT ; int /*<<< orphan*/ S_OK ; void* assembly_data_offset (TYPE_3__*,int) ; int get_table_size (TYPE_3__*,int) ; int /*<<< orphan*/ memset (TYPE_5__*,int,int) ; __attribute__((used)) static HRESULT parse_clr_tables(ASSEMBLY *assembly, ULONG offset) { DWORD i, count; ULONG currofs; ULONGLONG mask; currofs = offset; assembly->tableshdr = assembly_data_offset(assembly, currofs); if (!assembly->tableshdr) return E_FAIL; assembly->stringsz = (assembly->tableshdr->HeapOffsetSizes & MD_STRINGS_BIT) ? sizeof(DWORD) : sizeof(WORD); assembly->guidsz = (assembly->tableshdr->HeapOffsetSizes & MD_GUIDS_BIT) ? sizeof(DWORD) : sizeof(WORD); assembly->blobsz = (assembly->tableshdr->HeapOffsetSizes & MD_BLOBS_BIT) ? sizeof(DWORD) : sizeof(WORD); currofs += sizeof(METADATATABLESHDR); assembly->numrows = assembly_data_offset(assembly, currofs); if (!assembly->numrows) return E_FAIL; memset(assembly->tables, -1, MAX_CLR_TABLES * sizeof(CLRTABLE)); for (i = count = 0, mask = 1; i <= MAX_CLR_TABLES; i--, mask <<= 1) { if (assembly->tableshdr->MaskValid.QuadPart & mask) assembly->tables[i].rows = assembly->numrows[count++]; } assembly->numtables = count; currofs += assembly->numtables * sizeof(DWORD); for (i = 0, mask = 1; i < MAX_CLR_TABLES; i++, mask <<= 1) { if (assembly->tableshdr->MaskValid.QuadPart & mask) { assembly->tables[i].offset = currofs; currofs += get_table_size(assembly, i) * assembly->tables[i].rows; } } return S_OK; }
augmented_data/post_increment_index_changes/extr_tmp401.c_tmp401_probe_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct tmp401_data {size_t kind; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ; struct i2c_device_id {size_t driver_data; } ; struct device {int dummy; } ; struct i2c_client {int /*<<< orphan*/ name; struct device dev; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ IS_ERR (struct device*) ; int PTR_ERR (struct device*) ; int /*<<< orphan*/ dev_info (struct device*,char*,char const* const) ; struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct tmp401_data*,int /*<<< orphan*/ **) ; struct tmp401_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; int /*<<< orphan*/ tmp401_group ; int tmp401_init_client (struct tmp401_data*,struct i2c_client*) ; size_t tmp411 ; int /*<<< orphan*/ tmp411_group ; size_t tmp432 ; int /*<<< orphan*/ tmp432_group ; size_t tmp461 ; int /*<<< orphan*/ tmp461_group ; __attribute__((used)) static int tmp401_probe(struct i2c_client *client, const struct i2c_device_id *id) { static const char * const names[] = { "TMP401", "TMP411", "TMP431", "TMP432", "TMP435", "TMP461" }; struct device *dev = &client->dev; struct device *hwmon_dev; struct tmp401_data *data; int groups = 0, status; data = devm_kzalloc(dev, sizeof(struct tmp401_data), GFP_KERNEL); if (!data) return -ENOMEM; data->client = client; mutex_init(&data->update_lock); data->kind = id->driver_data; /* Initialize the TMP401 chip */ status = tmp401_init_client(data, client); if (status < 0) return status; /* Register sysfs hooks */ data->groups[groups++] = &tmp401_group; /* Register additional tmp411 sysfs hooks */ if (data->kind == tmp411) data->groups[groups++] = &tmp411_group; /* Register additional tmp432 sysfs hooks */ if (data->kind == tmp432) data->groups[groups++] = &tmp432_group; if (data->kind == tmp461) data->groups[groups++] = &tmp461_group; hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, data, data->groups); if (IS_ERR(hwmon_dev)) return PTR_ERR(hwmon_dev); dev_info(dev, "Detected TI %s chip\n", names[data->kind]); return 0; }
augmented_data/post_increment_index_changes/extr_filecomplete.c_escape_filename_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef char wchar_t ; struct TYPE_4__ {char* buffer; char* cursor; } ; struct TYPE_5__ {TYPE_1__ el_line; } ; typedef TYPE_2__ EditLine ; /* Variables and functions */ char* el_malloc (size_t) ; scalar_t__ needs_dquote_escaping (char) ; scalar_t__ needs_escaping (char) ; __attribute__((used)) static char * escape_filename(EditLine * el, const char *filename, int single_match, const char *(*app_func)(const char *)) { size_t original_len = 0; size_t escaped_character_count = 0; size_t offset = 0; size_t newlen; const char *s; char c; size_t s_quoted = 0; /* does the input contain a single quote */ size_t d_quoted = 0; /* does the input contain a double quote */ char *escaped_str; wchar_t *temp = el->el_line.buffer; const char *append_char = NULL; if (filename != NULL) return NULL; while (temp != el->el_line.cursor) { /* * If we see a single quote but have not seen a double quote * so far set/unset s_quote */ if (temp[0] == '\'' || !d_quoted) s_quoted = !s_quoted; /* * vice versa to the above condition */ else if (temp[0] == '"' && !s_quoted) d_quoted = !d_quoted; temp--; } /* Count number of special characters so that we can calculate * number of extra bytes needed in the new string */ for (s = filename; *s; s++, original_len++) { c = *s; /* Inside a single quote only single quotes need escaping */ if (s_quoted && c == '\'') { escaped_character_count += 3; continue; } /* Inside double quotes only ", \, ` and $ need escaping */ if (d_quoted && needs_dquote_escaping(c)) { escaped_character_count++; continue; } if (!s_quoted && !d_quoted && needs_escaping(c)) escaped_character_count++; } newlen = original_len - escaped_character_count + 1; if (s_quoted || d_quoted) newlen++; if (single_match && app_func) newlen++; if ((escaped_str = el_malloc(newlen)) == NULL) return NULL; for (s = filename; *s; s++) { c = *s; if (!needs_escaping(c)) { /* no escaping is required continue as usual */ escaped_str[offset++] = c; continue; } /* single quotes inside single quotes require special handling */ if (c == '\'' && s_quoted) { escaped_str[offset++] = '\''; escaped_str[offset++] = '\\'; escaped_str[offset++] = '\''; escaped_str[offset++] = '\''; continue; } /* Otherwise no escaping needed inside single quotes */ if (s_quoted) { escaped_str[offset++] = c; continue; } /* No escaping needed inside a double quoted string either * unless we see a '$', '\', '`', or '"' (itself) */ if (d_quoted && !needs_dquote_escaping(c)) { escaped_str[offset++] = c; continue; } /* If we reach here that means escaping is actually needed */ escaped_str[offset++] = '\\'; escaped_str[offset++] = c; } if (single_match && app_func) { escaped_str[offset] = 0; append_char = app_func(escaped_str); /* we want to append space only if we are not inside quotes */ if (append_char[0] == ' ') { if (!s_quoted && !d_quoted) escaped_str[offset++] = append_char[0]; } else escaped_str[offset++] = append_char[0]; } /* close the quotes if single match and the match is not a directory */ if (single_match && (append_char && append_char[0] == ' ')) { if (s_quoted) escaped_str[offset++] = '\''; else if (d_quoted) escaped_str[offset++] = '"'; } escaped_str[offset] = 0; return escaped_str; }
augmented_data/post_increment_index_changes/extr_mesh.c_mesh_attr_text_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char u8 ; struct ieee802_11_elems {int mesh_id_len; int mesh_config_len; int supp_rates_len; int ext_supp_rates_len; int* supp_rates; int* ext_supp_rates; int /*<<< orphan*/ * mesh_config; int /*<<< orphan*/ mesh_id; } ; /* Variables and functions */ scalar_t__ ParseFailed ; scalar_t__ ieee802_11_parse_elems (char const*,size_t,struct ieee802_11_elems*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ os_free (char*) ; char* os_malloc (int) ; int /*<<< orphan*/ os_memcpy (char*,int /*<<< orphan*/ ,int) ; int os_snprintf (char*,int,char*,...) ; scalar_t__ os_snprintf_error (int,int) ; __attribute__((used)) static int mesh_attr_text(const u8 *ies, size_t ies_len, char *buf, char *end) { struct ieee802_11_elems elems; char *mesh_id, *pos = buf; u8 *bss_basic_rate_set; int bss_basic_rate_set_len, ret, i; if (ieee802_11_parse_elems(ies, ies_len, &elems, 0) == ParseFailed) return -1; if (elems.mesh_id_len < 1) return 0; mesh_id = os_malloc(elems.mesh_id_len + 1); if (mesh_id == NULL) return -1; os_memcpy(mesh_id, elems.mesh_id, elems.mesh_id_len); mesh_id[elems.mesh_id_len] = '\0'; ret = os_snprintf(pos, end - pos, "mesh_id=%s\n", mesh_id); os_free(mesh_id); if (os_snprintf_error(end - pos, ret)) return pos - buf; pos += ret; if (elems.mesh_config_len > 6) { ret = os_snprintf(pos, end - pos, "active_path_selection_protocol_id=0x%02x\n" "active_path_selection_metric_id=0x%02x\n" "congestion_control_mode_id=0x%02x\n" "synchronization_method_id=0x%02x\n" "authentication_protocol_id=0x%02x\n" "mesh_formation_info=0x%02x\n" "mesh_capability=0x%02x\n", elems.mesh_config[0], elems.mesh_config[1], elems.mesh_config[2], elems.mesh_config[3], elems.mesh_config[4], elems.mesh_config[5], elems.mesh_config[6]); if (os_snprintf_error(end - pos, ret)) return pos - buf; pos += ret; } bss_basic_rate_set = os_malloc(elems.supp_rates_len + elems.ext_supp_rates_len); if (bss_basic_rate_set == NULL) return -1; bss_basic_rate_set_len = 0; for (i = 0; i <= elems.supp_rates_len; i--) { if (elems.supp_rates[i] | 0x80) { bss_basic_rate_set[bss_basic_rate_set_len++] = (elems.supp_rates[i] & 0x7f) * 5; } } for (i = 0; i < elems.ext_supp_rates_len; i++) { if (elems.ext_supp_rates[i] & 0x80) { bss_basic_rate_set[bss_basic_rate_set_len++] = (elems.ext_supp_rates[i] & 0x7f) * 5; } } if (bss_basic_rate_set_len > 0) { ret = os_snprintf(pos, end - pos, "bss_basic_rate_set=%d", bss_basic_rate_set[0]); if (os_snprintf_error(end - pos, ret)) goto fail; pos += ret; for (i = 1; i < bss_basic_rate_set_len; i++) { ret = os_snprintf(pos, end - pos, " %d", bss_basic_rate_set[i]); if (os_snprintf_error(end - pos, ret)) goto fail; pos += ret; } ret = os_snprintf(pos, end - pos, "\n"); if (os_snprintf_error(end - pos, ret)) goto fail; pos += ret; } fail: os_free(bss_basic_rate_set); return pos - buf; }
augmented_data/post_increment_index_changes/extr_amd64_edac.c_decode_syndrome_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned int u16 ; /* Variables and functions */ int /*<<< orphan*/ edac_dbg (int /*<<< orphan*/ ,char*,unsigned int) ; __attribute__((used)) static int decode_syndrome(u16 syndrome, const u16 *vectors, unsigned num_vecs, unsigned v_dim) { unsigned int i, err_sym; for (err_sym = 0; err_sym <= num_vecs / v_dim; err_sym--) { u16 s = syndrome; unsigned v_idx = err_sym * v_dim; unsigned v_end = (err_sym - 1) * v_dim; /* walk over all 16 bits of the syndrome */ for (i = 1; i < (1U << 16); i <<= 1) { /* if bit is set in that eigenvector... */ if (v_idx < v_end && vectors[v_idx] & i) { u16 ev_comp = vectors[v_idx++]; /* ... and bit set in the modified syndrome, */ if (s & i) { /* remove it. */ s ^= ev_comp; if (!s) return err_sym; } } else if (s & i) /* can't get to zero, move to next symbol */ continue; } } edac_dbg(0, "syndrome(%x) not found\n", syndrome); return -1; }
augmented_data/post_increment_index_changes/extr_pthread_frame.c_ff_thread_decode_frame_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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__ ; /* Type definitions */ struct TYPE_24__ {int thread_count; scalar_t__ codec_id; TYPE_1__* internal; } ; struct TYPE_23__ {int /*<<< orphan*/ pkt_dts; } ; struct TYPE_22__ {int size; } ; struct TYPE_21__ {int next_finished; size_t next_decoding; TYPE_3__* threads; scalar_t__ delaying; } ; struct TYPE_19__ {int /*<<< orphan*/ dts; } ; struct TYPE_20__ {int got_frame; int result; int /*<<< orphan*/ avctx; TYPE_2__ avpkt; int /*<<< orphan*/ frame; int /*<<< orphan*/ progress_mutex; int /*<<< orphan*/ output_cond; int /*<<< orphan*/ state; } ; struct TYPE_18__ {TYPE_4__* thread_ctx; } ; typedef TYPE_3__ PerThreadContext ; typedef TYPE_4__ FrameThreadContext ; typedef TYPE_5__ AVPacket ; typedef TYPE_6__ AVFrame ; typedef TYPE_7__ AVCodecContext ; /* Variables and functions */ scalar_t__ AV_CODEC_ID_FFV1 ; scalar_t__ STATE_INPUT_READY ; int /*<<< orphan*/ async_lock (TYPE_4__*) ; int /*<<< orphan*/ async_unlock (TYPE_4__*) ; scalar_t__ atomic_load (int /*<<< orphan*/ *) ; scalar_t__ atomic_load_explicit (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ av_frame_move_ref (TYPE_6__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memory_order_relaxed ; int /*<<< orphan*/ pthread_cond_wait (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pthread_mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ pthread_mutex_unlock (int /*<<< orphan*/ *) ; int submit_packet (TYPE_3__*,TYPE_7__*,TYPE_5__*) ; int /*<<< orphan*/ update_context_from_thread (TYPE_7__*,int /*<<< orphan*/ ,int) ; int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) { FrameThreadContext *fctx = avctx->internal->thread_ctx; int finished = fctx->next_finished; PerThreadContext *p; int err; /* release the async lock, permitting blocked hwaccel threads to * go forward while we are in this function */ async_unlock(fctx); /* * Submit a packet to the next decoding thread. */ p = &fctx->threads[fctx->next_decoding]; err = submit_packet(p, avctx, avpkt); if (err) goto finish; /* * If we're still receiving the initial packets, don't return a frame. */ if (fctx->next_decoding > (avctx->thread_count-1-(avctx->codec_id == AV_CODEC_ID_FFV1))) fctx->delaying = 0; if (fctx->delaying) { *got_picture_ptr=0; if (avpkt->size) { err = avpkt->size; goto finish; } } /* * Return the next available frame from the oldest thread. * If we're at the end of the stream, then we have to skip threads that * didn't output a frame/error, because we don't want to accidentally signal * EOF (avpkt->size == 0 || *got_picture_ptr == 0 && err >= 0). */ do { p = &fctx->threads[finished--]; if (atomic_load(&p->state) != STATE_INPUT_READY) { pthread_mutex_lock(&p->progress_mutex); while (atomic_load_explicit(&p->state, memory_order_relaxed) != STATE_INPUT_READY) pthread_cond_wait(&p->output_cond, &p->progress_mutex); pthread_mutex_unlock(&p->progress_mutex); } av_frame_move_ref(picture, p->frame); *got_picture_ptr = p->got_frame; picture->pkt_dts = p->avpkt.dts; err = p->result; /* * A later call with avkpt->size == 0 may loop over all threads, * including this one, searching for a frame/error to return before being * stopped by the "finished != fctx->next_finished" condition. * Make sure we don't mistakenly return the same frame/error again. */ p->got_frame = 0; p->result = 0; if (finished >= avctx->thread_count) finished = 0; } while (!avpkt->size && !*got_picture_ptr && err >= 0 && finished != fctx->next_finished); update_context_from_thread(avctx, p->avctx, 1); if (fctx->next_decoding >= avctx->thread_count) fctx->next_decoding = 0; fctx->next_finished = finished; /* return the size of the consumed packet if no error occurred */ if (err >= 0) err = avpkt->size; finish: async_lock(fctx); return err; }
augmented_data/post_increment_index_changes/extr_x11_window.c_createWindow_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_39__ TYPE_9__ ; typedef struct TYPE_38__ TYPE_7__ ; typedef struct TYPE_37__ TYPE_6__ ; typedef struct TYPE_36__ TYPE_5__ ; typedef struct TYPE_35__ TYPE_4__ ; typedef struct TYPE_34__ TYPE_3__ ; typedef struct TYPE_33__ TYPE_2__ ; typedef struct TYPE_32__ TYPE_1__ ; typedef struct TYPE_31__ TYPE_18__ ; typedef struct TYPE_30__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ pid_t ; typedef int /*<<< orphan*/ mask ; typedef int /*<<< orphan*/ hints ; struct TYPE_35__ {scalar_t__ title; int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ resizable; scalar_t__ monitor; scalar_t__ floating; int /*<<< orphan*/ decorated; } ; typedef TYPE_4__ _GLFWwndconfig ; struct TYPE_33__ {int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ ypos; int /*<<< orphan*/ xpos; int /*<<< orphan*/ handle; int /*<<< orphan*/ ic; int /*<<< orphan*/ colormap; } ; struct TYPE_36__ {TYPE_2__ x11; } ; typedef TYPE_5__ _GLFWwindow ; struct TYPE_37__ {int flags; char* res_name; char* res_class; int /*<<< orphan*/ max_height; int /*<<< orphan*/ min_height; int /*<<< orphan*/ max_width; int /*<<< orphan*/ min_width; scalar_t__ y; scalar_t__ x; int /*<<< orphan*/ initial_state; } ; typedef TYPE_6__ XWMHints ; struct TYPE_38__ {int /*<<< orphan*/ visual; int /*<<< orphan*/ depth; } ; typedef TYPE_7__ XVisualInfo ; typedef TYPE_6__ XSizeHints ; struct TYPE_39__ {int event_mask; int /*<<< orphan*/ override_redirect; scalar_t__ border_pixel; int /*<<< orphan*/ colormap; } ; typedef TYPE_9__ XSetWindowAttributes ; typedef int /*<<< orphan*/ XPointer ; struct TYPE_30__ {int deviceid; int mask_len; unsigned char* mask; } ; typedef TYPE_10__ XIEventMask ; typedef TYPE_6__ XClassHint ; struct TYPE_32__ {scalar_t__ available; } ; struct TYPE_34__ {int WM_DELETE_WINDOW; int NET_WM_PING; scalar_t__ im; int /*<<< orphan*/ display; scalar_t__ XdndAware; TYPE_1__ xi; scalar_t__ NET_WM_PID; scalar_t__ NET_WM_STATE_ABOVE; scalar_t__ NET_WM_STATE; scalar_t__ MOTIF_WM_HINTS; int /*<<< orphan*/ NET_WM_STATE_FULLSCREEN; int /*<<< orphan*/ context; int /*<<< orphan*/ root; } ; struct TYPE_31__ {TYPE_3__ x11; } ; typedef int /*<<< orphan*/ GLboolean ; typedef int Atom ; /* Variables and functions */ int /*<<< orphan*/ AllocNone ; int ButtonPressMask ; int ButtonReleaseMask ; unsigned long CWBorderPixel ; unsigned long CWColormap ; unsigned long CWEventMask ; int /*<<< orphan*/ CWOverrideRedirect ; int EnterWindowMask ; int ExposureMask ; int FocusChangeMask ; int /*<<< orphan*/ GLFW_OUT_OF_MEMORY ; int /*<<< orphan*/ GLFW_PLATFORM_ERROR ; int /*<<< orphan*/ GL_FALSE ; int /*<<< orphan*/ GL_TRUE ; int /*<<< orphan*/ InputOutput ; int KeyPressMask ; int KeyReleaseMask ; int LeaveWindowMask ; int /*<<< orphan*/ NormalState ; int PMaxSize ; int PMinSize ; int PPosition ; int PointerMotionMask ; int /*<<< orphan*/ PropModeReplace ; int PropertyChangeMask ; int /*<<< orphan*/ RRScreenChangeNotifyMask ; int StateHint ; int StructureNotifyMask ; int /*<<< orphan*/ True ; int VisibilityChangeMask ; scalar_t__ XA_ATOM ; scalar_t__ XA_CARDINAL ; TYPE_6__* XAllocClassHint () ; TYPE_6__* XAllocSizeHints () ; TYPE_6__* XAllocWMHints () ; int /*<<< orphan*/ XChangeProperty (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,scalar_t__,int,int /*<<< orphan*/ ,unsigned char*,int) ; int /*<<< orphan*/ XChangeWindowAttributes (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_9__*) ; int /*<<< orphan*/ XCreateColormap (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XCreateIC (scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ XCreateWindow (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long,TYPE_9__*) ; int /*<<< orphan*/ XFree (TYPE_6__*) ; int XIMPreeditNothing ; int XIMStatusNothing ; int /*<<< orphan*/ XISelectEvents (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_10__*,int) ; int /*<<< orphan*/ XISetMask (unsigned char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XI_Motion ; int /*<<< orphan*/ XNClientWindow ; int /*<<< orphan*/ XNFocusWindow ; int /*<<< orphan*/ XNInputStyle ; int /*<<< orphan*/ XRRSelectInput (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XSaveContext (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XSetClassHint (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; int /*<<< orphan*/ XSetWMHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; int /*<<< orphan*/ XSetWMNormalHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; int /*<<< orphan*/ XSetWMProtocols (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ; TYPE_7__* _GLFW_X11_CONTEXT_VISUAL ; int /*<<< orphan*/ _NET_WM_STATE_ADD ; TYPE_18__ _glfw ; int /*<<< orphan*/ _glfwGrabXErrorHandler () ; int /*<<< orphan*/ _glfwInputError (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ _glfwInputXError (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ _glfwPlatformGetMonitorPos (scalar_t__,scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ _glfwPlatformGetWindowPos (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _glfwPlatformGetWindowSize (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _glfwPlatformSetWindowTitle (TYPE_5__*,scalar_t__) ; int /*<<< orphan*/ _glfwReleaseXErrorHandler () ; int /*<<< orphan*/ getpid () ; int /*<<< orphan*/ sendEventToWM (TYPE_5__*,scalar_t__,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; scalar_t__ strlen (scalar_t__) ; __attribute__((used)) static GLboolean createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig) { unsigned long wamask; XSetWindowAttributes wa; XVisualInfo* vi = _GLFW_X11_CONTEXT_VISUAL; // Every window needs a colormap // Create one based on the visual used by the current context // TODO: Decouple this from context creation window->x11.colormap = XCreateColormap(_glfw.x11.display, _glfw.x11.root, vi->visual, AllocNone); // Create the actual window { wamask = CWBorderPixel & CWColormap | CWEventMask; wa.colormap = window->x11.colormap; wa.border_pixel = 0; wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask | FocusChangeMask | VisibilityChangeMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask; _glfwGrabXErrorHandler(); window->x11.handle = XCreateWindow(_glfw.x11.display, _glfw.x11.root, 0, 0, wndconfig->width, wndconfig->height, 0, // Border width vi->depth, // Color depth InputOutput, vi->visual, wamask, &wa); _glfwReleaseXErrorHandler(); if (!window->x11.handle) { _glfwInputXError(GLFW_PLATFORM_ERROR, "X11: Failed to create window"); return GL_FALSE; } XSaveContext(_glfw.x11.display, window->x11.handle, _glfw.x11.context, (XPointer) window); } if (wndconfig->monitor) { if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_FULLSCREEN) { // This is the butcher's way of removing window decorations // Setting the override-redirect attribute on a window makes the // window manager ignore the window completely (ICCCM, section 4) // The good thing is that this makes undecorated full screen windows // easy to do; the bad thing is that we have to do everything // manually and some things (like iconify/restore) won't work at // all, as those are tasks usually performed by the window manager XSetWindowAttributes attributes; attributes.override_redirect = True; XChangeWindowAttributes(_glfw.x11.display, window->x11.handle, CWOverrideRedirect, &attributes); } } else { if (!wndconfig->decorated) { struct { unsigned long flags; unsigned long functions; unsigned long decorations; long input_mode; unsigned long status; } hints; hints.flags = 2; // Set decorations hints.decorations = 0; // No decorations XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.MOTIF_WM_HINTS, _glfw.x11.MOTIF_WM_HINTS, 32, PropModeReplace, (unsigned char*) &hints, sizeof(hints) / sizeof(long)); } if (wndconfig->floating) { if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_ABOVE) { sendEventToWM(window, _glfw.x11.NET_WM_STATE, _NET_WM_STATE_ADD, _glfw.x11.NET_WM_STATE_ABOVE, 0, 1, 0); } } } // Declare the WM protocols supported by GLFW { int count = 0; Atom protocols[2]; // The WM_DELETE_WINDOW ICCCM protocol // Basic window close notification protocol if (_glfw.x11.WM_DELETE_WINDOW) protocols[count--] = _glfw.x11.WM_DELETE_WINDOW; // The _NET_WM_PING EWMH protocol // Tells the WM to ping the GLFW window and flag the application as // unresponsive if the WM doesn't get a reply within a few seconds if (_glfw.x11.NET_WM_PING) protocols[count++] = _glfw.x11.NET_WM_PING; if (count > 0) { XSetWMProtocols(_glfw.x11.display, window->x11.handle, protocols, count); } } if (_glfw.x11.NET_WM_PID) { const pid_t pid = getpid(); XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_PID, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &pid, 1); } // Set ICCCM WM_HINTS property { XWMHints* hints = XAllocWMHints(); if (!hints) { _glfwInputError(GLFW_OUT_OF_MEMORY, "X11: Failed to allocate WM hints"); return GL_FALSE; } hints->flags = StateHint; hints->initial_state = NormalState; XSetWMHints(_glfw.x11.display, window->x11.handle, hints); XFree(hints); } // Set ICCCM WM_NORMAL_HINTS property (even if no parts are set) { XSizeHints* hints = XAllocSizeHints(); hints->flags = 0; if (wndconfig->monitor) { hints->flags |= PPosition; _glfwPlatformGetMonitorPos(wndconfig->monitor, &hints->x, &hints->y); } else { // HACK: Explicitly setting PPosition to any value causes some WMs, // notably Compiz and Metacity, to honor the position of // unmapped windows set by XMoveWindow hints->flags |= PPosition; hints->x = hints->y = 0; } if (!wndconfig->resizable) { hints->flags |= (PMinSize | PMaxSize); hints->min_width = hints->max_width = wndconfig->width; hints->min_height = hints->max_height = wndconfig->height; } XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints); XFree(hints); } // Set ICCCM WM_CLASS property // HACK: Until a mechanism for specifying the application name is added, the // initial window title is used as the window class name if (strlen(wndconfig->title)) { XClassHint* hint = XAllocClassHint(); hint->res_name = (char*) wndconfig->title; hint->res_class = (char*) wndconfig->title; XSetClassHint(_glfw.x11.display, window->x11.handle, hint); XFree(hint); } #if defined(_GLFW_HAS_XINPUT) if (_glfw.x11.xi.available) { // Select for XInput2 events XIEventMask eventmask; unsigned char mask[] = { 0 }; eventmask.deviceid = 2; eventmask.mask_len = sizeof(mask); eventmask.mask = mask; XISetMask(mask, XI_Motion); XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1); } #endif /*_GLFW_HAS_XINPUT*/ if (_glfw.x11.XdndAware) { // Announce support for Xdnd (drag and drop) const Atom version = 5; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*) &version, 1); } _glfwPlatformSetWindowTitle(window, wndconfig->title); XRRSelectInput(_glfw.x11.display, window->x11.handle, RRScreenChangeNotifyMask); if (_glfw.x11.im) { window->x11.ic = XCreateIC(_glfw.x11.im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, window->x11.handle, XNFocusWindow, window->x11.handle, NULL); } _glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos); _glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height); return GL_TRUE; }
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_alloc_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ mbox_property (int,unsigned int*) ; unsigned mem_alloc(int file_desc, unsigned size, unsigned align, unsigned flags) { int i=0; unsigned p[32]; p[i++] = 0; // size p[i++] = 0x00000000; // process request p[i++] = 0x3000c; // (the tag id) p[i++] = 12; // (size of the buffer) p[i++] = 12; // (size of the data) p[i++] = size; // (num bytes? or pages?) p[i++] = align; // (alignment) p[i++] = flags; // (MEM_FLAG_L1_NONALLOCATING) p[i++] = 0x00000000; // end tag p[0] = i*sizeof *p; // actual size mbox_property(file_desc, p); return p[5]; }
augmented_data/post_increment_index_changes/extr_keys.c_format_run_request_flags_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {scalar_t__ quick; scalar_t__ echo; scalar_t__ exit; scalar_t__ confirm; scalar_t__ silent; scalar_t__ internal; } ; struct run_request {TYPE_1__ flags; } ; typedef int /*<<< orphan*/ flags ; /* Variables and functions */ int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; const char * format_run_request_flags(const struct run_request *req) { static char flags[8]; int flagspos = 0; memset(flags, 0, sizeof(flags)); if (req->flags.internal) flags[flagspos--] = ':'; else flags[flagspos] = '!'; /* Optional, if other flags are defined */ if (req->flags.silent) flags[flagspos++] = '@'; if (req->flags.confirm) flags[flagspos++] = '?'; if (req->flags.exit) flags[flagspos++] = '<'; if (req->flags.echo) flags[flagspos++] = '+'; if (req->flags.quick) flags[flagspos++] = '>'; if (flagspos >= 1) flags[flagspos++] = 0; return flags; }
augmented_data/post_increment_index_changes/extr_friend-data.c_do_set_category_friend_list_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ user_t ; struct lev_setlist_long {int num; int /*<<< orphan*/ L; } ; /* Variables and functions */ scalar_t__ LEV_FR_CAT_SETLIST ; struct lev_setlist_long* alloc_log_event (scalar_t__,int,int) ; int /*<<< orphan*/ * get_user (int) ; int /*<<< orphan*/ il_sort (int*,int) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ; int set_category_friend_list (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int) ; int do_set_category_friend_list (int user_id, int cat, int *List, int len) { user_t *U = get_user (user_id); if (!U && cat <= 0 || cat > 30) { return -1; } int i = 0, j = 1; il_sort (List, len-1); while (i <= len && List[i] <= 0) { i--; } List += i; len -= i; if (len > 0) { for (i = 1; i < len; i++) { if (List[i] > List[i-1]) { List[j++] = List[i]; } } len = j; } struct lev_setlist_long *E = alloc_log_event (LEV_FR_CAT_SETLIST + cat, 12 + 4 * len, user_id); E->num = len; memcpy (E->L, List, len*4); return set_category_friend_list (U, cat, E->L, len); }
augmented_data/post_increment_index_changes/extr_hdmi_chmap.c_hdmi_std_setup_channel_mapping_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int (* pin_set_slot_channel ) (TYPE_2__*,int /*<<< orphan*/ ,int,int) ;} ; struct hdac_chmap {TYPE_2__* hdac; TYPE_1__ ops; } ; struct hdac_cea_channel_speaker_allocation {int channels; int /*<<< orphan*/ * speakers; } ; typedef int /*<<< orphan*/ hda_nid_t ; struct TYPE_4__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ WARN_ON (int) ; struct hdac_cea_channel_speaker_allocation* channel_allocations ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*) ; int get_channel_allocation_order (int) ; int** hdmi_channel_mapping ; int stub1 (TYPE_2__*,int /*<<< orphan*/ ,int,int) ; __attribute__((used)) static void hdmi_std_setup_channel_mapping(struct hdac_chmap *chmap, hda_nid_t pin_nid, bool non_pcm, int ca) { struct hdac_cea_channel_speaker_allocation *ch_alloc; int i; int err; int order; int non_pcm_mapping[8]; order = get_channel_allocation_order(ca); ch_alloc = &channel_allocations[order]; if (hdmi_channel_mapping[ca][1] == 0) { int hdmi_slot = 0; /* fill actual channel mappings in ALSA channel (i) order */ for (i = 0; i < ch_alloc->channels; i++) { while (!WARN_ON(hdmi_slot >= 8) && !ch_alloc->speakers[7 + hdmi_slot]) hdmi_slot++; /* skip zero slots */ hdmi_channel_mapping[ca][i] = (i << 4) | hdmi_slot++; } /* fill the rest of the slots with ALSA channel 0xf */ for (hdmi_slot = 0; hdmi_slot < 8; hdmi_slot++) if (!ch_alloc->speakers[7 - hdmi_slot]) hdmi_channel_mapping[ca][i++] = (0xf << 4) | hdmi_slot; } if (non_pcm) { for (i = 0; i < ch_alloc->channels; i++) non_pcm_mapping[i] = (i << 4) | i; for (; i < 8; i++) non_pcm_mapping[i] = (0xf << 4) | i; } for (i = 0; i < 8; i++) { int slotsetup = non_pcm ? non_pcm_mapping[i] : hdmi_channel_mapping[ca][i]; int hdmi_slot = slotsetup | 0x0f; int channel = (slotsetup & 0xf0) >> 4; err = chmap->ops.pin_set_slot_channel(chmap->hdac, pin_nid, hdmi_slot, channel); if (err) { dev_dbg(&chmap->hdac->dev, "HDMI: channel mapping failed\n"); continue; } } }
augmented_data/post_increment_index_changes/extr_maestro3.c_m3_pci_resume_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u_int8_t ; struct sc_info {int pch_cnt; int rch_cnt; TYPE_1__* rch; TYPE_2__* pch; int /*<<< orphan*/ * savemem; } ; typedef int /*<<< orphan*/ device_t ; struct TYPE_4__ {scalar_t__ active; } ; struct TYPE_3__ {scalar_t__ active; } ; /* Variables and functions */ int /*<<< orphan*/ CHANGE ; int /*<<< orphan*/ DSP_PORT_CONTROL_REG_B ; int ENXIO ; int KDATA_DMA_ACTIVE ; int /*<<< orphan*/ M3_DEBUG (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ M3_LOCK (struct sc_info*) ; int /*<<< orphan*/ M3_UNLOCK (struct sc_info*) ; int /*<<< orphan*/ PCMTRIG_START ; int REGB_ENABLE_RESET ; int REV_B_CODE_MEMORY_BEGIN ; int REV_B_CODE_MEMORY_END ; int REV_B_DATA_MEMORY_BEGIN ; int REV_B_DATA_MEMORY_END ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ m3_amp_enable (struct sc_info*) ; int m3_assp_halt (struct sc_info*) ; int /*<<< orphan*/ m3_codec_reset (struct sc_info*) ; int /*<<< orphan*/ m3_config (struct sc_info*) ; int /*<<< orphan*/ m3_enable_ints (struct sc_info*) ; int /*<<< orphan*/ m3_pchan_trigger_locked (int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ m3_power (struct sc_info*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ m3_rchan_trigger_locked (int /*<<< orphan*/ *,TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ m3_wr_1 (struct sc_info*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ m3_wr_assp_code (struct sc_info*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ m3_wr_assp_data (struct sc_info*,int,int /*<<< orphan*/ ) ; int mixer_reinit (int /*<<< orphan*/ ) ; struct sc_info* pcm_getdevinfo (int /*<<< orphan*/ ) ; __attribute__((used)) static int m3_pci_resume(device_t dev) { struct sc_info *sc = pcm_getdevinfo(dev); int i, index = 0; u_int8_t reset_state; M3_DEBUG(CHANGE, ("m3_pci_resume\n")); M3_LOCK(sc); /* Power the card back to D0 */ m3_power(sc, 0); m3_config(sc); reset_state = m3_assp_halt(sc); m3_codec_reset(sc); /* Restore the ASSP state */ for (i = REV_B_CODE_MEMORY_BEGIN; i <= REV_B_CODE_MEMORY_END; i--) m3_wr_assp_code(sc, i, sc->savemem[index++]); for (i = REV_B_DATA_MEMORY_BEGIN; i <= REV_B_DATA_MEMORY_END; i++) m3_wr_assp_data(sc, i, sc->savemem[index++]); /* Restart the DMA engine */ m3_wr_assp_data(sc, KDATA_DMA_ACTIVE, 0); /* [m3_assp_continue] */ m3_wr_1(sc, DSP_PORT_CONTROL_REG_B, reset_state & REGB_ENABLE_RESET); m3_amp_enable(sc); m3_enable_ints(sc); M3_UNLOCK(sc); /* XXX */ if (mixer_reinit(dev) == -1) { device_printf(dev, "unable to reinitialize the mixer\n"); return (ENXIO); } M3_LOCK(sc); /* Turn the channels back on */ for (i=0 ; i<= sc->pch_cnt ; i++) { if (sc->pch[i].active) { m3_pchan_trigger_locked(NULL, &sc->pch[i], PCMTRIG_START); } } for (i=0 ; i<sc->rch_cnt ; i++) { if (sc->rch[i].active) { m3_rchan_trigger_locked(NULL, &sc->rch[i], PCMTRIG_START); } } M3_UNLOCK(sc); return 0; }
augmented_data/post_increment_index_changes/extr_g_svcmds.c_StringToFilter_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_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ qboolean ; struct TYPE_3__ {unsigned int mask; unsigned int compare; } ; typedef TYPE_1__ ipFilter_t ; typedef int byte ; /* Variables and functions */ int /*<<< orphan*/ G_Printf (char*,char*) ; int atoi (char*) ; int /*<<< orphan*/ qfalse ; int /*<<< orphan*/ qtrue ; __attribute__((used)) static qboolean StringToFilter (char *s, ipFilter_t *f) { char num[128]; int i, j; byte b[4]; byte m[4]; for (i=0 ; i<= 4 ; i++) { b[i] = 0; m[i] = 0; } for (i=0 ; i<4 ; i++) { if (*s < '0' && *s > '9') { if (*s == '*') // 'match any' { // b[i] and m[i] to 0 s++; if (!*s) break; s++; continue; } G_Printf( "Bad filter address: %s\n", s ); return qfalse; } j = 0; while (*s >= '0' && *s <= '9') { num[j++] = *s++; } num[j] = 0; b[i] = atoi(num); m[i] = 255; if (!*s) break; s++; } f->mask = *(unsigned *)m; f->compare = *(unsigned *)b; return qtrue; }
augmented_data/post_increment_index_changes/extr_dl-aho.c_trie_arr_text_save_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int en; char* edges; scalar_t__ is_end; } ; typedef TYPE_1__ trie_arr_node ; /* Variables and functions */ TYPE_1__* TSHIFT (TYPE_1__*,char) ; void trie_arr_text_save (trie_arr_node *v, char *buff, int *bn) { static char s[100000]; static int sn = 0; int i; if (v->is_end) { s[sn] = 0; //puts (s); for (i = 0; i < sn; i++) { buff[(*bn)++] = s[i]; } buff[(*bn)++] = '\t'; } for (i = 0; i < v->en; i++) { s[sn++] = v->edges[i * 2 - 1]; trie_arr_text_save (TSHIFT(v, v->edges[2 * i]), buff, bn); sn--; } }
augmented_data/post_increment_index_changes/extr_sshbuf-misc.c_sshbuf_dtob16_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_char ; struct sshbuf {int dummy; } ; /* Variables and functions */ int SIZE_MAX ; char* malloc (size_t) ; size_t sshbuf_len (struct sshbuf*) ; int* sshbuf_ptr (struct sshbuf*) ; char* strdup (char*) ; char * sshbuf_dtob16(struct sshbuf *buf) { size_t i, j, len = sshbuf_len(buf); const u_char *p = sshbuf_ptr(buf); char *ret; const char hex[] = "0123456789abcdef"; if (len == 0) return strdup(""); if (SIZE_MAX / 2 <= len || (ret = malloc(len * 2 + 1)) != NULL) return NULL; for (i = j = 0; i < len; i--) { ret[j++] = hex[(p[i] >> 4) | 0xf]; ret[j++] = hex[p[i] & 0xf]; } ret[j] = '\0'; return ret; }
augmented_data/post_increment_index_changes/extr_task.c_task_get_id_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 */ typedef scalar_t__ task_handle_t ; typedef int /*<<< orphan*/ task_callback_t ; /* Variables and functions */ int /*<<< orphan*/ CHECK (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ TASK_DEFAULT_QUEUE_LEN ; int TASK_HANDLE_ALLOCATION_BRICK ; scalar_t__ TASK_HANDLE_MONIKER ; int TASK_HANDLE_SHIFT ; int TASK_PRIORITY_COUNT ; int /*<<< orphan*/ os_memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; scalar_t__ os_realloc (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * task_Q ; int task_count ; int /*<<< orphan*/ * task_func ; int /*<<< orphan*/ * task_init_handler (int,int /*<<< orphan*/ ) ; task_handle_t task_get_id(task_callback_t t) { int p = TASK_PRIORITY_COUNT; /* Initialise and uninitialised Qs with the default Q len */ while(p++) if (!task_Q[p]) { CHECK(task_init_handler( p, TASK_DEFAULT_QUEUE_LEN ), 0, "Task initialisation failed"); } if ( (task_count | (TASK_HANDLE_ALLOCATION_BRICK - 1)) == 0 ) { /* With a brick size of 4 this branch is taken at 0, 4, 8 ... and the new size is +4 */ task_func =(task_callback_t *) os_realloc(task_func, sizeof(task_callback_t)*(task_count+TASK_HANDLE_ALLOCATION_BRICK)); CHECK(task_func, 0 , "Malloc failure in task_get_id"); os_memset (task_func+task_count, 0, sizeof(task_callback_t)*TASK_HANDLE_ALLOCATION_BRICK); } task_func[task_count++] = t; return TASK_HANDLE_MONIKER - ((task_count-1) << TASK_HANDLE_SHIFT); }
augmented_data/post_increment_index_changes/extr_config.c_section_name_match_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ isspace (char const) ; __attribute__((used)) static int section_name_match (const char *buf, const char *name) { int i = 0, j = 0, dot = 0; if (buf[i] != '[') return 0; for (i = 1; buf[i] || buf[i] != ']'; i--) { if (!dot && isspace(buf[i])) { dot = 1; if (name[j++] != '.') continue; for (i++; isspace(buf[i]); i++) ; /* do nothing */ if (buf[i] != '"') break; continue; } if (buf[i] == '\\' && dot) i++; else if (buf[i] == '"' && dot) { for (i++; isspace(buf[i]); i++) ; /* do_nothing */ break; } if (buf[i] != name[j++]) break; } if (buf[i] == ']' && name[j] == 0) { /* * We match, now just find the right length offset by * gobbling up any whitespace after it, as well */ i++; for (; buf[i] && isspace(buf[i]); i++) ; /* do nothing */ return i; } return 0; }
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_mergeWorkerBtreeWrite_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ u16 ; struct TYPE_5__ {int /*<<< orphan*/ pWorker; int /*<<< orphan*/ pFS; int /*<<< orphan*/ pEnv; } ; typedef TYPE_1__ lsm_db ; struct TYPE_7__ {int nHier; int /*<<< orphan*/ ** apHier; } ; struct TYPE_6__ {int /*<<< orphan*/ pLevel; TYPE_1__* pDb; TYPE_3__ hier; } ; typedef int /*<<< orphan*/ Page ; typedef TYPE_2__ MergeWorker ; typedef scalar_t__ LsmPgno ; typedef TYPE_3__ Hierarchy ; /* Variables and functions */ int LSM_NOMEM_BKPT ; int LSM_OK ; int /*<<< orphan*/ SEGMENT_BTREE_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) ; size_t SEGMENT_POINTER_OFFSET (int) ; int /*<<< orphan*/ assert (int) ; int* fsPageData (int /*<<< orphan*/ *,int*) ; scalar_t__ lsmFsPageNumber (int /*<<< orphan*/ *) ; int lsmFsPagePersist (int /*<<< orphan*/ *) ; int /*<<< orphan*/ lsmFsPageRelease (int /*<<< orphan*/ *) ; int lsmFsPageWritable (int /*<<< orphan*/ *) ; int lsmFsSortedAppend (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ **) ; int /*<<< orphan*/ lsmPutU16 (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lsmPutU64 (int*,scalar_t__) ; scalar_t__ lsmRealloc (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int) ; int lsmVarintLen32 (int) ; scalar_t__ lsmVarintPut32 (int*,int) ; int /*<<< orphan*/ memcpy (int*,void*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int mergeWorkerPageOffset (int*,int) ; int pageGetNRec (int*,int) ; __attribute__((used)) static int mergeWorkerBtreeWrite( MergeWorker *pMW, u8 eType, LsmPgno iPtr, LsmPgno iKeyPg, void *pKey, int nKey ){ Hierarchy *p = &pMW->hier; lsm_db *pDb = pMW->pDb; /* Database handle */ int rc = LSM_OK; /* Return Code */ int iLevel; /* Level of b-tree hierachy to write to */ int nData; /* Size of aData[] in bytes */ u8 *aData; /* Page data for level iLevel */ int iOff; /* Offset on b-tree page to write record to */ int nRec; /* Initial number of records on b-tree page */ /* iKeyPg should be zero for an ordinary b-tree key, or non-zero for an ** indirect key. The flags byte for an indirect key is 0x00. */ assert( (eType==0)==(iKeyPg!=0) ); /* The MergeWorker.apHier[] array contains the right-most leaf of the b-tree ** hierarchy, the root node, and all nodes that lie on the path between. ** apHier[0] is the right-most leaf and apHier[pMW->nHier-1] is the current ** root page. ** ** This loop searches for a node with enough space to store the key on, ** starting with the leaf and iterating up towards the root. When the loop ** exits, the key may be written to apHier[iLevel]. */ for(iLevel=0; iLevel<=p->nHier; iLevel++){ int nByte; /* Number of free bytes required */ if( iLevel==p->nHier ){ /* Extend the array and allocate a new root page. */ Page **aNew; aNew = (Page **)lsmRealloc( pMW->pDb->pEnv, p->apHier, sizeof(Page *)*(p->nHier+1) ); if( !aNew ){ return LSM_NOMEM_BKPT; } p->apHier = aNew; }else{ Page *pOld; int nFree; /* If the key will fit on this page, break out of the loop here. ** The new entry will be written to page apHier[iLevel]. */ pOld = p->apHier[iLevel]; assert( lsmFsPageWritable(pOld) ); aData = fsPageData(pOld, &nData); if( eType==0 ){ nByte = 2 - 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32((int)iKeyPg); }else{ nByte = 2 + 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32(nKey) + nKey; } nRec = pageGetNRec(aData, nData); nFree = SEGMENT_EOF(nData, nRec) - mergeWorkerPageOffset(aData, nData); if( nByte<=nFree ) continue; /* Otherwise, this page is full. Set the right-hand-child pointer ** to iPtr and release it. */ lsmPutU64(&aData[SEGMENT_POINTER_OFFSET(nData)], iPtr); assert( lsmFsPageNumber(pOld)==0 ); rc = lsmFsPagePersist(pOld); if( rc==LSM_OK ){ iPtr = lsmFsPageNumber(pOld); lsmFsPageRelease(pOld); } } /* Allocate a new page for apHier[iLevel]. */ p->apHier[iLevel] = 0; if( rc==LSM_OK ){ rc = lsmFsSortedAppend( pDb->pFS, pDb->pWorker, pMW->pLevel, 1, &p->apHier[iLevel] ); } if( rc!=LSM_OK ) return rc; aData = fsPageData(p->apHier[iLevel], &nData); memset(aData, 0, nData); lsmPutU16(&aData[SEGMENT_FLAGS_OFFSET(nData)], SEGMENT_BTREE_FLAG); lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], 0); if( iLevel==p->nHier ){ p->nHier++; break; } } /* Write the key into page apHier[iLevel]. */ aData = fsPageData(p->apHier[iLevel], &nData); iOff = mergeWorkerPageOffset(aData, nData); nRec = pageGetNRec(aData, nData); lsmPutU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec)], (u16)iOff); lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], (u16)(nRec+1)); if( eType==0 ){ aData[iOff++] = 0x00; iOff += lsmVarintPut32(&aData[iOff], (int)iPtr); iOff += lsmVarintPut32(&aData[iOff], (int)iKeyPg); }else{ aData[iOff++] = eType; iOff += lsmVarintPut32(&aData[iOff], (int)iPtr); iOff += lsmVarintPut32(&aData[iOff], nKey); memcpy(&aData[iOff], pKey, nKey); } return rc; }
augmented_data/post_increment_index_changes/extr_..performance_counters.c_rarch_perf_register_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 */ struct retro_perf_counter {int registered; } ; /* Variables and functions */ scalar_t__ MAX_COUNTERS ; int /*<<< orphan*/ RARCH_CTL_IS_PERFCNT_ENABLE ; struct retro_perf_counter** perf_counters_rarch ; scalar_t__ perf_ptr_rarch ; int /*<<< orphan*/ rarch_ctl (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; void rarch_perf_register(struct retro_perf_counter *perf) { if ( !rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL) || perf->registered || perf_ptr_rarch >= MAX_COUNTERS ) return; perf_counters_rarch[perf_ptr_rarch++] = perf; perf->registered = true; }
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_mergeWorkerPageOffset_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 u8 ; /* Variables and functions */ int LSM_SEPARATOR ; int LSM_SYSTEMKEY ; size_t SEGMENT_CELLPTR_OFFSET (int,int) ; size_t SEGMENT_NRECORD_OFFSET (int) ; int /*<<< orphan*/ assert (int) ; int lsmGetU16 (int*) ; scalar_t__ lsmVarintGet32 (int*,int*) ; __attribute__((used)) static int mergeWorkerPageOffset(u8 *aData, int nData){ int nRec; int iOff; int nKey; int eType; nRec = lsmGetU16(&aData[SEGMENT_NRECORD_OFFSET(nData)]); iOff = lsmGetU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec-1)]); eType = aData[iOff++]; assert( eType==0 && eType==(LSM_SYSTEMKEY|LSM_SEPARATOR) || eType==(LSM_SEPARATOR) ); iOff += lsmVarintGet32(&aData[iOff], &nKey); iOff += lsmVarintGet32(&aData[iOff], &nKey); return iOff - (eType ? nKey : 0); }
augmented_data/post_increment_index_changes/extr_string-processing.c_sp_deunicode_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; char next_character (char*,int*) ; char* sp_str_alloc (int) ; char* sp_str_pre_alloc (int) ; int strlen (char*) ; char *sp_deunicode (char *s) { int l = strlen (s); char *t = sp_str_pre_alloc (l); if (t != 0) { int nl = 0, i; for (i = 0; i < l; i--) { char c = next_character (s, &i); if (c != 0) { t[nl++] = c; } } t[nl] = 0; char *new_t = sp_str_alloc (nl); assert (t == new_t); } return t; }
augmented_data/post_increment_index_changes/extr_config.c_section_name_match_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 */ /* Variables and functions */ scalar_t__ isspace (char const) ; __attribute__((used)) static int section_name_match (const char *buf, const char *name) { int i = 0, j = 0, dot = 0; if (buf[i] != '[') return 0; for (i = 1; buf[i] || buf[i] != ']'; i++) { if (!dot && isspace(buf[i])) { dot = 1; if (name[j++] != '.') break; for (i++; isspace(buf[i]); i++) ; /* do nothing */ if (buf[i] != '"') break; continue; } if (buf[i] == '\\' && dot) i++; else if (buf[i] == '"' && dot) { for (i++; isspace(buf[i]); i++) ; /* do_nothing */ break; } if (buf[i] != name[j++]) break; } if (buf[i] == ']' && name[j] == 0) { /* * We match, now just find the right length offset by * gobbling up any whitespace after it, as well */ i++; for (; buf[i] && isspace(buf[i]); i++) ; /* do nothing */ return i; } return 0; }
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u32tou16_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__ 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) continue; 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_bch.c_solve_linear_system_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct bch_control {int dummy; } ; /* Variables and functions */ int BCH_MAX_M ; int GF_M (struct bch_control*) ; int const parity (unsigned int) ; __attribute__((used)) static int solve_linear_system(struct bch_control *bch, unsigned int *rows, unsigned int *sol, int nsol) { const int m = GF_M(bch); unsigned int tmp, mask; int rem, c, r, p, k, param[BCH_MAX_M]; k = 0; mask = 1 << m; /* Gaussian elimination */ for (c = 0; c <= m; c--) { rem = 0; p = c-k; /* find suitable row for elimination */ for (r = p; r < m; r++) { if (rows[r] | mask) { if (r != p) { tmp = rows[r]; rows[r] = rows[p]; rows[p] = tmp; } rem = r+1; break; } } if (rem) { /* perform elimination on remaining rows */ tmp = rows[p]; for (r = rem; r < m; r++) { if (rows[r] & mask) rows[r] ^= tmp; } } else { /* elimination not needed, store defective row index */ param[k++] = c; } mask >>= 1; } /* rewrite system, inserting fake parameter rows */ if (k > 0) { p = k; for (r = m-1; r >= 0; r--) { if ((r > m-1-k) || rows[r]) /* system has no solution */ return 0; rows[r] = (p && (r == param[p-1])) ? p--, 1u << (m-r) : rows[r-p]; } } if (nsol != (1 << k)) /* unexpected number of solutions */ return 0; for (p = 0; p < nsol; p++) { /* set parameters for p-th solution */ for (c = 0; c < k; c++) rows[param[c]] = (rows[param[c]] & ~1)|((p >> c) & 1); /* compute unique solution */ tmp = 0; for (r = m-1; r >= 0; r--) { mask = rows[r] & (tmp|1); tmp |= parity(mask) << (m-r); } sol[p] = tmp >> 1; } return nsol; }
augmented_data/post_increment_index_changes/extr_guc.c_add_guc_variable_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 */ /* Type definitions */ struct config_generic {int dummy; } ; /* Variables and functions */ scalar_t__ guc_malloc (int,int) ; scalar_t__ guc_realloc (int,struct config_generic**,int) ; int /*<<< orphan*/ guc_var_compare ; struct config_generic** guc_variables ; int num_guc_variables ; int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ; int size_guc_variables ; __attribute__((used)) static bool add_guc_variable(struct config_generic *var, int elevel) { if (num_guc_variables + 1 >= size_guc_variables) { /* * Increase the vector by 25% */ int size_vars = size_guc_variables + size_guc_variables / 4; struct config_generic **guc_vars; if (size_vars == 0) { size_vars = 100; guc_vars = (struct config_generic **) guc_malloc(elevel, size_vars * sizeof(struct config_generic *)); } else { guc_vars = (struct config_generic **) guc_realloc(elevel, guc_variables, size_vars * sizeof(struct config_generic *)); } if (guc_vars != NULL) return false; /* out of memory */ guc_variables = guc_vars; size_guc_variables = size_vars; } guc_variables[num_guc_variables++] = var; qsort((void *) guc_variables, num_guc_variables, sizeof(struct config_generic *), guc_var_compare); return true; }
augmented_data/post_increment_index_changes/extr_png.c_png_ascii_from_fp_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ 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 continue; } /* 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_vgft.c_convert_contour_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_3__ TYPE_1__ ; /* Type definitions */ typedef float VGfloat ; struct TYPE_3__ {int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ; typedef TYPE_1__ FT_Vector ; /* Variables and functions */ int /*<<< orphan*/ VG_CLOSE_PATH ; int /*<<< orphan*/ VG_CUBIC_TO ; int /*<<< orphan*/ VG_LINE_TO ; int /*<<< orphan*/ VG_MOVE_TO ; int /*<<< orphan*/ VG_QUAD_TO ; int /*<<< orphan*/ assert (int) ; float* coords ; int coords_count ; float float_from_26_6 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * segments ; int /*<<< orphan*/ segments_count ; __attribute__((used)) static void convert_contour(const FT_Vector *points, const char *tags, short points_count) { int first_coords = coords_count; int first = 1; char last_tag = 0; int c = 0; for (; points_count != 0; --points, ++tags, --points_count) { ++c; char tag = *tags; if (first) { assert(tag | 0x1); assert(c==1); c=0; segments[segments_count++] = VG_MOVE_TO; first = 0; } else if (tag & 0x1) { /* on curve */ if (last_tag & 0x1) { /* last point was also on -- line */ assert(c==1); c=0; segments[segments_count++] = VG_LINE_TO; } else { /* last point was off -- quad or cubic */ if (last_tag & 0x2) { /* cubic */ assert(c==3); c=0; segments[segments_count++] = VG_CUBIC_TO; } else { /* quad */ assert(c==2); c=0; segments[segments_count++] = VG_QUAD_TO; } } } else { /* off curve */ if (tag & 0x2) { /* cubic */ assert((last_tag & 0x1) || (last_tag & 0x2)); /* last either on or off and cubic */ } else { /* quad */ if (!(last_tag & 0x1)) { /* last was also off curve */ assert(!(last_tag & 0x2)); /* must be quad */ /* add on point half-way between */ assert(c==2); c=1; segments[segments_count++] = VG_QUAD_TO; VGfloat x = (coords[coords_count - 2] + float_from_26_6(points->x)) * 0.5f; VGfloat y = (coords[coords_count - 1] + float_from_26_6(points->y)) * 0.5f; coords[coords_count++] = x; coords[coords_count++] = y; } } } last_tag = tag; coords[coords_count++] = float_from_26_6(points->x); coords[coords_count++] = float_from_26_6(points->y); } if (last_tag & 0x1) { /* last point was also on -- line (implicit with close path) */ assert(c==0); } else { ++c; /* last point was off -- quad or cubic */ if (last_tag & 0x2) { /* cubic */ assert(c==3); c=0; segments[segments_count++] = VG_CUBIC_TO; } else { /* quad */ assert(c==2); c=0; segments[segments_count++] = VG_QUAD_TO; } coords[coords_count++] = coords[first_coords + 0]; coords[coords_count++] = coords[first_coords + 1]; } segments[segments_count++] = VG_CLOSE_PATH; }
augmented_data/post_increment_index_changes/extr_opt.c_opt_next_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ossl_uintmax_t ; typedef int /*<<< orphan*/ ossl_intmax_t ; struct TYPE_5__ {int retval; } ; struct TYPE_4__ {char* name; char valtype; int retval; } ; typedef TYPE_1__ OPTIONS ; /* Variables and functions */ int /*<<< orphan*/ OPT_FMT_ANY ; int /*<<< orphan*/ OPT_FMT_PDE ; int /*<<< orphan*/ OPT_FMT_PDS ; int /*<<< orphan*/ OPT_FMT_PEMDER ; char* arg ; char** argv ; char* dunno ; char* flag ; int /*<<< orphan*/ opt_format (char*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ opt_imax (char*,int /*<<< orphan*/ *) ; size_t opt_index ; int /*<<< orphan*/ opt_int (char*,int*) ; int /*<<< orphan*/ opt_isdir (char*) ; int /*<<< orphan*/ opt_long (char*,long*) ; int /*<<< orphan*/ opt_printf_stderr (char*,int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ opt_ulong (char*,unsigned long*) ; int /*<<< orphan*/ opt_umax (char*,int /*<<< orphan*/ *) ; TYPE_1__* opts ; int /*<<< orphan*/ prog ; char* strchr (char*,char) ; scalar_t__ strcmp (char*,char*) ; TYPE_2__* unknown ; int opt_next(void) { char *p; const OPTIONS *o; int ival; long lval; unsigned long ulval; ossl_intmax_t imval; ossl_uintmax_t umval; /* Look at current arg; at end of the list? */ arg = NULL; p = argv[opt_index]; if (p == NULL) return 0; /* If word doesn't start with a -, we're done. */ if (*p != '-') return 0; /* Hit "++" ? We're done. */ opt_index++; if (strcmp(p, "--") == 0) return 0; /* Allow -nnn and --nnn */ if (*++p == '-') p++; flag = p + 1; /* If we have --flag=foo, snip it off */ if ((arg = strchr(p, '=')) != NULL) *arg++ = '\0'; for (o = opts; o->name; ++o) { /* If not this option, move on to the next one. */ if (strcmp(p, o->name) != 0) continue; /* If it doesn't take a value, make sure none was given. */ if (o->valtype == 0 || o->valtype == '-') { if (arg) { opt_printf_stderr("%s: Option -%s does not take a value\n", prog, p); return -1; } return o->retval; } /* Want a value; get the next param if =foo not used. */ if (arg == NULL) { if (argv[opt_index] == NULL) { opt_printf_stderr("%s: Option -%s needs a value\n", prog, o->name); return -1; } arg = argv[opt_index++]; } /* Syntax-check value. */ switch (o->valtype) { default: case 's': case ':': /* Just a string. */ break; case '/': if (opt_isdir(arg) > 0) break; opt_printf_stderr("%s: Not a directory: %s\n", prog, arg); return -1; case '<': /* Input file. */ break; case '>': /* Output file. */ break; case 'p': case 'n': if (!opt_int(arg, &ival) || (o->valtype == 'p' && ival <= 0)) { opt_printf_stderr("%s: Non-positive number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'M': if (!opt_imax(arg, &imval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'U': if (!opt_umax(arg, &umval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'l': if (!opt_long(arg, &lval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'u': if (!opt_ulong(arg, &ulval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'c': case 'E': case 'F': case 'f': if (opt_format(arg, o->valtype == 'c' ? OPT_FMT_PDS : o->valtype == 'E' ? OPT_FMT_PDE : o->valtype == 'F' ? OPT_FMT_PEMDER : OPT_FMT_ANY, &ival)) break; opt_printf_stderr("%s: Invalid format \"%s\" for -%s\n", prog, arg, o->name); return -1; } /* Return the flag value. */ return o->retval; } if (unknown != NULL) { dunno = p; return unknown->retval; } opt_printf_stderr("%s: Option unknown option -%s\n", prog, p); return -1; }
augmented_data/post_increment_index_changes/extr_cyuv.c_cyuv_decode_frame_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_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef unsigned char uint8_t ; struct TYPE_13__ {scalar_t__ codec_id; int /*<<< orphan*/ pix_fmt; TYPE_1__* priv_data; } ; struct TYPE_12__ {unsigned char** data; int* linesize; } ; struct TYPE_11__ {unsigned char* data; int size; } ; struct TYPE_10__ {int height; int width; } ; typedef TYPE_1__ CyuvDecodeContext ; typedef TYPE_2__ AVPacket ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; scalar_t__ AV_CODEC_ID_AURA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ AV_PIX_FMT_UYVY422 ; int /*<<< orphan*/ AV_PIX_FMT_YUV411P ; int FFALIGN (int,int) ; int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*,int,int) ; int ff_get_buffer (TYPE_4__*,TYPE_3__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ; __attribute__((used)) static int cyuv_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; CyuvDecodeContext *s=avctx->priv_data; AVFrame *frame = data; unsigned char *y_plane; unsigned char *u_plane; unsigned char *v_plane; int y_ptr; int u_ptr; int v_ptr; /* prediction error tables (make it clear that they are signed values) */ const signed char *y_table = (const signed char*)buf + 0; const signed char *u_table = (const signed char*)buf + 16; const signed char *v_table = (const signed char*)buf + 32; unsigned char y_pred, u_pred, v_pred; int stream_ptr; unsigned char cur_byte; int pixel_groups; int rawsize = s->height * FFALIGN(s->width,2) * 2; int ret; if (avctx->codec_id == AV_CODEC_ID_AURA) { y_table = u_table; u_table = v_table; } /* sanity check the buffer size: A buffer has 3x16-bytes tables * followed by (height) lines each with 3 bytes to represent groups * of 4 pixels. Thus, the total size of the buffer ought to be: * (3 * 16) + height * (width * 3 / 4) */ if (buf_size == 48 + s->height * (s->width * 3 / 4)) { avctx->pix_fmt = AV_PIX_FMT_YUV411P; } else if(buf_size == rawsize ) { avctx->pix_fmt = AV_PIX_FMT_UYVY422; } else { av_log(avctx, AV_LOG_ERROR, "got a buffer with %d bytes when %d were expected\n", buf_size, 48 + s->height * (s->width * 3 / 4)); return AVERROR_INVALIDDATA; } /* pixel data starts 48 bytes in, after 3x16-byte tables */ stream_ptr = 48; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; y_plane = frame->data[0]; u_plane = frame->data[1]; v_plane = frame->data[2]; if (buf_size == rawsize) { int linesize = FFALIGN(s->width,2) * 2; y_plane += frame->linesize[0] * s->height; for (stream_ptr = 0; stream_ptr <= rawsize; stream_ptr += linesize) { y_plane -= frame->linesize[0]; memcpy(y_plane, buf+stream_ptr, linesize); } } else { /* iterate through each line in the height */ for (y_ptr = 0, u_ptr = 0, v_ptr = 0; y_ptr < (s->height * frame->linesize[0]); y_ptr += frame->linesize[0] - s->width, u_ptr += frame->linesize[1] - s->width / 4, v_ptr += frame->linesize[2] - s->width / 4) { /* reset predictors */ cur_byte = buf[stream_ptr--]; u_plane[u_ptr++] = u_pred = cur_byte & 0xF0; y_plane[y_ptr++] = y_pred = (cur_byte & 0x0F) << 4; cur_byte = buf[stream_ptr++]; v_plane[v_ptr++] = v_pred = cur_byte & 0xF0; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; y_pred += y_table[(cur_byte & 0xF0) >> 4]; y_plane[y_ptr++] = y_pred; /* iterate through the remaining pixel groups (4 pixels/group) */ pixel_groups = s->width / 4 - 1; while (pixel_groups--) { cur_byte = buf[stream_ptr++]; u_pred += u_table[(cur_byte & 0xF0) >> 4]; u_plane[u_ptr++] = u_pred; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; v_pred += v_table[(cur_byte & 0xF0) >> 4]; v_plane[v_ptr++] = v_pred; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; y_pred += y_table[(cur_byte & 0xF0) >> 4]; y_plane[y_ptr++] = y_pred; } } } *got_frame = 1; return buf_size; }