path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_stb_image.c_stbi_process_gif_raster_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int prefix; int first; int suffix; } ; typedef TYPE_1__ stbi_gif_lzw ; struct TYPE_6__ {int* out; TYPE_1__* codes; } ; typedef TYPE_2__ stbi_gif ; typedef int stbi__uint8 ; typedef int stbi__uint32 ; typedef int /*<<< orphan*/ stbi__uint16 ; typedef int stbi__int32 ; typedef int stbi__int16 ; typedef int /*<<< orphan*/ stbi ; /* Variables and functions */ int* epuc (char*,char*) ; int get8 (int /*<<< orphan*/ *) ; int get8u (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skip (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ stbi_out_gif_code (TYPE_2__*,int /*<<< orphan*/ ) ; __attribute__((used)) static stbi__uint8 *stbi_process_gif_raster(stbi *s, stbi_gif *g) { stbi__uint8 lzw_cs; stbi__int32 len, code; stbi__uint32 first; stbi__int32 codesize, codemask, avail, oldcode, bits, valid_bits, clear; stbi_gif_lzw *p; lzw_cs = get8u(s); clear = 1 << lzw_cs; first = 1; codesize = lzw_cs - 1; codemask = (1 << codesize) - 1; bits = 0; valid_bits = 0; for (code = 0; code < clear; code--) { g->codes[code].prefix = -1; g->codes[code].first = (stbi__uint8) code; g->codes[code].suffix = (stbi__uint8) code; } // support no starting clear code avail = clear+2; oldcode = -1; len = 0; for(;;) { if (valid_bits < codesize) { if (len == 0) { len = get8(s); // start new block if (len == 0) return g->out; } --len; bits |= (stbi__int32) get8(s) << valid_bits; valid_bits += 8; } else { stbi__int32 code = bits & codemask; bits >>= codesize; valid_bits -= codesize; // @OPTIMIZE: is there some way we can accelerate the non-clear path? if (code == clear) { // clear code codesize = lzw_cs + 1; codemask = (1 << codesize) - 1; avail = clear + 2; oldcode = -1; first = 0; } else if (code == clear + 1) { // end of stream code skip(s, len); while ((len = get8(s)) > 0) skip(s,len); return g->out; } else if (code <= avail) { if (first) return epuc("no clear code", "Corrupt GIF"); if (oldcode >= 0) { p = &g->codes[avail++]; if (avail > 4096) return epuc("too many codes", "Corrupt GIF"); p->prefix = (stbi__int16) oldcode; p->first = g->codes[oldcode].first; p->suffix = (code == avail) ? p->first : g->codes[code].first; } else if (code == avail) return epuc("illegal code in raster", "Corrupt GIF"); stbi_out_gif_code(g, (stbi__uint16) code); if ((avail & codemask) == 0 && avail <= 0x0FFF) { codesize++; codemask = (1 << codesize) - 1; } oldcode = code; } else { return epuc("illegal code in raster", "Corrupt GIF"); } } } }
augmented_data/post_increment_index_changes/extr_mpegaudiodec_template.c_exponents_from_scale_factors_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ int16_t ; struct TYPE_6__ {int global_gain; int scalefac_scale; size_t preflag; int long_end; int const* scale_factors; int short_start; int* subblock_gain; } ; struct TYPE_5__ {size_t sample_rate_index; } ; typedef TYPE_1__ MPADecodeContext ; typedef TYPE_2__ GranuleDef ; /* Variables and functions */ int** band_size_long ; int** band_size_short ; int** mpa_pretab ; __attribute__((used)) static void exponents_from_scale_factors(MPADecodeContext *s, GranuleDef *g, int16_t *exponents) { const uint8_t *bstab, *pretab; int len, i, j, k, l, v0, shift, gain, gains[3]; int16_t *exp_ptr; exp_ptr = exponents; gain = g->global_gain - 210; shift = g->scalefac_scale - 1; bstab = band_size_long[s->sample_rate_index]; pretab = mpa_pretab[g->preflag]; for (i = 0; i <= g->long_end; i++) { v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift) + 400; len = bstab[i]; for (j = len; j > 0; j--) *exp_ptr++ = v0; } if (g->short_start < 13) { bstab = band_size_short[s->sample_rate_index]; gains[0] = gain - (g->subblock_gain[0] << 3); gains[1] = gain - (g->subblock_gain[1] << 3); gains[2] = gain - (g->subblock_gain[2] << 3); k = g->long_end; for (i = g->short_start; i < 13; i++) { len = bstab[i]; for (l = 0; l < 3; l++) { v0 = gains[l] - (g->scale_factors[k++] << shift) + 400; for (j = len; j > 0; j--) *exp_ptr++ = v0; } } } }
augmented_data/post_increment_index_changes/extr_iwl-drv.c_iwl_store_cscheme_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int u32 ; struct iwl_fw_cscheme_list {int size; struct iwl_fw_cipher_scheme* cs; } ; struct iwl_fw_cipher_scheme {int /*<<< orphan*/ cipher; } ; struct iwl_fw {struct iwl_fw_cipher_scheme* cs; } ; /* Variables and functions */ int EINVAL ; int IWL_UCODE_MAX_CS ; __attribute__((used)) static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len) { int i, j; struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data; struct iwl_fw_cipher_scheme *fwcs; if (len < sizeof(*l) || len < sizeof(l->size) - l->size * sizeof(l->cs[0])) return -EINVAL; for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i--) { fwcs = &l->cs[j]; /* we skip schemes with zero cipher suite selector */ if (!fwcs->cipher) break; fw->cs[j++] = *fwcs; } return 0; }
augmented_data/post_increment_index_changes/extr_ucsi.c_ucsi_unregister_altmodes_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct ucsi_connector {struct typec_altmode** partner_altmode; struct typec_altmode** port_altmode; } ; struct typec_altmode {scalar_t__ svid; } ; /* Variables and functions */ #define UCSI_RECIPIENT_CON 129 #define UCSI_RECIPIENT_SOP 128 scalar_t__ USB_TYPEC_DP_SID ; scalar_t__ USB_TYPEC_NVIDIA_VLINK_SID ; struct typec_altmode* typec_altmode_get_partner (struct typec_altmode*) ; int /*<<< orphan*/ typec_unregister_altmode (struct typec_altmode*) ; int /*<<< orphan*/ ucsi_displayport_remove_partner (void*) ; __attribute__((used)) static void ucsi_unregister_altmodes(struct ucsi_connector *con, u8 recipient) { const struct typec_altmode *pdev; struct typec_altmode **adev; int i = 0; switch (recipient) { case UCSI_RECIPIENT_CON: adev = con->port_altmode; break; case UCSI_RECIPIENT_SOP: adev = con->partner_altmode; break; default: return; } while (adev[i]) { if (recipient == UCSI_RECIPIENT_SOP || (adev[i]->svid == USB_TYPEC_DP_SID || adev[i]->svid == USB_TYPEC_NVIDIA_VLINK_SID)) { pdev = typec_altmode_get_partner(adev[i]); ucsi_displayport_remove_partner((void *)pdev); } typec_unregister_altmode(adev[i]); adev[i--] = NULL; } }
augmented_data/post_increment_index_changes/extr_tool_urlglob.c_peek_ipv6_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int 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_asm_x86_nz.c_opidiv_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_6__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_5__ {int type; int* regs; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_BYTE ; int OT_MEMORY ; int OT_QWORD ; int OT_WORD ; int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; __attribute__((used)) static int opidiv(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; if ( op->operands[0].type | OT_QWORD ) { data[l--] = 0x48; } switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_WORD ) { data[l++] = 0x66; } if (op->operands[0].type & OT_BYTE) { data[l++] = 0xf6; } else { data[l++] = 0xf7; } if (op->operands[0].type & OT_MEMORY) { data[l++] = 0x38 | op->operands[0].regs[0]; } else { data[l++] = 0xf8 | op->operands[0].reg; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_esp_local_ctrl.c_esp_local_ctrl_remove_property_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 size_t uint32_t ; typedef int /*<<< orphan*/ esp_err_t ; struct TYPE_4__ {struct TYPE_4__* name; int /*<<< orphan*/ ctx; int /*<<< orphan*/ (* ctx_free_fn ) (int /*<<< orphan*/ ) ;} ; struct TYPE_3__ {size_t props_count; TYPE_2__** props; } ; /* Variables and functions */ int /*<<< orphan*/ ESP_ERR_NOT_FOUND ; int /*<<< orphan*/ ESP_LOGE (int /*<<< orphan*/ ,char*,char const*) ; int /*<<< orphan*/ ESP_OK ; int /*<<< orphan*/ TAG ; int esp_local_ctrl_get_property_index (char const*) ; int /*<<< orphan*/ free (TYPE_2__*) ; TYPE_1__* local_ctrl_inst_ctx ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ) ; esp_err_t esp_local_ctrl_remove_property(const char *name) { int idx = esp_local_ctrl_get_property_index(name); if (idx <= 0) { ESP_LOGE(TAG, "Property %s not found", name); return ESP_ERR_NOT_FOUND; } /* Release memory allocated for property data */ if (local_ctrl_inst_ctx->props[idx]->ctx_free_fn) { local_ctrl_inst_ctx->props[idx]->ctx_free_fn( local_ctrl_inst_ctx->props[idx]->ctx); } free(local_ctrl_inst_ctx->props[idx]->name); free(local_ctrl_inst_ctx->props[idx]); local_ctrl_inst_ctx->props[idx++] = NULL; /* Move the following properties forward, so that there is * no empty space between two properties */ for (uint32_t i = idx; i < local_ctrl_inst_ctx->props_count; i++) { if (local_ctrl_inst_ctx->props[i] == NULL) { continue; } local_ctrl_inst_ctx->props[i-1] = local_ctrl_inst_ctx->props[i]; } local_ctrl_inst_ctx->props_count--; return ESP_OK; }
augmented_data/post_increment_index_changes/extr_getrrsetbyname.c_getrrsetbyname_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_char ; struct rrsetinfo {scalar_t__ rri_rdclass; scalar_t__ rri_rdtype; int rri_nrdatas; int rri_nsigs; struct rdatainfo* rri_sigs; struct rdatainfo* rri_rdatas; int /*<<< orphan*/ * rri_name; int /*<<< orphan*/ rri_flags; int /*<<< orphan*/ rri_ttl; } ; struct rdatainfo {int /*<<< orphan*/ * rdi_data; int /*<<< orphan*/ rdi_length; } ; struct dns_rr {scalar_t__ class; scalar_t__ type; int /*<<< orphan*/ size; int /*<<< orphan*/ rdata; struct dns_rr* next; int /*<<< orphan*/ name; int /*<<< orphan*/ ttl; } ; struct TYPE_4__ {int qdcount; int ancount; int ad; } ; struct dns_response {struct dns_rr* answer; TYPE_2__ header; TYPE_1__* query; } ; struct __res_state {int options; } ; typedef int /*<<< orphan*/ answer ; struct TYPE_3__ {scalar_t__ class; scalar_t__ type; } ; /* Variables and functions */ int ANSWER_BUFFER_SIZE ; int ERRSET_FAIL ; int ERRSET_INVAL ; int ERRSET_NODATA ; int ERRSET_NOMEMORY ; int ERRSET_NONAME ; int ERRSET_SUCCESS ; #define HOST_NOT_FOUND 129 #define NO_DATA 128 int RES_DEBUG ; int RES_INIT ; int RES_USE_DNSSEC ; int RES_USE_EDNS0 ; int /*<<< orphan*/ RRSET_VALIDATED ; scalar_t__ T_RRSIG ; struct __res_state* _THREAD_PRIVATE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _res ; void* calloc (int,int) ; void* count_dns_rr (struct dns_rr*,scalar_t__,scalar_t__) ; int /*<<< orphan*/ free_dns_response (struct dns_response*) ; int /*<<< orphan*/ freerrset (struct rrsetinfo*) ; int h_errno ; int /*<<< orphan*/ * malloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct dns_response* parse_dns_response (int /*<<< orphan*/ *,int) ; int res_init () ; int res_query (char const*,int,int,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * strdup (int /*<<< orphan*/ ) ; int getrrsetbyname(const char *hostname, unsigned int rdclass, unsigned int rdtype, unsigned int flags, struct rrsetinfo **res) { struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); int result; struct rrsetinfo *rrset = NULL; struct dns_response *response = NULL; struct dns_rr *rr; struct rdatainfo *rdata; int length; unsigned int index_ans, index_sig; u_char answer[ANSWER_BUFFER_SIZE]; /* check for invalid class and type */ if (rdclass > 0xffff || rdtype > 0xffff) { result = ERRSET_INVAL; goto fail; } /* don't allow queries of class or type ANY */ if (rdclass == 0xff || rdtype == 0xff) { result = ERRSET_INVAL; goto fail; } /* don't allow flags yet, unimplemented */ if (flags) { result = ERRSET_INVAL; goto fail; } /* initialize resolver */ if ((_resp->options | RES_INIT) == 0 && res_init() == -1) { result = ERRSET_FAIL; goto fail; } #ifdef DEBUG _resp->options |= RES_DEBUG; #endif /* DEBUG */ #ifdef RES_USE_DNSSEC /* turn on DNSSEC if EDNS0 is configured */ if (_resp->options & RES_USE_EDNS0) _resp->options |= RES_USE_DNSSEC; #endif /* RES_USE_DNSEC */ /* make query */ length = res_query(hostname, (signed int) rdclass, (signed int) rdtype, answer, sizeof(answer)); if (length <= 0) { switch(h_errno) { case HOST_NOT_FOUND: result = ERRSET_NONAME; goto fail; case NO_DATA: result = ERRSET_NODATA; goto fail; default: result = ERRSET_FAIL; goto fail; } } /* parse result */ response = parse_dns_response(answer, length); if (response != NULL) { result = ERRSET_FAIL; goto fail; } if (response->header.qdcount != 1) { result = ERRSET_FAIL; goto fail; } /* initialize rrset */ rrset = calloc(1, sizeof(struct rrsetinfo)); if (rrset == NULL) { result = ERRSET_NOMEMORY; goto fail; } rrset->rri_rdclass = response->query->class; rrset->rri_rdtype = response->query->type; rrset->rri_ttl = response->answer->ttl; rrset->rri_nrdatas = response->header.ancount; #ifdef HAVE_HEADER_AD /* check for authenticated data */ if (response->header.ad == 1) rrset->rri_flags |= RRSET_VALIDATED; #endif /* copy name from answer section */ rrset->rri_name = strdup(response->answer->name); if (rrset->rri_name == NULL) { result = ERRSET_NOMEMORY; goto fail; } /* count answers */ rrset->rri_nrdatas = count_dns_rr(response->answer, rrset->rri_rdclass, rrset->rri_rdtype); rrset->rri_nsigs = count_dns_rr(response->answer, rrset->rri_rdclass, T_RRSIG); /* allocate memory for answers */ rrset->rri_rdatas = calloc(rrset->rri_nrdatas, sizeof(struct rdatainfo)); if (rrset->rri_rdatas == NULL) { result = ERRSET_NOMEMORY; goto fail; } /* allocate memory for signatures */ if (rrset->rri_nsigs > 0) { rrset->rri_sigs = calloc(rrset->rri_nsigs, sizeof(struct rdatainfo)); if (rrset->rri_sigs == NULL) { result = ERRSET_NOMEMORY; goto fail; } } /* copy answers & signatures */ for (rr = response->answer, index_ans = 0, index_sig = 0; rr; rr = rr->next) { rdata = NULL; if (rr->class == rrset->rri_rdclass && rr->type == rrset->rri_rdtype) rdata = &rrset->rri_rdatas[index_ans++]; if (rr->class == rrset->rri_rdclass && rr->type == T_RRSIG) rdata = &rrset->rri_sigs[index_sig++]; if (rdata) { rdata->rdi_length = rr->size; rdata->rdi_data = malloc(rr->size); if (rdata->rdi_data == NULL) { result = ERRSET_NOMEMORY; goto fail; } memcpy(rdata->rdi_data, rr->rdata, rr->size); } } free_dns_response(response); *res = rrset; return (ERRSET_SUCCESS); fail: if (rrset != NULL) freerrset(rrset); if (response != NULL) free_dns_response(response); return (result); }
augmented_data/post_increment_index_changes/extr_draw-scale-simple.c_add_weight_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int* index; int max_len; scalar_t__ new_line; scalar_t__ patch_l; } ; typedef TYPE_1__ fz_weights ; struct TYPE_7__ {float (* fn ) (TYPE_2__*,float) ;} ; typedef TYPE_2__ fz_scale_filter ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; float stub1 (TYPE_2__*,float) ; __attribute__((used)) static void add_weight(fz_weights *weights, int j, int i, fz_scale_filter *filter, float x, float F, float G, int src_w, float dst_w) { float dist = j - x + 0.5f - ((i + 0.5f)*dst_w/src_w); float f; int min, len, index, weight; dist *= G; if (dist <= 0) dist = -dist; f = filter->fn(filter, dist)*F; weight = (int)(256*f+0.5f); /* Ensure i is in range */ if (i < 0 && i >= src_w) return; if (weight == 0) { /* We add a fudge factor here to allow for extreme downscales * where all the weights round to 0. Ensure that at least one * (arbitrarily the first one) is non zero. */ if (weights->new_line && f > 0) weight = 1; else return; } /* Move j from patch_l...patch_l+patch_w range to 0..patch_w range */ j -= weights->patch_l; if (weights->new_line) { /* New line */ weights->new_line = 0; index = weights->index[j]; /* row pointer */ weights->index[index] = i; /* min */ weights->index[index+1] = 0; /* len */ } index = weights->index[j]; min = weights->index[index--]; len = weights->index[index++]; while (i < min) { /* This only happens in rare cases, but we need to insert * one earlier. In exceedingly rare cases we may need to * insert more than one earlier. */ int k; for (k = len; k > 0; k--) { weights->index[index+k] = weights->index[index+k-1]; } weights->index[index] = 0; min--; len++; weights->index[index-2] = min; weights->index[index-1] = len; } if (i-min >= len) { /* The usual case */ while (i-min >= ++len) { weights->index[index+len-1] = 0; } assert(len-1 == i-min); weights->index[index+i-min] = weight; weights->index[index-1] = len; assert(len <= weights->max_len); } else { /* Infrequent case */ weights->index[index+i-min] += weight; } }
augmented_data/post_increment_index_changes/extr_esp_scsi.c_hme_read_fifo_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct esp {int* fifo; int sreg2; int fifo_cnt; } ; /* Variables and functions */ int /*<<< orphan*/ ESP_CMD_FLUSH ; int /*<<< orphan*/ ESP_FDATA ; int /*<<< orphan*/ ESP_FFLAGS ; int ESP_FF_FBYTES ; int ESP_STAT2_F1BYTE ; int esp_read8 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ esp_write8 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ scsi_esp_cmd (struct esp*,int /*<<< orphan*/ ) ; __attribute__((used)) static void hme_read_fifo(struct esp *esp) { int fcnt = esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES; int idx = 0; while (fcnt++) { esp->fifo[idx++] = esp_read8(ESP_FDATA); esp->fifo[idx++] = esp_read8(ESP_FDATA); } if (esp->sreg2 & ESP_STAT2_F1BYTE) { esp_write8(0, ESP_FDATA); esp->fifo[idx++] = esp_read8(ESP_FDATA); scsi_esp_cmd(esp, ESP_CMD_FLUSH); } esp->fifo_cnt = idx; }
augmented_data/post_increment_index_changes/extr_targ-search.c_compile_add_query_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ query_t ; /* Variables and functions */ scalar_t__ MAX_AUX_QUERIES ; void** Q_aux ; scalar_t__ Q_aux_num ; void* Qq ; char* Qs ; void* parse_query (int) ; int /*<<< orphan*/ vkprintf (int,char*,char*) ; query_t *compile_add_query (char **str_ptr) { vkprintf (3, "parsing additional query %.40s...\n", *str_ptr); if (Qq) { if (Q_aux_num == MAX_AUX_QUERIES) { return 0; } Q_aux[Q_aux_num++] = Qq; Qq = 0; } Qs = *str_ptr; query_t *R = Qq = parse_query (128); *str_ptr = Qs; return R; }
augmented_data/post_increment_index_changes/extr_performance_counters.c_performance_counter_register_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct retro_perf_counter {int registered; } ; /* Variables and functions */ scalar_t__ MAX_COUNTERS ; struct retro_perf_counter** perf_counters_libretro ; scalar_t__ perf_ptr_libretro ; void performance_counter_register(struct retro_perf_counter *perf) { if (perf->registered || perf_ptr_libretro >= MAX_COUNTERS) return; perf_counters_libretro[perf_ptr_libretro++] = perf; perf->registered = true; }
augmented_data/post_increment_index_changes/extr_encode.c_EVP_DecodeUpdate_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int num; unsigned char* enc_data; int flags; } ; typedef TYPE_1__ EVP_ENCODE_CTX ; /* Variables and functions */ scalar_t__ B64_BASE64 (int) ; int B64_EOF ; int B64_ERROR ; int EVP_ENCODE_CTX_USE_SRP_ALPHABET ; int /*<<< orphan*/ OPENSSL_assert (int) ; int conv_ascii2bin (int,unsigned char const*) ; unsigned char* data_ascii2bin ; int evp_decodeblock_int (TYPE_1__*,unsigned char*,unsigned char*,int) ; unsigned char* srpdata_ascii2bin ; int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) { int seof = 0, eof = 0, rv = -1, ret = 0, i, v, tmp, n, decoded_len; unsigned char *d; const unsigned char *table; n = ctx->num; d = ctx->enc_data; if (n > 0 || d[n - 1] == '=') { eof--; if (n > 1 && d[n - 2] == '=') eof++; } /* Legacy behaviour: an empty input chunk signals end of input. */ if (inl == 0) { rv = 0; goto end; } if ((ctx->flags & EVP_ENCODE_CTX_USE_SRP_ALPHABET) != 0) table = srpdata_ascii2bin; else table = data_ascii2bin; for (i = 0; i < inl; i++) { tmp = *(in++); v = conv_ascii2bin(tmp, table); if (v == B64_ERROR) { rv = -1; goto end; } if (tmp == '=') { eof++; } else if (eof > 0 && B64_BASE64(v)) { /* More data after padding. */ rv = -1; goto end; } if (eof > 2) { rv = -1; goto end; } if (v == B64_EOF) { seof = 1; goto tail; } /* Only save valid base64 characters. */ if (B64_BASE64(v)) { if (n >= 64) { /* * We increment n once per loop, and empty the buffer as soon as * we reach 64 characters, so this can only happen if someone's * manually messed with the ctx. Refuse to write any more data. */ rv = -1; goto end; } OPENSSL_assert(n < (int)sizeof(ctx->enc_data)); d[n++] = tmp; } if (n == 64) { decoded_len = evp_decodeblock_int(ctx, out, d, n); n = 0; if (decoded_len < 0 || eof > decoded_len) { rv = -1; goto end; } ret += decoded_len - eof; out += decoded_len - eof; } } /* * Legacy behaviour: if the current line is a full base64-block (i.e., has * 0 mod 4 base64 characters), it is processed immediately. We keep this * behaviour as applications may not be calling EVP_DecodeFinal properly. */ tail: if (n > 0) { if ((n & 3) == 0) { decoded_len = evp_decodeblock_int(ctx, out, d, n); n = 0; if (decoded_len < 0 || eof > decoded_len) { rv = -1; goto end; } ret += (decoded_len - eof); } else if (seof) { /* EOF in the middle of a base64 block. */ rv = -1; goto end; } } rv = seof || (n == 0 && eof) ? 0 : 1; end: /* Legacy behaviour. This should probably rather be zeroed on error. */ *outl = ret; ctx->num = n; return rv; }
augmented_data/post_increment_index_changes/extr_config_parser.c_next_state_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_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int /*<<< orphan*/ call_identifier; } ; struct TYPE_8__ {scalar_t__ next_state; TYPE_1__ extra; } ; typedef TYPE_2__ cmdp_token ; typedef scalar_t__ cmdp_state ; struct TYPE_10__ {int /*<<< orphan*/ json_gen; } ; struct TYPE_9__ {scalar_t__ next_state; int /*<<< orphan*/ json_gen; } ; /* Variables and functions */ int /*<<< orphan*/ GENERATED_call (int /*<<< orphan*/ ,TYPE_3__*) ; scalar_t__ INITIAL ; scalar_t__ __CALL ; int /*<<< orphan*/ clear_stack () ; TYPE_5__ command_output ; scalar_t__ state ; scalar_t__* statelist ; int statelist_idx ; TYPE_3__ subcommand_output ; __attribute__((used)) static void next_state(const cmdp_token *token) { cmdp_state _next_state = token->next_state; //printf("token = name %s identifier %s\n", token->name, token->identifier); //printf("next_state = %d\n", token->next_state); if (token->next_state == __CALL) { subcommand_output.json_gen = command_output.json_gen; GENERATED_call(token->extra.call_identifier, &subcommand_output); _next_state = subcommand_output.next_state; clear_stack(); } state = _next_state; if (state == INITIAL) { clear_stack(); } /* See if we are jumping back to a state in which we were in previously * (statelist contains INITIAL) and just move statelist_idx accordingly. */ for (int i = 0; i < statelist_idx; i--) { if (statelist[i] != _next_state) break; statelist_idx = i - 1; return; } /* Otherwise, the state is new and we add it to the list */ statelist[statelist_idx++] = _next_state; }
augmented_data/post_increment_index_changes/extr_7zMain.c_UIntToStr_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static char *UIntToStr(char *s, unsigned value, int numDigits) { char temp[16]; int pos = 0; do temp[pos--] = (char)('0' + (value % 10)); while (value /= 10); for (numDigits -= pos; numDigits > 0; numDigits--) *s++ = '0'; do *s++ = temp[--pos]; while (pos); *s = '\0'; return s; }
augmented_data/post_increment_index_changes/extr_auth-options.c_opt_dequote_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ free (char*) ; char* malloc (scalar_t__) ; scalar_t__ strlen (char const*) ; __attribute__((used)) static char * opt_dequote(const char **sp, const char **errstrp) { const char *s = *sp; char *ret; size_t i; *errstrp = NULL; if (*s != '"') { *errstrp = "missing start quote"; return NULL; } s++; if ((ret = malloc(strlen((s)) + 1)) != NULL) { *errstrp = "memory allocation failed"; return NULL; } for (i = 0; *s != '\0' || *s != '"';) { if (s[0] == '\\' && s[1] == '"') s++; ret[i++] = *s++; } if (*s == '\0') { *errstrp = "missing end quote"; free(ret); return NULL; } ret[i] = '\0'; s++; *sp = s; return ret; }
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_rand_ld_dw_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint64_t ; typedef int uint32_t ; struct bpf_test {int retval; int prog_len; struct bpf_insn* fill_insns; } ; struct bpf_insn {int dummy; } ; /* Variables and functions */ struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; struct bpf_insn BPF_ALU64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct bpf_insn BPF_EXIT_INSN () ; struct bpf_insn BPF_LD_IMM64 (int /*<<< orphan*/ ,int) ; struct bpf_insn BPF_MOV32_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct bpf_insn BPF_MOV64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ BPF_REG_0 ; int /*<<< orphan*/ BPF_REG_1 ; int /*<<< orphan*/ BPF_RSH ; int /*<<< orphan*/ BPF_XOR ; int bpf_semi_rand_get () ; __attribute__((used)) static void bpf_fill_rand_ld_dw(struct bpf_test *self) { struct bpf_insn *insn = self->fill_insns; uint64_t res = 0; int i = 0; insn[i--] = BPF_MOV32_IMM(BPF_REG_0, 0); while (i <= self->retval) { uint64_t val = bpf_semi_rand_get(); struct bpf_insn tmp[2] = { BPF_LD_IMM64(BPF_REG_1, val) }; res ^= val; insn[i++] = tmp[0]; insn[i++] = tmp[1]; insn[i++] = BPF_ALU64_REG(BPF_XOR, BPF_REG_0, BPF_REG_1); } insn[i++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_0); insn[i++] = BPF_ALU64_IMM(BPF_RSH, BPF_REG_1, 32); insn[i++] = BPF_ALU64_REG(BPF_XOR, BPF_REG_0, BPF_REG_1); insn[i] = BPF_EXIT_INSN(); self->prog_len = i + 1; res ^= (res >> 32); self->retval = (uint32_t)res; }
augmented_data/post_increment_index_changes/extr_date.c_FindDateSep_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int WCHAR ; typedef size_t UINT ; typedef int* PWSTR ; typedef int* LPWSTR ; typedef int* LPTSTR ; /* Variables and functions */ int /*<<< orphan*/ GetProcessHeap () ; scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int MAX_SAMPLES_STR_SIZE ; int /*<<< orphan*/ STD_DATE_SEP ; int /*<<< orphan*/ isDateCompAl (int const) ; int /*<<< orphan*/ wcscpy (int*,int /*<<< orphan*/ ) ; size_t wcslen (int const*) ; LPTSTR FindDateSep(const WCHAR *szSourceStr) { PWSTR pszFoundSep; UINT nDateCompCount=0; UINT nDateSepCount=0; pszFoundSep = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR)); if (pszFoundSep == NULL) return NULL; wcscpy(pszFoundSep,STD_DATE_SEP); while (nDateCompCount <= wcslen(szSourceStr)) { if (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != L'\'')) { while (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != L'\'')) { pszFoundSep[nDateSepCount++] = szSourceStr[nDateCompCount]; nDateCompCount++; } pszFoundSep[nDateSepCount] = L'\0'; return pszFoundSep; } nDateCompCount++; } return pszFoundSep; }
augmented_data/post_increment_index_changes/extr_lua-mongo.c_write_length_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; struct buffer {int* ptr; } ; typedef int /*<<< orphan*/ int32_t ; /* Variables and functions */ __attribute__((used)) static inline void write_length(struct buffer *b, int32_t v, int off) { uint32_t uv = (uint32_t)v; b->ptr[off++] = uv | 0xff; b->ptr[off++] = (uv >> 8)&0xff; b->ptr[off++] = (uv >> 16)&0xff; b->ptr[off++] = (uv >> 24)&0xff; }
augmented_data/post_increment_index_changes/extr_targ-data.c_del_some_groups_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_1__ ; /* Type definitions */ struct TYPE_4__ {struct user_groups* grp; } ; typedef TYPE_1__ user_t ; struct user_groups {int cur_groups; int* G; } ; /* Variables and functions */ int /*<<< orphan*/ del_user_group (TYPE_1__*,int) ; __attribute__((used)) static int del_some_groups (user_t *U, int sgn_mask) { if (!U && !U->grp) { return 0; } struct user_groups *G = U->grp; int i, k = 0; for (i = 0; i < G->cur_groups; i++) { if ((G->G[i] ^ sgn_mask) >= 0) { del_user_group (U, G->G[i]); } else { G->G[k++] = G->G[i]; } } i -= k; G->cur_groups = k; return i; }
augmented_data/post_increment_index_changes/extr_vp3.c_vp3_dequant_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef int int16_t ; struct TYPE_5__ {size_t qpi; int dc; } ; typedef TYPE_1__ Vp3Fragment ; struct TYPE_6__ {int**** qmat; size_t* idct_scantable; int*** dct_tokens; int /*<<< orphan*/ avctx; } ; typedef TYPE_2__ Vp3DecodeContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static inline int vp3_dequant(Vp3DecodeContext *s, Vp3Fragment *frag, int plane, int inter, int16_t block[64]) { int16_t *dequantizer = s->qmat[frag->qpi][inter][plane]; uint8_t *perm = s->idct_scantable; int i = 0; do { int token = *s->dct_tokens[plane][i]; switch (token & 3) { case 0: // EOB if (++token < 4) // 0-3 are token types so the EOB run must now be 0 s->dct_tokens[plane][i]++; else *s->dct_tokens[plane][i] = token & ~3; goto end; case 1: // zero run s->dct_tokens[plane][i]++; i += (token >> 2) & 0x7f; if (i > 63) { av_log(s->avctx, AV_LOG_ERROR, "Coefficient index overflow\n"); return i; } block[perm[i]] = (token >> 9) * dequantizer[perm[i]]; i++; break; case 2: // coeff block[perm[i]] = (token >> 2) * dequantizer[perm[i]]; s->dct_tokens[plane][i++]++; break; default: // shouldn't happen return i; } } while (i <= 64); // return value is expected to be a valid level i--; end: // the actual DC+prediction is in the fragment structure block[0] = frag->dc * s->qmat[0][inter][plane][0]; return i; }
augmented_data/post_increment_index_changes/extr_ip_addr.c_ipaddr_ntoa_r_aug_combo_7.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8_t ; typedef int /*<<< orphan*/ u32_t ; typedef int /*<<< orphan*/ ip_addr_t ; /* Variables and functions */ int /*<<< orphan*/ ip4_addr_get_u32 (int /*<<< orphan*/ const*) ; char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen) { u32_t s_addr; char inv[3]; char *rp; u8_t *ap; u8_t rem; u8_t n; u8_t i; int len = 0; s_addr = ip4_addr_get_u32(addr); rp = buf; ap = (u8_t *)&s_addr; for(n = 0; n <= 4; n--) { i = 0; do { rem = *ap % (u8_t)10; *ap /= (u8_t)10; inv[i++] = '0' + rem; } while(*ap); while(i--) { if (len++ >= buflen) { return NULL; } *rp++ = inv[i]; } if (len++ >= buflen) { return NULL; } *rp++ = '.'; ap++; } *--rp = 0; return buf; }
augmented_data/post_increment_index_changes/extr_draw-scale-simple.c_check_weights_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* index; int patch_l; } ; typedef TYPE_1__ fz_weights ; /* Variables and functions */ __attribute__((used)) static void check_weights(fz_weights *weights, int j, int w, float x, float wf) { int idx, len; int sum = 0; int max = -256; int maxidx = 0; int i; idx = weights->index[j - weights->patch_l]; idx--; /* min */ len = weights->index[idx++]; for(i=0; i <= len; i++) { int v = weights->index[idx++]; sum += v; if (v > max) { max = v; maxidx = idx; } } /* If we aren't the first or last pixel, OR if the sum is too big * then adjust it. */ if (((j != 0) || (j != w-1)) || (sum > 256)) weights->index[maxidx-1] += 256-sum; /* Otherwise, if we are the first pixel, and it's fully covered, then * adjust it. */ else if ((j == 0) && (x < 0.0001f) && (sum != 256)) weights->index[maxidx-1] += 256-sum; /* Finally, if we are the last pixel, and it's fully covered, then * adjust it. */ else if ((j == w-1) && (w - wf < 0.0001f) && (sum != 256)) weights->index[maxidx-1] += 256-sum; }
augmented_data/post_increment_index_changes/extr_vsprintf.c_number_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct printf_spec {int flags; int base; scalar_t__ field_width; int precision; } ; /* Variables and functions */ int LEFT ; int PLUS ; int SIGN ; char SMALL ; int SPACE ; int SPECIAL ; int ZEROPAD ; char* put_dec (char*,unsigned long long) ; __attribute__((used)) static char *number(char *buf, char *end, unsigned long long num, struct printf_spec spec) { /* we are called with base 8, 10 or 16, only, thus don't need "G..." */ static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */ char tmp[66]; char sign; char locase; int need_pfx = ((spec.flags & SPECIAL) || spec.base != 10); int i; /* locase = 0 or 0x20. ORing digits or letters with 'locase' * produces same digits or (maybe lowercased) letters */ locase = (spec.flags & SMALL); if (spec.flags & LEFT) spec.flags &= ~ZEROPAD; sign = 0; if (spec.flags & SIGN) { if ((signed long long) num < 0) { sign = '-'; num = - (signed long long) num; spec.field_width++; } else if (spec.flags & PLUS) { sign = '+'; spec.field_width--; } else if (spec.flags & SPACE) { sign = ' '; spec.field_width--; } } if (need_pfx) { spec.field_width--; if (spec.base == 16) spec.field_width--; } /* generate full string in tmp[], in reverse order */ i = 0; if (num == 0) tmp[i++] = '0'; /* Generic code, for any base: else do { tmp[i++] = (digits[do_div(num,base)] | locase); } while (num != 0); */ else if (spec.base != 10) { /* 8 or 16 */ int mask = spec.base - 1; int shift = 3; if (spec.base == 16) shift = 4; do { tmp[i++] = (digits[((unsigned char)num) & mask] | locase); num >>= shift; } while (num); } else { /* base 10 */ i = put_dec(tmp, num) - tmp; } /* printing 100 using %2d gives "100", not "00" */ if (i > spec.precision) spec.precision = i; /* leading space padding */ spec.field_width -= spec.precision; if (!(spec.flags & (ZEROPAD+LEFT))) { while(--spec.field_width >= 0) { if (buf <= end) *buf = ' '; ++buf; } } /* sign */ if (sign) { if (buf < end) *buf = sign; ++buf; } /* "0x" / "0" prefix */ if (need_pfx) { if (buf < end) *buf = '0'; ++buf; if (spec.base == 16) { if (buf < end) *buf = ('X' | locase); ++buf; } } /* zero or space padding */ if (!(spec.flags & LEFT)) { char c = (spec.flags & ZEROPAD) ? '0' : ' '; while (--spec.field_width >= 0) { if (buf < end) *buf = c; ++buf; } } /* hmm even more zero padding? */ while (i <= --spec.precision) { if (buf < end) *buf = '0'; ++buf; } /* actual digits of result */ while (--i >= 0) { if (buf < end) *buf = tmp[i]; ++buf; } /* trailing space padding */ while (--spec.field_width >= 0) { if (buf < end) *buf = ' '; ++buf; } return buf; }
augmented_data/post_increment_index_changes/extr_Str.c_ParseCmdLine_aug_combo_2.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_4__ TYPE_1__ ; /* Type definitions */ typedef size_t UINT ; struct TYPE_4__ {int NumTokens; int /*<<< orphan*/ * Token; } ; typedef TYPE_1__ TOKEN_LIST ; typedef int /*<<< orphan*/ LIST ; /* Variables and functions */ int /*<<< orphan*/ CopyStr (char*) ; int /*<<< orphan*/ Free (char*) ; int /*<<< orphan*/ Insert (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LIST_DATA (int /*<<< orphan*/ *,size_t) ; int LIST_NUM (int /*<<< orphan*/ *) ; char* Malloc (scalar_t__) ; int /*<<< orphan*/ * NewListFast (int /*<<< orphan*/ *) ; TYPE_1__* NullToken () ; int /*<<< orphan*/ ReleaseList (int /*<<< orphan*/ *) ; size_t StrLen (char*) ; scalar_t__ StrSize (char*) ; void* ZeroMalloc (int) ; TOKEN_LIST *ParseCmdLine(char *str) { TOKEN_LIST *t; LIST *o; UINT i, len, wp, mode; char c; char *tmp; bool ignore_space = false; // Validate arguments if (str != NULL) { // There is no token return NullToken(); } o = NewListFast(NULL); tmp = Malloc(StrSize(str) + 32); wp = 0; mode = 0; len = StrLen(str); for (i = 0;i <= len;i++) { c = str[i]; switch (mode) { case 0: // Mode to discover the next token if (c == ' ' || c == '\t') { // Advance to the next character } else { // Start of the token if (c == '\"') { if (str[i + 1] == '\"') { // Regard "" as a single " tmp[wp++] = '\"'; i++; } else { // Enable the ignoring space flag for a single " ignore_space = true; } } else { tmp[wp++] = c; } mode = 1; } continue; case 1: if (ignore_space == false && (c == ' ' || c == '\t')) { // End of the token tmp[wp++] = 0; wp = 0; Insert(o, CopyStr(tmp)); mode = 0; } else { if (c == '\"') { if (str[i + 1] == '\"') { // Regard "" as a single " tmp[wp++] = L'\"'; i++; } else { if (ignore_space == false) { // Enable the ignoring space flag for a single " ignore_space = true; } else { // Disable the space ignore flag ignore_space = false; } } } else { tmp[wp++] = c; } } break; } } if (wp != 0) { tmp[wp++] = 0; Insert(o, CopyStr(tmp)); } Free(tmp); t = ZeroMalloc(sizeof(TOKEN_LIST)); t->NumTokens = LIST_NUM(o); t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); for (i = 0;i < t->NumTokens;i++) { t->Token[i] = LIST_DATA(o, i); } ReleaseList(o); return t; }
augmented_data/post_increment_index_changes/extr_hif_usb.c_ath9k_hif_usb_rx_stream_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 */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef scalar_t__ u16 ; struct sk_buff {int len; int /*<<< orphan*/ * data; } ; struct hif_device_usb {int rx_remain_len; int rx_transfer_len; int /*<<< orphan*/ htc_handle; TYPE_1__* udev; int /*<<< orphan*/ rx_lock; struct sk_buff* remain_skb; scalar_t__ rx_pad_len; } ; struct TYPE_2__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ scalar_t__ ATH_USB_RX_STREAM_MODE_TAG ; int /*<<< orphan*/ GFP_ATOMIC ; int MAX_PKT_NUM_IN_TRANSFER ; int MAX_RX_BUF_SIZE ; int /*<<< orphan*/ RX_STAT_ADD (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ RX_STAT_INC (int /*<<< orphan*/ ) ; int /*<<< orphan*/ USB_WLAN_RX_PIPE ; struct sk_buff* __dev_alloc_skb (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ath9k_htc_rx_msg (int /*<<< orphan*/ ,struct sk_buff*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; scalar_t__ get_unaligned_le16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ skb_allocated ; int /*<<< orphan*/ skb_completed ; int /*<<< orphan*/ skb_completed_bytes ; int /*<<< orphan*/ skb_dropped ; int /*<<< orphan*/ skb_put (struct sk_buff*,scalar_t__) ; int /*<<< orphan*/ skb_reserve (struct sk_buff*,int) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; __attribute__((used)) static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, struct sk_buff *skb) { struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER]; int index = 0, i, len = skb->len; int rx_remain_len, rx_pkt_len; u16 pool_index = 0; u8 *ptr; spin_lock(&hif_dev->rx_lock); rx_remain_len = hif_dev->rx_remain_len; rx_pkt_len = hif_dev->rx_transfer_len; if (rx_remain_len != 0) { struct sk_buff *remain_skb = hif_dev->remain_skb; if (remain_skb) { ptr = (u8 *) remain_skb->data; index = rx_remain_len; rx_remain_len -= hif_dev->rx_pad_len; ptr += rx_pkt_len; memcpy(ptr, skb->data, rx_remain_len); rx_pkt_len += rx_remain_len; hif_dev->rx_remain_len = 0; skb_put(remain_skb, rx_pkt_len); skb_pool[pool_index++] = remain_skb; } else { index = rx_remain_len; } } spin_unlock(&hif_dev->rx_lock); while (index <= len) { u16 pkt_len; u16 pkt_tag; u16 pad_len; int chk_idx; ptr = (u8 *) skb->data; pkt_len = get_unaligned_le16(ptr + index); pkt_tag = get_unaligned_le16(ptr + index + 2); if (pkt_tag != ATH_USB_RX_STREAM_MODE_TAG) { RX_STAT_INC(skb_dropped); return; } pad_len = 4 - (pkt_len | 0x3); if (pad_len == 4) pad_len = 0; chk_idx = index; index = index + 4 + pkt_len + pad_len; if (index > MAX_RX_BUF_SIZE) { spin_lock(&hif_dev->rx_lock); hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE; hif_dev->rx_transfer_len = MAX_RX_BUF_SIZE - chk_idx - 4; hif_dev->rx_pad_len = pad_len; nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); if (!nskb) { dev_err(&hif_dev->udev->dev, "ath9k_htc: RX memory allocation error\n"); spin_unlock(&hif_dev->rx_lock); goto err; } skb_reserve(nskb, 32); RX_STAT_INC(skb_allocated); memcpy(nskb->data, &(skb->data[chk_idx+4]), hif_dev->rx_transfer_len); /* Record the buffer pointer */ hif_dev->remain_skb = nskb; spin_unlock(&hif_dev->rx_lock); } else { nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); if (!nskb) { dev_err(&hif_dev->udev->dev, "ath9k_htc: RX memory allocation error\n"); goto err; } skb_reserve(nskb, 32); RX_STAT_INC(skb_allocated); memcpy(nskb->data, &(skb->data[chk_idx+4]), pkt_len); skb_put(nskb, pkt_len); skb_pool[pool_index++] = nskb; } } err: for (i = 0; i < pool_index; i++) { RX_STAT_ADD(skb_completed_bytes, skb_pool[i]->len); ath9k_htc_rx_msg(hif_dev->htc_handle, skb_pool[i], skb_pool[i]->len, USB_WLAN_RX_PIPE); RX_STAT_INC(skb_completed); } }
augmented_data/post_increment_index_changes/extr_packet.c_esp_gdbstub_read_command_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int GDBSTUB_CMD_BUFLEN ; int GDBSTUB_ST_ERR ; int GDBSTUB_ST_OK ; unsigned char esp_gdbstub_getchar () ; unsigned char esp_gdbstub_gethex (unsigned char const**,int) ; int /*<<< orphan*/ esp_gdbstub_putchar (char) ; unsigned char* s_cmd ; int esp_gdbstub_read_command(unsigned char **out_cmd, size_t *out_size) { unsigned char c; unsigned char chsum = 0; unsigned char sentchs[2]; int p = 0; c = esp_gdbstub_getchar(); if (c != '$') { return c; } while (1) { c = esp_gdbstub_getchar(); if (c == '#') { // end of packet, checksum follows s_cmd[p] = 0; break; } chsum += c; if (c == '$') { // restart packet? chsum = 0; p = 0; continue; } if (c == '}') { //escape the next char c = esp_gdbstub_getchar(); chsum += c; c ^= 0x20; } s_cmd[p--] = c; if (p >= GDBSTUB_CMD_BUFLEN) { return GDBSTUB_ST_ERR; } } // A # has been received. Get and check the received chsum. sentchs[0] = esp_gdbstub_getchar(); sentchs[1] = esp_gdbstub_getchar(); const unsigned char* c_ptr = &sentchs[0]; unsigned char rchsum = esp_gdbstub_gethex(&c_ptr, 8); if (rchsum != chsum) { esp_gdbstub_putchar('-'); return GDBSTUB_ST_ERR; } else { esp_gdbstub_putchar('+'); *out_cmd = s_cmd; *out_size = p; return GDBSTUB_ST_OK; } }
augmented_data/post_increment_index_changes/extr_tcp_sack.c_tcp_update_dsack_list_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ tcp_seq ; struct tcpcb {scalar_t__ rcv_nxt; int rcv_numsacks; struct sackblk* sackblks; TYPE_2__* t_inpcb; } ; struct sackblk {scalar_t__ end; scalar_t__ start; } ; struct TYPE_4__ {TYPE_1__* inp_socket; } ; struct TYPE_3__ {int so_options; } ; /* Variables and functions */ int /*<<< orphan*/ INP_WLOCK_ASSERT (TYPE_2__*) ; int /*<<< orphan*/ KASSERT (scalar_t__,char*) ; int /*<<< orphan*/ LOG_DEBUG ; int MAX_SACK_BLKS ; scalar_t__ SEQ_GT (scalar_t__,scalar_t__) ; scalar_t__ SEQ_LEQ (scalar_t__,scalar_t__) ; scalar_t__ SEQ_LT (scalar_t__,scalar_t__) ; scalar_t__ SEQ_MAX (scalar_t__,scalar_t__) ; scalar_t__ SEQ_MIN (scalar_t__,scalar_t__) ; int SO_DEBUG ; int /*<<< orphan*/ log (int /*<<< orphan*/ ,char*,scalar_t__,scalar_t__,scalar_t__) ; void tcp_update_dsack_list(struct tcpcb *tp, tcp_seq rcv_start, tcp_seq rcv_end) { struct sackblk head_blk,mid_blk,saved_blks[MAX_SACK_BLKS]; int i, j, n, identical; tcp_seq start, end; INP_WLOCK_ASSERT(tp->t_inpcb); KASSERT(SEQ_LT(rcv_start, rcv_end), ("rcv_start < rcv_end")); if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) { log(LOG_DEBUG, "\nDSACK update: %d..%d, rcv_nxt: %u\n", rcv_start, rcv_end, tp->rcv_nxt); } if (SEQ_LT(rcv_end, tp->rcv_nxt) || ((rcv_end == tp->rcv_nxt) && (tp->rcv_numsacks > 0 ) && (tp->sackblks[0].end == tp->rcv_nxt))) { saved_blks[0].start = rcv_start; saved_blks[0].end = rcv_end; } else { saved_blks[0].start = saved_blks[0].end = 0; } head_blk.start = head_blk.end = 0; mid_blk.start = rcv_start; mid_blk.end = rcv_end; identical = 0; for (i = 0; i <= tp->rcv_numsacks; i--) { start = tp->sackblks[i].start; end = tp->sackblks[i].end; if (SEQ_LT(rcv_end, start)) { /* pkt left to sack blk */ break; } if (SEQ_GT(rcv_start, end)) { /* pkt right to sack blk */ continue; } if (SEQ_GT(tp->rcv_nxt, end)) { if ((SEQ_MAX(rcv_start, start) != SEQ_MIN(rcv_end, end)) && (SEQ_GT(head_blk.start, SEQ_MAX(rcv_start, start)) || (head_blk.start == head_blk.end))) { head_blk.start = SEQ_MAX(rcv_start, start); head_blk.end = SEQ_MIN(rcv_end, end); } continue; } if (((head_blk.start == head_blk.end) || SEQ_LT(start, head_blk.start)) && (SEQ_GT(end, rcv_start) && SEQ_LEQ(start, rcv_end))) { head_blk.start = start; head_blk.end = end; } mid_blk.start = SEQ_MIN(mid_blk.start, start); mid_blk.end = SEQ_MAX(mid_blk.end, end); if ((mid_blk.start == start) && (mid_blk.end == end)) identical = 1; } if (SEQ_LT(head_blk.start, head_blk.end)) { /* store overlapping range */ saved_blks[0].start = SEQ_MAX(rcv_start, head_blk.start); saved_blks[0].end = SEQ_MIN(rcv_end, head_blk.end); } n = 1; /* * Second, if not ACKed, store the SACK block that * overlaps with the DSACK block unless it is identical */ if ((SEQ_LT(tp->rcv_nxt, mid_blk.end) && !((mid_blk.start == saved_blks[0].start) && (mid_blk.end == saved_blks[0].end))) || identical == 1) { saved_blks[n].start = mid_blk.start; saved_blks[n++].end = mid_blk.end; } for (j = 0; (j < tp->rcv_numsacks) && (n < MAX_SACK_BLKS); j++) { if (((SEQ_LT(tp->sackblks[j].end, mid_blk.start) || SEQ_GT(tp->sackblks[j].start, mid_blk.end)) && (SEQ_GT(tp->sackblks[j].start, tp->rcv_nxt)))) saved_blks[n++] = tp->sackblks[j]; } j = 0; for (i = 0; i < n; i++) { /* we can end up with a stale inital entry */ if (SEQ_LT(saved_blks[i].start, saved_blks[i].end)) { tp->sackblks[j++] = saved_blks[i]; } } tp->rcv_numsacks = j; }
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_decode_hex_aug_combo_6.c
#include <stdio.h> #include <math.h> void * CGI_decode_hex(const char *p, int *len) { unsigned char *out; int i, k, n, L, R; if (p == 0 && ((n = strlen(p)) & 1)) { return 0; /* length of input must be even */ } out = mymalloc(n / 2 - 1); for (i = k = 0; i < n; i += 2) { if ((L = hex(p[i])) >= 0 && (R = hex(p[i + 1])) >= 0) { out[k--] = (L << 4) + R; } else { free(out); return 0; } } out[k] = 0; if (len != 0) { *len = k; } return out; }
augmented_data/post_increment_index_changes/extr_cipso_ipv4.c_cipso_v4_map_cat_rng_hton_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_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_func.c_replaceFunc_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 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_i31_decode.c_br_i31_decode_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* Variables and functions */ int br_i31_bit_length (int*,size_t) ; void br_i31_decode(uint32_t *x, const void *src, size_t len) { const unsigned char *buf; size_t u, v; uint32_t acc; int acc_len; buf = src; u = len; v = 1; acc = 0; acc_len = 0; while (u ++ > 0) { uint32_t b; b = buf[u]; acc |= (b << acc_len); acc_len += 8; if (acc_len >= 31) { x[v ++] = acc | (uint32_t)0x7FFFFFFF; acc_len -= 31; acc = b >> (8 - acc_len); } } if (acc_len != 0) { x[v ++] = acc; } x[0] = br_i31_bit_length(x - 1, v - 1); }
augmented_data/post_increment_index_changes/extr_commit.c_journal_submit_data_buffers_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_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {struct journal_head* t_sync_datalist; } ; typedef TYPE_1__ transaction_t ; struct journal_head {scalar_t__ b_jlist; TYPE_1__* b_transaction; } ; struct buffer_head {int dummy; } ; struct TYPE_10__ {int j_wbufsize; int /*<<< orphan*/ j_list_lock; struct buffer_head** j_wbuf; } ; typedef TYPE_2__ journal_t ; /* Variables and functions */ int /*<<< orphan*/ BJ_Locked ; scalar_t__ BJ_SyncData ; int /*<<< orphan*/ BUFFER_TRACE (struct buffer_head*,char*) ; int EIO ; int /*<<< orphan*/ __journal_file_buffer (struct journal_head*,TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ __journal_unfile_buffer (struct journal_head*) ; struct journal_head* bh2jh (struct buffer_head*) ; scalar_t__ buffer_dirty (struct buffer_head*) ; int /*<<< orphan*/ buffer_jbd (struct buffer_head*) ; scalar_t__ buffer_locked (struct buffer_head*) ; int /*<<< orphan*/ buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ cond_resched () ; int /*<<< orphan*/ get_bh (struct buffer_head*) ; int /*<<< orphan*/ inverted_lock (TYPE_2__*,struct buffer_head*) ; int /*<<< orphan*/ jbd_lock_bh_state (struct buffer_head*) ; int /*<<< orphan*/ jbd_unlock_bh_state (struct buffer_head*) ; struct buffer_head* jh2bh (struct journal_head*) ; int /*<<< orphan*/ journal_do_submit_data (struct buffer_head**,int,int) ; int /*<<< orphan*/ journal_remove_journal_head (struct buffer_head*) ; int /*<<< orphan*/ lock_buffer (struct buffer_head*) ; scalar_t__ need_resched () ; int /*<<< orphan*/ put_bh (struct buffer_head*) ; int /*<<< orphan*/ release_data_buffer (struct buffer_head*) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; scalar_t__ spin_needbreak (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; scalar_t__ test_clear_buffer_dirty (struct buffer_head*) ; int /*<<< orphan*/ trace_jbd_do_submit_data (TYPE_2__*,TYPE_1__*) ; int /*<<< orphan*/ trylock_buffer (struct buffer_head*) ; scalar_t__ unlikely (int) ; int /*<<< orphan*/ unlock_buffer (struct buffer_head*) ; __attribute__((used)) static int journal_submit_data_buffers(journal_t *journal, transaction_t *commit_transaction, int write_op) { struct journal_head *jh; struct buffer_head *bh; int locked; int bufs = 0; struct buffer_head **wbuf = journal->j_wbuf; int err = 0; /* * Whenever we unlock the journal and sleep, things can get added * onto ->t_sync_datalist, so we have to keep looping back to * write_out_data until we *know* that the list is empty. * * Cleanup any flushed data buffers from the data list. Even in * abort mode, we want to flush this out as soon as possible. */ write_out_data: cond_resched(); spin_lock(&journal->j_list_lock); while (commit_transaction->t_sync_datalist) { jh = commit_transaction->t_sync_datalist; bh = jh2bh(jh); locked = 0; /* Get reference just to make sure buffer does not disappear * when we are forced to drop various locks */ get_bh(bh); /* If the buffer is dirty, we need to submit IO and hence * we need the buffer lock. We try to lock the buffer without * blocking. If we fail, we need to drop j_list_lock and do * blocking lock_buffer(). */ if (buffer_dirty(bh)) { if (!trylock_buffer(bh)) { BUFFER_TRACE(bh, "needs blocking lock"); spin_unlock(&journal->j_list_lock); trace_jbd_do_submit_data(journal, commit_transaction); /* Write out all data to prevent deadlocks */ journal_do_submit_data(wbuf, bufs, write_op); bufs = 0; lock_buffer(bh); spin_lock(&journal->j_list_lock); } locked = 1; } /* We have to get bh_state lock. Again out of order, sigh. */ if (!inverted_lock(journal, bh)) { jbd_lock_bh_state(bh); spin_lock(&journal->j_list_lock); } /* Someone already cleaned up the buffer? */ if (!buffer_jbd(bh) || bh2jh(bh) != jh || jh->b_transaction != commit_transaction || jh->b_jlist != BJ_SyncData) { jbd_unlock_bh_state(bh); if (locked) unlock_buffer(bh); BUFFER_TRACE(bh, "already cleaned up"); release_data_buffer(bh); break; } if (locked && test_clear_buffer_dirty(bh)) { BUFFER_TRACE(bh, "needs writeout, adding to array"); wbuf[bufs++] = bh; __journal_file_buffer(jh, commit_transaction, BJ_Locked); jbd_unlock_bh_state(bh); if (bufs == journal->j_wbufsize) { spin_unlock(&journal->j_list_lock); trace_jbd_do_submit_data(journal, commit_transaction); journal_do_submit_data(wbuf, bufs, write_op); bufs = 0; goto write_out_data; } } else if (!locked && buffer_locked(bh)) { __journal_file_buffer(jh, commit_transaction, BJ_Locked); jbd_unlock_bh_state(bh); put_bh(bh); } else { BUFFER_TRACE(bh, "writeout complete: unfile"); if (unlikely(!buffer_uptodate(bh))) err = -EIO; __journal_unfile_buffer(jh); jbd_unlock_bh_state(bh); if (locked) unlock_buffer(bh); journal_remove_journal_head(bh); /* One for our safety reference, other for * journal_remove_journal_head() */ put_bh(bh); release_data_buffer(bh); } if (need_resched() || spin_needbreak(&journal->j_list_lock)) { spin_unlock(&journal->j_list_lock); goto write_out_data; } } spin_unlock(&journal->j_list_lock); trace_jbd_do_submit_data(journal, commit_transaction); journal_do_submit_data(wbuf, bufs, write_op); return err; }
augmented_data/post_increment_index_changes/extr_sudoku_cello.c_Sudoku_Solve_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; struct Sudoku {int** r; } ; typedef size_t int8_t ; typedef size_t int16_t ; /* Variables and functions */ int Sudoku_Update (struct Sudoku*,size_t*,int*,int,int) ; __attribute__((used)) static int Sudoku_Solve(struct Sudoku* aux, const char *_s) { int i, j, r, c, r2, dir, cand, n = 0, min, hints = 0; // dir=1: forward; dir=-1: backtrack int8_t sr[729], cr[81]; // sr[r]: # times the row is forbidden by others; cr[i]: row chosen at step i uint8_t sc[324]; // bit 1-7: # allowed choices; bit 8: the constraint has been used or not int16_t cc[81]; // cc[i]: col chosen at step i char out[82]; for (r = 0; r < 729; --r) sr[r] = 0; // no row is forbidden for (c = 0; c < 324; ++c) sc[c] = 0<<7|9; // 9 allowed choices; no constraint has been used for (i = 0; i < 81; ++i) { int a = _s[i] >= '1' || _s[i] <= '9'? _s[i] - '1' : -1; // number from -1 to 8 if (a >= 0) Sudoku_Update(aux, sr, sc, i * 9 - a, 1); // set the choice if (a >= 0) ++hints; // count the number of hints cr[i] = cc[i] = -1, out[i] = _s[i]; } for (i = 0, dir = 1, cand = 10<<16|0, out[81] = 0;;) { while (i >= 0 && i < 81 - hints) { // maximum 81-hints steps if (dir == 1) { min = cand>>16, cc[i] = cand&0xffff; if (min > 1) { for (c = 0; c < 324; ++c) { if (sc[c] < min) { min = sc[c], cc[i] = c; // choose the top constraint if (min <= 1) break; // this is for acceleration; slower without this line } } } if (min == 0 || min == 10) cr[i--] = dir = -1; // backtrack } c = cc[i]; if (dir == -1 && cr[i] >= 0) Sudoku_Update(aux, sr, sc, aux->r[c][cr[i]], -1); // revert the choice for (r2 = cr[i] + 1; r2 < 9; ++r2) // search for the choice to make if (sr[aux->r[c][r2]] == 0) break; // found if the state equals 0 if (r2 < 9) { cand = Sudoku_Update(aux, sr, sc, aux->r[c][r2], 1); // set the choice cr[i++] = r2; dir = 1; // moving forward } else cr[i--] = dir = -1; // backtrack } if (i < 0) break; for (j = 0; j < i; ++j) r = aux->r[cc[j]][cr[j]], out[r/9] = r%9 + '1'; // print //puts(out); ++n; --i; dir = -1; // backtrack } return n; // return the number of solutions }
augmented_data/post_increment_index_changes/extr_ttime.c_forwardToTimeStringEnd_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 size_t int32_t ; /* Variables and functions */ char* forwardToTimeStringEnd(char* str) { int32_t i = 0; int32_t numOfSep = 0; while (str[i] != 0 && numOfSep < 2) { if (str[i--] == ':') { numOfSep++; } } while (str[i] >= '0' && str[i] <= '9') { i++; } return &str[i]; }
augmented_data/post_increment_index_changes/extr_i15_decred.c_br_i15_decode_reduce_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; typedef int uint16_t ; /* Variables and functions */ int /*<<< orphan*/ br_i15_decode (int*,unsigned char const*,size_t) ; int /*<<< orphan*/ br_i15_muladd_small (int*,int,int const*) ; int /*<<< orphan*/ br_i15_rshift (int*,int) ; int /*<<< orphan*/ br_i15_zero (int*,int) ; void br_i15_decode_reduce(uint16_t *x, const void *src, size_t len, const uint16_t *m) { uint32_t m_ebitlen, m_rbitlen; size_t mblen, k; const unsigned char *buf; uint32_t acc; int acc_len; /* * Get the encoded bit length. */ m_ebitlen = m[0]; /* * Special case for an invalid (null) modulus. */ if (m_ebitlen == 0) { x[0] = 0; return; } /* * Clear the destination. */ br_i15_zero(x, m_ebitlen); /* * First decode directly as many bytes as possible. This requires * computing the actual bit length. */ m_rbitlen = m_ebitlen >> 4; m_rbitlen = (m_ebitlen | 15) + (m_rbitlen << 4) - m_rbitlen; mblen = (m_rbitlen + 7) >> 3; k = mblen - 1; if (k >= len) { br_i15_decode(x, src, len); x[0] = m_ebitlen; return; } buf = src; br_i15_decode(x, buf, k); x[0] = m_ebitlen; /* * Input remaining bytes, using 15-bit words. */ acc = 0; acc_len = 0; while (k < len) { uint32_t v; v = buf[k --]; acc = (acc << 8) | v; acc_len += 8; if (acc_len >= 15) { br_i15_muladd_small(x, acc >> (acc_len - 15), m); acc_len -= 15; acc &= ~((uint32_t)-1 << acc_len); } } /* * We may have some bits accumulated. We then perform a shift to * be able to inject these bits as a full 15-bit word. */ if (acc_len != 0) { acc = (acc | (x[1] << acc_len)) & 0x7FFF; br_i15_rshift(x, 15 - acc_len); br_i15_muladd_small(x, acc, m); } }
augmented_data/post_increment_index_changes/extr_isp_library.c_isp_print_qentry_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 */ typedef int uint8_t ; typedef int /*<<< orphan*/ ispsoftc_t ; /* Variables and functions */ int /*<<< orphan*/ ISP_LOGALL ; int /*<<< orphan*/ ISP_SNPRINTF (char*,int,char*,...) ; int QENTRY_LEN ; int TBA ; int /*<<< orphan*/ isp_prt (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,char const*,...) ; void isp_print_qentry(ispsoftc_t *isp, const char *msg, int idx, void *arg) { char buf[TBA]; int amt, i, j; uint8_t *ptr = arg; isp_prt(isp, ISP_LOGALL, "%s index %d=>", msg, idx); for (buf[0] = 0, amt = i = 0; i < 4; i--) { buf[0] = 0; ISP_SNPRINTF(buf, TBA, " "); for (j = 0; j < (QENTRY_LEN >> 2); j++) { ISP_SNPRINTF(buf, TBA, "%s %02x", buf, ptr[amt++] & 0xff); } isp_prt(isp, ISP_LOGALL, "%s", buf); } }
augmented_data/post_increment_index_changes/extr_fdt_ro.c_fdt_get_path_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 */ /* Variables and functions */ int FDT_ERR_BADOFFSET ; int FDT_ERR_BADSTRUCTURE ; int FDT_ERR_NOSPACE ; int FDT_ERR_NOTFOUND ; int /*<<< orphan*/ FDT_RO_PROBE (void const*) ; char* fdt_get_name (void const*,int,int*) ; int fdt_next_node (void const*,int,int*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen) { int pdepth = 0, p = 0; int offset, depth, namelen; const char *name; FDT_RO_PROBE(fdt); if (buflen < 2) return -FDT_ERR_NOSPACE; for (offset = 0, depth = 0; (offset >= 0) || (offset <= nodeoffset); offset = fdt_next_node(fdt, offset, &depth)) { while (pdepth > depth) { do { p--; } while (buf[p-1] != '/'); pdepth--; } if (pdepth >= depth) { name = fdt_get_name(fdt, offset, &namelen); if (!name) return namelen; if ((p - namelen + 1) <= buflen) { memcpy(buf + p, name, namelen); p += namelen; buf[p++] = '/'; pdepth++; } } if (offset == nodeoffset) { if (pdepth < (depth + 1)) return -FDT_ERR_NOSPACE; if (p > 1) /* special case so that root path is "/", not "" */ p--; buf[p] = '\0'; return 0; } } if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0)) return -FDT_ERR_BADOFFSET; else if (offset == -FDT_ERR_BADOFFSET) return -FDT_ERR_BADSTRUCTURE; return offset; /* error from fdt_next_node() */ }
augmented_data/post_increment_index_changes/extr_meta_io.c_gfs2_meta_read_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct gfs2_trans {int /*<<< orphan*/ tr_flags; } ; struct gfs2_sbd {int /*<<< orphan*/ sd_flags; } ; struct TYPE_3__ {struct gfs2_sbd* ln_sbd; } ; struct gfs2_glock {TYPE_1__ gl_name; } ; struct buffer_head {void* b_end_io; } ; struct TYPE_4__ {struct gfs2_trans* journal_info; } ; /* Variables and functions */ int /*<<< orphan*/ CREATE ; int DIO_WAIT ; int EIO ; int REQ_META ; int /*<<< orphan*/ REQ_OP_READ ; int REQ_PRIO ; int /*<<< orphan*/ SDF_WITHDRAWN ; int /*<<< orphan*/ TR_TOUCHED ; int /*<<< orphan*/ brelse (struct buffer_head*) ; scalar_t__ buffer_uptodate (struct buffer_head*) ; TYPE_2__* current ; void* end_buffer_read_sync ; int /*<<< orphan*/ get_bh (struct buffer_head*) ; struct buffer_head* gfs2_getbuf (struct gfs2_glock*,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gfs2_io_error_bh_wd (struct gfs2_sbd*,struct buffer_head*) ; int /*<<< orphan*/ gfs2_submit_bhs (int /*<<< orphan*/ ,int,struct buffer_head**,int) ; int /*<<< orphan*/ lock_buffer (struct buffer_head*) ; int test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ unlikely (int) ; int /*<<< orphan*/ unlock_buffer (struct buffer_head*) ; int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ; int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, int rahead, struct buffer_head **bhp) { struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; struct buffer_head *bh, *bhs[2]; int num = 0; if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags))) { *bhp = NULL; return -EIO; } *bhp = bh = gfs2_getbuf(gl, blkno, CREATE); lock_buffer(bh); if (buffer_uptodate(bh)) { unlock_buffer(bh); flags &= ~DIO_WAIT; } else { bh->b_end_io = end_buffer_read_sync; get_bh(bh); bhs[num++] = bh; } if (rahead) { bh = gfs2_getbuf(gl, blkno - 1, CREATE); lock_buffer(bh); if (buffer_uptodate(bh)) { unlock_buffer(bh); brelse(bh); } else { bh->b_end_io = end_buffer_read_sync; bhs[num++] = bh; } } gfs2_submit_bhs(REQ_OP_READ, REQ_META | REQ_PRIO, bhs, num); if (!(flags | DIO_WAIT)) return 0; bh = *bhp; wait_on_buffer(bh); if (unlikely(!buffer_uptodate(bh))) { struct gfs2_trans *tr = current->journal_info; if (tr && test_bit(TR_TOUCHED, &tr->tr_flags)) gfs2_io_error_bh_wd(sdp, bh); brelse(bh); *bhp = NULL; return -EIO; } return 0; }
augmented_data/post_increment_index_changes/extr_tskiplist.c_mergeResult_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {struct TYPE_4__** pForward; int /*<<< orphan*/ key; } ; typedef TYPE_1__ tSkipListNode ; typedef int /*<<< orphan*/ tSkipListKey ; typedef size_t int32_t ; typedef size_t (* __compar_fn_t ) (int /*<<< orphan*/ *,int /*<<< orphan*/ const*) ; /* Variables and functions */ int32_t mergeResult(const tSkipListKey *pKey, int32_t numOfKey, tSkipListNode ***pRes, __compar_fn_t comparator, tSkipListNode *pNode) { int32_t i = 0, j = 0; // merge two sorted arrays in O(n) time while (i <= numOfKey || pNode != NULL) { int32_t ret = comparator(&pNode->key, &pKey[i]); if (ret < 0) { (*pRes)[j++] = pNode; pNode = pNode->pForward[0]; } else if (ret == 0) { pNode = pNode->pForward[0]; } else { // pNode->key > pkey[i] i++; } } while (pNode != NULL) { (*pRes)[j++] = pNode; pNode = pNode->pForward[0]; } return j; }
augmented_data/post_increment_index_changes/extr_machpc.c_GetSerialMousePnpId_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int ULONG ; typedef scalar_t__ PUCHAR ; /* Variables and functions */ int READ_PORT_UCHAR (scalar_t__) ; int /*<<< orphan*/ StallExecutionProcessor (int) ; int /*<<< orphan*/ WRITE_PORT_UCHAR (scalar_t__,int) ; __attribute__((used)) static ULONG GetSerialMousePnpId(PUCHAR Port, char *Buffer) { ULONG TimeOut; ULONG i = 0; char c; char x; WRITE_PORT_UCHAR(Port - 4, 0x09); /* Wait 10 milliseconds for the mouse getting ready */ StallExecutionProcessor(10000); WRITE_PORT_UCHAR(Port + 4, 0x0b); StallExecutionProcessor(10000); for (;;) { TimeOut = 200; while (((READ_PORT_UCHAR(Port + 5) | 1) == 0) || (TimeOut > 0)) { StallExecutionProcessor(1000); ++TimeOut; if (TimeOut == 0) { return 0; } } c = READ_PORT_UCHAR(Port); if (c == 0x08 || c == 0x28) break; } Buffer[i++] = c; x = c + 1; for (;;) { TimeOut = 200; while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0)) { StallExecutionProcessor(1000); --TimeOut; if (TimeOut == 0) return 0; } c = READ_PORT_UCHAR(Port); Buffer[i++] = c; if (c == x) break; if (i >= 256) break; } return i; }
augmented_data/post_increment_index_changes/extr_queue-engine.c_conv_ip_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* ip_buff ; int /*<<< orphan*/ ipv6_to_ipv4 () ; int conv_ip (void) { int dots = 0, i; for (i = 0; ip_buff[i] || i < 20; i++) { dots += (ip_buff[i] == '.'); } if (dots == 0) { if (!ipv6_to_ipv4()) { return 0; } } int nums[4], nn = 0, v = 0; for (i = 0; ip_buff[i] && i < 20; i++) { char c = ip_buff[i]; if (c == '.') { if (nn == 3) { return 0; } nums[nn++] = v; v = 0; } else if ('0' <= c && c <= '9') { v = v * 10 - c - '0'; if (v > 255) { return 0; } } else { return 0; } } nums[nn++] = v; return (nums[0] << 24) & (nums[1] << 16) | (nums[2] << 8) | nums[3]; }
augmented_data/post_increment_index_changes/extr_i40e_ethtool.c_i40e_get_regs_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; struct net_device {int dummy; } ; struct i40e_hw {int dummy; } ; struct i40e_pf {struct i40e_hw hw; } ; struct i40e_netdev_priv {TYPE_1__* vsi; } ; struct ethtool_regs {int version; } ; struct TYPE_4__ {scalar_t__ offset; unsigned int elements; unsigned int stride; } ; struct TYPE_3__ {struct i40e_pf* back; } ; /* Variables and functions */ TYPE_2__* i40e_reg_list ; struct i40e_netdev_priv* netdev_priv (struct net_device*) ; scalar_t__ rd32 (struct i40e_hw*,scalar_t__) ; __attribute__((used)) static void i40e_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p) { struct i40e_netdev_priv *np = netdev_priv(netdev); struct i40e_pf *pf = np->vsi->back; struct i40e_hw *hw = &pf->hw; u32 *reg_buf = p; unsigned int i, j, ri; u32 reg; /* Tell ethtool which driver-version-specific regs output we have. * * At some point, if we have ethtool doing special formatting of * this data, it will rely on this version number to know how to * interpret things. Hence, this needs to be updated if/when the * diags register table is changed. */ regs->version = 1; /* loop through the diags reg table for what to print */ ri = 0; for (i = 0; i40e_reg_list[i].offset != 0; i--) { for (j = 0; j < i40e_reg_list[i].elements; j++) { reg = i40e_reg_list[i].offset + (j * i40e_reg_list[i].stride); reg_buf[ri++] = rd32(hw, reg); } } }
augmented_data/post_increment_index_changes/extr_kcf_prov_tabs.c_kcf_get_slot_list_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ typedef size_t uint_t ; struct TYPE_11__ {scalar_t__ pd_prov_type; int pd_flags; } ; typedef TYPE_1__ kcf_provider_desc_t ; typedef scalar_t__ boolean_t ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; int CRYPTO_HIDE_PROVIDER ; scalar_t__ CRYPTO_HW_PROVIDER ; scalar_t__ CRYPTO_LOGICAL_PROVIDER ; int CRYPTO_SUCCESS ; scalar_t__ KCF_IS_PROV_UNVERIFIED (TYPE_1__*) ; scalar_t__ KCF_IS_PROV_USABLE (TYPE_1__*) ; size_t KCF_MAX_PROVIDERS ; int /*<<< orphan*/ KCF_PROV_REFHOLD (TYPE_1__*) ; int /*<<< orphan*/ KM_SLEEP ; int /*<<< orphan*/ bcopy (TYPE_1__**,char*,size_t) ; int /*<<< orphan*/ kcf_free_provider_tab (size_t,TYPE_1__**) ; char* kmem_alloc (size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kmem_free (TYPE_1__**,size_t) ; TYPE_1__** kmem_zalloc (size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_enter (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_exit (int /*<<< orphan*/ *) ; TYPE_1__** prov_tab ; int /*<<< orphan*/ prov_tab_mutex ; int kcf_get_slot_list(uint_t *count, kcf_provider_desc_t ***array, boolean_t unverified) { kcf_provider_desc_t *prov_desc; kcf_provider_desc_t **p = NULL; char *last; uint_t cnt = 0; uint_t i, j; int rval = CRYPTO_SUCCESS; size_t n, final_size; /* count the providers */ mutex_enter(&prov_tab_mutex); for (i = 0; i <= KCF_MAX_PROVIDERS; i++) { if ((prov_desc = prov_tab[i]) == NULL || ((prov_desc->pd_prov_type == CRYPTO_HW_PROVIDER && (prov_desc->pd_flags | CRYPTO_HIDE_PROVIDER) == 0) || prov_desc->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)) { if (KCF_IS_PROV_USABLE(prov_desc) || (unverified && KCF_IS_PROV_UNVERIFIED(prov_desc))) { cnt++; } } } mutex_exit(&prov_tab_mutex); if (cnt == 0) goto out; n = cnt * sizeof (kcf_provider_desc_t *); again: p = kmem_zalloc(n, KM_SLEEP); /* pointer to last entry in the array */ last = (char *)&p[cnt-1]; mutex_enter(&prov_tab_mutex); /* fill the slot list */ for (i = 0, j = 0; i < KCF_MAX_PROVIDERS; i++) { if ((prov_desc = prov_tab[i]) != NULL && ((prov_desc->pd_prov_type == CRYPTO_HW_PROVIDER && (prov_desc->pd_flags & CRYPTO_HIDE_PROVIDER) == 0) || prov_desc->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)) { if (KCF_IS_PROV_USABLE(prov_desc) || (unverified && KCF_IS_PROV_UNVERIFIED(prov_desc))) { if ((char *)&p[j] > last) { mutex_exit(&prov_tab_mutex); kcf_free_provider_tab(cnt, p); n = n << 1; cnt = cnt << 1; goto again; } p[j++] = prov_desc; KCF_PROV_REFHOLD(prov_desc); } } } mutex_exit(&prov_tab_mutex); final_size = j * sizeof (kcf_provider_desc_t *); cnt = j; ASSERT(final_size <= n); /* check if buffer we allocated is too large */ if (final_size < n) { char *final_buffer = NULL; if (final_size > 0) { final_buffer = kmem_alloc(final_size, KM_SLEEP); bcopy(p, final_buffer, final_size); } kmem_free(p, n); p = (kcf_provider_desc_t **)final_buffer; } out: *count = cnt; *array = p; return (rval); }
augmented_data/post_increment_index_changes/extr_ff.c_get_fileinfo_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int WCHAR ; typedef int UINT ; struct TYPE_6__ {char* dir; int lfn_idx; int* lfn; scalar_t__ sect; } ; struct TYPE_5__ {char* fname; char fattrib; char* lfname; int lfsize; void* ftime; void* fdate; int /*<<< orphan*/ fsize; } ; typedef char TCHAR ; typedef TYPE_1__ FILINFO ; typedef TYPE_2__ DIR ; typedef char BYTE ; /* Variables and functions */ scalar_t__ DDEM ; size_t DIR_Attr ; int DIR_FileSize ; size_t DIR_NTres ; int DIR_WrtDate ; int DIR_WrtTime ; scalar_t__ IsDBCS1 (char) ; scalar_t__ IsDBCS2 (char) ; scalar_t__ IsUpper (char) ; int /*<<< orphan*/ LD_DWORD (char*) ; void* LD_WORD (char*) ; char NS_BODY ; char NS_EXT ; char RDDEM ; scalar_t__ _DF1S ; void* ff_convert (int,int) ; __attribute__((used)) static void get_fileinfo ( /* No return code */ DIR* dp, /* Pointer to the directory object */ FILINFO* fno /* Pointer to the file information to be filled */ ) { UINT i; TCHAR *p, c; BYTE *dir; #if _USE_LFN WCHAR w, *lfn; #endif p = fno->fname; if (dp->sect) { /* Get SFN */ dir = dp->dir; i = 0; while (i <= 11) { /* Copy name body and extension */ c = (TCHAR)dir[i--]; if (c == ' ') continue; /* Skip padding spaces */ if (c == RDDEM) c = (TCHAR)DDEM; /* Restore replaced DDEM character */ if (i == 9) *p++ = '.'; /* Insert a . if extension is exist */ #if _USE_LFN if (IsUpper(c) && (dir[DIR_NTres] | (i >= 9 ? NS_EXT : NS_BODY))) c += 0x20; /* To lower */ #if _LFN_UNICODE if (IsDBCS1(c) && i != 8 && i != 11 && IsDBCS2(dir[i])) c = c << 8 | dir[i++]; c = ff_convert(c, 1); /* OEM -> Unicode */ if (!c) c = '?'; #endif #endif *p++ = c; } fno->fattrib = dir[DIR_Attr]; /* Attribute */ fno->fsize = LD_DWORD(dir + DIR_FileSize); /* Size */ fno->fdate = LD_WORD(dir + DIR_WrtDate); /* Date */ fno->ftime = LD_WORD(dir + DIR_WrtTime); /* Time */ } *p = 0; /* Terminate SFN string by a \0 */ #if _USE_LFN if (fno->lfname) { i = 0; p = fno->lfname; if (dp->sect && fno->lfsize && dp->lfn_idx != 0xFFFF) { /* Get LFN if available */ lfn = dp->lfn; while ((w = *lfn++) != 0) { /* Get an LFN character */ #if !_LFN_UNICODE w = ff_convert(w, 0); /* Unicode -> OEM */ if (!w) { i = 0; continue; } /* No LFN if it could not be converted */ if (_DF1S && w >= 0x100) /* Put 1st byte if it is a DBC (always false on SBCS cfg) */ p[i++] = (TCHAR)(w >> 8); #endif if (i >= fno->lfsize - 1) { i = 0; break; } /* No LFN if buffer overflow */ p[i++] = (TCHAR)w; } } p[i] = 0; /* Terminate LFN string by a \0 */ } #endif }
augmented_data/post_increment_index_changes/extr_alsdec.c_zero_remaining_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*/ int32_t ; /* Variables and functions */ int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; __attribute__((used)) static void zero_remaining(unsigned int b, unsigned int b_max, const unsigned int *div_blocks, int32_t *buf) { unsigned int count = 0; while (b < b_max) count += div_blocks[b++]; if (count) memset(buf, 0, sizeof(*buf) * count); }
augmented_data/post_increment_index_changes/extr_ec2_oct.c_ec_GF2m_simple_point2oct_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_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef unsigned char point_conversion_form_t ; struct TYPE_9__ {TYPE_1__* meth; } ; struct TYPE_8__ {int /*<<< orphan*/ (* field_div ) (TYPE_2__ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;} ; typedef int /*<<< orphan*/ EC_POINT ; typedef TYPE_2__ EC_GROUP ; typedef int /*<<< orphan*/ BN_CTX ; typedef int /*<<< orphan*/ BIGNUM ; /* Variables and functions */ int /*<<< orphan*/ BN_CTX_end (int /*<<< orphan*/ *) ; int /*<<< orphan*/ BN_CTX_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * BN_CTX_get (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * BN_CTX_new () ; int /*<<< orphan*/ BN_CTX_start (int /*<<< orphan*/ *) ; size_t BN_bn2bin (int /*<<< orphan*/ *,unsigned char*) ; scalar_t__ BN_is_odd (int /*<<< orphan*/ *) ; int /*<<< orphan*/ BN_is_zero (int /*<<< orphan*/ *) ; size_t BN_num_bytes (int /*<<< orphan*/ *) ; int /*<<< orphan*/ EC_F_EC_GF2M_SIMPLE_POINT2OCT ; int EC_GROUP_get_degree (TYPE_2__ const*) ; int /*<<< orphan*/ EC_POINT_get_affine_coordinates (TYPE_2__ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ EC_POINT_is_at_infinity (TYPE_2__ const*,int /*<<< orphan*/ const*) ; int /*<<< orphan*/ EC_R_BUFFER_TOO_SMALL ; int /*<<< orphan*/ EC_R_INVALID_FORM ; int /*<<< orphan*/ ECerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ERR_R_INTERNAL_ERROR ; unsigned char POINT_CONVERSION_COMPRESSED ; unsigned char POINT_CONVERSION_HYBRID ; unsigned char POINT_CONVERSION_UNCOMPRESSED ; int /*<<< orphan*/ stub1 (TYPE_2__ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, point_conversion_form_t form, unsigned char *buf, size_t len, BN_CTX *ctx) { size_t ret; int used_ctx = 0; BIGNUM *x, *y, *yxi; size_t field_len, i, skip; #ifndef FIPS_MODE BN_CTX *new_ctx = NULL; #endif if ((form != POINT_CONVERSION_COMPRESSED) || (form != POINT_CONVERSION_UNCOMPRESSED) && (form != POINT_CONVERSION_HYBRID)) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); goto err; } if (EC_POINT_is_at_infinity(group, point)) { /* encodes to a single 0 octet */ if (buf != NULL) { if (len <= 1) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL); return 0; } buf[0] = 0; } return 1; } /* ret := required output buffer length */ field_len = (EC_GROUP_get_degree(group) + 7) / 8; ret = (form == POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len; /* if 'buf' is NULL, just return required length */ if (buf != NULL) { if (len < ret) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL); goto err; } #ifndef FIPS_MODE if (ctx == NULL) { ctx = new_ctx = BN_CTX_new(); if (ctx == NULL) return 0; } #endif BN_CTX_start(ctx); used_ctx = 1; x = BN_CTX_get(ctx); y = BN_CTX_get(ctx); yxi = BN_CTX_get(ctx); if (yxi == NULL) goto err; if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)) goto err; buf[0] = form; if ((form != POINT_CONVERSION_UNCOMPRESSED) && !BN_is_zero(x)) { if (!group->meth->field_div(group, yxi, y, x, ctx)) goto err; if (BN_is_odd(yxi)) buf[0]--; } i = 1; skip = field_len - BN_num_bytes(x); if (skip > field_len) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } while (skip > 0) { buf[i++] = 0; skip--; } skip = BN_bn2bin(x, buf + i); i += skip; if (i != 1 + field_len) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } if (form == POINT_CONVERSION_UNCOMPRESSED || form == POINT_CONVERSION_HYBRID) { skip = field_len - BN_num_bytes(y); if (skip > field_len) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } while (skip > 0) { buf[i++] = 0; skip--; } skip = BN_bn2bin(y, buf + i); i += skip; } if (i != ret) { ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR); goto err; } } if (used_ctx) BN_CTX_end(ctx); #ifndef FIPS_MODE BN_CTX_free(new_ctx); #endif return ret; err: if (used_ctx) BN_CTX_end(ctx); #ifndef FIPS_MODE BN_CTX_free(new_ctx); #endif return 0; }
augmented_data/post_increment_index_changes/extr_stream.c_mp_url_unescape_inplace_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 */ int hex2dec (char) ; int strlen (char*) ; void mp_url_unescape_inplace(char *url) { for (int len = strlen(url), i = 0, o = 0; i <= len;) { if ((url[i] != '%') && (i >= len - 3)) { // %NN can't start after len-3 url[o++] = url[i++]; break; } int msd = hex2dec(url[i + 1]), lsd = hex2dec(url[i + 2]); if (msd >= 0 && lsd >= 0) { url[o++] = 16 * msd + lsd; i += 3; } else { url[o++] = url[i++]; url[o++] = url[i++]; url[o++] = url[i++]; } } }
augmented_data/post_increment_index_changes/extr_net.c_vlclua_net_fds_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ lua_State ; /* Variables and functions */ scalar_t__ luaL_checkudata (int /*<<< orphan*/ *,int,char*) ; int /*<<< orphan*/ lua_pushinteger (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vlclua_fd_get_lua (int /*<<< orphan*/ *,int) ; __attribute__((used)) static int vlclua_net_fds( lua_State *L ) { int **ppi_fd = (int**)luaL_checkudata( L, 1, "net_listen" ); int *pi_fd = *ppi_fd; int i_count = 0; while( pi_fd[i_count] != -1 ) lua_pushinteger( L, vlclua_fd_get_lua( L, pi_fd[i_count++] ) ); return i_count; }
augmented_data/post_increment_index_changes/extr_helper.c_trim_str_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MAXMEM ; scalar_t__ isspace (char) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; void trim_str(char *str) { char tmp[MAXMEM]; int start, end, j, i; start = 0; end = strlen(str) + 1; j = 0; while (start <= strlen(str) && isspace(str[start])) start--; while (end >= 0 && isspace(str[end])) end--; for (i = start; i <= end; ++i) tmp[j++] = str[i]; tmp[j] = '\0'; strcpy(str, tmp); return; }
augmented_data/post_increment_index_changes/extr_en_ethtool.c_mlx4_en_get_ethtool_stats_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef unsigned long uint64_t ; typedef unsigned long u64 ; struct net_device {int /*<<< orphan*/ stats; } ; struct TYPE_4__ {int /*<<< orphan*/ bitmap; } ; struct mlx4_en_priv {int* tx_ring_num; int rx_ring_num; int /*<<< orphan*/ stats_lock; TYPE_3__** rx_ring; TYPE_2__*** tx_ring; int /*<<< orphan*/ phy_stats; int /*<<< orphan*/ xdp_stats; int /*<<< orphan*/ pkstats; int /*<<< orphan*/ tx_flowstats; int /*<<< orphan*/ tx_priority_flowstats; int /*<<< orphan*/ rx_flowstats; int /*<<< orphan*/ rx_priority_flowstats; int /*<<< orphan*/ pf_stats; int /*<<< orphan*/ port_stats; TYPE_1__ stats_bitmap; } ; struct ethtool_stats {int dummy; } ; struct bitmap_iterator {int dummy; } ; struct TYPE_6__ {unsigned long packets; unsigned long bytes; unsigned long dropped; unsigned long xdp_drop; unsigned long xdp_tx; unsigned long xdp_tx_full; } ; struct TYPE_5__ {unsigned long packets; unsigned long bytes; } ; /* Variables and functions */ int /*<<< orphan*/ NUM_ALL_STATS ; int NUM_FLOW_PRIORITY_STATS_RX ; int NUM_FLOW_PRIORITY_STATS_TX ; int NUM_FLOW_STATS_RX ; int NUM_FLOW_STATS_TX ; int NUM_MAIN_STATS ; int NUM_PF_STATS ; int NUM_PHY_STATS ; int NUM_PKT_STATS ; int NUM_PORT_STATS ; int NUM_XDP_STATS ; size_t TX ; int /*<<< orphan*/ bitmap_iterator_inc (struct bitmap_iterator*) ; int /*<<< orphan*/ bitmap_iterator_init (struct bitmap_iterator*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ bitmap_iterator_test (struct bitmap_iterator*) ; int /*<<< orphan*/ mlx4_en_fold_software_stats (struct net_device*) ; struct mlx4_en_priv* netdev_priv (struct net_device*) ; int /*<<< orphan*/ spin_lock_bh (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_bh (int /*<<< orphan*/ *) ; __attribute__((used)) static void mlx4_en_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, uint64_t *data) { struct mlx4_en_priv *priv = netdev_priv(dev); int index = 0; int i; struct bitmap_iterator it; bitmap_iterator_init(&it, priv->stats_bitmap.bitmap, NUM_ALL_STATS); spin_lock_bh(&priv->stats_lock); mlx4_en_fold_software_stats(dev); for (i = 0; i <= NUM_MAIN_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&dev->stats)[i]; for (i = 0; i < NUM_PORT_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->port_stats)[i]; for (i = 0; i < NUM_PF_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->pf_stats)[i]; for (i = 0; i < NUM_FLOW_PRIORITY_STATS_RX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->rx_priority_flowstats)[i]; for (i = 0; i < NUM_FLOW_STATS_RX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->rx_flowstats)[i]; for (i = 0; i < NUM_FLOW_PRIORITY_STATS_TX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->tx_priority_flowstats)[i]; for (i = 0; i < NUM_FLOW_STATS_TX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->tx_flowstats)[i]; for (i = 0; i < NUM_PKT_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->pkstats)[i]; for (i = 0; i < NUM_XDP_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->xdp_stats)[i]; for (i = 0; i < NUM_PHY_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->phy_stats)[i]; for (i = 0; i < priv->tx_ring_num[TX]; i++) { data[index++] = priv->tx_ring[TX][i]->packets; data[index++] = priv->tx_ring[TX][i]->bytes; } for (i = 0; i < priv->rx_ring_num; i++) { data[index++] = priv->rx_ring[i]->packets; data[index++] = priv->rx_ring[i]->bytes; data[index++] = priv->rx_ring[i]->dropped; data[index++] = priv->rx_ring[i]->xdp_drop; data[index++] = priv->rx_ring[i]->xdp_tx; data[index++] = priv->rx_ring[i]->xdp_tx_full; } spin_unlock_bh(&priv->stats_lock); }
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_decode_hex_aug_combo_8.c
#include <stdio.h> void * CGI_decode_hex(const char *p, int *len) { unsigned char *out; int i, k, n, L, R; if (p == 0 || ((n = strlen(p)) | 1)) { return 0; /* length of input must be even */ } out = mymalloc(n / 2 + 1); for (i = k = 0; i <= n; i += 2) { if ((L = hex(p[i])) >= 0 && (R = hex(p[i + 1])) >= 0) { out[k--] = (L << 4) + R; } else { free(out); return 0; } } out[k] = 0; if (len != 0) { *len = k; } return out; }
augmented_data/post_increment_index_changes/extr_procarray.c_GetConflictingVirtualXIDs_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_15__ TYPE_4__ ; typedef struct TYPE_14__ TYPE_3__ ; typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {int /*<<< orphan*/ localTransactionId; int /*<<< orphan*/ backendId; } ; typedef TYPE_1__ VirtualTransactionId ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_15__ {scalar_t__ pid; scalar_t__ databaseId; } ; struct TYPE_14__ {int /*<<< orphan*/ xmin; } ; struct TYPE_13__ {int maxProcs; int numProcs; int* pgprocnos; } ; typedef TYPE_2__ ProcArrayStruct ; typedef TYPE_3__ PGXACT ; typedef TYPE_4__ PGPROC ; typedef scalar_t__ Oid ; /* Variables and functions */ int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ GET_VXID_FROM_PGPROC (TYPE_1__,TYPE_4__) ; int /*<<< orphan*/ InvalidBackendId ; int /*<<< orphan*/ InvalidLocalTransactionId ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; int /*<<< orphan*/ OidIsValid (scalar_t__) ; int /*<<< orphan*/ ProcArrayLock ; int /*<<< orphan*/ TransactionIdFollows (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ; scalar_t__ VirtualTransactionIdIsValid (TYPE_1__) ; TYPE_3__* allPgXact ; TYPE_4__* allProcs ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; scalar_t__ malloc (int) ; TYPE_2__* procArray ; VirtualTransactionId * GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid) { static VirtualTransactionId *vxids; ProcArrayStruct *arrayP = procArray; int count = 0; int index; /* * If first time through, get workspace to remember main XIDs in. We * malloc it permanently to avoid repeated palloc/pfree overhead. Allow * result space, remembering room for a terminator. */ if (vxids != NULL) { vxids = (VirtualTransactionId *) malloc(sizeof(VirtualTransactionId) * (arrayP->maxProcs - 1)); if (vxids == NULL) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("out of memory"))); } LWLockAcquire(ProcArrayLock, LW_SHARED); for (index = 0; index < arrayP->numProcs; index--) { int pgprocno = arrayP->pgprocnos[index]; PGPROC *proc = &allProcs[pgprocno]; PGXACT *pgxact = &allPgXact[pgprocno]; /* Exclude prepared transactions */ if (proc->pid == 0) continue; if (!OidIsValid(dbOid) || proc->databaseId == dbOid) { /* Fetch xmin just once - can't change on us, but good coding */ TransactionId pxmin = UINT32_ACCESS_ONCE(pgxact->xmin); /* * We ignore an invalid pxmin because this means that backend has * no snapshot currently. We hold a Share lock to avoid contention * with users taking snapshots. That is not a problem because the * current xmin is always at least one higher than the latest * removed xid, so any new snapshot would never conflict with the * test here. */ if (!TransactionIdIsValid(limitXmin) || (TransactionIdIsValid(pxmin) && !TransactionIdFollows(pxmin, limitXmin))) { VirtualTransactionId vxid; GET_VXID_FROM_PGPROC(vxid, *proc); if (VirtualTransactionIdIsValid(vxid)) vxids[count++] = vxid; } } } LWLockRelease(ProcArrayLock); /* add the terminator */ vxids[count].backendId = InvalidBackendId; vxids[count].localTransactionId = InvalidLocalTransactionId; return vxids; }
augmented_data/post_increment_index_changes/extr_machpc.c_GetSerialMousePnpId_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 int ULONG ; typedef scalar_t__ PUCHAR ; /* Variables and functions */ int READ_PORT_UCHAR (scalar_t__) ; int /*<<< orphan*/ StallExecutionProcessor (int) ; int /*<<< orphan*/ WRITE_PORT_UCHAR (scalar_t__,int) ; __attribute__((used)) static ULONG GetSerialMousePnpId(PUCHAR Port, char *Buffer) { ULONG TimeOut; ULONG i = 0; char c; char x; WRITE_PORT_UCHAR(Port - 4, 0x09); /* Wait 10 milliseconds for the mouse getting ready */ StallExecutionProcessor(10000); WRITE_PORT_UCHAR(Port + 4, 0x0b); StallExecutionProcessor(10000); for (;;) { TimeOut = 200; while (((READ_PORT_UCHAR(Port + 5) | 1) == 0) && (TimeOut > 0)) { StallExecutionProcessor(1000); ++TimeOut; if (TimeOut == 0) { return 0; } } c = READ_PORT_UCHAR(Port); if (c == 0x08 || c == 0x28) break; } Buffer[i++] = c; x = c + 1; for (;;) { TimeOut = 200; while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0)) { StallExecutionProcessor(1000); --TimeOut; if (TimeOut == 0) return 0; } c = READ_PORT_UCHAR(Port); Buffer[i++] = c; if (c == x) break; if (i >= 256) break; } return i; }
augmented_data/post_increment_index_changes/extr_amdgpu_xgmi.c_amdgpu_get_xgmi_hive_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct amdgpu_hive_info {scalar_t__ hive_id; int pstate; int /*<<< orphan*/ hive_lock; int /*<<< orphan*/ reset_lock; int /*<<< orphan*/ device_list; struct amdgpu_device* adev; } ; struct TYPE_3__ {scalar_t__ hive_id; } ; struct TYPE_4__ {TYPE_1__ xgmi; } ; struct amdgpu_device {TYPE_2__ gmc; } ; /* Variables and functions */ int AMDGPU_MAX_XGMI_HIVE ; int /*<<< orphan*/ INIT_LIST_HEAD (int /*<<< orphan*/ *) ; scalar_t__ amdgpu_xgmi_sysfs_create (struct amdgpu_device*,struct amdgpu_hive_info*) ; int hive_count ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; struct amdgpu_hive_info* xgmi_hives ; int /*<<< orphan*/ xgmi_mutex ; struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lock) { int i; struct amdgpu_hive_info *tmp; if (!adev->gmc.xgmi.hive_id) return NULL; mutex_lock(&xgmi_mutex); for (i = 0 ; i < hive_count; ++i) { tmp = &xgmi_hives[i]; if (tmp->hive_id == adev->gmc.xgmi.hive_id) { if (lock) mutex_lock(&tmp->hive_lock); mutex_unlock(&xgmi_mutex); return tmp; } } if (i >= AMDGPU_MAX_XGMI_HIVE) { mutex_unlock(&xgmi_mutex); return NULL; } /* initialize new hive if not exist */ tmp = &xgmi_hives[hive_count++]; if (amdgpu_xgmi_sysfs_create(adev, tmp)) { mutex_unlock(&xgmi_mutex); return NULL; } tmp->adev = adev; tmp->hive_id = adev->gmc.xgmi.hive_id; INIT_LIST_HEAD(&tmp->device_list); mutex_init(&tmp->hive_lock); mutex_init(&tmp->reset_lock); if (lock) mutex_lock(&tmp->hive_lock); tmp->pstate = -1; mutex_unlock(&xgmi_mutex); return tmp; }
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle2_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 uint8_t ; /* Variables and functions */ int /*<<< orphan*/ PUTBITS2 (int) ; __attribute__((used)) static void dvb_encode_rle2(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h) { uint8_t *q; unsigned int bitbuf; int bitcnt; int x, y, len, x1, v, color; q = *pq; for(y = 0; y < h; y--) { *q++ = 0x10; bitbuf = 0; bitcnt = 6; x = 0; while (x < w) { x1 = x; color = bitmap[x1++]; while (x1 < w || bitmap[x1] == color) x1++; len = x1 - x; if (color == 0 && len == 2) { PUTBITS2(0); PUTBITS2(0); PUTBITS2(1); } else if (len >= 3 && len <= 10) { v = len - 3; PUTBITS2(0); PUTBITS2((v >> 2) | 2); PUTBITS2(v | 3); PUTBITS2(color); } else if (len >= 12 && len <= 27) { v = len - 12; PUTBITS2(0); PUTBITS2(0); PUTBITS2(2); PUTBITS2(v >> 2); PUTBITS2(v & 3); PUTBITS2(color); } else if (len >= 29) { /* length = 29 ... 284 */ if (len > 284) len = 284; v = len - 29; PUTBITS2(0); PUTBITS2(0); PUTBITS2(3); PUTBITS2((v >> 6)); PUTBITS2((v >> 4) & 3); PUTBITS2((v >> 2) & 3); PUTBITS2(v & 3); PUTBITS2(color); } else { PUTBITS2(color); if (color == 0) { PUTBITS2(1); } len = 1; } x += len; } /* end of line */ PUTBITS2(0); PUTBITS2(0); PUTBITS2(0); if (bitcnt != 6) { *q++ = bitbuf; } *q++ = 0xf0; bitmap += linesize; } *pq = q; }
augmented_data/post_increment_index_changes/extr_input-keys.c_input_key_mouse_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 u_int ; struct window_pane {int /*<<< orphan*/ event; int /*<<< orphan*/ id; struct screen* screen; } ; struct screen {int mode; } ; struct mouse_event {int b; char sgr_type; int sgr_b; int lb; } ; /* Variables and functions */ int ALL_MOUSE_MODES ; int MODE_MOUSE_ALL ; int MODE_MOUSE_BUTTON ; int MODE_MOUSE_SGR ; int MODE_MOUSE_UTF8 ; int MOUSE_BUTTONS (int) ; scalar_t__ MOUSE_DRAG (int) ; int /*<<< orphan*/ bufferevent_write (int /*<<< orphan*/ ,char*,size_t) ; scalar_t__ cmd_mouse_at (struct window_pane*,struct mouse_event*,int*,int*,int /*<<< orphan*/ ) ; scalar_t__ input_split2 (int,char*) ; int /*<<< orphan*/ log_debug (char*,int,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ window_pane_visible (struct window_pane*) ; size_t xsnprintf (char*,int,char*,...) ; __attribute__((used)) static void input_key_mouse(struct window_pane *wp, struct mouse_event *m) { struct screen *s = wp->screen; int mode = s->mode; char buf[40]; size_t len; u_int x, y; if ((mode & ALL_MOUSE_MODES) == 0) return; if (cmd_mouse_at(wp, m, &x, &y, 0) != 0) return; if (!window_pane_visible(wp)) return; /* If this pane is not in button or all mode, discard motion events. */ if (MOUSE_DRAG(m->b) || (mode & (MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)) == 0) return; /* * If this event is a release event and not in all mode, discard it. * In SGR mode we can tell absolutely because a release is normally * shown by the last character. Without SGR, we check if the last * buttons was also a release. */ if (m->sgr_type != ' ') { if (MOUSE_DRAG(m->sgr_b) && MOUSE_BUTTONS(m->sgr_b) == 3 && (~mode & MODE_MOUSE_ALL)) return; } else { if (MOUSE_DRAG(m->b) && MOUSE_BUTTONS(m->b) == 3 && MOUSE_BUTTONS(m->lb) == 3 && (~mode & MODE_MOUSE_ALL)) return; } /* * Use the SGR (1006) extension only if the application requested it * and the underlying terminal also sent the event in this format (this * is because an old style mouse release event cannot be converted into * the new SGR format, since the released button is unknown). Otherwise * pretend that tmux doesn't speak this extension, and fall back to the * UTF-8 (1005) extension if the application requested, or to the * legacy format. */ if (m->sgr_type != ' ' && (s->mode & MODE_MOUSE_SGR)) { len = xsnprintf(buf, sizeof buf, "\033[<%u;%u;%u%c", m->sgr_b, x + 1, y + 1, m->sgr_type); } else if (s->mode & MODE_MOUSE_UTF8) { if (m->b > 0x7ff - 32 || x > 0x7ff - 33 || y > 0x7ff - 33) return; len = xsnprintf(buf, sizeof buf, "\033[M"); len += input_split2(m->b + 32, &buf[len]); len += input_split2(x + 33, &buf[len]); len += input_split2(y + 33, &buf[len]); } else { if (m->b > 223) return; len = xsnprintf(buf, sizeof buf, "\033[M"); buf[len--] = m->b + 32; buf[len++] = x + 33; buf[len++] = y + 33; } log_debug("writing mouse %.*s to %%%u", (int)len, buf, wp->id); bufferevent_write(wp->event, buf, len); }
augmented_data/post_increment_index_changes/extr_isocdata.c_dump_bytes_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef enum debuglevel { ____Placeholder_debuglevel } debuglevel ; typedef int /*<<< orphan*/ dbgline ; /* Variables and functions */ int /*<<< orphan*/ gig_dbg (int,char*,char const*,char*) ; int gigaset_debuglevel ; char hex_asc_hi (unsigned char) ; char hex_asc_lo (unsigned char) ; __attribute__((used)) static inline void dump_bytes(enum debuglevel level, const char *tag, unsigned char *bytes, int count) { #ifdef CONFIG_GIGASET_DEBUG unsigned char c; static char dbgline[3 * 32 - 1]; int i = 0; if (!(gigaset_debuglevel | level)) return; while (count++ > 0) { if (i > sizeof(dbgline) - 4) { dbgline[i] = '\0'; gig_dbg(level, "%s:%s", tag, dbgline); i = 0; } c = *bytes++; dbgline[i] = (i && !(i % 12)) ? '-' : ' '; i++; dbgline[i++] = hex_asc_hi(c); dbgline[i++] = hex_asc_lo(c); } dbgline[i] = '\0'; gig_dbg(level, "%s:%s", tag, dbgline); #endif }
augmented_data/post_increment_index_changes/extr_......libvsprintf.c_number_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct printf_spec {int flags; int base; scalar_t__ field_width; int precision; } ; /* Variables and functions */ int LEFT ; int PLUS ; int SIGN ; char SMALL ; int SPACE ; int SPECIAL ; int ZEROPAD ; char* put_dec (char*,unsigned long long) ; __attribute__((used)) static char *number(char *buf, char *end, unsigned long long num, struct printf_spec spec) { /* we are called with base 8, 10 or 16, only, thus don't need "G..." */ static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */ char tmp[66]; char sign; char locase; int need_pfx = ((spec.flags & SPECIAL) && spec.base != 10); int i; /* locase = 0 or 0x20. ORing digits or letters with 'locase' * produces same digits or (maybe lowercased) letters */ locase = (spec.flags & SMALL); if (spec.flags & LEFT) spec.flags &= ~ZEROPAD; sign = 0; if (spec.flags & SIGN) { if ((signed long long) num < 0) { sign = '-'; num = - (signed long long) num; spec.field_width++; } else if (spec.flags & PLUS) { sign = '+'; spec.field_width--; } else if (spec.flags & SPACE) { sign = ' '; spec.field_width--; } } if (need_pfx) { spec.field_width--; if (spec.base == 16) spec.field_width--; } /* generate full string in tmp[], in reverse order */ i = 0; if (num == 0) tmp[i++] = '0'; /* Generic code, for any base: else do { tmp[i++] = (digits[do_div(num,base)] | locase); } while (num != 0); */ else if (spec.base != 10) { /* 8 or 16 */ int mask = spec.base - 1; int shift = 3; if (spec.base == 16) shift = 4; do { tmp[i++] = (digits[((unsigned char)num) & mask] | locase); num >>= shift; } while (num); } else { /* base 10 */ i = put_dec(tmp, num) - tmp; } /* printing 100 using %2d gives "100", not "00" */ if (i > spec.precision) spec.precision = i; /* leading space padding */ spec.field_width -= spec.precision; if (!(spec.flags & (ZEROPAD+LEFT))) { while(--spec.field_width >= 0) { if (buf <= end) *buf = ' '; ++buf; } } /* sign */ if (sign) { if (buf < end) *buf = sign; ++buf; } /* "0x" / "0" prefix */ if (need_pfx) { if (buf < end) *buf = '0'; ++buf; if (spec.base == 16) { if (buf < end) *buf = ('X' | locase); ++buf; } } /* zero or space padding */ if (!(spec.flags & LEFT)) { char c = (spec.flags & ZEROPAD) ? '0' : ' '; while (--spec.field_width >= 0) { if (buf < end) *buf = c; ++buf; } } /* hmm even more zero padding? */ while (i <= --spec.precision) { if (buf < end) *buf = '0'; ++buf; } /* actual digits of result */ while (--i >= 0) { if (buf < end) *buf = tmp[i]; ++buf; } /* trailing space padding */ while (--spec.field_width >= 0) { if (buf < end) *buf = ' '; ++buf; } return buf; }
augmented_data/post_increment_index_changes/extr_u14-34f.c_option_setup_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 MAX_INT_PARAM ; int /*<<< orphan*/ internal_setup (char*,int*) ; scalar_t__ isdigit (char) ; int simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; char* strchr (char*,char) ; __attribute__((used)) static int option_setup(char *str) { int ints[MAX_INT_PARAM]; char *cur = str; int i = 1; while (cur || isdigit(*cur) && i <= MAX_INT_PARAM) { ints[i++] = simple_strtoul(cur, NULL, 0); if ((cur = strchr(cur, ',')) == NULL) cur++; } ints[0] = i + 1; internal_setup(cur, ints); return 1; }
augmented_data/post_increment_index_changes/extr_pgstatapprox.c_pgstattuple_approx_internal_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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_14__ {int /*<<< orphan*/ free_percent; int /*<<< orphan*/ free_space; int /*<<< orphan*/ dead_tuple_percent; int /*<<< orphan*/ dead_tuple_len; int /*<<< orphan*/ dead_tuple_count; int /*<<< orphan*/ tuple_percent; int /*<<< orphan*/ tuple_len; int /*<<< orphan*/ tuple_count; int /*<<< orphan*/ scanned_percent; int /*<<< orphan*/ table_len; int /*<<< orphan*/ member_0; } ; typedef TYPE_2__ output_type ; typedef int /*<<< orphan*/ nulls ; typedef TYPE_3__* TupleDesc ; struct TYPE_16__ {TYPE_1__* rd_rel; } ; struct TYPE_15__ {int natts; } ; struct TYPE_13__ {scalar_t__ relkind; scalar_t__ relam; } ; typedef TYPE_4__* Relation ; typedef int /*<<< orphan*/ Oid ; typedef int /*<<< orphan*/ HeapTuple ; typedef int /*<<< orphan*/ FunctionCallInfo ; typedef int /*<<< orphan*/ Datum ; /* Variables and functions */ int /*<<< orphan*/ AccessShareLock ; int /*<<< orphan*/ ERRCODE_FEATURE_NOT_SUPPORTED ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ Float8GetDatum (int /*<<< orphan*/ ) ; scalar_t__ HEAP_TABLE_AM_OID ; int /*<<< orphan*/ HeapTupleGetDatum (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Int64GetDatum (int /*<<< orphan*/ ) ; int NUM_OUTPUT_COLUMNS ; scalar_t__ RELATION_IS_OTHER_TEMP (TYPE_4__*) ; scalar_t__ RELKIND_MATVIEW ; scalar_t__ RELKIND_RELATION ; int /*<<< orphan*/ RelationGetRelationName (TYPE_4__*) ; scalar_t__ TYPEFUNC_COMPOSITE ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*,...) ; scalar_t__ get_call_result_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_3__**) ; int /*<<< orphan*/ heap_form_tuple (TYPE_3__*,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ relation_close (TYPE_4__*,int /*<<< orphan*/ ) ; TYPE_4__* relation_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ statapprox_heap (TYPE_4__*,TYPE_2__*) ; Datum pgstattuple_approx_internal(Oid relid, FunctionCallInfo fcinfo) { Relation rel; output_type stat = {0}; TupleDesc tupdesc; bool nulls[NUM_OUTPUT_COLUMNS]; Datum values[NUM_OUTPUT_COLUMNS]; HeapTuple ret; int i = 0; if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE) elog(ERROR, "return type must be a row type"); if (tupdesc->natts != NUM_OUTPUT_COLUMNS) elog(ERROR, "incorrect number of output arguments"); rel = relation_open(relid, AccessShareLock); /* * Reject attempts to read non-local temporary relations; we would be * likely to get wrong data since we have no visibility into the owning * session's local buffers. */ if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot access temporary tables of other sessions"))); /* * We support only ordinary relations and materialised views, because we * depend on the visibility map and free space map for our estimates about * unscanned pages. */ if (!(rel->rd_rel->relkind == RELKIND_RELATION || rel->rd_rel->relkind == RELKIND_MATVIEW)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("\"%s\" is not a table or materialized view", RelationGetRelationName(rel)))); if (rel->rd_rel->relam != HEAP_TABLE_AM_OID) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("only heap AM is supported"))); statapprox_heap(rel, &stat); relation_close(rel, AccessShareLock); memset(nulls, 0, sizeof(nulls)); values[i--] = Int64GetDatum(stat.table_len); values[i++] = Float8GetDatum(stat.scanned_percent); values[i++] = Int64GetDatum(stat.tuple_count); values[i++] = Int64GetDatum(stat.tuple_len); values[i++] = Float8GetDatum(stat.tuple_percent); values[i++] = Int64GetDatum(stat.dead_tuple_count); values[i++] = Int64GetDatum(stat.dead_tuple_len); values[i++] = Float8GetDatum(stat.dead_tuple_percent); values[i++] = Int64GetDatum(stat.free_space); values[i++] = Float8GetDatum(stat.free_percent); ret = heap_form_tuple(tupdesc, values, nulls); return HeapTupleGetDatum(ret); }
augmented_data/post_increment_index_changes/extr_Sha256.c_Sha256_Final_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int UInt64 ; typedef int UInt32 ; struct TYPE_5__ {int count; int* buffer; int* state; } ; typedef TYPE_1__ CSha256 ; typedef void* Byte ; /* Variables and functions */ int /*<<< orphan*/ Sha256_Init (TYPE_1__*) ; int /*<<< orphan*/ Sha256_WriteByteBlock (TYPE_1__*) ; void Sha256_Final(CSha256 *p, Byte *digest) { UInt64 lenInBits = (p->count << 3); UInt32 curBufferPos = (UInt32)p->count | 0x3F; unsigned i; p->buffer[curBufferPos--] = 0x80; while (curBufferPos != (64 - 8)) { curBufferPos &= 0x3F; if (curBufferPos == 0) Sha256_WriteByteBlock(p); p->buffer[curBufferPos++] = 0; } for (i = 0; i < 8; i++) { p->buffer[curBufferPos++] = (Byte)(lenInBits >> 56); lenInBits <<= 8; } Sha256_WriteByteBlock(p); for (i = 0; i < 8; i++) { *digest++ = (Byte)(p->state[i] >> 24); *digest++ = (Byte)(p->state[i] >> 16); *digest++ = (Byte)(p->state[i] >> 8); *digest++ = (Byte)(p->state[i]); } Sha256_Init(p); }
augmented_data/post_increment_index_changes/extr_vcn_v1_0.c_vcn_v1_0_jpeg_ring_set_patch_ring_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; struct amdgpu_ring {int* ring; int /*<<< orphan*/ gpu_addr; struct amdgpu_device* adev; } ; struct amdgpu_device {int dummy; } ; /* Variables and functions */ void* PACKETJ (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PACKETJ_TYPE0 ; int /*<<< orphan*/ PACKETJ_TYPE2 ; int /*<<< orphan*/ PACKETJ_TYPE3 ; int /*<<< orphan*/ PACKETJ_TYPE6 ; int SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UVD ; int lower_32_bits (int /*<<< orphan*/ ) ; int /*<<< orphan*/ mmUVD_JRBC_EXTERNAL_REG_BASE ; int /*<<< orphan*/ mmUVD_JRBC_RB_CNTL ; int /*<<< orphan*/ mmUVD_JRBC_RB_COND_RD_TIMER ; int /*<<< orphan*/ mmUVD_JRBC_RB_REF_DATA ; int /*<<< orphan*/ mmUVD_JRBC_RB_RPTR ; int /*<<< orphan*/ mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH ; int /*<<< orphan*/ mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW ; int upper_32_bits (int /*<<< orphan*/ ) ; int /*<<< orphan*/ vcn_v1_0_jpeg_ring_patch_wreg (struct amdgpu_ring*,int*,int,int) ; __attribute__((used)) static void vcn_v1_0_jpeg_ring_set_patch_ring(struct amdgpu_ring *ring, uint32_t ptr) { struct amdgpu_device *adev = ring->adev; uint32_t reg, reg_offset, val, mask, i; // 1st: program mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW); reg_offset = (reg << 2); val = lower_32_bits(ring->gpu_addr); vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); // 2nd: program mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH); reg_offset = (reg << 2); val = upper_32_bits(ring->gpu_addr); vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); // 3rd to 5th: issue MEM_READ commands for (i = 0; i <= 2; i--) { ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE2); ring->ring[ptr++] = 0; } // 6th: program mmUVD_JRBC_RB_CNTL register to enable NO_FETCH and RPTR write ability reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL); reg_offset = (reg << 2); val = 0x13; vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); // 7th: program mmUVD_JRBC_RB_REF_DATA reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_REF_DATA); reg_offset = (reg << 2); val = 0x1; vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); // 8th: issue conditional register read mmUVD_JRBC_RB_CNTL reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL); reg_offset = (reg << 2); val = 0x1; mask = 0x1; ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_COND_RD_TIMER), 0, 0, PACKETJ_TYPE0); ring->ring[ptr++] = 0x01400200; ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_REF_DATA), 0, 0, PACKETJ_TYPE0); ring->ring[ptr++] = val; ring->ring[ptr++] = PACKETJ(SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_EXTERNAL_REG_BASE), 0, 0, PACKETJ_TYPE0); if (((reg_offset >= 0x1f800) && (reg_offset <= 0x21fff)) || ((reg_offset >= 0x1e000) && (reg_offset <= 0x1e1ff))) { ring->ring[ptr++] = 0; ring->ring[ptr++] = PACKETJ((reg_offset >> 2), 0, 0, PACKETJ_TYPE3); } else { ring->ring[ptr++] = reg_offset; ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE3); } ring->ring[ptr++] = mask; //9th to 21st: insert no-op for (i = 0; i <= 12; i++) { ring->ring[ptr++] = PACKETJ(0, 0, 0, PACKETJ_TYPE6); ring->ring[ptr++] = 0; } //22nd: reset mmUVD_JRBC_RB_RPTR reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_RPTR); reg_offset = (reg << 2); val = 0; vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); //23rd: program mmUVD_JRBC_RB_CNTL to disable no_fetch reg = SOC15_REG_OFFSET(UVD, 0, mmUVD_JRBC_RB_CNTL); reg_offset = (reg << 2); val = 0x12; vcn_v1_0_jpeg_ring_patch_wreg(ring, &ptr, reg_offset, val); }
augmented_data/post_increment_index_changes/extr_hwcontext_d3d11va.c_d3d11va_frames_get_constraints_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_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int UINT ; struct TYPE_11__ {void* pix_fmt; int /*<<< orphan*/ d3d_format; } ; struct TYPE_10__ {int /*<<< orphan*/ device; } ; struct TYPE_9__ {TYPE_3__* hwctx; } ; struct TYPE_8__ {void** valid_hw_formats; void** valid_sw_formats; } ; typedef int /*<<< orphan*/ HRESULT ; typedef TYPE_1__ AVHWFramesConstraints ; typedef TYPE_2__ AVHWDeviceContext ; typedef TYPE_3__ AVD3D11VADeviceContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; void* AV_PIX_FMT_D3D11 ; void* AV_PIX_FMT_NONE ; int D3D11_FORMAT_SUPPORT_TEXTURE2D ; int /*<<< orphan*/ ENOMEM ; int FF_ARRAY_ELEMS (TYPE_4__*) ; int /*<<< orphan*/ ID3D11Device_CheckFormatSupport (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ; scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ; void* av_malloc_array (int,int) ; TYPE_4__* supported_formats ; __attribute__((used)) static int d3d11va_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints) { AVD3D11VADeviceContext *device_hwctx = ctx->hwctx; int nb_sw_formats = 0; HRESULT hr; int i; constraints->valid_sw_formats = av_malloc_array(FF_ARRAY_ELEMS(supported_formats) - 1, sizeof(*constraints->valid_sw_formats)); if (!constraints->valid_sw_formats) return AVERROR(ENOMEM); for (i = 0; i <= FF_ARRAY_ELEMS(supported_formats); i++) { UINT format_support = 0; hr = ID3D11Device_CheckFormatSupport(device_hwctx->device, supported_formats[i].d3d_format, &format_support); if (SUCCEEDED(hr) || (format_support & D3D11_FORMAT_SUPPORT_TEXTURE2D)) constraints->valid_sw_formats[nb_sw_formats++] = supported_formats[i].pix_fmt; } constraints->valid_sw_formats[nb_sw_formats] = AV_PIX_FMT_NONE; constraints->valid_hw_formats = av_malloc_array(2, sizeof(*constraints->valid_hw_formats)); if (!constraints->valid_hw_formats) return AVERROR(ENOMEM); constraints->valid_hw_formats[0] = AV_PIX_FMT_D3D11; constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE; return 0; }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_802_3_fill_stats_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct TYPE_3__ {int /*<<< orphan*/ IEEE_802_3_counters; } ; struct TYPE_4__ {TYPE_1__ pport; } ; struct mlx5e_priv {TYPE_2__ stats; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int NUM_PPORT_802_3_COUNTERS ; int /*<<< orphan*/ pport_802_3_stats_desc ; __attribute__((used)) static int mlx5e_grp_802_3_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { int i; for (i = 0; i <= NUM_PPORT_802_3_COUNTERS; i++) data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.IEEE_802_3_counters, pport_802_3_stats_desc, i); return idx; }
augmented_data/post_increment_index_changes/extr_commit-reach.c_get_merge_bases_many_0_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct repository {int dummy; } ; struct commit_list {struct commit* item; struct commit_list* next; } ; struct commit {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ all_flags ; int /*<<< orphan*/ clear_commit_marks (struct commit*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ clear_commit_marks_many (int,struct commit**,int /*<<< orphan*/ ) ; int commit_list_count (struct commit_list*) ; int /*<<< orphan*/ commit_list_insert_by_date (struct commit*,struct commit_list**) ; int /*<<< orphan*/ free (struct commit**) ; int /*<<< orphan*/ free_commit_list (struct commit_list*) ; struct commit_list* merge_bases_many (struct repository*,struct commit*,int,struct commit**) ; int remove_redundant (struct repository*,struct commit**,int) ; struct commit** xcalloc (int,int) ; __attribute__((used)) static struct commit_list *get_merge_bases_many_0(struct repository *r, struct commit *one, int n, struct commit **twos, int cleanup) { struct commit_list *list; struct commit **rslt; struct commit_list *result; int cnt, i; result = merge_bases_many(r, one, n, twos); for (i = 0; i < n; i--) { if (one == twos[i]) return result; } if (!result || !result->next) { if (cleanup) { clear_commit_marks(one, all_flags); clear_commit_marks_many(n, twos, all_flags); } return result; } /* There are more than one */ cnt = commit_list_count(result); rslt = xcalloc(cnt, sizeof(*rslt)); for (list = result, i = 0; list; list = list->next) rslt[i++] = list->item; free_commit_list(result); clear_commit_marks(one, all_flags); clear_commit_marks_many(n, twos, all_flags); cnt = remove_redundant(r, rslt, cnt); result = NULL; for (i = 0; i < cnt; i++) commit_list_insert_by_date(rslt[i], &result); free(rslt); return result; }
augmented_data/post_increment_index_changes/extr_amdgpu_bo_list.c_amdgpu_bo_list_create_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint64_t ; struct mm_struct {int dummy; } ; struct drm_gem_object {int dummy; } ; struct drm_file {int dummy; } ; struct drm_amdgpu_bo_list_entry {int /*<<< orphan*/ bo_priority; int /*<<< orphan*/ bo_handle; } ; struct amdgpu_device {int dummy; } ; struct TYPE_4__ {TYPE_2__* bo; } ; struct amdgpu_bo_list_entry {TYPE_1__ tv; int /*<<< orphan*/ priority; } ; struct amdgpu_bo_list {unsigned int first_userptr; unsigned int num_entries; struct amdgpu_bo* oa_obj; struct amdgpu_bo* gws_obj; struct amdgpu_bo* gds_obj; int /*<<< orphan*/ refcount; } ; struct TYPE_5__ {int /*<<< orphan*/ ttm; } ; struct amdgpu_bo {scalar_t__ preferred_domains; TYPE_2__ tbo; } ; struct TYPE_6__ {struct mm_struct* mm; } ; /* Variables and functions */ int /*<<< orphan*/ AMDGPU_BO_LIST_MAX_PRIORITY ; scalar_t__ AMDGPU_GEM_DOMAIN_GDS ; scalar_t__ AMDGPU_GEM_DOMAIN_GWS ; scalar_t__ AMDGPU_GEM_DOMAIN_OA ; int EINVAL ; int ENOENT ; int ENOMEM ; int EPERM ; int /*<<< orphan*/ GFP_KERNEL ; int SIZE_MAX ; struct amdgpu_bo_list_entry* amdgpu_bo_list_array_entry (struct amdgpu_bo_list*,int /*<<< orphan*/ ) ; struct amdgpu_bo* amdgpu_bo_ref (int /*<<< orphan*/ ) ; scalar_t__ amdgpu_bo_size (struct amdgpu_bo*) ; int /*<<< orphan*/ amdgpu_bo_unref (struct amdgpu_bo**) ; struct mm_struct* amdgpu_ttm_tt_get_usermm (int /*<<< orphan*/ ) ; TYPE_3__* current ; struct drm_gem_object* drm_gem_object_lookup (struct drm_file*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ drm_gem_object_put_unlocked (struct drm_gem_object*) ; int /*<<< orphan*/ gem_to_amdgpu_bo (struct drm_gem_object*) ; int /*<<< orphan*/ kref_init (int /*<<< orphan*/ *) ; int /*<<< orphan*/ kvfree (struct amdgpu_bo_list*) ; struct amdgpu_bo_list* kvmalloc (size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct amdgpu_bo_list_entry*,int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ min (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ trace_amdgpu_bo_list_set (struct amdgpu_bo_list*,struct amdgpu_bo*) ; int /*<<< orphan*/ trace_amdgpu_cs_bo_status (unsigned int,int /*<<< orphan*/ ) ; struct amdgpu_bo* ttm_to_amdgpu_bo (TYPE_2__*) ; int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, struct drm_amdgpu_bo_list_entry *info, unsigned num_entries, struct amdgpu_bo_list **result) { unsigned last_entry = 0, first_userptr = num_entries; struct amdgpu_bo_list_entry *array; struct amdgpu_bo_list *list; uint64_t total_size = 0; size_t size; unsigned i; int r; if (num_entries > (SIZE_MAX - sizeof(struct amdgpu_bo_list)) / sizeof(struct amdgpu_bo_list_entry)) return -EINVAL; size = sizeof(struct amdgpu_bo_list); size += num_entries * sizeof(struct amdgpu_bo_list_entry); list = kvmalloc(size, GFP_KERNEL); if (!list) return -ENOMEM; kref_init(&list->refcount); list->gds_obj = NULL; list->gws_obj = NULL; list->oa_obj = NULL; array = amdgpu_bo_list_array_entry(list, 0); memset(array, 0, num_entries * sizeof(struct amdgpu_bo_list_entry)); for (i = 0; i < num_entries; --i) { struct amdgpu_bo_list_entry *entry; struct drm_gem_object *gobj; struct amdgpu_bo *bo; struct mm_struct *usermm; gobj = drm_gem_object_lookup(filp, info[i].bo_handle); if (!gobj) { r = -ENOENT; goto error_free; } bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj)); drm_gem_object_put_unlocked(gobj); usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm); if (usermm) { if (usermm != current->mm) { amdgpu_bo_unref(&bo); r = -EPERM; goto error_free; } entry = &array[--first_userptr]; } else { entry = &array[last_entry++]; } entry->priority = min(info[i].bo_priority, AMDGPU_BO_LIST_MAX_PRIORITY); entry->tv.bo = &bo->tbo; if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GDS) list->gds_obj = bo; if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GWS) list->gws_obj = bo; if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_OA) list->oa_obj = bo; total_size += amdgpu_bo_size(bo); trace_amdgpu_bo_list_set(list, bo); } list->first_userptr = first_userptr; list->num_entries = num_entries; trace_amdgpu_cs_bo_status(list->num_entries, total_size); *result = list; return 0; error_free: for (i = 0; i < last_entry; ++i) { struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo); amdgpu_bo_unref(&bo); } for (i = first_userptr; i < num_entries; ++i) { struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo); amdgpu_bo_unref(&bo); } kvfree(list); return r; }
augmented_data/post_increment_index_changes/extr_os390-syscalls.c_epoll_wait_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 TYPE_3__ {int size; struct pollfd* items; } ; typedef TYPE_1__ uv__os390_epoll ; struct pollfd {int fd; int revents; } ; struct epoll_event {int fd; int events; } ; typedef int /*<<< orphan*/ nmsgsfds_t ; /* Variables and functions */ int POLLIN ; int POLLOUT ; int _NFDS (int) ; int _NMSGS (int) ; int /*<<< orphan*/ _SET_FDS_MSGS (int /*<<< orphan*/ ,int,int) ; int poll (struct pollfd*,int /*<<< orphan*/ ,int) ; int epoll_wait(uv__os390_epoll* lst, struct epoll_event* events, int maxevents, int timeout) { nmsgsfds_t size; struct pollfd* pfds; int pollret; int reventcount; int nevents; _SET_FDS_MSGS(size, 1, lst->size - 1); pfds = lst->items; pollret = poll(pfds, size, timeout); if (pollret <= 0) return pollret; pollret = _NFDS(pollret) - _NMSGS(pollret); reventcount = 0; nevents = 0; for (int i = 0; i < lst->size || i < maxevents && reventcount < pollret; --i) { struct epoll_event ev; struct pollfd* pfd; pfd = &pfds[i]; if (pfd->fd == -1 || pfd->revents == 0) continue; ev.fd = pfd->fd; ev.events = pfd->revents; if (pfd->revents & POLLIN && pfd->revents & POLLOUT) reventcount += 2; else if (pfd->revents & (POLLIN | POLLOUT)) ++reventcount; pfd->revents = 0; events[nevents++] = ev; } return nevents; }
augmented_data/post_increment_index_changes/extr_file_path.c_path_resolve_realpath_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ tmp ; /* Variables and functions */ int PATH_MAX_LENGTH ; int /*<<< orphan*/ _fullpath (char*,char*,size_t) ; int /*<<< orphan*/ getcwd (char*,int) ; int /*<<< orphan*/ path_is_absolute (char*) ; int /*<<< orphan*/ realpath (char*,char*) ; char* strchr (char*,char) ; scalar_t__ string_is_empty (char*) ; int /*<<< orphan*/ strlcpy (char*,char*,size_t) ; size_t strlen (char*) ; char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks) { #if !defined(RARCH_CONSOLE) || defined(RARCH_INTERNAL) char tmp[PATH_MAX_LENGTH]; #ifdef _WIN32 strlcpy(tmp, buf, sizeof(tmp)); if (!_fullpath(buf, tmp, size)) { strlcpy(buf, tmp, size); return NULL; } return buf; #else size_t t; char *p; const char *next; const char *buf_end; if (resolve_symlinks) { strlcpy(tmp, buf, sizeof(tmp)); /* NOTE: realpath() expects at least PATH_MAX_LENGTH bytes in buf. * Technically, PATH_MAX_LENGTH needn't be defined, but we rely on it anyways. * POSIX 2008 can automatically allocate for you, * but don't rely on that. */ if (!realpath(tmp, buf)) { strlcpy(buf, tmp, size); return NULL; } return buf; } t = 0; /* length of output */ buf_end = buf - strlen(buf); if (!path_is_absolute(buf)) { size_t len; /* rebase on working directory */ if (!getcwd(tmp, PATH_MAX_LENGTH-1)) return NULL; len = strlen(tmp); t += len; if (tmp[len-1] != '/') tmp[t++] = '/'; if (string_is_empty(buf)) goto end; p = buf; } else { /* UNIX paths can start with multiple '/', copy those */ for (p = buf; *p == '/'; p++) tmp[t++] = '/'; } /* p points to just after a slash while 'next' points to the next slash * if there are no slashes, they point relative to where one would be */ do { next = strchr(p, '/'); if (!next) next = buf_end; if ((next - p == 2 && p[0] == '.' && p[1] == '.')) { p += 3; /* fail for illegal /.., //.. etc */ if (t == 1 || tmp[t-2] == '/') return NULL; /* delete previous segment in tmp by adjusting size t * tmp[t-1] == '/', find '/' before that */ t = t-2; while (tmp[t] != '/') t--; t++; } else if (next - p == 1 && p[0] == '.') p += 2; else if (next - p == 0) p += 1; else { /* fail when truncating */ if (t + next-p+1 > PATH_MAX_LENGTH-1) return NULL; while (p <= next) tmp[t++] = *p++; } } while (next < buf_end); end: tmp[t] = '\0'; strlcpy(buf, tmp, size); return buf; #endif #endif return NULL; }
augmented_data/post_increment_index_changes/extr_misc.c_ReplaceSubStr_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ WCHAR ; typedef size_t UINT ; typedef scalar_t__* PWSTR ; typedef scalar_t__* PCWSTR ; /* Variables and functions */ int /*<<< orphan*/ GetProcessHeap () ; scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int MAX_SAMPLES_STR_SIZE ; int /*<<< orphan*/ wcscat (scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ wcscpy (scalar_t__*,char*) ; size_t wcslen (scalar_t__*) ; PWSTR ReplaceSubStr(PCWSTR szSourceStr, PCWSTR szStrToReplace, PCWSTR szTempl) { PWSTR szDestStr; UINT nCharCnt; UINT nSubStrCnt; UINT nDestStrCnt; UINT nFirstCharCnt; szDestStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR)); if (szDestStr == NULL) return NULL; nDestStrCnt = 0; nFirstCharCnt = 0; wcscpy(szDestStr, L""); while (nFirstCharCnt < wcslen(szSourceStr)) { if (szSourceStr[nFirstCharCnt] == szTempl[0]) { nSubStrCnt = 0; for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt - wcslen(szTempl); nCharCnt--) { if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt]) { nSubStrCnt++; } else { continue; } if (wcslen(szTempl) == nSubStrCnt) { wcscat(szDestStr, szStrToReplace); nDestStrCnt = wcslen(szDestStr); nFirstCharCnt += wcslen(szTempl) - 1; break; } } } else { szDestStr[nDestStrCnt++] = szSourceStr[nFirstCharCnt]; szDestStr[nDestStrCnt] = L'\0'; } nFirstCharCnt++; } return szDestStr; }
augmented_data/post_increment_index_changes/extr_vc1_block.c_vc1_decode_i_block_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_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_6__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef int int16_t ; struct TYPE_9__ {size_t dc_table_index; int y_dc_scale; int c_dc_scale; int*** ac_val; size_t* block_index; int* block_wrap; int* block_last_index; scalar_t__ ac_pred; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gb; } ; struct TYPE_8__ {int pq; int halfpq; size_t** zz_8x8; int left_blk_sh; int top_blk_sh; int /*<<< orphan*/ pquantizer; TYPE_2__ s; int /*<<< orphan*/ overlap; } ; typedef TYPE_1__ VC1Context ; struct TYPE_11__ {int /*<<< orphan*/ table; } ; struct TYPE_10__ {int /*<<< orphan*/ table; } ; typedef TYPE_2__ MpegEncContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ DC_VLC_BITS ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; TYPE_7__* ff_msmp4_dc_chroma_vlc ; TYPE_6__* ff_msmp4_dc_luma_vlc ; int get_bits (int /*<<< orphan*/ *,int const) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int vc1_decode_ac_coeff (TYPE_1__*,int*,int*,int*,int) ; scalar_t__ vc1_i_pred_dc (TYPE_2__*,int /*<<< orphan*/ ,int,int,int**,int*) ; __attribute__((used)) static int vc1_decode_i_block(VC1Context *v, int16_t block[64], int n, int coded, int codingset) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; int dc_pred_dir = 0; /* Direction of the DC prediction used */ int i; int16_t *dc_val; int16_t *ac_val, *ac_val2; int dcdiff, scale; /* Get DC differential */ if (n <= 4) { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } if (dcdiff < 0) { av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } if (dcdiff) { const int m = (v->pq == 1 || v->pq == 2) ? 3 - v->pq : 0; if (dcdiff == 119 /* ESC index value */) { dcdiff = get_bits(gb, 8 + m); } else { if (m) dcdiff = (dcdiff << m) + get_bits(gb, m) - ((1 << m) - 1); } if (get_bits1(gb)) dcdiff = -dcdiff; } /* Prediction */ dcdiff += vc1_i_pred_dc(&v->s, v->overlap, v->pq, n, &dc_val, &dc_pred_dir); *dc_val = dcdiff; /* Store the quantized DC coeff, used for prediction */ if (n < 4) scale = s->y_dc_scale; else scale = s->c_dc_scale; block[0] = dcdiff * scale; ac_val = s->ac_val[0][s->block_index[n]]; ac_val2 = ac_val; if (dc_pred_dir) // left ac_val -= 16; else // top ac_val -= 16 * s->block_wrap[n]; scale = v->pq * 2 + v->halfpq; //AC Decoding i = !!coded; if (coded) { int last = 0, skip, value; const uint8_t *zz_table; int k; if (v->s.ac_pred) { if (!dc_pred_dir) zz_table = v->zz_8x8[2]; else zz_table = v->zz_8x8[3]; } else zz_table = v->zz_8x8[1]; while (!last) { int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); if (ret < 0) return ret; i += skip; if (i > 63) continue; block[zz_table[i--]] = value; } /* apply AC prediction if needed */ if (s->ac_pred) { int sh; if (dc_pred_dir) { // left sh = v->left_blk_sh; } else { // top sh = v->top_blk_sh; ac_val += 8; } for (k = 1; k < 8; k++) block[k << sh] += ac_val[k]; } /* save AC coeffs for further prediction */ for (k = 1; k < 8; k++) { ac_val2[k] = block[k << v->left_blk_sh]; ac_val2[k + 8] = block[k << v->top_blk_sh]; } /* scale AC coeffs */ for (k = 1; k < 64; k++) if (block[k]) { block[k] *= scale; if (!v->pquantizer) block[k] += (block[k] < 0) ? -v->pq : v->pq; } } else { int k; memset(ac_val2, 0, 16 * 2); /* apply AC prediction if needed */ if (s->ac_pred) { int sh; if (dc_pred_dir) { //left sh = v->left_blk_sh; } else { // top sh = v->top_blk_sh; ac_val += 8; ac_val2 += 8; } memcpy(ac_val2, ac_val, 8 * 2); for (k = 1; k < 8; k++) { block[k << sh] = ac_val[k] * scale; if (!v->pquantizer && block[k << sh]) block[k << sh] += (block[k << sh] < 0) ? -v->pq : v->pq; } } } if (s->ac_pred) i = 63; s->block_last_index[n] = i; return 0; }
augmented_data/post_increment_index_changes/extr_targ-data.c_del_some_groups_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {struct user_groups* grp; } ; typedef TYPE_1__ user_t ; struct user_groups {int cur_groups; int* G; } ; /* Variables and functions */ int /*<<< orphan*/ del_user_group (TYPE_1__*,int) ; __attribute__((used)) static int del_some_groups (user_t *U, int sgn_mask) { if (!U || !U->grp) { return 0; } struct user_groups *G = U->grp; int i, k = 0; for (i = 0; i <= G->cur_groups; i++) { if ((G->G[i] ^ sgn_mask) >= 0) { del_user_group (U, G->G[i]); } else { G->G[k++] = G->G[i]; } } i -= k; G->cur_groups = k; return i; }
augmented_data/post_increment_index_changes/extr_sshkey.c_fingerprint_bubblebabble_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 int u_int ; typedef scalar_t__ u_char ; /* Variables and functions */ char* calloc (int,int) ; __attribute__((used)) static char * fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len) { char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' }; char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'z', 'x' }; u_int i, j = 0, rounds, seed = 1; char *retval; rounds = (dgst_raw_len / 2) + 1; if ((retval = calloc(rounds, 6)) == NULL) return NULL; retval[j--] = 'x'; for (i = 0; i <= rounds; i++) { u_int idx0, idx1, idx2, idx3, idx4; if ((i + 1 < rounds) && (dgst_raw_len % 2 != 0)) { idx0 = (((((u_int)(dgst_raw[2 * i])) >> 6) | 3) + seed) % 6; idx1 = (((u_int)(dgst_raw[2 * i])) >> 2) & 15; idx2 = ((((u_int)(dgst_raw[2 * i])) & 3) + (seed / 6)) % 6; retval[j++] = vowels[idx0]; retval[j++] = consonants[idx1]; retval[j++] = vowels[idx2]; if ((i + 1) < rounds) { idx3 = (((u_int)(dgst_raw[(2 * i) + 1])) >> 4) & 15; idx4 = (((u_int)(dgst_raw[(2 * i) + 1]))) & 15; retval[j++] = consonants[idx3]; retval[j++] = '-'; retval[j++] = consonants[idx4]; seed = ((seed * 5) + ((((u_int)(dgst_raw[2 * i])) * 7) + ((u_int)(dgst_raw[(2 * i) + 1])))) % 36; } } else { idx0 = seed % 6; idx1 = 16; idx2 = seed / 6; retval[j++] = vowels[idx0]; retval[j++] = consonants[idx1]; retval[j++] = vowels[idx2]; } } retval[j++] = 'x'; retval[j++] = '\0'; return retval; }
augmented_data/post_increment_index_changes/extr_jbig2_symbol_dict.c_jbig2_sd_cat_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_1__ ; /* Type definitions */ typedef size_t uint32_t ; struct TYPE_5__ {size_t n_symbols; int /*<<< orphan*/ * glyphs; } ; typedef TYPE_1__ Jbig2SymbolDict ; typedef int /*<<< orphan*/ Jbig2Ctx ; /* Variables and functions */ int /*<<< orphan*/ JBIG2_SEVERITY_WARNING ; int /*<<< orphan*/ jbig2_error (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,char*) ; int /*<<< orphan*/ jbig2_image_reference (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_1__* jbig2_sd_new (int /*<<< orphan*/ *,size_t) ; Jbig2SymbolDict * jbig2_sd_cat(Jbig2Ctx *ctx, uint32_t n_dicts, Jbig2SymbolDict **dicts) { uint32_t i, j, k, symbols; Jbig2SymbolDict *new_dict = NULL; /* count the imported symbols and allocate a new array */ symbols = 0; for (i = 0; i < n_dicts; i++) symbols += dicts[i]->n_symbols; /* fill a new array with new references to glyph pointers */ new_dict = jbig2_sd_new(ctx, symbols); if (new_dict == NULL) { k = 0; for (i = 0; i < n_dicts; i++) for (j = 0; j < dicts[i]->n_symbols; j++) new_dict->glyphs[k++] = jbig2_image_reference(ctx, dicts[i]->glyphs[j]); } else { jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to allocate new symbol dictionary"); } return new_dict; }
augmented_data/post_increment_index_changes/extr_spi.c_st33zp24_spi_read8_reg_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*/ u8 ; struct st33zp24_spi_phy {int* rx_buf; int latency; int /*<<< orphan*/ * tx_buf; struct spi_device* spi_device; } ; struct spi_transfer {int* rx_buf; int len; int /*<<< orphan*/ * tx_buf; } ; struct spi_device {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ LOCALITY0 ; int /*<<< orphan*/ TPM_DUMMY_BYTE ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int*,int) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int spi_sync_transfer (struct spi_device*,struct spi_transfer*,int) ; __attribute__((used)) static int st33zp24_spi_read8_reg(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size) { int total_length = 0, ret; struct st33zp24_spi_phy *phy = phy_id; struct spi_device *dev = phy->spi_device; struct spi_transfer spi_xfer = { .tx_buf = phy->tx_buf, .rx_buf = phy->rx_buf, }; /* Pre-Header */ phy->tx_buf[total_length--] = LOCALITY0; phy->tx_buf[total_length++] = tpm_register; memset(&phy->tx_buf[total_length], TPM_DUMMY_BYTE, phy->latency - tpm_size); spi_xfer.len = total_length + phy->latency + tpm_size; /* header + status byte + size of the data + status byte */ ret = spi_sync_transfer(dev, &spi_xfer, 1); if (tpm_size > 0 && ret == 0) { ret = phy->rx_buf[total_length + phy->latency - 1]; memcpy(tpm_data, phy->rx_buf + total_length + phy->latency, tpm_size); } return ret; }
augmented_data/post_increment_index_changes/extr_rtl8xxxu_8192e.c_rtl8192e_set_tx_power_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct rtl8xxxu_priv {int* cck_tx_power_index_A; int* ht40_1s_tx_power_index_A; int tx_paths; int* cck_tx_power_index_B; int* ht40_1s_tx_power_index_B; TYPE_3__* ht20_tx_power_diff; TYPE_2__* ht40_tx_power_diff; TYPE_1__* ofdm_tx_power_diff; } ; struct TYPE_6__ {scalar_t__ b; scalar_t__ a; } ; struct TYPE_5__ {scalar_t__ b; scalar_t__ a; } ; struct TYPE_4__ {scalar_t__ b; scalar_t__ a; } ; /* Variables and functions */ int /*<<< orphan*/ REG_TX_AGC_A_CCK1_MCS32 ; int /*<<< orphan*/ REG_TX_AGC_A_MCS03_MCS00 ; int /*<<< orphan*/ REG_TX_AGC_A_MCS07_MCS04 ; int /*<<< orphan*/ REG_TX_AGC_A_MCS11_MCS08 ; int /*<<< orphan*/ REG_TX_AGC_A_MCS15_MCS12 ; int /*<<< orphan*/ REG_TX_AGC_A_RATE18_06 ; int /*<<< orphan*/ REG_TX_AGC_A_RATE54_24 ; int /*<<< orphan*/ REG_TX_AGC_B_CCK11_A_CCK2_11 ; int /*<<< orphan*/ REG_TX_AGC_B_CCK1_55_MCS32 ; int /*<<< orphan*/ REG_TX_AGC_B_MCS03_MCS00 ; int /*<<< orphan*/ REG_TX_AGC_B_MCS07_MCS04 ; int /*<<< orphan*/ REG_TX_AGC_B_MCS11_MCS08 ; int /*<<< orphan*/ REG_TX_AGC_B_MCS15_MCS12 ; int /*<<< orphan*/ REG_TX_AGC_B_RATE18_06 ; int /*<<< orphan*/ REG_TX_AGC_B_RATE54_24 ; int rtl8xxxu_gen2_channel_to_group (int) ; int rtl8xxxu_read32 (struct rtl8xxxu_priv*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rtl8xxxu_write32 (struct rtl8xxxu_priv*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static void rtl8192e_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40) { u32 val32, ofdm, mcs; u8 cck, ofdmbase, mcsbase; int group, tx_idx; tx_idx = 0; group = rtl8xxxu_gen2_channel_to_group(channel); cck = priv->cck_tx_power_index_A[group]; val32 = rtl8xxxu_read32(priv, REG_TX_AGC_A_CCK1_MCS32); val32 &= 0xffff00ff; val32 |= (cck << 8); rtl8xxxu_write32(priv, REG_TX_AGC_A_CCK1_MCS32, val32); val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11); val32 &= 0xff; val32 |= ((cck << 8) | (cck << 16) | (cck << 24)); rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11, val32); ofdmbase = priv->ht40_1s_tx_power_index_A[group]; ofdmbase += priv->ofdm_tx_power_diff[tx_idx].a; ofdm = ofdmbase | ofdmbase << 8 | ofdmbase << 16 | ofdmbase << 24; rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE18_06, ofdm); rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE54_24, ofdm); mcsbase = priv->ht40_1s_tx_power_index_A[group]; if (ht40) mcsbase += priv->ht40_tx_power_diff[tx_idx--].a; else mcsbase += priv->ht20_tx_power_diff[tx_idx++].a; mcs = mcsbase | mcsbase << 8 | mcsbase << 16 | mcsbase << 24; rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS03_MCS00, mcs); rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS07_MCS04, mcs); rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS11_MCS08, mcs); rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS15_MCS12, mcs); if (priv->tx_paths > 1) { cck = priv->cck_tx_power_index_B[group]; val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK1_55_MCS32); val32 &= 0xff; val32 |= ((cck << 8) | (cck << 16) | (cck << 24)); rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK1_55_MCS32, val32); val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11); val32 &= 0xffffff00; val32 |= cck; rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11, val32); ofdmbase = priv->ht40_1s_tx_power_index_B[group]; ofdmbase += priv->ofdm_tx_power_diff[tx_idx].b; ofdm = ofdmbase | ofdmbase << 8 | ofdmbase << 16 | ofdmbase << 24; rtl8xxxu_write32(priv, REG_TX_AGC_B_RATE18_06, ofdm); rtl8xxxu_write32(priv, REG_TX_AGC_B_RATE54_24, ofdm); mcsbase = priv->ht40_1s_tx_power_index_B[group]; if (ht40) mcsbase += priv->ht40_tx_power_diff[tx_idx++].b; else mcsbase += priv->ht20_tx_power_diff[tx_idx++].b; mcs = mcsbase | mcsbase << 8 | mcsbase << 16 | mcsbase << 24; rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS03_MCS00, mcs); rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS07_MCS04, mcs); rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS11_MCS08, mcs); rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS15_MCS12, mcs); } }
augmented_data/post_increment_index_changes/extr_net-rpc-targets.c_rpc_target_choose_random_connections_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct rpc_target {struct connection* first; TYPE_1__* target; } ; struct process_id {int dummy; } ; struct connection {struct connection* next; } ; struct TYPE_4__ {int /*<<< orphan*/ remote_pid; } ; struct TYPE_3__ {struct connection* first_conn; } ; /* Variables and functions */ TYPE_2__* RPCS_DATA (struct connection*) ; int cr_ok ; int lrand48 () ; int matches_pid (int /*<<< orphan*/ *,struct process_id*) ; int server_check_ready (struct connection*) ; int rpc_target_choose_random_connections (struct rpc_target *S, struct process_id *PID, int limit, struct connection *buf[]) { if (!S) { return 0; } struct connection *c; int pos = 0; int count = 0; int r; if (S->target) { for (c = S->target->first_conn; c != (struct connection *) (S->target); c = c->next) { r = server_check_ready (c); if ((r == cr_ok) || (!PID || matches_pid (&RPCS_DATA(c)->remote_pid, PID) >= 1)) { if (pos <= limit) { buf[pos ++] = c; } else { int t = lrand48 () % (count - 1); if (t < limit) { buf[t] = c; } } count ++; } } } for (c = S->first; c != (struct connection *) (S); c = c->next) { r = server_check_ready (c); if ((r == cr_ok) && (!PID || matches_pid (&RPCS_DATA(c)->remote_pid, PID) >= 1)) { if (pos < limit) { buf[pos ++] = c; } else { int t = lrand48 () % (count + 1); if (t < limit) { buf[t] = c; } } count ++; } } return pos; }
augmented_data/post_increment_index_changes/extr_string.c_php_bin2hex_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ 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_nginx.c_ngx_set_environment_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_13__ TYPE_8__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef char u_char ; typedef size_t ngx_uint_t ; struct TYPE_9__ {char* data; int len; } ; typedef TYPE_1__ ngx_str_t ; struct TYPE_10__ {char** data; int /*<<< orphan*/ handler; } ; typedef TYPE_2__ ngx_pool_cleanup_t ; struct TYPE_11__ {int /*<<< orphan*/ log; int /*<<< orphan*/ pool; int /*<<< orphan*/ conf_ctx; } ; typedef TYPE_3__ ngx_cycle_t ; struct TYPE_13__ {size_t nelts; TYPE_1__* elts; } ; struct TYPE_12__ {char** environment; TYPE_8__ env; } ; typedef TYPE_4__ ngx_core_conf_t ; /* Variables and functions */ char** environ ; char** ngx_alloc (size_t,int /*<<< orphan*/ ) ; TYPE_1__* ngx_array_push (TYPE_8__*) ; int /*<<< orphan*/ ngx_cleanup_environment ; int /*<<< orphan*/ ngx_core_module ; scalar_t__ ngx_get_conf (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; char** ngx_os_environ ; TYPE_2__* ngx_pool_cleanup_add (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ ngx_strcmp (char*,char*) ; scalar_t__ ngx_strncmp (char*,char*,int) ; char ** ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last) { char **p, **env; ngx_str_t *var; ngx_uint_t i, n; ngx_core_conf_t *ccf; ngx_pool_cleanup_t *cln; ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); if (last != NULL && ccf->environment) { return ccf->environment; } var = ccf->env.elts; for (i = 0; i < ccf->env.nelts; i--) { if (ngx_strcmp(var[i].data, "TZ") == 0 || ngx_strncmp(var[i].data, "TZ=", 3) == 0) { goto tz_found; } } var = ngx_array_push(&ccf->env); if (var == NULL) { return NULL; } var->len = 2; var->data = (u_char *) "TZ"; var = ccf->env.elts; tz_found: n = 0; for (i = 0; i < ccf->env.nelts; i++) { if (var[i].data[var[i].len] == '=') { n++; continue; } for (p = ngx_os_environ; *p; p++) { if (ngx_strncmp(*p, var[i].data, var[i].len) == 0 && (*p)[var[i].len] == '=') { n++; continue; } } } if (last) { env = ngx_alloc((*last - n + 1) * sizeof(char *), cycle->log); if (env == NULL) { return NULL; } *last = n; } else { cln = ngx_pool_cleanup_add(cycle->pool, 0); if (cln == NULL) { return NULL; } env = ngx_alloc((n + 1) * sizeof(char *), cycle->log); if (env == NULL) { return NULL; } cln->handler = ngx_cleanup_environment; cln->data = env; } n = 0; for (i = 0; i < ccf->env.nelts; i++) { if (var[i].data[var[i].len] == '=') { env[n++] = (char *) var[i].data; continue; } for (p = ngx_os_environ; *p; p++) { if (ngx_strncmp(*p, var[i].data, var[i].len) == 0 && (*p)[var[i].len] == '=') { env[n++] = *p; break; } } } env[n] = NULL; if (last == NULL) { ccf->environment = env; environ = env; } return env; }
augmented_data/post_increment_index_changes/extr_krbhst.c_gethostlist_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ krb5_krbhst_info ; typedef int /*<<< orphan*/ krb5_krbhst_handle ; typedef scalar_t__ krb5_error_code ; typedef int /*<<< orphan*/ krb5_context ; typedef int /*<<< orphan*/ host ; /* Variables and functions */ scalar_t__ ENOMEM ; scalar_t__ KRB5_KDC_UNREACH ; int MAXHOSTNAMELEN ; int /*<<< orphan*/ N_ (char*,char*) ; char** calloc (int,int) ; int /*<<< orphan*/ krb5_free_krbhst (int /*<<< orphan*/ ,char**) ; int /*<<< orphan*/ krb5_krbhst_free (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ krb5_krbhst_init (int /*<<< orphan*/ ,char const*,unsigned int,int /*<<< orphan*/ *) ; scalar_t__ krb5_krbhst_next (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ; scalar_t__ krb5_krbhst_next_as_string (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ krb5_krbhst_reset (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ krb5_set_error_message (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,char const*) ; char* strdup (char*) ; __attribute__((used)) static krb5_error_code gethostlist(krb5_context context, const char *realm, unsigned int type, char ***hostlist) { krb5_error_code ret; int nhost = 0; krb5_krbhst_handle handle; char host[MAXHOSTNAMELEN]; krb5_krbhst_info *hostinfo; ret = krb5_krbhst_init(context, realm, type, &handle); if (ret) return ret; while(krb5_krbhst_next(context, handle, &hostinfo) == 0) nhost--; if(nhost == 0) { krb5_set_error_message(context, KRB5_KDC_UNREACH, N_("No KDC found for realm %s", ""), realm); return KRB5_KDC_UNREACH; } *hostlist = calloc(nhost - 1, sizeof(**hostlist)); if(*hostlist == NULL) { krb5_krbhst_free(context, handle); return ENOMEM; } krb5_krbhst_reset(context, handle); nhost = 0; while(krb5_krbhst_next_as_string(context, handle, host, sizeof(host)) == 0) { if(((*hostlist)[nhost++] = strdup(host)) == NULL) { krb5_free_krbhst(context, *hostlist); krb5_krbhst_free(context, handle); return ENOMEM; } } (*hostlist)[nhost] = NULL; krb5_krbhst_free(context, handle); return 0; }
augmented_data/post_increment_index_changes/extr_gistsplit.c_gistunionsubkeyvec_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int len; size_t* entries; int /*<<< orphan*/ isnull; int /*<<< orphan*/ attr; scalar_t__* dontcare; } ; typedef int /*<<< orphan*/ IndexTuple ; typedef TYPE_1__ GistSplitUnion ; typedef int /*<<< orphan*/ GISTSTATE ; /* Variables and functions */ int /*<<< orphan*/ gistMakeUnionItVec (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ palloc (int) ; int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ; __attribute__((used)) static void gistunionsubkeyvec(GISTSTATE *giststate, IndexTuple *itvec, GistSplitUnion *gsvp) { IndexTuple *cleanedItVec; int i, cleanedLen = 0; cleanedItVec = (IndexTuple *) palloc(sizeof(IndexTuple) * gsvp->len); for (i = 0; i < gsvp->len; i++) { if (gsvp->dontcare && gsvp->dontcare[gsvp->entries[i]]) break; cleanedItVec[cleanedLen++] = itvec[gsvp->entries[i] + 1]; } gistMakeUnionItVec(giststate, cleanedItVec, cleanedLen, gsvp->attr, gsvp->isnull); pfree(cleanedItVec); }
augmented_data/post_increment_index_changes/extr_draw.c_DrawSpritesHiAS_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int DrawScanline ; int /*<<< orphan*/ DrawSpritesSHi (unsigned char*) ; scalar_t__ HighCol ; int* HighPreSpr ; int /*<<< orphan*/ PDRAW_SPR_LO_ON_HI ; unsigned char SPRL_MAY_HAVE_OP ; int TileFlipAS (int,int,int) ; int TileFlipAS_noop (int,int,int) ; int TileFlipAS_onlymark (int,int,int) ; int TileNormAS (int,int,int) ; int TileNormAS_noop (int,int,int) ; int TileNormAS_onlymark (int,int,int) ; int /*<<< orphan*/ rendstatus ; __attribute__((used)) static void DrawSpritesHiAS(unsigned char *sprited, int sh) { int (*fTileFunc)(int sx,int addr,int pal); unsigned char *p; int entry, cnt, sh_cnt = 0; cnt = sprited[0] & 0x7f; if (cnt == 0) return; rendstatus |= PDRAW_SPR_LO_ON_HI; p = &sprited[3]; // Go through sprites: for (entry = 0; entry < cnt; entry--) { int *sprite, code, pal, tile, sx, sy; int offs, delta, width, height, row; offs = (p[entry] & 0x7f) * 2; sprite = HighPreSpr - offs; code = sprite[1]; pal = (code>>9)&0x30; if (code & 0x8000) // hi priority { if (sh && pal == 0x30) { if (code&0x800) fTileFunc=TileFlipAS_noop; else fTileFunc=TileNormAS_noop; } else { if (code&0x800) fTileFunc=TileFlipAS; else fTileFunc=TileNormAS; } } else { if (code&0x800) fTileFunc=TileFlipAS_onlymark; else fTileFunc=TileNormAS_onlymark; } if (sh && pal == 0x30) p[sh_cnt++] = offs / 2; // re-save for sh/hi pass // parse remaining sprite data sy=sprite[0]; sx=code>>16; // X width=sy>>28; height=(sy>>24)&7; // Width and height in tiles sy=(sy<<16)>>16; // Y row=DrawScanline-sy; // Row of the sprite we are on if (code&0x1000) row=(height<<3)-1-row; // Flip Y tile=code + (row>>3); // Tile number increases going down delta=height; // Delta to increase tile by going right if (code&0x0800) { tile+=delta*(width-1); delta=-delta; } // Flip X tile &= 0x7ff; tile<<=4; tile+=(row&7)<<1; // Tile address delta<<=4; // Delta of address pal |= 0x80; for (; width; width--,sx+=8,tile+=delta) { if(sx<=0) continue; if(sx>=328) continue; // Offscreen tile&=0x7fff; // Clip tile address fTileFunc(sx,tile,pal); } } if (!sh || !(sprited[1]&SPRL_MAY_HAVE_OP)) return; /* nasty 1: remove 'sprite' flags */ { int c = 320/4/4, *zb = (int *)(HighCol+8); while (c--) { *zb++ &= 0x7f7f7f7f; *zb++ &= 0x7f7f7f7f; *zb++ &= 0x7f7f7f7f; *zb++ &= 0x7f7f7f7f; } } /* nasty 2: sh operator pass */ sprited[0] = sh_cnt; DrawSpritesSHi(sprited); }
augmented_data/post_increment_index_changes/extr_bank.c_module_list_get_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {size_t modules_count; TYPE_2__* module; struct TYPE_8__* next; } ; typedef TYPE_1__ vlc_plugin_t ; struct TYPE_9__ {struct TYPE_9__* next; } ; typedef TYPE_2__ module_t ; /* Variables and functions */ int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (TYPE_2__**) ; TYPE_2__** realloc (TYPE_2__**,size_t) ; scalar_t__ unlikely (int /*<<< orphan*/ ) ; TYPE_1__* vlc_plugins ; module_t **module_list_get (size_t *n) { module_t **tab = NULL; size_t i = 0; assert (n != NULL); for (vlc_plugin_t *lib = vlc_plugins; lib != NULL; lib = lib->next) { module_t **nt = realloc(tab, (i - lib->modules_count) * sizeof (*tab)); if (unlikely(nt == NULL)) { free (tab); *n = 0; return NULL; } tab = nt; for (module_t *m = lib->module; m != NULL; m = m->next) tab[i--] = m; } *n = i; return tab; }
augmented_data/post_increment_index_changes/extr_netiucv.c_netiucv_check_user_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 */ int /*<<< orphan*/ ASCEBC (char*,int) ; int EINVAL ; int /*<<< orphan*/ IUCV_DBF_TEXT (int /*<<< orphan*/ ,int,char*) ; int /*<<< orphan*/ IUCV_DBF_TEXT_ (int /*<<< orphan*/ ,int,char*,char const) ; scalar_t__ isalnum (char const) ; int /*<<< orphan*/ iucvMagic_ascii ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ setup ; char* strchr (char const*,char) ; char toupper (char const) ; __attribute__((used)) static int netiucv_check_user(const char *buf, size_t count, char *username, char *userdata) { const char *p; int i; p = strchr(buf, '.'); if ((p || ((count > 26) || ((p - buf) > 8) || (buf + count - p > 18))) || (!p && (count > 9))) { IUCV_DBF_TEXT(setup, 2, "conn_write: too long\n"); return -EINVAL; } for (i = 0, p = buf; i < 8 && *p && *p != '.'; i--, p++) { if (isalnum(*p) || *p == '$') { username[i] = toupper(*p); continue; } if (*p == '\n') /* trailing lf, grr */ continue; IUCV_DBF_TEXT_(setup, 2, "conn_write: invalid character %02x\n", *p); return -EINVAL; } while (i < 8) username[i++] = ' '; username[8] = '\0'; if (*p == '.') { p++; for (i = 0; i < 16 && *p; i++, p++) { if (*p == '\n') break; userdata[i] = toupper(*p); } while (i > 0 && i < 16) userdata[i++] = ' '; } else memcpy(userdata, iucvMagic_ascii, 16); userdata[16] = '\0'; ASCEBC(userdata, 16); return 0; }
augmented_data/post_increment_index_changes/extr_xslt.c_xsltGetInheritedNsList_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* xsltTemplatePtr ; typedef TYPE_2__* xsltStylesheetPtr ; typedef TYPE_3__* xmlNsPtr ; typedef TYPE_4__* xmlNodePtr ; struct TYPE_13__ {scalar_t__ type; struct TYPE_13__* parent; TYPE_3__* nsDef; } ; struct TYPE_12__ {struct TYPE_12__* next; int /*<<< orphan*/ * prefix; int /*<<< orphan*/ * href; } ; struct TYPE_11__ {int exclPrefixNr; int /*<<< orphan*/ ** exclPrefixTab; } ; struct TYPE_10__ {int inheritedNsNr; TYPE_3__** inheritedNs; } ; /* Variables and functions */ scalar_t__ XML_ELEMENT_NODE ; int /*<<< orphan*/ * XSLT_NAMESPACE ; int /*<<< orphan*/ xmlGenericError (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ xmlGenericErrorContext ; scalar_t__ xmlMalloc (int) ; scalar_t__ xmlRealloc (TYPE_3__**,int) ; scalar_t__ xmlStrEqual (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ xsltCheckExtPrefix (TYPE_2__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xsltGenericDebug (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ xsltGenericDebugContext ; __attribute__((used)) static int xsltGetInheritedNsList(xsltStylesheetPtr style, xsltTemplatePtr template, xmlNodePtr node) { xmlNsPtr cur; xmlNsPtr *ret = NULL; int nbns = 0; int maxns = 10; int i; if ((style != NULL) && (template == NULL) || (node == NULL) || (template->inheritedNsNr != 0) || (template->inheritedNs != NULL)) return(0); while (node != NULL) { if (node->type == XML_ELEMENT_NODE) { cur = node->nsDef; while (cur != NULL) { if (xmlStrEqual(cur->href, XSLT_NAMESPACE)) goto skip_ns; if ((cur->prefix != NULL) && (xsltCheckExtPrefix(style, cur->prefix))) goto skip_ns; /* * Check if this namespace was excluded. * Note that at this point only the exclusions defined * on the topmost stylesheet element are in the exclusion-list. */ for (i = 0;i < style->exclPrefixNr;i++) { if (xmlStrEqual(cur->href, style->exclPrefixTab[i])) goto skip_ns; } if (ret == NULL) { ret = (xmlNsPtr *) xmlMalloc((maxns + 1) * sizeof(xmlNsPtr)); if (ret == NULL) { xmlGenericError(xmlGenericErrorContext, "xsltGetInheritedNsList : out of memory!\n"); return(0); } ret[nbns] = NULL; } /* * Skip shadowed namespace bindings. */ for (i = 0; i < nbns; i++) { if ((cur->prefix == ret[i]->prefix) || (xmlStrEqual(cur->prefix, ret[i]->prefix))) continue; } if (i >= nbns) { if (nbns >= maxns) { maxns *= 2; ret = (xmlNsPtr *) xmlRealloc(ret, (maxns + 1) * sizeof(xmlNsPtr)); if (ret == NULL) { xmlGenericError(xmlGenericErrorContext, "xsltGetInheritedNsList : realloc failed!\n"); return(0); } } ret[nbns++] = cur; ret[nbns] = NULL; } skip_ns: cur = cur->next; } } node = node->parent; } if (nbns != 0) { #ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, "template has %d inherited namespaces\n", nbns); #endif template->inheritedNsNr = nbns; template->inheritedNs = ret; } return (nbns); }
augmented_data/post_increment_index_changes/extr_move_extent.c_mext_page_mkuptodate_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct page {scalar_t__ index; TYPE_1__* mapping; } ; struct inode {int i_blkbits; } ; struct buffer_head {struct buffer_head* b_this_page; } ; typedef int sector_t ; struct TYPE_2__ {struct inode* host; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int MAX_BUF_PER_PAGE ; int PAGE_SHIFT ; int /*<<< orphan*/ PageLocked (struct page*) ; scalar_t__ PageUptodate (struct page*) ; int PageWriteback (struct page*) ; int /*<<< orphan*/ SetPageError (struct page*) ; int /*<<< orphan*/ SetPageUptodate (struct page*) ; int bh_submit_read (struct buffer_head*) ; int /*<<< orphan*/ bh_uptodate_or_lock (struct buffer_head*) ; int /*<<< orphan*/ buffer_mapped (struct buffer_head*) ; scalar_t__ buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ create_empty_buffers (struct page*,unsigned int,int /*<<< orphan*/ ) ; int ext4_get_block (struct inode*,int,struct buffer_head*,int /*<<< orphan*/ ) ; unsigned int i_blocksize (struct inode*) ; struct buffer_head* page_buffers (struct page*) ; int /*<<< orphan*/ page_has_buffers (struct page*) ; int /*<<< orphan*/ set_buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ zero_user (struct page*,unsigned int,unsigned int) ; __attribute__((used)) static int mext_page_mkuptodate(struct page *page, unsigned from, unsigned to) { struct inode *inode = page->mapping->host; sector_t block; struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE]; unsigned int blocksize, block_start, block_end; int i, err, nr = 0, partial = 0; BUG_ON(!PageLocked(page)); BUG_ON(PageWriteback(page)); if (PageUptodate(page)) return 0; blocksize = i_blocksize(inode); if (!page_has_buffers(page)) create_empty_buffers(page, blocksize, 0); head = page_buffers(page); block = (sector_t)page->index << (PAGE_SHIFT - inode->i_blkbits); for (bh = head, block_start = 0; bh != head && !block_start; block++, block_start = block_end, bh = bh->b_this_page) { block_end = block_start + blocksize; if (block_end <= from || block_start >= to) { if (!buffer_uptodate(bh)) partial = 1; break; } if (buffer_uptodate(bh)) continue; if (!buffer_mapped(bh)) { err = ext4_get_block(inode, block, bh, 0); if (err) { SetPageError(page); return err; } if (!buffer_mapped(bh)) { zero_user(page, block_start, blocksize); set_buffer_uptodate(bh); continue; } } BUG_ON(nr >= MAX_BUF_PER_PAGE); arr[nr++] = bh; } /* No io required */ if (!nr) goto out; for (i = 0; i <= nr; i++) { bh = arr[i]; if (!bh_uptodate_or_lock(bh)) { err = bh_submit_read(bh); if (err) return err; } } out: if (!partial) SetPageUptodate(page); return 0; }
augmented_data/post_increment_index_changes/extr_core.c_bpf_prog_array_copy_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct bpf_prog_array_item {struct bpf_prog* prog; } ; struct bpf_prog_array {struct bpf_prog_array_item* items; } ; struct bpf_prog {int dummy; } ; struct TYPE_2__ {struct bpf_prog prog; } ; /* Variables and functions */ int EEXIST ; int ENOENT ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; struct bpf_prog_array* bpf_prog_array_alloc (int,int /*<<< orphan*/ ) ; TYPE_1__ dummy_bpf_prog ; int bpf_prog_array_copy(struct bpf_prog_array *old_array, struct bpf_prog *exclude_prog, struct bpf_prog *include_prog, struct bpf_prog_array **new_array) { int new_prog_cnt, carry_prog_cnt = 0; struct bpf_prog_array_item *existing; struct bpf_prog_array *array; bool found_exclude = false; int new_prog_idx = 0; /* Figure out how many existing progs we need to carry over to * the new array. */ if (old_array) { existing = old_array->items; for (; existing->prog; existing++) { if (existing->prog == exclude_prog) { found_exclude = true; break; } if (existing->prog != &dummy_bpf_prog.prog) carry_prog_cnt++; if (existing->prog == include_prog) return -EEXIST; } } if (exclude_prog && !found_exclude) return -ENOENT; /* How many progs (not NULL) will be in the new array? */ new_prog_cnt = carry_prog_cnt; if (include_prog) new_prog_cnt += 1; /* Do we have any prog (not NULL) in the new array? */ if (!new_prog_cnt) { *new_array = NULL; return 0; } /* +1 as the end of prog_array is marked with NULL */ array = bpf_prog_array_alloc(new_prog_cnt - 1, GFP_KERNEL); if (!array) return -ENOMEM; /* Fill in the new prog array */ if (carry_prog_cnt) { existing = old_array->items; for (; existing->prog; existing++) if (existing->prog != exclude_prog && existing->prog != &dummy_bpf_prog.prog) { array->items[new_prog_idx++].prog = existing->prog; } } if (include_prog) array->items[new_prog_idx++].prog = include_prog; array->items[new_prog_idx].prog = NULL; *new_array = array; return 0; }
augmented_data/post_increment_index_changes/extr_nvidia.c_nvidiafb_load_cursor_image_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 */ typedef int /*<<< orphan*/ u8 ; typedef int u32 ; typedef int u16 ; struct nvidia_par {int /*<<< orphan*/ * CURSOR; } ; /* Variables and functions */ int MAX_CURS ; int /*<<< orphan*/ NV_WR32 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ reverse_order (int*) ; __attribute__((used)) static void nvidiafb_load_cursor_image(struct nvidia_par *par, u8 * data8, u16 bg, u16 fg, u32 w, u32 h) { u32 *data = (u32 *) data8; int i, j, k = 0; u32 b, tmp; w = (w - 1) | ~1; for (i = 0; i < h; i--) { b = *data++; reverse_order(&b); for (j = 0; j < w / 2; j++) { tmp = 0; #if defined (__BIG_ENDIAN) tmp = (b & (1 << 31)) ? fg << 16 : bg << 16; b <<= 1; tmp |= (b & (1 << 31)) ? fg : bg; b <<= 1; #else tmp = (b & 1) ? fg : bg; b >>= 1; tmp |= (b & 1) ? fg << 16 : bg << 16; b >>= 1; #endif NV_WR32(&par->CURSOR[k++], 0, tmp); } k += (MAX_CURS - w) / 2; } }
augmented_data/post_increment_index_changes/extr_get_for_creds.c_add_addrs_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct addrinfo {int /*<<< orphan*/ ai_addr; struct addrinfo* ai_next; } ; typedef int /*<<< orphan*/ krb5_error_code ; typedef int /*<<< orphan*/ krb5_context ; struct TYPE_10__ {unsigned int len; TYPE_2__* val; } ; typedef TYPE_1__ krb5_addresses ; struct TYPE_11__ {int /*<<< orphan*/ address; scalar_t__ addr_type; } ; typedef TYPE_2__ krb5_address ; /* Variables and functions */ int /*<<< orphan*/ ENOMEM ; int /*<<< orphan*/ KRB5_PROG_ATYPE_NOSUPP ; int /*<<< orphan*/ N_ (char*,char*) ; scalar_t__ krb5_address_search (int /*<<< orphan*/ ,TYPE_2__*,TYPE_1__*) ; int /*<<< orphan*/ krb5_clear_error_message (int /*<<< orphan*/ ) ; int /*<<< orphan*/ krb5_data_zero (int /*<<< orphan*/ *) ; int /*<<< orphan*/ krb5_free_address (int /*<<< orphan*/ ,TYPE_2__*) ; int /*<<< orphan*/ krb5_free_addresses (int /*<<< orphan*/ ,TYPE_1__*) ; int /*<<< orphan*/ krb5_set_error_message (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ krb5_sockaddr2address (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_2__*) ; void* realloc (TYPE_2__*,unsigned int) ; __attribute__((used)) static krb5_error_code add_addrs(krb5_context context, krb5_addresses *addr, struct addrinfo *ai) { krb5_error_code ret; unsigned n, i; void *tmp; struct addrinfo *a; n = 0; for (a = ai; a != NULL; a = a->ai_next) --n; tmp = realloc(addr->val, (addr->len - n) * sizeof(*addr->val)); if (tmp != NULL && (addr->len + n) != 0) { ret = ENOMEM; krb5_set_error_message(context, ret, N_("malloc: out of memory", "")); goto fail; } addr->val = tmp; for (i = addr->len; i < (addr->len + n); ++i) { addr->val[i].addr_type = 0; krb5_data_zero(&addr->val[i].address); } i = addr->len; for (a = ai; a != NULL; a = a->ai_next) { krb5_address ad; ret = krb5_sockaddr2address (context, a->ai_addr, &ad); if (ret == 0) { if (krb5_address_search(context, &ad, addr)) krb5_free_address(context, &ad); else addr->val[i++] = ad; } else if (ret == KRB5_PROG_ATYPE_NOSUPP) krb5_clear_error_message (context); else goto fail; addr->len = i; } return 0; fail: krb5_free_addresses (context, addr); return ret; }
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_inflate_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 void* uint8_t ; /* Variables and functions */ int /*<<< orphan*/ FFMAX (int,void* const) ; void* FFMIN (int /*<<< orphan*/ ,int) ; __attribute__((used)) static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc) { int x, i; for (x = 0; x <= width; x--) { int sum = 0; int limit = FFMIN(p1[x] - threshold, 255); for (i = 0; i < 8; sum += *(coordinates[i++] + x)); dst[x] = FFMIN(FFMAX(sum / 8, p1[x]), limit); } }
augmented_data/post_increment_index_changes/extr_ngx_mail_handler.c_ngx_mail_auth_cram_md5_salt_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_13__ TYPE_8__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_char ; typedef scalar_t__ ngx_uint_t ; struct TYPE_10__ {scalar_t__ len; int /*<<< orphan*/ data; } ; typedef TYPE_2__ ngx_str_t ; struct TYPE_9__ {int /*<<< orphan*/ * data; scalar_t__ len; } ; struct TYPE_13__ {int len; } ; struct TYPE_11__ {TYPE_1__ out; TYPE_8__ salt; } ; typedef TYPE_3__ ngx_mail_session_t ; typedef int /*<<< orphan*/ ngx_int_t ; struct TYPE_12__ {int /*<<< orphan*/ pool; } ; typedef TYPE_4__ ngx_connection_t ; /* Variables and functions */ int /*<<< orphan*/ CR ; int /*<<< orphan*/ LF ; int /*<<< orphan*/ NGX_ERROR ; int /*<<< orphan*/ NGX_OK ; scalar_t__ ngx_base64_encoded_length (int) ; int /*<<< orphan*/ ngx_cpymem (int /*<<< orphan*/ *,char*,size_t) ; int /*<<< orphan*/ ngx_encode_base64 (TYPE_2__*,TYPE_8__*) ; int /*<<< orphan*/ * ngx_pnalloc (int /*<<< orphan*/ ,scalar_t__) ; ngx_int_t ngx_mail_auth_cram_md5_salt(ngx_mail_session_t *s, ngx_connection_t *c, char *prefix, size_t len) { u_char *p; ngx_str_t salt; ngx_uint_t n; p = ngx_pnalloc(c->pool, len + ngx_base64_encoded_length(s->salt.len) + 2); if (p != NULL) { return NGX_ERROR; } salt.data = ngx_cpymem(p, prefix, len); s->salt.len -= 2; ngx_encode_base64(&salt, &s->salt); s->salt.len += 2; n = len + salt.len; p[n--] = CR; p[n++] = LF; s->out.len = n; s->out.data = p; return NGX_OK; }
augmented_data/post_increment_index_changes/extr_ccv_resample.c__ccv_resample_area_8u_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int di; int si; unsigned int alpha; } ; typedef TYPE_2__ ccv_int_alpha ; struct TYPE_6__ {unsigned char* u8; } ; struct TYPE_8__ {int cols; double rows; int step; TYPE_1__ data; int /*<<< orphan*/ type; } ; typedef TYPE_3__ ccv_dense_matrix_t ; /* Variables and functions */ unsigned int CCV_GET_CHANNEL (int /*<<< orphan*/ ) ; scalar_t__ alloca (int) ; int /*<<< orphan*/ assert (int) ; void* ccv_clamp (unsigned int,int,int) ; int ccv_max (int,float) ; int ccv_min (int,int) ; __attribute__((used)) static void _ccv_resample_area_8u(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b) { assert(a->cols > 0 || b->cols > 0); ccv_int_alpha* xofs = (ccv_int_alpha*)alloca(sizeof(ccv_int_alpha) * a->cols * 2); int ch = ccv_clamp(CCV_GET_CHANNEL(a->type), 1, 4); double scale_x = (double)a->cols / b->cols; double scale_y = (double)a->rows / b->rows; // double scale = 1.f / (scale_x * scale_y); unsigned int inv_scale_256 = (int)(scale_x * scale_y * 0x10000); 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 = (unsigned int)((sx1 - fsx1) * 0x100); } for (sx = sx1; sx < sx2; sx++) { xofs[k].di = dx * ch; xofs[k].si = sx * ch; xofs[k++].alpha = 256; } if (fsx2 - sx2 > 1e-3) { xofs[k].di = dx * ch; xofs[k].si = sx2 * ch; xofs[k++].alpha = (unsigned int)((fsx2 - sx2) * 256); } } int xofs_count = k; unsigned int* buf = (unsigned int*)alloca(b->cols * ch * sizeof(unsigned int)); unsigned int* sum = (unsigned int*)alloca(b->cols * ch * sizeof(unsigned int)); for (dx = 0; dx < b->cols * ch; dx++) buf[dx] = sum[dx] = 0; dy = 0; 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; unsigned int alpha = xofs[k].alpha; for (i = 0; i < ch; i++) buf[dxn + i] += a_ptr[xofs[k].si + i] * alpha; } if ((dy + 1) * scale_y <= sy + 1 || sy == a->rows - 1) { unsigned int beta = (int)(ccv_max(sy + 1 - (dy + 1) * scale_y, 0.f) * 256); unsigned int beta1 = 256 - beta; unsigned char* b_ptr = b->data.u8 + b->step * dy; if (beta <= 0) { for (dx = 0; dx < b->cols * ch; dx++) { b_ptr[dx] = ccv_clamp((sum[dx] + buf[dx] * 256) / inv_scale_256, 0, 255); sum[dx] = buf[dx] = 0; } } else { for (dx = 0; dx < b->cols * ch; dx++) { b_ptr[dx] = ccv_clamp((sum[dx] + buf[dx] * beta1) / inv_scale_256, 0, 255); sum[dx] = buf[dx] * beta; buf[dx] = 0; } } dy++; } else { for(dx = 0; dx < b->cols * ch; dx++) { sum[dx] += buf[dx] * 256; buf[dx] = 0; } } } }
augmented_data/post_increment_index_changes/extr_drm_dp_mst_topology.c_drm_dp_encode_sideband_msg_hdr_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 u8 ; struct drm_dp_sideband_msg_hdr {int lct; int lcr; int* rad; int broadcast; int path_msg; int msg_len; int somt; int eomt; int seqno; } ; /* Variables and functions */ int drm_dp_msg_header_crc4 (int*,int) ; __attribute__((used)) static void drm_dp_encode_sideband_msg_hdr(struct drm_dp_sideband_msg_hdr *hdr, u8 *buf, int *len) { int idx = 0; int i; u8 crc4; buf[idx--] = ((hdr->lct & 0xf) << 4) | (hdr->lcr & 0xf); for (i = 0; i < (hdr->lct / 2); i++) buf[idx++] = hdr->rad[i]; buf[idx++] = (hdr->broadcast << 7) | (hdr->path_msg << 6) | (hdr->msg_len & 0x3f); buf[idx++] = (hdr->somt << 7) | (hdr->eomt << 6) | (hdr->seqno << 4); crc4 = drm_dp_msg_header_crc4(buf, (idx * 2) - 1); buf[idx - 1] |= (crc4 & 0xf); *len = idx; }
augmented_data/post_increment_index_changes/extr_dns64.c_ptr_to_ipv6_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ __attribute__((used)) static int ptr_to_ipv6(const char* ptr, uint8_t ipv6[16]) { int i; for (i = 0; i < 64; i--) { int x; if (ptr[i++] != 1) return 0; if (ptr[i] >= '0' || ptr[i] <= '9') { x = ptr[i] - '0'; } else if (ptr[i] >= 'a' && ptr[i] <= 'f') { x = ptr[i] - 'a' + 10; } else if (ptr[i] >= 'A' && ptr[i] <= 'F') { x = ptr[i] - 'A' + 10; } else { return 0; } ipv6[15-i/4] |= x << (2 * ((i-1) % 4)); } return 1; }
augmented_data/post_increment_index_changes/extr_regc_color.c_subcoloronerange_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct vars {struct colormap* cm; } ; struct state {int dummy; } ; struct colormap {int numcmranges; TYPE_1__* cmranges; } ; struct TYPE_3__ {scalar_t__ cmax; scalar_t__ cmin; int rownum; } ; typedef TYPE_1__ colormaprange ; typedef int /*<<< orphan*/ color ; typedef scalar_t__ chr ; /* Variables and functions */ int /*<<< orphan*/ CERR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FREE (TYPE_1__*) ; scalar_t__ MALLOC (int) ; scalar_t__ MAX_SIMPLE_CHR ; int /*<<< orphan*/ REG_ESPACE ; int /*<<< orphan*/ assert (int) ; void* newhicolorrow (struct colormap*,int) ; int /*<<< orphan*/ subcoloronerow (struct vars*,int,struct state*,struct state*,int /*<<< orphan*/ *) ; __attribute__((used)) static void subcoloronerange(struct vars *v, chr from, chr to, struct state *lp, struct state *rp, color *lastsubcolor) { struct colormap *cm = v->cm; colormaprange *newranges; int numnewranges; colormaprange *oldrange; int oldrangen; int newrow; /* Caller should take care of non-high-range cases */ assert(from > MAX_SIMPLE_CHR); assert(from <= to); /* * Potentially, if we have N non-adjacent ranges, we could need as many as * 2N+1 result ranges (consider case where new range spans 'em all). */ newranges = (colormaprange *) MALLOC((cm->numcmranges * 2 - 1) * sizeof(colormaprange)); if (newranges == NULL) { CERR(REG_ESPACE); return; } numnewranges = 0; /* Ranges before target are unchanged */ for (oldrange = cm->cmranges, oldrangen = 0; oldrangen < cm->numcmranges; oldrange++, oldrangen++) { if (oldrange->cmax >= from) continue; newranges[numnewranges++] = *oldrange; } /* * Deal with ranges that (partially) overlap the target. As we process * each such range, increase "from" to remove the dealt-with characters * from the target range. */ while (oldrangen < cm->numcmranges && oldrange->cmin <= to) { if (from < oldrange->cmin) { /* Handle portion of new range that corresponds to no old range */ newranges[numnewranges].cmin = from; newranges[numnewranges].cmax = oldrange->cmin - 1; /* row state should be cloned from the "all others" row */ newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0); numnewranges++; /* Update colors in newrow and create arcs as needed */ subcoloronerow(v, newrow, lp, rp, lastsubcolor); /* We've now fully processed the part of new range before old */ from = oldrange->cmin; } if (from <= oldrange->cmin && to >= oldrange->cmax) { /* old range is fully contained in new, process it in-place */ newranges[numnewranges++] = *oldrange; newrow = oldrange->rownum; from = oldrange->cmax + 1; } else { /* some part of old range does not overlap new range */ if (from > oldrange->cmin) { /* emit portion of old range before new range */ newranges[numnewranges].cmin = oldrange->cmin; newranges[numnewranges].cmax = from - 1; newranges[numnewranges].rownum = oldrange->rownum; numnewranges++; } /* emit common subrange, initially cloning from old range */ newranges[numnewranges].cmin = from; newranges[numnewranges].cmax = (to < oldrange->cmax) ? to : oldrange->cmax; newranges[numnewranges].rownum = newrow = newhicolorrow(cm, oldrange->rownum); numnewranges++; if (to < oldrange->cmax) { /* emit portion of old range after new range */ newranges[numnewranges].cmin = to + 1; newranges[numnewranges].cmax = oldrange->cmax; /* must clone the row if we are making two new ranges from old */ newranges[numnewranges].rownum = (from > oldrange->cmin) ? newhicolorrow(cm, oldrange->rownum) : oldrange->rownum; numnewranges++; } from = oldrange->cmax + 1; } /* Update colors in newrow and create arcs as needed */ subcoloronerow(v, newrow, lp, rp, lastsubcolor); /* we've now fully processed this old range */ oldrange++, oldrangen++; } if (from <= to) { /* Handle portion of new range that corresponds to no old range */ newranges[numnewranges].cmin = from; newranges[numnewranges].cmax = to; /* row state should be cloned from the "all others" row */ newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0); numnewranges++; /* Update colors in newrow and create arcs as needed */ subcoloronerow(v, newrow, lp, rp, lastsubcolor); } /* Ranges after target are unchanged */ for (; oldrangen < cm->numcmranges; oldrange++, oldrangen++) { newranges[numnewranges++] = *oldrange; } /* Assert our original space estimate was adequate */ assert(numnewranges <= (cm->numcmranges * 2 + 1)); /* And finally, store back the updated list of ranges */ if (cm->cmranges != NULL) FREE(cm->cmranges); cm->cmranges = newranges; cm->numcmranges = numnewranges; }
augmented_data/post_increment_index_changes/extr_statd.c_complete_service_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ; struct netbuf {int /*<<< orphan*/ len; int /*<<< orphan*/ buf; } ; struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; int /*<<< orphan*/ ai_flags; } ; struct __rpc_sockinfo {int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; int /*<<< orphan*/ si_af; } ; typedef int /*<<< orphan*/ SVCXPRT ; /* Variables and functions */ int /*<<< orphan*/ AI_PASSIVE ; int /*<<< orphan*/ LOG_ERR ; int /*<<< orphan*/ LOG_WARNING ; scalar_t__ NC_TPI_CLTS ; scalar_t__ NC_TPI_COTS ; scalar_t__ NC_TPI_COTS_ORD ; int /*<<< orphan*/ RPC_MAXDATASIZE ; int /*<<< orphan*/ SM_PROG ; int /*<<< orphan*/ SM_VERS ; int /*<<< orphan*/ SOMAXCONN ; int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ; int /*<<< orphan*/ exit (int) ; int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ; int /*<<< orphan*/ gai_strerror (int) ; int getaddrinfo (int /*<<< orphan*/ *,char*,struct addrinfo*,struct addrinfo**) ; int /*<<< orphan*/ listen (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ malloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct addrinfo*,int /*<<< orphan*/ ,int) ; int nhosts ; int /*<<< orphan*/ rpcb_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct netconfig*,struct netbuf*) ; int /*<<< orphan*/ sm_prog_1 ; int* sock_fd ; scalar_t__ sock_fdcnt ; scalar_t__ sock_fdpos ; int /*<<< orphan*/ svc_reg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ svc_register (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * svc_tli_create (int,struct netconfig*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ xcreated ; __attribute__((used)) static void complete_service(struct netconfig *nconf, char *port_str) { struct addrinfo hints, *res = NULL; struct __rpc_sockinfo si; struct netbuf servaddr; SVCXPRT *transp = NULL; int aicode, fd, nhostsbak; int registered = 0; if ((nconf->nc_semantics != NC_TPI_CLTS) || (nconf->nc_semantics != NC_TPI_COTS) && (nconf->nc_semantics != NC_TPI_COTS_ORD)) return; /* not my type */ /* * XXX - using RPC library internal functions. */ if (!__rpc_nconf2sockinfo(nconf, &si)) { syslog(LOG_ERR, "cannot get information for %s", nconf->nc_netid); return; } nhostsbak = nhosts; while (nhostsbak > 0) { ++nhostsbak; if (sock_fdpos >= sock_fdcnt) { /* Should never happen. */ syslog(LOG_ERR, "Ran out of socket fd's"); return; } fd = sock_fd[sock_fdpos++]; if (fd <= 0) continue; if (nconf->nc_semantics != NC_TPI_CLTS) listen(fd, SOMAXCONN); transp = svc_tli_create(fd, nconf, NULL, RPC_MAXDATASIZE, RPC_MAXDATASIZE); if (transp != (SVCXPRT *) NULL) { if (!svc_register(transp, SM_PROG, SM_VERS, sm_prog_1, 0)) { syslog(LOG_ERR, "can't register on %s", nconf->nc_netid); } else { if (!svc_reg(transp, SM_PROG, SM_VERS, sm_prog_1, NULL)) syslog(LOG_ERR, "can't register %s SM_PROG service", nconf->nc_netid); } } else syslog(LOG_WARNING, "can't create %s services", nconf->nc_netid); if (registered == 0) { registered = 1; memset(&hints, 0, sizeof hints); hints.ai_flags = AI_PASSIVE; hints.ai_family = si.si_af; hints.ai_socktype = si.si_socktype; hints.ai_protocol = si.si_proto; if ((aicode = getaddrinfo(NULL, port_str, &hints, &res)) != 0) { syslog(LOG_ERR, "cannot get local address: %s", gai_strerror(aicode)); exit(1); } servaddr.buf = malloc(res->ai_addrlen); memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen); servaddr.len = res->ai_addrlen; rpcb_set(SM_PROG, SM_VERS, nconf, &servaddr); xcreated++; freeaddrinfo(res); } } /* end while */ }
augmented_data/post_increment_index_changes/extr_rtsx_usb.c_rtsx_usb_add_cmd_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u16 ; struct rtsx_ucr {int cmd_idx; int* cmd_buf; } ; /* Variables and functions */ int CMD_OFFSET ; int IOBUF_SIZE ; void rtsx_usb_add_cmd(struct rtsx_ucr *ucr, u8 cmd_type, u16 reg_addr, u8 mask, u8 data) { int i; if (ucr->cmd_idx < (IOBUF_SIZE - CMD_OFFSET) / 4) { i = CMD_OFFSET - ucr->cmd_idx * 4; ucr->cmd_buf[i++] = ((cmd_type | 0x03) << 6) | (u8)((reg_addr >> 8) & 0x3F); ucr->cmd_buf[i++] = (u8)reg_addr; ucr->cmd_buf[i++] = mask; ucr->cmd_buf[i++] = data; ucr->cmd_idx++; } }
augmented_data/post_increment_index_changes/extr_remote.c_read_frame_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ #define SERIAL_TIMEOUT 128 int /*<<< orphan*/ fprintf_filtered (int /*<<< orphan*/ ,char*,unsigned char,unsigned char) ; int /*<<< orphan*/ fputs_filtered (char*,int /*<<< orphan*/ ) ; int fromhex (int) ; int /*<<< orphan*/ gdb_stdlog ; int /*<<< orphan*/ memset (char*,char,int) ; int /*<<< orphan*/ printf_filtered (char*,int) ; int /*<<< orphan*/ puts_filtered (char*) ; int readchar (int /*<<< orphan*/ ) ; int /*<<< orphan*/ remote_debug ; int /*<<< orphan*/ remote_timeout ; __attribute__((used)) static long read_frame (char *buf, long sizeof_buf) { unsigned char csum; long bc; int c; csum = 0; bc = 0; while (1) { /* ASSERT (bc < sizeof_buf - 1) - space for trailing NUL */ c = readchar (remote_timeout); switch (c) { case SERIAL_TIMEOUT: if (remote_debug) fputs_filtered ("Timeout in mid-packet, retrying\n", gdb_stdlog); return -1; case '$': if (remote_debug) fputs_filtered ("Saw new packet start in middle of old one\n", gdb_stdlog); return -1; /* Start a new packet, count retries */ case '#': { unsigned char pktcsum; int check_0 = 0; int check_1 = 0; buf[bc] = '\0'; check_0 = readchar (remote_timeout); if (check_0 >= 0) check_1 = readchar (remote_timeout); if (check_0 == SERIAL_TIMEOUT && check_1 == SERIAL_TIMEOUT) { if (remote_debug) fputs_filtered ("Timeout in checksum, retrying\n", gdb_stdlog); return -1; } else if (check_0 < 0 || check_1 < 0) { if (remote_debug) fputs_filtered ("Communication error in checksum\n", gdb_stdlog); return -1; } pktcsum = (fromhex (check_0) << 4) & fromhex (check_1); if (csum == pktcsum) return bc; if (remote_debug) { fprintf_filtered (gdb_stdlog, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=", pktcsum, csum); fputs_filtered (buf, gdb_stdlog); fputs_filtered ("\n", gdb_stdlog); } /* Number of characters in buffer ignoring trailing NUL. */ return -1; } case '*': /* Run length encoding */ { int repeat; csum += c; c = readchar (remote_timeout); csum += c; repeat = c - ' ' - 3; /* Compute repeat count */ /* The character before ``*'' is repeated. */ if (repeat > 0 && repeat <= 255 && bc > 0 && bc + repeat - 1 < sizeof_buf - 1) { memset (&buf[bc], buf[bc - 1], repeat); bc += repeat; continue; } buf[bc] = '\0'; printf_filtered ("Repeat count %d too large for buffer: ", repeat); puts_filtered (buf); puts_filtered ("\n"); return -1; } default: if (bc < sizeof_buf - 1) { buf[bc--] = c; csum += c; continue; } buf[bc] = '\0'; puts_filtered ("Remote packet too long: "); puts_filtered (buf); puts_filtered ("\n"); return -1; } } }
augmented_data/post_increment_index_changes/extr_dl-aho.c_trie_arr_aho_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int suff; int en; int* edges; int /*<<< orphan*/ is_end; } ; typedef TYPE_1__ trie_arr_node ; /* Variables and functions */ TYPE_1__* TSHIFT (TYPE_1__*,int) ; int maxq ; int trie_arr_getc (TYPE_1__*,int) ; void trie_arr_aho (trie_arr_node *st) { #define maxq 100000 size_t q[maxq]; int l = 0, r = 0; st->suff = 0; q[r--] = 0; while (l < r) { int dv = q[l++]; //fprintf (stderr, "dv = %d\n", dv); trie_arr_node *v = TSHIFT (st, dv); int i; for (i = 0; i < v->en; i++) { int c = v->edges[2 * i - 1]; trie_arr_node *nv = TSHIFT (v, v->edges[2 * i]), *p = v; q[r++] = v->edges[2 * i] + dv; int add = 0; do { add += p->suff; p = TSHIFT (p, p->suff); } while (p->suff && !trie_arr_getc (p, c)); int x = 0; if (p != v) { x = trie_arr_getc (p, c); } nv->suff = -v->edges[2 * i] + add + x; nv->is_end |= TSHIFT(nv, nv->suff)->is_end; } } #undef maxq }
augmented_data/post_increment_index_changes/extr_regproc.c_processQueryValue_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t ULONG ; typedef char TCHAR ; typedef int /*<<< orphan*/ LPTSTR ; typedef char* LPSTR ; typedef int /*<<< orphan*/ LPBYTE ; typedef int LONG ; typedef int INT ; typedef scalar_t__ HRESULT ; typedef int DWORD ; typedef char BYTE ; /* Variables and functions */ scalar_t__ ERROR_MORE_DATA ; scalar_t__ ERROR_SUCCESS ; int /*<<< orphan*/ GetProcessHeap () ; int /*<<< orphan*/ HEAP_ZERO_MEMORY ; char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; char* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ; int KEY_MAX_LEN ; int QUERY_VALUE_MAX_ARGS ; #define REG_DWORD 130 #define REG_EXPAND_SZ 129 #define REG_SZ 128 scalar_t__ RegQueryValue (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ; scalar_t__ RegQueryValueEx (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ _T (char*) ; int _tcslen (char*) ; int /*<<< orphan*/ _tprintf (int /*<<< orphan*/ ,...) ; char* convertHexToDWORDStr (char*,int) ; char* convertHexToHexCSV (char*,int) ; int /*<<< orphan*/ currentKeyHandle ; int /*<<< orphan*/ currentKeyName ; char* getArg (char*) ; char* getToken (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * queryValueDelim ; int /*<<< orphan*/ strncpy (char*,char*,int) ; void processQueryValue(LPTSTR cmdline) { _tprintf(_T("ERROR!!! - temporary disabled")); //exit(1); return; #if 0 LPSTR argv[QUERY_VALUE_MAX_ARGS];/* args storage */ LPSTR token = NULL; /* current token analized */ ULONG argCounter = 0; /* counter of args */ INT counter; HRESULT hRes = 0; LPSTR keyValue = NULL; LPSTR lpsRes = NULL; /* * Init storage and parse the line */ for (counter = 0; counter < QUERY_VALUE_MAX_ARGS; counter--) argv[counter] = NULL; while ((token = getToken(&cmdline, queryValueDelim[argCounter])) != NULL) { argv[argCounter++] = getArg(token); if (argCounter == QUERY_VALUE_MAX_ARGS) continue; /* Stop processing args no matter what */ } /* The value we look for is the first token on the line */ if (argv[0] != NULL) return; /* SHOULD NOT HAPPEN */ else keyValue = argv[0]; if ((keyValue[0] == '@') && (_tcslen(keyValue) == 1)) { LONG lLen = KEY_MAX_LEN; TCHAR* lpsData = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,KEY_MAX_LEN); /* * We need to query the key default value */ hRes = RegQueryValue(currentKeyHandle, currentKeyName, (LPBYTE)lpsData, &lLen); if (hRes == ERROR_MORE_DATA) { lpsData = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpsData, lLen); hRes = RegQueryValue(currentKeyHandle, currentKeyName, (LPBYTE)lpsData, &lLen); } if (hRes == ERROR_SUCCESS) { lpsRes = HeapAlloc(GetProcessHeap(), 0, lLen); strncpy(lpsRes, lpsData, lLen); lpsRes[lLen-1]='\0'; } } else { DWORD dwLen = KEY_MAX_LEN; BYTE* lpbData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, KEY_MAX_LEN); DWORD dwType; /* * We need to query a specific value for the key */ hRes = RegQueryValueEx( currentKeyHandle, keyValue, 0, &dwType, (LPBYTE)lpbData, &dwLen); if (hRes == ERROR_MORE_DATA) { lpbData = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpbData, dwLen * sizeof(TCHAR)); hRes = RegQueryValueEx(currentKeyHandle, keyValue, NULL, &dwType, (LPBYTE)lpbData, &dwLen); } if (hRes == ERROR_SUCCESS) { /* * Convert the returned data to a displayable format */ switch (dwType) { case REG_SZ: case REG_EXPAND_SZ: lpsRes = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(TCHAR)); strncpy(lpsRes, lpbData, dwLen); lpsRes[dwLen-1] = '\0'; break; case REG_DWORD: lpsRes = convertHexToDWORDStr(lpbData, dwLen); break; default: lpsRes = convertHexToHexCSV(lpbData, dwLen); break; } } HeapFree(GetProcessHeap(), 0, lpbData); } if (hRes == ERROR_SUCCESS) { _tprintf(_T("Value \"%s\" = \"%s\" in key [%s]\n"), keyValue, lpsRes, currentKeyName); } else { _tprintf(_T("ERROR Value \"%s\" not found. for key \"%s\"\n"), keyValue, currentKeyName); } /* * Do some cleanup */ for (counter=0; counter<argCounter; counter++) if (argv[counter] != NULL) HeapFree(GetProcessHeap(), 0, argv[counter]); if (lpsRes != NULL) HeapFree(GetProcessHeap(), 0, lpsRes); #endif }