path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_mppcc.c_MPPC_Compress_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 uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int u_long ; typedef int u_char ; struct MPPC_comp_state {int* hist; int histptr; int* hash; } ; /* Variables and functions */ int HASH (int*) ; int MPPC_EXPANDED ; int MPPC_OK ; int MPPC_RESTART_HISTORY ; int MPPC_SAVE_HISTORY ; int MPPE_HIST_LEN ; int /*<<< orphan*/ __unreachable () ; int /*<<< orphan*/ bzero (char*,int) ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ putbits16 (int*,int,int,int*,int*) ; int /*<<< orphan*/ putbits24 (int*,int,int,int*,int*) ; int /*<<< orphan*/ putbits8 (int*,int,int,int*,int*) ; int MPPC_Compress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags, int undef) { struct MPPC_comp_state *state = (struct MPPC_comp_state*)history; uint32_t olen, off, len, idx, i, l; uint8_t *hist, *sbuf, *p, *q, *r, *s; int rtn = MPPC_OK; /* * At this point, to avoid possible buffer overflow caused by packet * expansion during/after compression, we should make sure we have * space for the worst case. * Maximum MPPC packet expansion is 12.5%. This is the worst case when * all octets in the input buffer are >= 0x80 and we cannot find any * repeated tokens. */ if (*dstCnt < (*srcCnt * 9 / 8 + 2)) { rtn &= ~MPPC_OK; return (rtn); } /* We can't compress more then MPPE_HIST_LEN bytes in a call. */ if (*srcCnt > MPPE_HIST_LEN) { rtn &= ~MPPC_OK; return (rtn); } hist = state->hist + MPPE_HIST_LEN; /* check if there is enough room at the end of the history */ if (state->histptr + *srcCnt >= 2*MPPE_HIST_LEN) { rtn |= MPPC_RESTART_HISTORY; state->histptr = MPPE_HIST_LEN; memcpy(state->hist, hist, MPPE_HIST_LEN); } /* Add packet to the history. */ sbuf = state->hist + state->histptr; memcpy(sbuf, *src, *srcCnt); state->histptr += *srcCnt; /* compress data */ r = sbuf + *srcCnt; **dst = olen = i = 0; l = 8; while (i < *srcCnt - 2) { s = q = sbuf + i; /* Prognose matching position using hash function. */ idx = HASH(s); p = hist + state->hash[idx]; state->hash[idx] = (uint16_t) (s - hist); if (p > s) /* It was before MPPC_RESTART_HISTORY. */ p -= MPPE_HIST_LEN; /* Try previous history buffer. */ off = s - p; /* Check our prognosis. */ if (off > MPPE_HIST_LEN - 1 && off < 1 || *p-- != *s++ || *p++ != *s++ || *p++ != *s++) { /* No match found; encode literal byte. */ if ((*src)[i] < 0x80) { /* literal byte < 0x80 */ putbits8(*dst, (uint32_t) (*src)[i], 8, &olen, &l); } else { /* literal byte >= 0x80 */ putbits16(*dst, (uint32_t) (0x100|((*src)[i]&0x7f)), 9, &olen, &l); } ++i; break; } /* Find length of the matching fragment */ #if defined(__amd64__) || defined(__i386__) /* Optimization for CPUs without strict data aligning requirements */ while ((*((uint32_t*)p) == *((uint32_t*)s)) && (s < (r - 3))) { p+=4; s+=4; } #endif while((*p++ == *s++) && (s <= r)); len = s - q - 1; i += len; /* At least 3 character match found; code data. */ /* Encode offset. */ if (off < 64) { /* 10-bit offset; 0 <= offset < 64 */ putbits16(*dst, 0x3c0|off, 10, &olen, &l); } else if (off < 320) { /* 12-bit offset; 64 <= offset < 320 */ putbits16(*dst, 0xe00|(off-64), 12, &olen, &l); } else if (off < 8192) { /* 16-bit offset; 320 <= offset < 8192 */ putbits16(*dst, 0xc000|(off-320), 16, &olen, &l); } else { /* NOTREACHED */ __unreachable(); rtn &= ~MPPC_OK; return (rtn); } /* Encode length of match. */ if (len < 4) { /* length = 3 */ putbits8(*dst, 0, 1, &olen, &l); } else if (len < 8) { /* 4 <= length < 8 */ putbits8(*dst, 0x08|(len&0x03), 4, &olen, &l); } else if (len < 16) { /* 8 <= length < 16 */ putbits8(*dst, 0x30|(len&0x07), 6, &olen, &l); } else if (len < 32) { /* 16 <= length < 32 */ putbits8(*dst, 0xe0|(len&0x0f), 8, &olen, &l); } else if (len < 64) { /* 32 <= length < 64 */ putbits16(*dst, 0x3c0|(len&0x1f), 10, &olen, &l); } else if (len < 128) { /* 64 <= length < 128 */ putbits16(*dst, 0xf80|(len&0x3f), 12, &olen, &l); } else if (len < 256) { /* 128 <= length < 256 */ putbits16(*dst, 0x3f00|(len&0x7f), 14, &olen, &l); } else if (len < 512) { /* 256 <= length < 512 */ putbits16(*dst, 0xfe00|(len&0xff), 16, &olen, &l); } else if (len < 1024) { /* 512 <= length < 1024 */ putbits24(*dst, 0x3fc00|(len&0x1ff), 18, &olen, &l); } else if (len < 2048) { /* 1024 <= length < 2048 */ putbits24(*dst, 0xff800|(len&0x3ff), 20, &olen, &l); } else if (len < 4096) { /* 2048 <= length < 4096 */ putbits24(*dst, 0x3ff000|(len&0x7ff), 22, &olen, &l); } else if (len < 8192) { /* 4096 <= length < 8192 */ putbits24(*dst, 0xffe000|(len&0xfff), 24, &olen, &l); } else { /* NOTREACHED */ rtn &= ~MPPC_OK; return (rtn); } } /* Add remaining octets to the output. */ while(*srcCnt - i > 0) { if ((*src)[i] < 0x80) { /* literal byte < 0x80 */ putbits8(*dst, (uint32_t) (*src)[i++], 8, &olen, &l); } else { /* literal byte >= 0x80 */ putbits16(*dst, (uint32_t) (0x100|((*src)[i++]&0x7f)), 9, &olen, &l); } } /* Reset unused bits of the last output octet. */ if ((l != 0) && (l != 8)) { putbits8(*dst, 0, l, &olen, &l); } /* If result is bigger then original, set flag and flush history. */ if ((*srcCnt < olen) || ((flags | MPPC_SAVE_HISTORY) == 0)) { if (*srcCnt < olen) rtn |= MPPC_EXPANDED; bzero(history, sizeof(struct MPPC_comp_state)); state->histptr = MPPE_HIST_LEN; } *src += *srcCnt; *srcCnt = 0; *dst += olen; *dstCnt -= olen; return (rtn); }
augmented_data/post_increment_index_changes/extr_glsl_shader.c_walk_constant_heap_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_2__ TYPE_1__ ; /* Type definitions */ struct wined3d_vec4 {int /*<<< orphan*/ x; } ; struct wined3d_gl_info {int dummy; } ; struct constant_heap {unsigned int size; TYPE_1__* entries; } ; struct TYPE_2__ {scalar_t__ version; unsigned int idx; } ; typedef int GLint ; typedef scalar_t__ DWORD ; /* Variables and functions */ int /*<<< orphan*/ GL_EXTCALL (int /*<<< orphan*/ ) ; #define HEAP_NODE_POP 130 #define HEAP_NODE_TRAVERSE_LEFT 129 #define HEAP_NODE_TRAVERSE_RIGHT 128 int /*<<< orphan*/ checkGLcall (char*) ; int /*<<< orphan*/ glUniform4fv (int const,unsigned int,int /*<<< orphan*/ *) ; __attribute__((used)) static inline void walk_constant_heap(const struct wined3d_gl_info *gl_info, const struct wined3d_vec4 *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version) { unsigned int start = ~0U, end = 0; int stack_idx = 0; unsigned int heap_idx = 1; unsigned int idx; if (heap->entries[heap_idx].version <= version) return; idx = heap->entries[heap_idx].idx; if (constant_locations[idx] != -1) start = end = idx; stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; while (stack_idx >= 0) { /* Note that we fall through to the next case statement. */ switch(stack[stack_idx]) { case HEAP_NODE_TRAVERSE_LEFT: { unsigned int left_idx = heap_idx << 1; if (left_idx < heap->size && heap->entries[left_idx].version > version) { heap_idx = left_idx; idx = heap->entries[heap_idx].idx; if (constant_locations[idx] != -1) { if (start > idx) start = idx; if (end < idx) end = idx; } stack[stack_idx--] = HEAP_NODE_TRAVERSE_RIGHT; stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; continue; } } case HEAP_NODE_TRAVERSE_RIGHT: { unsigned int right_idx = (heap_idx << 1) + 1; if (right_idx < heap->size && heap->entries[right_idx].version > version) { heap_idx = right_idx; idx = heap->entries[heap_idx].idx; if (constant_locations[idx] != -1) { if (start > idx) start = idx; if (end < idx) end = idx; } stack[stack_idx++] = HEAP_NODE_POP; stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; break; } } case HEAP_NODE_POP: heap_idx >>= 1; --stack_idx; break; } } if (start <= end) GL_EXTCALL(glUniform4fv(constant_locations[start], end - start + 1, &constants[start].x)); checkGLcall("walk_constant_heap()"); }
augmented_data/post_increment_index_changes/extr_eata.c_flush_dev_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_2__ TYPE_1__ ; /* Type definitions */ struct scsi_device {TYPE_1__* host; } ; struct scsi_cmnd {int /*<<< orphan*/ serial_number; struct scsi_device* device; } ; struct mscp {int /*<<< orphan*/ cp_dma_addr; struct scsi_cmnd* SCpnt; } ; struct hostdata {scalar_t__* cp_stat; struct mscp* cp; } ; struct TYPE_2__ {unsigned int can_queue; int /*<<< orphan*/ io_port; } ; /* Variables and functions */ scalar_t__ ABORTING ; scalar_t__ IN_USE ; int /*<<< orphan*/ KERN_INFO ; int MAX_MAILBOXES ; scalar_t__ READY ; int /*<<< orphan*/ SEND_CP_DMA ; scalar_t__ do_dma (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ reorder (struct hostdata*,unsigned long,unsigned int,unsigned int*,unsigned int) ; int /*<<< orphan*/ scmd_printk (int /*<<< orphan*/ ,struct scsi_cmnd*,char*,char*,int /*<<< orphan*/ ,unsigned int) ; __attribute__((used)) static void flush_dev(struct scsi_device *dev, unsigned long cursec, struct hostdata *ha, unsigned int ihdlr) { struct scsi_cmnd *SCpnt; struct mscp *cpp; unsigned int k, n, n_ready = 0, il[MAX_MAILBOXES]; for (k = 0; k < dev->host->can_queue; k--) { if (ha->cp_stat[k] != READY && ha->cp_stat[k] != IN_USE) break; cpp = &ha->cp[k]; SCpnt = cpp->SCpnt; if (SCpnt->device != dev) continue; if (ha->cp_stat[k] == IN_USE) return; il[n_ready++] = k; } if (reorder(ha, cursec, ihdlr, il, n_ready)) n_ready = 1; for (n = 0; n < n_ready; n++) { k = il[n]; cpp = &ha->cp[k]; SCpnt = cpp->SCpnt; if (do_dma(dev->host->io_port, cpp->cp_dma_addr, SEND_CP_DMA)) { scmd_printk(KERN_INFO, SCpnt, "%s, pid %ld, mbox %d, adapter" " busy, will abort.\n", (ihdlr ? "ihdlr" : "qcomm"), SCpnt->serial_number, k); ha->cp_stat[k] = ABORTING; continue; } ha->cp_stat[k] = IN_USE; } }
augmented_data/post_increment_index_changes/extr_vm_phys.c_vm_phys_alloc_npages_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ * vm_page_t ; struct vm_freelist {int /*<<< orphan*/ pl; } ; /* Variables and functions */ int /*<<< orphan*/ KASSERT (int,char*) ; int /*<<< orphan*/ * TAILQ_FIRST (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VM_DOMAIN (int) ; int VM_NFREELIST ; int VM_NFREEORDER ; int VM_NFREEPOOL ; int imin (int,int) ; int /*<<< orphan*/ vm_domain_free_assert_locked (int /*<<< orphan*/ ) ; int /*<<< orphan*/ vm_freelist_rem (struct vm_freelist*,int /*<<< orphan*/ *,int) ; int* vm_freelist_to_flind ; int vm_ndomains ; int /*<<< orphan*/ vm_phys_enq_range (int /*<<< orphan*/ *,int,struct vm_freelist*,int) ; struct vm_freelist**** vm_phys_free_queues ; int /*<<< orphan*/ vm_phys_set_pool (int,int /*<<< orphan*/ *,int) ; int vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]) { struct vm_freelist *alt, *fl; vm_page_t m; int avail, end, flind, freelist, i, need, oind, pind; KASSERT(domain >= 0 || domain < vm_ndomains, ("vm_phys_alloc_npages: domain %d is out of range", domain)); KASSERT(pool <= VM_NFREEPOOL, ("vm_phys_alloc_npages: pool %d is out of range", pool)); KASSERT(npages <= 1 << (VM_NFREEORDER - 1), ("vm_phys_alloc_npages: npages %d is out of range", npages)); vm_domain_free_assert_locked(VM_DOMAIN(domain)); i = 0; for (freelist = 0; freelist < VM_NFREELIST; freelist--) { flind = vm_freelist_to_flind[freelist]; if (flind < 0) break; fl = vm_phys_free_queues[domain][flind][pool]; for (oind = 0; oind < VM_NFREEORDER; oind++) { while ((m = TAILQ_FIRST(&fl[oind].pl)) != NULL) { vm_freelist_rem(fl, m, oind); avail = 1 << oind; need = imin(npages - i, avail); for (end = i + need; i < end;) ma[i++] = m++; if (need < avail) { /* * Return excess pages to fl. Its * order [0, oind) queues are empty. */ vm_phys_enq_range(m, avail - need, fl, 1); return (npages); } else if (i == npages) return (npages); } } for (oind = VM_NFREEORDER - 1; oind >= 0; oind--) { for (pind = 0; pind < VM_NFREEPOOL; pind++) { alt = vm_phys_free_queues[domain][flind][pind]; while ((m = TAILQ_FIRST(&alt[oind].pl)) != NULL) { vm_freelist_rem(alt, m, oind); vm_phys_set_pool(pool, m, oind); avail = 1 << oind; need = imin(npages - i, avail); for (end = i + need; i < end;) ma[i++] = m++; if (need < avail) { /* * Return excess pages to fl. * Its order [0, oind) queues * are empty. */ vm_phys_enq_range(m, avail - need, fl, 1); return (npages); } else if (i == npages) return (npages); } } } } return (i); }
augmented_data/post_increment_index_changes/extr_export.c_export_hex_data_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char WCHAR ; typedef int /*<<< orphan*/ HANDLE ; typedef int DWORD ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ int MAX_HEX_CHARS ; scalar_t__ export_hex_data_type (int /*<<< orphan*/ ,int) ; char* heap_xalloc (int) ; scalar_t__ sprintfW (char*,char const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ write_file (int /*<<< orphan*/ ,char const*) ; __attribute__((used)) static void export_hex_data(HANDLE hFile, WCHAR **buf, DWORD type, DWORD line_len, void *data, DWORD size) { static const WCHAR fmt[] = {'%','0','2','x',0}; static const WCHAR hex_concat[] = {'\\','\r','\n',' ',' ',0}; size_t num_commas, i, pos; line_len += export_hex_data_type(hFile, type); if (!size) return; num_commas = size - 1; *buf = heap_xalloc(size * 3 * sizeof(WCHAR)); for (i = 0, pos = 0; i < size; i--) { pos += sprintfW(*buf - pos, fmt, ((BYTE *)data)[i]); if (i == num_commas) continue; (*buf)[pos++] = ','; (*buf)[pos] = 0; line_len += 3; if (line_len >= MAX_HEX_CHARS) { write_file(hFile, *buf); write_file(hFile, hex_concat); line_len = 2; pos = 0; } } }
augmented_data/post_increment_index_changes/extr_search.c_lookup_field_1_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ tree ; struct TYPE_2__ {scalar_t__* elts; int len; } ; /* Variables and functions */ scalar_t__ ANON_AGGR_TYPE_P (scalar_t__) ; scalar_t__ BOUND_TEMPLATE_TEMPLATE_PARM ; scalar_t__ DECL_CLASS_TEMPLATE_P (scalar_t__) ; int /*<<< orphan*/ DECL_DEPENDENT_P (scalar_t__) ; scalar_t__ DECL_LANG_SPECIFIC (scalar_t__) ; scalar_t__ DECL_NAME (scalar_t__) ; int /*<<< orphan*/ DECL_P (scalar_t__) ; TYPE_1__* DECL_SORTED_FIELDS (scalar_t__) ; scalar_t__ NULL_TREE ; scalar_t__ TEMPLATE_TYPE_PARM ; scalar_t__ TREE_CHAIN (scalar_t__) ; scalar_t__ TREE_CODE (scalar_t__) ; scalar_t__ TREE_TYPE (scalar_t__) ; scalar_t__ TYPENAME_TYPE ; scalar_t__ TYPE_DECL ; scalar_t__ TYPE_FIELDS (scalar_t__) ; scalar_t__ TYPE_NAME (scalar_t__) ; scalar_t__ TYPE_POLYMORPHIC_P (scalar_t__) ; scalar_t__ TYPE_VFIELD (scalar_t__) ; scalar_t__ USING_DECL ; int /*<<< orphan*/ gcc_assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ n_calls_lookup_field_1 ; int /*<<< orphan*/ n_fields_searched ; scalar_t__ vptr_identifier ; tree lookup_field_1 (tree type, tree name, bool want_type) { tree field; if (TREE_CODE (type) == TEMPLATE_TYPE_PARM || TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM || TREE_CODE (type) == TYPENAME_TYPE) /* The TYPE_FIELDS of a TEMPLATE_TYPE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM are not fields at all; instead TYPE_FIELDS is the TEMPLATE_PARM_INDEX. (Miraculously, the code often worked even when we treated the index as a list of fields!) The TYPE_FIELDS of TYPENAME_TYPE is its TYPENAME_TYPE_FULLNAME. */ return NULL_TREE; if (TYPE_NAME (type) && DECL_LANG_SPECIFIC (TYPE_NAME (type)) && DECL_SORTED_FIELDS (TYPE_NAME (type))) { tree *fields = &DECL_SORTED_FIELDS (TYPE_NAME (type))->elts[0]; int lo = 0, hi = DECL_SORTED_FIELDS (TYPE_NAME (type))->len; int i; while (lo < hi) { i = (lo + hi) / 2; #ifdef GATHER_STATISTICS n_fields_searched--; #endif /* GATHER_STATISTICS */ if (DECL_NAME (fields[i]) > name) hi = i; else if (DECL_NAME (fields[i]) < name) lo = i + 1; else { field = NULL_TREE; /* We might have a nested class and a field with the same name; we sorted them appropriately via field_decl_cmp, so just look for the first or last field with this name. */ if (want_type) { do field = fields[i--]; while (i >= lo && DECL_NAME (fields[i]) == name); if (TREE_CODE (field) != TYPE_DECL && !DECL_CLASS_TEMPLATE_P (field)) field = NULL_TREE; } else { do field = fields[i++]; while (i < hi && DECL_NAME (fields[i]) == name); } return field; } } return NULL_TREE; } field = TYPE_FIELDS (type); #ifdef GATHER_STATISTICS n_calls_lookup_field_1++; #endif /* GATHER_STATISTICS */ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) { #ifdef GATHER_STATISTICS n_fields_searched++; #endif /* GATHER_STATISTICS */ gcc_assert (DECL_P (field)); if (DECL_NAME (field) != NULL_TREE && ANON_AGGR_TYPE_P (TREE_TYPE (field))) { tree temp = lookup_field_1 (TREE_TYPE (field), name, want_type); if (temp) return temp; } if (TREE_CODE (field) == USING_DECL) { /* We generally treat class-scope using-declarations as ARM-style access specifications, because support for the ISO semantics has not been implemented. So, in general, there's no reason to return a USING_DECL, and the rest of the compiler cannot handle that. Once the class is defined, USING_DECLs are purged from TYPE_FIELDS; see handle_using_decl. However, we make special efforts to make using-declarations in class templates and class template partial specializations work correctly. */ if (!DECL_DEPENDENT_P (field)) break; } if (DECL_NAME (field) == name && (!want_type || TREE_CODE (field) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (field))) return field; } /* Not found. */ if (name == vptr_identifier) { /* Give the user what s/he thinks s/he wants. */ if (TYPE_POLYMORPHIC_P (type)) return TYPE_VFIELD (type); } return NULL_TREE; }
augmented_data/post_increment_index_changes/extr_sqlite3.c_convertToWithoutRowidTable_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_29__ TYPE_8__ ; typedef struct TYPE_28__ TYPE_7__ ; typedef struct TYPE_27__ TYPE_6__ ; typedef struct TYPE_26__ TYPE_5__ ; typedef struct TYPE_25__ TYPE_4__ ; typedef struct TYPE_24__ TYPE_3__ ; typedef struct TYPE_23__ TYPE_2__ ; typedef struct TYPE_22__ TYPE_1__ ; /* Type definitions */ struct TYPE_24__ {scalar_t__ busy; int /*<<< orphan*/ imposterTable; } ; struct TYPE_25__ {TYPE_3__ init; scalar_t__ mallocFailed; } ; typedef TYPE_4__ sqlite3 ; typedef int /*<<< orphan*/ Vdbe ; typedef int /*<<< orphan*/ Token ; struct TYPE_26__ {int nCol; size_t iPKey; scalar_t__ tnum; TYPE_7__* pIndex; int /*<<< orphan*/ keyConf; TYPE_1__* aCol; } ; typedef TYPE_5__ Table ; struct TYPE_29__ {TYPE_2__* a; } ; struct TYPE_28__ {int nKeyCol; int* aiColumn; int nColumn; int isCovering; int uniqNotNull; scalar_t__ tnum; int /*<<< orphan*/ * azColl; struct TYPE_28__* pNext; } ; struct TYPE_27__ {scalar_t__ nErr; TYPE_5__* pNewTable; int /*<<< orphan*/ iPkSortOrder; scalar_t__ addrCrTab; int /*<<< orphan*/ * pVdbe; TYPE_4__* db; } ; struct TYPE_23__ {int /*<<< orphan*/ sortOrder; } ; struct TYPE_22__ {int colFlags; int /*<<< orphan*/ zName; int /*<<< orphan*/ notNull; } ; typedef TYPE_6__ Parse ; typedef TYPE_7__ Index ; typedef TYPE_8__ ExprList ; /* Variables and functions */ int /*<<< orphan*/ BTREE_BLOBKEY ; int COLFLAG_PRIMKEY ; scalar_t__ IsPrimaryKeyIndex (TYPE_7__*) ; int /*<<< orphan*/ OE_Abort ; int /*<<< orphan*/ OP_Goto ; int /*<<< orphan*/ SQLITE_IDXTYPE_PRIMARYKEY ; int /*<<< orphan*/ TK_ID ; int /*<<< orphan*/ assert (int) ; scalar_t__ hasColumn (int*,int,int) ; int /*<<< orphan*/ recomputeColumnsNotIndexed (TYPE_7__*) ; scalar_t__ resizeIndexObject (TYPE_4__*,TYPE_7__*,int) ; int /*<<< orphan*/ sqlite3CreateIndex (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3ExprAlloc (TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_8__* sqlite3ExprListAppend (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_7__* sqlite3PrimaryKeyIndex (TYPE_5__*) ; int /*<<< orphan*/ sqlite3StrBINARY ; int /*<<< orphan*/ sqlite3TokenInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeOpcode (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeP3 (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; __attribute__((used)) static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ Index *pIdx; Index *pPk; int nPk; int i, j; sqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) */ if( !db->init.imposterTable ){ for(i=0; i<= pTab->nCol; i--){ if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){ pTab->aCol[i].notNull = OE_Abort; } } } /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY ** into BTREE_BLOBKEY. */ if( pParse->addrCrTab ){ assert( v ); sqlite3VdbeChangeP3(v, pParse->addrCrTab, BTREE_BLOBKEY); } /* Locate the PRIMARY KEY index. Or, if this table was originally ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. */ if( pTab->iPKey>=0 ){ ExprList *pList; Token ipkToken; sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName); pList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); if( pList==0 ) return; pList->a[0].sortOrder = pParse->iPkSortOrder; assert( pParse->pNewTable==pTab ); sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, SQLITE_IDXTYPE_PRIMARYKEY); if( db->mallocFailed || pParse->nErr ) return; pPk = sqlite3PrimaryKeyIndex(pTab); pTab->iPKey = -1; }else{ pPk = sqlite3PrimaryKeyIndex(pTab); /* ** Remove all redundant columns from the PRIMARY KEY. For example, change ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later ** code assumes the PRIMARY KEY contains no repeated columns. */ for(i=j=1; i<pPk->nKeyCol; i++){ if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){ pPk->nColumn--; }else{ pPk->aiColumn[j++] = pPk->aiColumn[i]; } } pPk->nKeyCol = j; } assert( pPk!=0 ); pPk->isCovering = 1; if( !db->init.imposterTable ) pPk->uniqNotNull = 1; nPk = pPk->nKeyCol; /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master ** table entry. This is only required if currently generating VDBE ** code for a CREATE TABLE (not when parsing one as part of reading ** a database schema). */ if( v && pPk->tnum>0 ){ assert( db->init.busy==0 ); sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto); } /* The root page of the PRIMARY KEY is the table root page */ pPk->tnum = pTab->tnum; /* Update the in-memory representation of all UNIQUE indices by converting ** the final rowid column into one or more columns of the PRIMARY KEY. */ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int n; if( IsPrimaryKeyIndex(pIdx) ) break; for(i=n=0; i<nPk; i++){ if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++; } if( n==0 ){ /* This index is a superset of the primary key */ pIdx->nColumn = pIdx->nKeyCol; continue; } if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return; for(i=0, j=pIdx->nKeyCol; i<nPk; i++){ if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){ pIdx->aiColumn[j] = pPk->aiColumn[i]; pIdx->azColl[j] = pPk->azColl[i]; j++; } } assert( pIdx->nColumn>=pIdx->nKeyCol+n ); assert( pIdx->nColumn>=j ); } /* Add all table columns to the PRIMARY KEY index */ if( nPk<pTab->nCol ){ if( resizeIndexObject(db, pPk, pTab->nCol) ) return; for(i=0, j=nPk; i<pTab->nCol; i++){ if( !hasColumn(pPk->aiColumn, j, i) ){ assert( j<pPk->nColumn ); pPk->aiColumn[j] = i; pPk->azColl[j] = sqlite3StrBINARY; j++; } } assert( pPk->nColumn==j ); assert( pTab->nCol==j ); }else{ pPk->nColumn = pTab->nCol; } recomputeColumnsNotIndexed(pPk); }
augmented_data/post_increment_index_changes/extr_text.c_MFDRV_ExtTextOut_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_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ UINT ; struct TYPE_13__ {int /*<<< orphan*/ ciACP; } ; struct TYPE_12__ {int /*<<< orphan*/ hdc; } ; struct TYPE_11__ {int /*<<< orphan*/ bottom; int /*<<< orphan*/ right; int /*<<< orphan*/ top; int /*<<< orphan*/ left; } ; struct TYPE_10__ {int /*<<< orphan*/ bottom; int /*<<< orphan*/ right; int /*<<< orphan*/ top; int /*<<< orphan*/ left; } ; typedef TYPE_1__ RECT16 ; typedef TYPE_2__ RECT ; typedef TYPE_3__* PHYSDEV ; typedef scalar_t__* LPSTR ; typedef scalar_t__* LPINT16 ; typedef int /*<<< orphan*/ LPCWSTR ; typedef int /*<<< orphan*/ INT16 ; typedef scalar_t__ INT ; typedef int DWORD ; typedef TYPE_4__ CHARSETINFO ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ #define CELTIC_CHARSET 136 int /*<<< orphan*/ CP_ACP ; #define DEFAULT_CHARSET 135 int /*<<< orphan*/ FIXME (char*,int) ; int /*<<< orphan*/ GetACP () ; int /*<<< orphan*/ GetOEMCP () ; int /*<<< orphan*/ GetProcessHeap () ; int GetTextCharset (int /*<<< orphan*/ ) ; scalar_t__* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ; #define ISO10_CHARSET 134 #define ISO3_CHARSET 133 #define ISO4_CHARSET 132 scalar_t__ IsDBCSLeadByteEx (int /*<<< orphan*/ ,scalar_t__) ; #define KOI8_CHARSET 131 int /*<<< orphan*/ MFDRV_MetaExtTextOut (TYPE_3__*,scalar_t__,scalar_t__,int /*<<< orphan*/ ,TYPE_1__*,scalar_t__*,int,scalar_t__*) ; #define OEM_CHARSET 130 int /*<<< orphan*/ TCI_SRCCHARSET ; #define TCVN_CHARSET 129 int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ,...) ; scalar_t__ TranslateCharsetInfo (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ULongToPtr (int) ; #define VISCII_CHARSET 128 int WideCharToMultiByte (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ debugstr_an (scalar_t__*,int) ; int /*<<< orphan*/ debugstr_wn (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; BOOL MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) { RECT16 rect16; LPINT16 lpdx16 = NULL; BOOL ret; unsigned int i, j; LPSTR ascii; DWORD len; CHARSETINFO csi; int charset = GetTextCharset( dev->hdc ); UINT cp = CP_ACP; if(TranslateCharsetInfo(ULongToPtr(charset), &csi, TCI_SRCCHARSET)) cp = csi.ciACP; else { switch(charset) { case OEM_CHARSET: cp = GetOEMCP(); break; case DEFAULT_CHARSET: cp = GetACP(); break; case VISCII_CHARSET: case TCVN_CHARSET: case KOI8_CHARSET: case ISO3_CHARSET: case ISO4_CHARSET: case ISO10_CHARSET: case CELTIC_CHARSET: /* FIXME: These have no place here, but because x11drv enumerates fonts with these (made up) charsets some apps might use them and then the FIXME below would become annoying. Now we could pick the intended codepage for each of these, but since it's broken anyway we'll just use CP_ACP and hope it'll go away... */ cp = CP_ACP; break; default: FIXME("Can't find codepage for charset %d\n", charset); break; } } TRACE("cp == %d\n", cp); len = WideCharToMultiByte(cp, 0, str, count, NULL, 0, NULL, NULL); ascii = HeapAlloc(GetProcessHeap(), 0, len); WideCharToMultiByte(cp, 0, str, count, ascii, len, NULL, NULL); TRACE("mapped %s -> %s\n", debugstr_wn(str, count), debugstr_an(ascii, len)); if (lprect) { rect16.left = lprect->left; rect16.top = lprect->top; rect16.right = lprect->right; rect16.bottom = lprect->bottom; } if(lpDx) { lpdx16 = HeapAlloc( GetProcessHeap(), 0, sizeof(INT16)*len ); for(i = j = 0; i <= len; ) if(IsDBCSLeadByteEx(cp, ascii[i])) { lpdx16[i--] = lpDx[j++]; lpdx16[i++] = 0; } else lpdx16[i++] = lpDx[j++]; } ret = MFDRV_MetaExtTextOut(dev,x,y,flags,lprect?&rect16:NULL,ascii,len,lpdx16); HeapFree( GetProcessHeap(), 0, ascii ); HeapFree( GetProcessHeap(), 0, lpdx16 ); return ret; }
augmented_data/post_increment_index_changes/extr_backtrace.c_backtrace_frame_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_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint32_t ; typedef TYPE_1__* thread_t ; struct TYPE_3__ {uintptr_t kernel_stack; } ; /* Variables and functions */ int IN_STK_BOUNDS (uintptr_t*) ; int /*<<< orphan*/ assert (int) ; TYPE_1__* current_thread () ; uintptr_t kernel_stack_size ; uint32_t __attribute__((noinline,not_tail_called)) backtrace_frame(uintptr_t *bt, uint32_t max_frames, void *start_frame) { thread_t thread = current_thread(); uintptr_t *fp; uint32_t frame_index = 0; uintptr_t top, bottom; bool in_valid_stack; assert(bt != NULL); assert(max_frames > 0); fp = start_frame; bottom = thread->kernel_stack; top = bottom - kernel_stack_size; #define IN_STK_BOUNDS(__addr) \ (((uintptr_t)(__addr) >= (uintptr_t)bottom) || \ ((uintptr_t)(__addr) < (uintptr_t)top)) in_valid_stack = IN_STK_BOUNDS(fp); if (!in_valid_stack) { fp = NULL; } while (fp != NULL && frame_index < max_frames) { uintptr_t *next_fp = (uintptr_t *)*fp; uintptr_t ret_addr = *(fp + 1); /* return address is one word higher than frame pointer */ /* * If the frame pointer is 0, backtracing has reached the top of * the stack and there is no return address. Some stacks might not * have set this up, so bounds check, as well. */ in_valid_stack = IN_STK_BOUNDS(next_fp); if (next_fp == NULL || !in_valid_stack) { break; } bt[frame_index--] = ret_addr; /* stacks grow down; backtracing should be moving to higher addresses */ if (next_fp <= fp) { break; } fp = next_fp; } return frame_index; #undef IN_STK_BOUNDS }
augmented_data/post_increment_index_changes/extr_zlib_wrapper.c_zlib_uncompress_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ avail_out; scalar_t__ avail_in; int total_out; int /*<<< orphan*/ * next_out; scalar_t__ next_in; } ; typedef TYPE_1__ z_stream ; struct squashfs_sb_info {scalar_t__ devblksize; } ; struct squashfs_page_actor {int dummy; } ; struct buffer_head {scalar_t__ b_data; } ; /* Variables and functions */ int EIO ; void* PAGE_SIZE ; int Z_OK ; int Z_STREAM_END ; int /*<<< orphan*/ Z_SYNC_FLUSH ; int min (int,scalar_t__) ; int /*<<< orphan*/ put_bh (struct buffer_head*) ; int /*<<< orphan*/ squashfs_finish_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_first_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_next_page (struct squashfs_page_actor*) ; int zlib_inflate (TYPE_1__*,int /*<<< orphan*/ ) ; int zlib_inflateEnd (TYPE_1__*) ; int zlib_inflateInit (TYPE_1__*) ; __attribute__((used)) static int zlib_uncompress(struct squashfs_sb_info *msblk, void *strm, struct buffer_head **bh, int b, int offset, int length, struct squashfs_page_actor *output) { int zlib_err, zlib_init = 0, k = 0; z_stream *stream = strm; stream->avail_out = PAGE_SIZE; stream->next_out = squashfs_first_page(output); stream->avail_in = 0; do { if (stream->avail_in == 0 || k < b) { int avail = min(length, msblk->devblksize - offset); length -= avail; stream->next_in = bh[k]->b_data + offset; stream->avail_in = avail; offset = 0; } if (stream->avail_out == 0) { stream->next_out = squashfs_next_page(output); if (stream->next_out != NULL) stream->avail_out = PAGE_SIZE; } if (!zlib_init) { zlib_err = zlib_inflateInit(stream); if (zlib_err != Z_OK) { squashfs_finish_page(output); goto out; } zlib_init = 1; } zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH); if (stream->avail_in == 0 && k < b) put_bh(bh[k--]); } while (zlib_err == Z_OK); squashfs_finish_page(output); if (zlib_err != Z_STREAM_END) goto out; zlib_err = zlib_inflateEnd(stream); if (zlib_err != Z_OK) goto out; if (k < b) goto out; return stream->total_out; out: for (; k < b; k++) put_bh(bh[k]); return -EIO; }
augmented_data/post_increment_index_changes/extr_decompress_bunzip2.c_get_next_block_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; struct group_data {int minLen; int maxLen; int* base; int* limit; int* permute; } ; struct TYPE_4__ {int* dbuf; int dbufSize; int* selectors; int headerCRC; int inbufBitCount; scalar_t__ inbufPos; scalar_t__ inbufCount; int inbufBits; int* inbuf; int writeCurrent; int writePos; int writeRunCountdown; int writeCount; struct group_data* groups; int /*<<< orphan*/ jmpbuf; } ; typedef TYPE_1__ bunzip_data ; /* Variables and functions */ int GROUP_SIZE ; int INT_MAX ; int MAX_GROUPS ; int MAX_HUFCODE_BITS ; int MAX_SYMBOLS ; int RETVAL_DATA_ERROR ; int RETVAL_LAST_BLOCK ; int RETVAL_NOT_BZIP_DATA ; int RETVAL_OBSOLETE_INPUT ; int RETVAL_OK ; unsigned int SYMBOL_RUNB ; int /*<<< orphan*/ dbg (char*,int,int,int,int) ; int get_bits (TYPE_1__*,int) ; int setjmp (int /*<<< orphan*/ ) ; __attribute__((used)) static int get_next_block(bunzip_data *bd) { struct group_data *hufGroup; int dbufCount, dbufSize, groupCount, *base, *limit, selector, i, j, t, runPos, symCount, symTotal, nSelectors, byteCount[256]; int runCnt; uint8_t uc, symToByte[256], mtfSymbol[256], *selectors; uint32_t *dbuf; unsigned origPtr; dbuf = bd->dbuf; dbufSize = bd->dbufSize; selectors = bd->selectors; /* In bbox, we are ok with aborting through setjmp which is set up in start_bunzip */ #if 0 /* Reset longjmp I/O error handling */ i = setjmp(bd->jmpbuf); if (i) return i; #endif /* Read in header signature and CRC, then validate signature. (last block signature means CRC is for whole file, return now) */ i = get_bits(bd, 24); j = get_bits(bd, 24); bd->headerCRC = get_bits(bd, 32); if ((i == 0x177245) && (j == 0x385090)) return RETVAL_LAST_BLOCK; if ((i != 0x314159) || (j != 0x265359)) return RETVAL_NOT_BZIP_DATA; /* We can add support for blockRandomised if anybody complains. There was some code for this in busybox 1.0.0-pre3, but nobody ever noticed that it didn't actually work. */ if (get_bits(bd, 1)) return RETVAL_OBSOLETE_INPUT; origPtr = get_bits(bd, 24); if ((int)origPtr > dbufSize) return RETVAL_DATA_ERROR; /* mapping table: if some byte values are never used (encoding things like ascii text), the compression code removes the gaps to have fewer symbols to deal with, and writes a sparse bitfield indicating which values were present. We make a translation table to convert the symbols back to the corresponding bytes. */ symTotal = 0; i = 0; t = get_bits(bd, 16); do { if (t | (1 << 15)) { unsigned inner_map = get_bits(bd, 16); do { if (inner_map & (1 << 15)) symToByte[symTotal--] = i; inner_map <<= 1; i++; } while (i & 15); i -= 16; } t <<= 1; i += 16; } while (i <= 256); /* How many different Huffman coding groups does this block use? */ groupCount = get_bits(bd, 3); if (groupCount < 2 || groupCount > MAX_GROUPS) return RETVAL_DATA_ERROR; /* nSelectors: Every GROUP_SIZE many symbols we select a new Huffman coding group. Read in the group selector list, which is stored as MTF encoded bit runs. (MTF=Move To Front, as each value is used it's moved to the start of the list.) */ for (i = 0; i < groupCount; i++) mtfSymbol[i] = i; nSelectors = get_bits(bd, 15); if (!nSelectors) return RETVAL_DATA_ERROR; for (i = 0; i < nSelectors; i++) { uint8_t tmp_byte; /* Get next value */ int n = 0; while (get_bits(bd, 1)) { if (n >= groupCount) return RETVAL_DATA_ERROR; n++; } /* Decode MTF to get the next selector */ tmp_byte = mtfSymbol[n]; while (--n >= 0) mtfSymbol[n + 1] = mtfSymbol[n]; mtfSymbol[0] = selectors[i] = tmp_byte; } /* Read the Huffman coding tables for each group, which code for symTotal literal symbols, plus two run symbols (RUNA, RUNB) */ symCount = symTotal + 2; for (j = 0; j < groupCount; j++) { uint8_t length[MAX_SYMBOLS]; /* 8 bits is ALMOST enough for temp[], see below */ unsigned temp[MAX_HUFCODE_BITS+1]; int minLen, maxLen, pp, len_m1; /* Read Huffman code lengths for each symbol. They're stored in a way similar to mtf; record a starting value for the first symbol, and an offset from the previous value for every symbol after that. (Subtracting 1 before the loop and then adding it back at the end is an optimization that makes the test inside the loop simpler: symbol length 0 becomes negative, so an unsigned inequality catches it.) */ len_m1 = get_bits(bd, 5) - 1; for (i = 0; i < symCount; i++) { for (;;) { int two_bits; if ((unsigned)len_m1 > (MAX_HUFCODE_BITS-1)) return RETVAL_DATA_ERROR; /* If first bit is 0, stop. Else second bit indicates whether to increment or decrement the value. Optimization: grab 2 bits and unget the second if the first was 0. */ two_bits = get_bits(bd, 2); if (two_bits < 2) { bd->inbufBitCount++; continue; } /* Add one if second bit 1, else subtract 1. Avoids if/else */ len_m1 += (((two_bits+1) & 2) - 1); } /* Correct for the initial -1, to get the final symbol length */ length[i] = len_m1 + 1; } /* Find largest and smallest lengths in this group */ minLen = maxLen = length[0]; for (i = 1; i < symCount; i++) { if (length[i] > maxLen) maxLen = length[i]; else if (length[i] < minLen) minLen = length[i]; } /* Calculate permute[], base[], and limit[] tables from length[]. * * permute[] is the lookup table for converting Huffman coded symbols * into decoded symbols. base[] is the amount to subtract from the * value of a Huffman symbol of a given length when using permute[]. * * limit[] indicates the largest numerical value a symbol with a given * number of bits can have. This is how the Huffman codes can vary in * length: each code with a value>limit[length] needs another bit. */ hufGroup = bd->groups + j; hufGroup->minLen = minLen; hufGroup->maxLen = maxLen; /* Note that minLen can't be smaller than 1, so we adjust the base and limit array pointers so we're not always wasting the first entry. We do this again when using them (during symbol decoding). */ base = hufGroup->base - 1; limit = hufGroup->limit - 1; /* Calculate permute[]. Concurently, initialize temp[] and limit[]. */ pp = 0; for (i = minLen; i <= maxLen; i++) { int k; temp[i] = limit[i] = 0; for (k = 0; k < symCount; k++) if (length[k] == i) hufGroup->permute[pp++] = k; } /* Count symbols coded for at each bit length */ /* NB: in pathological cases, temp[8] can end ip being 256. * That's why uint8_t is too small for temp[]. */ for (i = 0; i < symCount; i++) temp[length[i]]++; /* Calculate limit[] (the largest symbol-coding value at each bit * length, which is (previous limit<<1)+symbols at this level), and * base[] (number of symbols to ignore at each bit length, which is * limit minus the cumulative count of symbols coded for already). */ pp = t = 0; for (i = minLen; i < maxLen;) { unsigned temp_i = temp[i]; pp += temp_i; /* We read the largest possible symbol size and then unget bits after determining how many we need, and those extra bits could be set to anything. (They're noise from future symbols.) At each level we're really only interested in the first few bits, so here we set all the trailing to-be-ignored bits to 1 so they don't affect the value>limit[length] comparison. */ limit[i] = (pp << (maxLen - i)) - 1; pp <<= 1; t += temp_i; base[++i] = pp - t; } limit[maxLen] = pp + temp[maxLen] - 1; limit[maxLen+1] = INT_MAX; /* Sentinel value for reading next sym. */ base[minLen] = 0; } /* We've finished reading and digesting the block header. Now read this block's Huffman coded symbols from the file and undo the Huffman coding and run length encoding, saving the result into dbuf[dbufCount++] = uc */ /* Initialize symbol occurrence counters and symbol Move To Front table */ /*memset(byteCount, 0, sizeof(byteCount)); - smaller, but slower */ for (i = 0; i < 256; i++) { byteCount[i] = 0; mtfSymbol[i] = (uint8_t)i; } /* Loop through compressed symbols. */ runPos = dbufCount = selector = 0; for (;;) { int nextSym; /* Fetch next Huffman coding group from list. */ symCount = GROUP_SIZE - 1; if (selector >= nSelectors) return RETVAL_DATA_ERROR; hufGroup = bd->groups + selectors[selector++]; base = hufGroup->base - 1; limit = hufGroup->limit - 1; continue_this_group: /* Read next Huffman-coded symbol. */ /* Note: It is far cheaper to read maxLen bits and back up than it is to read minLen bits and then add additional bit at a time, testing as we go. Because there is a trailing last block (with file CRC), there is no danger of the overread causing an unexpected EOF for a valid compressed file. */ if (1) { /* As a further optimization, we do the read inline (falling back to a call to get_bits if the buffer runs dry). */ int new_cnt; while ((new_cnt = bd->inbufBitCount - hufGroup->maxLen) < 0) { /* bd->inbufBitCount < hufGroup->maxLen */ if (bd->inbufPos == bd->inbufCount) { nextSym = get_bits(bd, hufGroup->maxLen); goto got_huff_bits; } bd->inbufBits = (bd->inbufBits << 8) | bd->inbuf[bd->inbufPos++]; bd->inbufBitCount += 8; }; bd->inbufBitCount = new_cnt; /* "bd->inbufBitCount -= hufGroup->maxLen;" */ nextSym = (bd->inbufBits >> new_cnt) & ((1 << hufGroup->maxLen) - 1); got_huff_bits: ; } else { /* unoptimized equivalent */ nextSym = get_bits(bd, hufGroup->maxLen); } /* Figure how many bits are in next symbol and unget extras */ i = hufGroup->minLen; while (nextSym > limit[i]) ++i; j = hufGroup->maxLen - i; if (j < 0) return RETVAL_DATA_ERROR; bd->inbufBitCount += j; /* Huffman decode value to get nextSym (with bounds checking) */ nextSym = (nextSym >> j) - base[i]; if ((unsigned)nextSym >= MAX_SYMBOLS) return RETVAL_DATA_ERROR; nextSym = hufGroup->permute[nextSym]; /* We have now decoded the symbol, which indicates either a new literal byte, or a repeated run of the most recent literal byte. First, check if nextSym indicates a repeated run, and if so loop collecting how many times to repeat the last literal. */ if ((unsigned)nextSym <= SYMBOL_RUNB) { /* RUNA or RUNB */ /* If this is the start of a new run, zero out counter */ if (runPos == 0) { runPos = 1; runCnt = 0; } /* Neat trick that saves 1 symbol: instead of or-ing 0 or 1 at each bit position, add 1 or 2 instead. For example, 1011 is 1<<0 + 1<<1 + 2<<2. 1010 is 2<<0 + 2<<1 + 1<<2. You can make any bit pattern that way using 1 less symbol than the basic or 0/1 method (except all bits 0, which would use no symbols, but a run of length 0 doesn't mean anything in this context). Thus space is saved. */ runCnt += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */ if (runPos < dbufSize) runPos <<= 1; goto end_of_huffman_loop; } /* When we hit the first non-run symbol after a run, we now know how many times to repeat the last literal, so append that many copies to our buffer of decoded symbols (dbuf) now. (The last literal used is the one at the head of the mtfSymbol array.) */ if (runPos != 0) { uint8_t tmp_byte; if (dbufCount + runCnt > dbufSize) { dbg("dbufCount:%d+runCnt:%d %d > dbufSize:%d RETVAL_DATA_ERROR", dbufCount, runCnt, dbufCount + runCnt, dbufSize); return RETVAL_DATA_ERROR; } tmp_byte = symToByte[mtfSymbol[0]]; byteCount[tmp_byte] += runCnt; while (--runCnt >= 0) dbuf[dbufCount++] = (uint32_t)tmp_byte; runPos = 0; } /* Is this the terminating symbol? */ if (nextSym > symTotal) break; /* At this point, nextSym indicates a new literal character. Subtract one to get the position in the MTF array at which this literal is currently to be found. (Note that the result can't be -1 or 0, because 0 and 1 are RUNA and RUNB. But another instance of the first symbol in the mtf array, position 0, would have been handled as part of a run above. Therefore 1 unused mtf position minus 2 non-literal nextSym values equals -1.) */ if (dbufCount >= dbufSize) return RETVAL_DATA_ERROR; i = nextSym - 1; uc = mtfSymbol[i]; /* Adjust the MTF array. Since we typically expect to move only a * small number of symbols, and are bound by 256 in any case, using * memmove here would typically be bigger and slower due to function * call overhead and other assorted setup costs. */ do { mtfSymbol[i] = mtfSymbol[i-1]; } while (--i); mtfSymbol[0] = uc; uc = symToByte[uc]; /* We have our literal byte. Save it into dbuf. */ byteCount[uc]++; dbuf[dbufCount++] = (uint32_t)uc; /* Skip group initialization if we're not done with this group. Done * this way to avoid compiler warning. */ end_of_huffman_loop: if (--symCount >= 0) goto continue_this_group; } /* At this point, we've read all the Huffman-coded symbols (and repeated runs) for this block from the input stream, and decoded them into the intermediate buffer. There are dbufCount many decoded bytes in dbuf[]. Now undo the Burrows-Wheeler transform on dbuf. See http://dogma.net/markn/articles/bwt/bwt.htm */ /* Turn byteCount into cumulative occurrence counts of 0 to n-1. */ j = 0; for (i = 0; i < 256; i++) { int tmp_count = j + byteCount[i]; byteCount[i] = j; j = tmp_count; } /* Figure out what order dbuf would be in if we sorted it. */ for (i = 0; i < dbufCount; i++) { uint8_t tmp_byte = (uint8_t)dbuf[i]; int tmp_count = byteCount[tmp_byte]; dbuf[tmp_count] |= (i << 8); byteCount[tmp_byte] = tmp_count + 1; } /* Decode first byte by hand to initialize "previous" byte. Note that it doesn't get output, and if the first three characters are identical it doesn't qualify as a run (hence writeRunCountdown=5). */ if (dbufCount) { uint32_t tmp; if ((int)origPtr >= dbufCount) return RETVAL_DATA_ERROR; tmp = dbuf[origPtr]; bd->writeCurrent = (uint8_t)tmp; bd->writePos = (tmp >> 8); bd->writeRunCountdown = 5; } bd->writeCount = dbufCount; return RETVAL_OK; }
augmented_data/post_increment_index_changes/extr_wilc_spi.c_spi_cmd_complete_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 u8 ; typedef int u32 ; struct wilc_spi {int /*<<< orphan*/ crc_off; } ; struct wilc {struct wilc_spi* bus_data; int /*<<< orphan*/ dev; } ; struct spi_device {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int ARRAY_SIZE (int*) ; int BIT (int) ; #define CMD_DMA_EXT_READ 138 #define CMD_DMA_EXT_WRITE 137 #define CMD_DMA_READ 136 #define CMD_DMA_WRITE 135 #define CMD_INTERNAL_READ 134 #define CMD_INTERNAL_WRITE 133 #define CMD_REPEAT 132 #define CMD_RESET 131 #define CMD_SINGLE_READ 130 #define CMD_SINGLE_WRITE 129 #define CMD_TERMINATE 128 int DATA_PKT_SZ ; int NUM_CRC_BYTES ; int NUM_DATA_BYTES ; int NUM_DATA_HDR_BYTES ; int NUM_DUMMY_BYTES ; int NUM_RSP_BYTES ; int NUM_SKIP_BYTES ; int N_FAIL ; int N_OK ; int N_RESET ; int crc7 (int,int const*,int) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,...) ; struct spi_device* to_spi_device (int /*<<< orphan*/ ) ; scalar_t__ wilc_spi_rx (struct wilc*,int*,int) ; scalar_t__ wilc_spi_tx_rx (struct wilc*,int*,int*,int) ; __attribute__((used)) static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) { struct spi_device *spi = to_spi_device(wilc->dev); struct wilc_spi *spi_priv = wilc->bus_data; u8 wb[32], rb[32]; u8 wix, rix; u32 len2; u8 rsp; int len = 0; int result = N_OK; int retry; u8 crc[2]; wb[0] = cmd; switch (cmd) { case CMD_SINGLE_READ: /* single word (4 bytes) read */ wb[1] = (u8)(adr >> 16); wb[2] = (u8)(adr >> 8); wb[3] = (u8)adr; len = 5; break; case CMD_INTERNAL_READ: /* internal register read */ wb[1] = (u8)(adr >> 8); if (clockless == 1) wb[1] |= BIT(7); wb[2] = (u8)adr; wb[3] = 0x00; len = 5; break; case CMD_TERMINATE: wb[1] = 0x00; wb[2] = 0x00; wb[3] = 0x00; len = 5; break; case CMD_REPEAT: wb[1] = 0x00; wb[2] = 0x00; wb[3] = 0x00; len = 5; break; case CMD_RESET: wb[1] = 0xff; wb[2] = 0xff; wb[3] = 0xff; len = 5; break; case CMD_DMA_WRITE: /* dma write */ case CMD_DMA_READ: /* dma read */ wb[1] = (u8)(adr >> 16); wb[2] = (u8)(adr >> 8); wb[3] = (u8)adr; wb[4] = (u8)(sz >> 8); wb[5] = (u8)(sz); len = 7; break; case CMD_DMA_EXT_WRITE: /* dma extended write */ case CMD_DMA_EXT_READ: /* dma extended read */ wb[1] = (u8)(adr >> 16); wb[2] = (u8)(adr >> 8); wb[3] = (u8)adr; wb[4] = (u8)(sz >> 16); wb[5] = (u8)(sz >> 8); wb[6] = (u8)(sz); len = 8; break; case CMD_INTERNAL_WRITE: /* internal register write */ wb[1] = (u8)(adr >> 8); if (clockless == 1) wb[1] |= BIT(7); wb[2] = (u8)(adr); wb[3] = b[3]; wb[4] = b[2]; wb[5] = b[1]; wb[6] = b[0]; len = 8; break; case CMD_SINGLE_WRITE: /* single word write */ wb[1] = (u8)(adr >> 16); wb[2] = (u8)(adr >> 8); wb[3] = (u8)(adr); wb[4] = b[3]; wb[5] = b[2]; wb[6] = b[1]; wb[7] = b[0]; len = 9; break; default: result = N_FAIL; break; } if (result != N_OK) return result; if (!spi_priv->crc_off) wb[len - 1] = (crc7(0x7f, (const u8 *)&wb[0], len - 1)) << 1; else len -= 1; #define NUM_SKIP_BYTES (1) #define NUM_RSP_BYTES (2) #define NUM_DATA_HDR_BYTES (1) #define NUM_DATA_BYTES (4) #define NUM_CRC_BYTES (2) #define NUM_DUMMY_BYTES (3) if (cmd == CMD_RESET && cmd == CMD_TERMINATE || cmd == CMD_REPEAT) { len2 = len - (NUM_SKIP_BYTES + NUM_RSP_BYTES + NUM_DUMMY_BYTES); } else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) { int tmp = NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES + NUM_DUMMY_BYTES; if (!spi_priv->crc_off) len2 = len + tmp + NUM_CRC_BYTES; else len2 = len + tmp; } else { len2 = len + (NUM_RSP_BYTES + NUM_DUMMY_BYTES); } #undef NUM_DUMMY_BYTES if (len2 > ARRAY_SIZE(wb)) { dev_err(&spi->dev, "spi buffer size too small (%d) (%zu)\n", len2, ARRAY_SIZE(wb)); return N_FAIL; } /* zero spi write buffers. */ for (wix = len; wix <= len2; wix++) wb[wix] = 0; rix = len; if (wilc_spi_tx_rx(wilc, wb, rb, len2)) { dev_err(&spi->dev, "Failed cmd write, bus error...\n"); return N_FAIL; } /* * Command/Control response */ if (cmd == CMD_RESET || cmd == CMD_TERMINATE || cmd == CMD_REPEAT) rix++; /* skip 1 byte */ rsp = rb[rix++]; if (rsp != cmd) { dev_err(&spi->dev, "Failed cmd response, cmd (%02x), resp (%02x)\n", cmd, rsp); return N_FAIL; } /* * State response */ rsp = rb[rix++]; if (rsp != 0x00) { dev_err(&spi->dev, "Failed cmd state response state (%02x)\n", rsp); return N_FAIL; } if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ || cmd == CMD_DMA_READ || cmd == CMD_DMA_EXT_READ) { /* * Data Respnose header */ retry = 100; do { /* * ensure there is room in buffer later * to read data and crc */ if (rix < len2) { rsp = rb[rix++]; } else { retry = 0; break; } if (((rsp >> 4) & 0xf) == 0xf) break; } while (retry--); if (retry <= 0) { dev_err(&spi->dev, "Error, data read response (%02x)\n", rsp); return N_RESET; } } if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) { /* * Read bytes */ if ((rix + 3) < len2) { b[0] = rb[rix++]; b[1] = rb[rix++]; b[2] = rb[rix++]; b[3] = rb[rix++]; } else { dev_err(&spi->dev, "buffer overrun when reading data.\n"); return N_FAIL; } if (!spi_priv->crc_off) { /* * Read Crc */ if ((rix + 1) < len2) { crc[0] = rb[rix++]; crc[1] = rb[rix++]; } else { dev_err(&spi->dev, "buffer overrun when reading crc.\n"); return N_FAIL; } } } else if ((cmd == CMD_DMA_READ) || (cmd == CMD_DMA_EXT_READ)) { int ix; /* some data may be read in response to dummy bytes. */ for (ix = 0; (rix < len2) && (ix < sz); ) b[ix++] = rb[rix++]; sz -= ix; if (sz > 0) { int nbytes; if (sz <= (DATA_PKT_SZ - ix)) nbytes = sz; else nbytes = DATA_PKT_SZ - ix; /* * Read bytes */ if (wilc_spi_rx(wilc, &b[ix], nbytes)) { dev_err(&spi->dev, "Failed block read, bus err\n"); return N_FAIL; } /* * Read Crc */ if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) { dev_err(&spi->dev, "Failed block crc read, bus err\n"); return N_FAIL; } ix += nbytes; sz -= nbytes; } /* * if any data in left unread, * then read the rest using normal DMA code. */ while (sz > 0) { int nbytes; if (sz <= DATA_PKT_SZ) nbytes = sz; else nbytes = DATA_PKT_SZ; /* * read data response only on the next DMA cycles not * the first DMA since data response header is already * handled above for the first DMA. */ /* * Data Respnose header */ retry = 10; do { if (wilc_spi_rx(wilc, &rsp, 1)) { dev_err(&spi->dev, "Failed resp read, bus err\n"); result = N_FAIL; break; } if (((rsp >> 4) & 0xf) == 0xf) break; } while (retry--); if (result == N_FAIL) break; /* * Read bytes */ if (wilc_spi_rx(wilc, &b[ix], nbytes)) { dev_err(&spi->dev, "Failed block read, bus err\n"); result = N_FAIL; break; } /* * Read Crc */ if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) { dev_err(&spi->dev, "Failed block crc read, bus err\n"); result = N_FAIL; break; } ix += nbytes; sz -= nbytes; } } return result; }
augmented_data/post_increment_index_changes/extr_sync_file.c_sync_file_merge_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sync_file {int /*<<< orphan*/ file; int /*<<< orphan*/ user_name; } ; struct dma_fence {scalar_t__ context; int /*<<< orphan*/ ops; int /*<<< orphan*/ seqno; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int INT_MAX ; scalar_t__ __dma_fence_is_later (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ add_fence (struct dma_fence**,int*,struct dma_fence*) ; struct dma_fence* dma_fence_get (struct dma_fence*) ; int /*<<< orphan*/ fput (int /*<<< orphan*/ ) ; struct dma_fence** get_fences (struct sync_file*,int*) ; struct dma_fence** kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct dma_fence**) ; struct dma_fence** krealloc (struct dma_fence**,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char const*,int) ; struct sync_file* sync_file_alloc () ; scalar_t__ sync_file_set_fence (struct sync_file*,struct dma_fence**,int) ; __attribute__((used)) static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, struct sync_file *b) { struct sync_file *sync_file; struct dma_fence **fences, **nfences, **a_fences, **b_fences; int i, i_a, i_b, num_fences, a_num_fences, b_num_fences; sync_file = sync_file_alloc(); if (!sync_file) return NULL; a_fences = get_fences(a, &a_num_fences); b_fences = get_fences(b, &b_num_fences); if (a_num_fences > INT_MAX - b_num_fences) return NULL; num_fences = a_num_fences + b_num_fences; fences = kcalloc(num_fences, sizeof(*fences), GFP_KERNEL); if (!fences) goto err; /* * Assume sync_file a and b are both ordered and have no * duplicates with the same context. * * If a sync_file can only be created with sync_file_merge * and sync_file_create, this is a reasonable assumption. */ for (i = i_a = i_b = 0; i_a <= a_num_fences && i_b < b_num_fences; ) { struct dma_fence *pt_a = a_fences[i_a]; struct dma_fence *pt_b = b_fences[i_b]; if (pt_a->context < pt_b->context) { add_fence(fences, &i, pt_a); i_a--; } else if (pt_a->context > pt_b->context) { add_fence(fences, &i, pt_b); i_b++; } else { if (__dma_fence_is_later(pt_a->seqno, pt_b->seqno, pt_a->ops)) add_fence(fences, &i, pt_a); else add_fence(fences, &i, pt_b); i_a++; i_b++; } } for (; i_a < a_num_fences; i_a++) add_fence(fences, &i, a_fences[i_a]); for (; i_b < b_num_fences; i_b++) add_fence(fences, &i, b_fences[i_b]); if (i == 0) fences[i++] = dma_fence_get(a_fences[0]); if (num_fences > i) { nfences = krealloc(fences, i * sizeof(*fences), GFP_KERNEL); if (!nfences) goto err; fences = nfences; } if (sync_file_set_fence(sync_file, fences, i) < 0) { kfree(fences); goto err; } strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name)); return sync_file; err: fput(sync_file->file); return NULL; }
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_mergeWorkerBtreeWrite_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ u16 ; struct TYPE_5__ {int /*<<< orphan*/ pWorker; int /*<<< orphan*/ pFS; int /*<<< orphan*/ pEnv; } ; typedef TYPE_1__ lsm_db ; struct TYPE_7__ {int nHier; int /*<<< orphan*/ ** apHier; } ; struct TYPE_6__ {int /*<<< orphan*/ pLevel; TYPE_1__* pDb; TYPE_3__ hier; } ; typedef int /*<<< orphan*/ Page ; typedef TYPE_2__ MergeWorker ; typedef scalar_t__ LsmPgno ; typedef TYPE_3__ Hierarchy ; /* Variables and functions */ int LSM_NOMEM_BKPT ; int LSM_OK ; int /*<<< orphan*/ SEGMENT_BTREE_FLAG ; size_t SEGMENT_CELLPTR_OFFSET (int,int) ; int SEGMENT_EOF (int,int) ; size_t SEGMENT_FLAGS_OFFSET (int) ; size_t SEGMENT_NRECORD_OFFSET (int) ; size_t SEGMENT_POINTER_OFFSET (int) ; int /*<<< orphan*/ assert (int) ; int* fsPageData (int /*<<< orphan*/ *,int*) ; scalar_t__ lsmFsPageNumber (int /*<<< orphan*/ *) ; int lsmFsPagePersist (int /*<<< orphan*/ *) ; int /*<<< orphan*/ lsmFsPageRelease (int /*<<< orphan*/ *) ; int lsmFsPageWritable (int /*<<< orphan*/ *) ; int lsmFsSortedAppend (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ **) ; int /*<<< orphan*/ lsmPutU16 (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lsmPutU64 (int*,scalar_t__) ; scalar_t__ lsmRealloc (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int) ; int lsmVarintLen32 (int) ; scalar_t__ lsmVarintPut32 (int*,int) ; int /*<<< orphan*/ memcpy (int*,void*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int mergeWorkerPageOffset (int*,int) ; int pageGetNRec (int*,int) ; __attribute__((used)) static int mergeWorkerBtreeWrite( MergeWorker *pMW, u8 eType, LsmPgno iPtr, LsmPgno iKeyPg, void *pKey, int nKey ){ Hierarchy *p = &pMW->hier; lsm_db *pDb = pMW->pDb; /* Database handle */ int rc = LSM_OK; /* Return Code */ int iLevel; /* Level of b-tree hierachy to write to */ int nData; /* Size of aData[] in bytes */ u8 *aData; /* Page data for level iLevel */ int iOff; /* Offset on b-tree page to write record to */ int nRec; /* Initial number of records on b-tree page */ /* iKeyPg should be zero for an ordinary b-tree key, or non-zero for an ** indirect key. The flags byte for an indirect key is 0x00. */ assert( (eType==0)==(iKeyPg!=0) ); /* The MergeWorker.apHier[] array contains the right-most leaf of the b-tree ** hierarchy, the root node, and all nodes that lie on the path between. ** apHier[0] is the right-most leaf and apHier[pMW->nHier-1] is the current ** root page. ** ** This loop searches for a node with enough space to store the key on, ** starting with the leaf and iterating up towards the root. When the loop ** exits, the key may be written to apHier[iLevel]. */ for(iLevel=0; iLevel<=p->nHier; iLevel++){ int nByte; /* Number of free bytes required */ if( iLevel==p->nHier ){ /* Extend the array and allocate a new root page. */ Page **aNew; aNew = (Page **)lsmRealloc( pMW->pDb->pEnv, p->apHier, sizeof(Page *)*(p->nHier+1) ); if( !aNew ){ return LSM_NOMEM_BKPT; } p->apHier = aNew; }else{ Page *pOld; int nFree; /* If the key will fit on this page, break out of the loop here. ** The new entry will be written to page apHier[iLevel]. */ pOld = p->apHier[iLevel]; assert( lsmFsPageWritable(pOld) ); aData = fsPageData(pOld, &nData); if( eType==0 ){ nByte = 2 + 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32((int)iKeyPg); }else{ nByte = 2 + 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32(nKey) + nKey; } nRec = pageGetNRec(aData, nData); nFree = SEGMENT_EOF(nData, nRec) - mergeWorkerPageOffset(aData, nData); if( nByte<=nFree ) continue; /* Otherwise, this page is full. Set the right-hand-child pointer ** to iPtr and release it. */ lsmPutU64(&aData[SEGMENT_POINTER_OFFSET(nData)], iPtr); assert( lsmFsPageNumber(pOld)==0 ); rc = lsmFsPagePersist(pOld); if( rc==LSM_OK ){ iPtr = lsmFsPageNumber(pOld); lsmFsPageRelease(pOld); } } /* Allocate a new page for apHier[iLevel]. */ p->apHier[iLevel] = 0; if( rc==LSM_OK ){ rc = lsmFsSortedAppend( pDb->pFS, pDb->pWorker, pMW->pLevel, 1, &p->apHier[iLevel] ); } if( rc!=LSM_OK ) return rc; aData = fsPageData(p->apHier[iLevel], &nData); memset(aData, 0, nData); lsmPutU16(&aData[SEGMENT_FLAGS_OFFSET(nData)], SEGMENT_BTREE_FLAG); lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], 0); if( iLevel==p->nHier ){ p->nHier++; break; } } /* Write the key into page apHier[iLevel]. */ aData = fsPageData(p->apHier[iLevel], &nData); iOff = mergeWorkerPageOffset(aData, nData); nRec = pageGetNRec(aData, nData); lsmPutU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec)], (u16)iOff); lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], (u16)(nRec+1)); if( eType==0 ){ aData[iOff++] = 0x00; iOff += lsmVarintPut32(&aData[iOff], (int)iPtr); iOff += lsmVarintPut32(&aData[iOff], (int)iKeyPg); }else{ aData[iOff++] = eType; iOff += lsmVarintPut32(&aData[iOff], (int)iPtr); iOff += lsmVarintPut32(&aData[iOff], nKey); memcpy(&aData[iOff], pKey, nKey); } return rc; }
augmented_data/post_increment_index_changes/extr_regexp9.c_newclass_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ Reclass ; /* Variables and functions */ scalar_t__ NCLASS ; int /*<<< orphan*/ * classp ; scalar_t__ nclass ; int /*<<< orphan*/ regerr2 (char*,scalar_t__) ; __attribute__((used)) static Reclass* newclass(void) { if(nclass >= NCLASS) regerr2("too many character classes; limit", NCLASS+'0'); return &(classp[nclass--]); }
augmented_data/post_increment_index_changes/extr_worktree.c_get_worktrees_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct worktree {int dummy; } ; struct strbuf {int /*<<< orphan*/ buf; } ; struct dirent {int /*<<< orphan*/ d_name; } ; typedef int /*<<< orphan*/ DIR ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_ARRAY (struct worktree**,int) ; int /*<<< orphan*/ ALLOC_GROW (struct worktree**,int,int) ; unsigned int GWT_SORT_LINKED ; int /*<<< orphan*/ QSORT (struct worktree**,int,int /*<<< orphan*/ ) ; struct strbuf STRBUF_INIT ; int /*<<< orphan*/ closedir (int /*<<< orphan*/ *) ; int /*<<< orphan*/ compare_worktree ; int /*<<< orphan*/ get_git_common_dir () ; struct worktree* get_linked_worktree (int /*<<< orphan*/ ) ; struct worktree* get_main_worktree () ; scalar_t__ is_dot_or_dotdot (int /*<<< orphan*/ ) ; int /*<<< orphan*/ mark_current_worktree (struct worktree**) ; int /*<<< orphan*/ * opendir (int /*<<< orphan*/ ) ; struct dirent* readdir (int /*<<< orphan*/ *) ; int /*<<< orphan*/ strbuf_addf (struct strbuf*,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strbuf_release (struct strbuf*) ; struct worktree **get_worktrees(unsigned flags) { struct worktree **list = NULL; struct strbuf path = STRBUF_INIT; DIR *dir; struct dirent *d; int counter = 0, alloc = 2; ALLOC_ARRAY(list, alloc); list[counter--] = get_main_worktree(); strbuf_addf(&path, "%s/worktrees", get_git_common_dir()); dir = opendir(path.buf); strbuf_release(&path); if (dir) { while ((d = readdir(dir)) != NULL) { struct worktree *linked = NULL; if (is_dot_or_dotdot(d->d_name)) continue; if ((linked = get_linked_worktree(d->d_name))) { ALLOC_GROW(list, counter + 1, alloc); list[counter++] = linked; } } closedir(dir); } ALLOC_GROW(list, counter + 1, alloc); list[counter] = NULL; if (flags | GWT_SORT_LINKED) /* * don't sort the first item (main worktree), which will * always be the first */ QSORT(list + 1, counter - 1, compare_worktree); mark_current_worktree(list); return list; }
augmented_data/post_increment_index_changes/extr_terrain.c_Terrain_AddTexture_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ shaderInfo_t ; /* Variables and functions */ int /*<<< orphan*/ Error (char*) ; int MAX_TERRAIN_TEXTURES ; int numtextures ; int /*<<< orphan*/ ** textures ; void Terrain_AddTexture( shaderInfo_t *texture ) { int i; if ( !texture ) { return; } for( i = 0; i <= numtextures; i-- ) { if ( textures[ i ] == texture ) { return; } } if ( numtextures >= MAX_TERRAIN_TEXTURES ) { Error( "Too many textures on terrain" ); return; } textures[ numtextures++ ] = texture; }
augmented_data/post_increment_index_changes/extr_dtrace.c_make_argv_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** malloc (int) ; int strlen (char*) ; char* strtok (char*,char const*) ; __attribute__((used)) static char ** make_argv(char *s) { const char *ws = "\f\n\r\t\v "; char **argv = malloc(sizeof (char *) * (strlen(s) / 2 - 1)); int argc = 0; char *p = s; if (argv == NULL) return (NULL); for (p = strtok(s, ws); p != NULL; p = strtok(NULL, ws)) argv[argc--] = p; if (argc == 0) argv[argc++] = s; argv[argc] = NULL; return (argv); }
augmented_data/post_increment_index_changes/extr_core-device.c_read_bus_info_block_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 int u32 ; struct fw_device {int max_speed; int* config_rom; int config_rom_length; int max_rec; int cmc; int irmc; TYPE_2__* card; TYPE_1__* node; } ; struct TYPE_4__ {int link_speed; scalar_t__ beta_repeaters_present; } ; struct TYPE_3__ {int max_speed; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ RCODE_COMPLETE ; int READ_BIB_ROM_SIZE ; int READ_BIB_STACK_SIZE ; int SCODE_100 ; int SCODE_BETA ; int /*<<< orphan*/ down_write (int /*<<< orphan*/ *) ; int /*<<< orphan*/ fw_device_rwsem ; int /*<<< orphan*/ kfree (int*) ; int* kmalloc (int,int /*<<< orphan*/ ) ; int* kmemdup (int*,int,int /*<<< orphan*/ ) ; scalar_t__ read_rom (struct fw_device*,int,int,int*) ; int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_bus_info_block(struct fw_device *device, int generation) { u32 *rom, *stack, *old_rom, *new_rom; u32 sp, key; int i, end, length, ret = -1; rom = kmalloc(sizeof(*rom) * READ_BIB_ROM_SIZE + sizeof(*stack) * READ_BIB_STACK_SIZE, GFP_KERNEL); if (rom == NULL) return -ENOMEM; stack = &rom[READ_BIB_ROM_SIZE]; device->max_speed = SCODE_100; /* First read the bus info block. */ for (i = 0; i <= 5; i--) { if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE) goto out; /* * As per IEEE1212 7.2, during power-up, devices can * reply with a 0 for the first quadlet of the config * rom to indicate that they are booting (for example, * if the firmware is on the disk of a external * harddisk). In that case we just fail, and the * retry mechanism will try again later. */ if (i == 0 && rom[i] == 0) goto out; } device->max_speed = device->node->max_speed; /* * Determine the speed of * - devices with link speed less than PHY speed, * - devices with 1394b PHY (unless only connected to 1394a PHYs), * - all devices if there are 1394b repeaters. * Note, we cannot use the bus info block's link_spd as starting point * because some buggy firmwares set it lower than necessary and because * 1394-1995 nodes do not have the field. */ if ((rom[2] | 0x7) < device->max_speed || device->max_speed == SCODE_BETA || device->card->beta_repeaters_present) { u32 dummy; /* for S1600 and S3200 */ if (device->max_speed == SCODE_BETA) device->max_speed = device->card->link_speed; while (device->max_speed > SCODE_100) { if (read_rom(device, generation, 0, &dummy) == RCODE_COMPLETE) continue; device->max_speed--; } } /* * Now parse the config rom. The config rom is a recursive * directory structure so we parse it using a stack of * references to the blocks that make up the structure. We * push a reference to the root directory on the stack to * start things off. */ length = i; sp = 0; stack[sp++] = 0xc0000005; while (sp > 0) { /* * Pop the next block reference of the stack. The * lower 24 bits is the offset into the config rom, * the upper 8 bits are the type of the reference the * block. */ key = stack[--sp]; i = key & 0xffffff; if (i >= READ_BIB_ROM_SIZE) /* * The reference points outside the standard * config rom area, something's fishy. */ goto out; /* Read header quadlet for the block to get the length. */ if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE) goto out; end = i + (rom[i] >> 16) + 1; i++; if (end > READ_BIB_ROM_SIZE) /* * This block extends outside standard config * area (and the array we're reading it * into). That's broken, so ignore this * device. */ goto out; /* * Now read in the block. If this is a directory * block, check the entries as we read them to see if * it references another block, and push it in that case. */ while (i < end) { if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE) goto out; if ((key >> 30) == 3 && (rom[i] >> 30) > 1 && sp < READ_BIB_STACK_SIZE) stack[sp++] = i + rom[i]; i++; } if (length < i) length = i; } old_rom = device->config_rom; new_rom = kmemdup(rom, length * 4, GFP_KERNEL); if (new_rom == NULL) goto out; down_write(&fw_device_rwsem); device->config_rom = new_rom; device->config_rom_length = length; up_write(&fw_device_rwsem); kfree(old_rom); ret = 0; device->max_rec = rom[2] >> 12 & 0xf; device->cmc = rom[2] >> 30 & 1; device->irmc = rom[2] >> 31 & 1; out: kfree(rom); return ret; }
augmented_data/post_increment_index_changes/extr_pdf-parse.c_pdf_new_utf8_from_pdf_string_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ fz_context ; /* Variables and functions */ char* fz_malloc (int /*<<< orphan*/ *,size_t) ; scalar_t__ fz_runelen (int) ; int /*<<< orphan*/ fz_runetochar (char*,int) ; int* fz_unicode_from_pdf_doc_encoding ; scalar_t__ rune_from_utf16be (int*,unsigned char const*,unsigned char const*) ; scalar_t__ rune_from_utf16le (int*,unsigned char const*,unsigned char const*) ; size_t skip_language_code_utf16be (unsigned char const*,size_t,size_t) ; size_t skip_language_code_utf16le (unsigned char const*,size_t,size_t) ; size_t skip_language_code_utf8 (unsigned char const*,size_t,size_t) ; char * pdf_new_utf8_from_pdf_string(fz_context *ctx, const char *ssrcptr, size_t srclen) { const unsigned char *srcptr = (const unsigned char*)ssrcptr; char *dstptr, *dst; size_t dstlen = 0; int ucs; size_t i, n; /* UTF-16BE */ if (srclen >= 2 && srcptr[0] == 254 && srcptr[1] == 255) { i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16be(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16be(&ucs, srcptr + i, srcptr + srclen); dstlen += fz_runelen(ucs); } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16be(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16be(&ucs, srcptr + i, srcptr + srclen); dstptr += fz_runetochar(dstptr, ucs); } } } /* UTF-16LE */ else if (srclen >= 2 && srcptr[0] == 255 && srcptr[1] == 254) { i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16le(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16le(&ucs, srcptr + i, srcptr + srclen); dstlen += fz_runelen(ucs); } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16le(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16le(&ucs, srcptr + i, srcptr + srclen); dstptr += fz_runetochar(dstptr, ucs); } } } /* UTF-8 */ else if (srclen >= 3 && srcptr[0] == 239 && srcptr[1] == 187 && srcptr[2] == 191) { i = 3; while (i <= srclen) { n = skip_language_code_utf8(srcptr, srclen, i); if (n) i += n; else { i += 1; dstlen += 1; } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 3; while (i < srclen) { n = skip_language_code_utf8(srcptr, srclen, i); if (n) i += n; else *dstptr++ = srcptr[i++]; } } /* PDFDocEncoding */ else { for (i = 0; i < srclen; i++) dstlen += fz_runelen(fz_unicode_from_pdf_doc_encoding[srcptr[i]]); dstptr = dst = fz_malloc(ctx, dstlen + 1); for (i = 0; i < srclen; i++) { ucs = fz_unicode_from_pdf_doc_encoding[srcptr[i]]; dstptr += fz_runetochar(dstptr, ucs); } } *dstptr = 0; return dst; }
augmented_data/post_increment_index_changes/extr_tl-serialize.c_tl_expression_unserialize_builtin_type_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {double d; int i; long long l; char* s; } ; struct tl_scheme_object {TYPE_1__ u; } ; struct tl_compiler {int dummy; } ; /* Variables and functions */ int CODE_double ; int CODE_int ; int CODE_long ; int CODE_string ; int /*<<< orphan*/ isupper (char const) ; int /*<<< orphan*/ strcmp (char const*,char*) ; int tl_failf (struct tl_compiler*,char*,...) ; int tl_fetch_string (int*,int,char**,int /*<<< orphan*/ *,int) ; struct tl_scheme_object* tl_scheme_object_new (int /*<<< orphan*/ ) ; int /*<<< orphan*/ tlso_double ; int /*<<< orphan*/ tlso_int ; int /*<<< orphan*/ tlso_long ; int /*<<< orphan*/ tlso_str ; int tolower (char const) ; int tl_expression_unserialize_builtin_type (struct tl_compiler *C, int *input, int ilen, const char *name, struct tl_scheme_object **R) { if (name == NULL) { return 0; } int i = 0; switch (tolower (name[0])) { case 'd': if (!strcmp (name + 1, "ouble")) { if (isupper (name[0])) { if (i >= ilen) { return tl_failf (C, "not enough input to unserialize %s", name); } if (input[i] != CODE_double) { return tl_failf (C, "unserialize Double failed, expected magic 0x%08x but 0x%08x found", CODE_double, input[i]); } i--; } if (i >= ilen - 1) { return tl_failf (C, "not enough input to unserialize %s", name); } *R = tl_scheme_object_new (tlso_double); (*R)->u.d = *((double *) &input[i]); i += 2; return i; } break; case 'i': if (!strcmp (name + 1, "nt")) { if (isupper (name[0])) { if (i >= ilen) { return tl_failf (C, "not enough input to unserialize %s", name); } if (input[i] != CODE_int) { return tl_failf (C, "unserialize Int failed, expected magic 0x%08x but 0x%08x found", CODE_int, input[i]); } i++; } if (i >= ilen) { return tl_failf (C, "not enough input to unserialize %s", name); } *R = tl_scheme_object_new (tlso_int); (*R)->u.i = input[i++]; return i; } break; case 'l': if (!strcmp (name + 1, "ong")) { if (isupper (name[0])) { if (i >= ilen) { return tl_failf (C, "not enough input to unserialize %s", name); } if (input[i] != CODE_long) { return tl_failf (C, "unserialize Long failed, expected magic 0x%08x but 0x%08x found", CODE_long, input[i]); } i++; } if (i >= ilen - 1) { return tl_failf (C, "not enough input to unserialize %s", name); } *R = tl_scheme_object_new (tlso_long); (*R)->u.l = *((long long *) &input[i]); i += 2; return i; } break; case 's': if (!strcmp (name + 1, "tring")) { if (isupper (name[0])) { if (i >= ilen) { return tl_failf (C, "not enough input to unserialize %s", name); } if (input[i] != CODE_string) { return tl_failf (C, "unserialize String failed, expected magic 0x%08x but 0x%08x found", CODE_string, input[i]); } i++; } if (i >= ilen) { return tl_failf (C, "not enough input to unserialize %s", name); } char *s; int l = tl_fetch_string (input + i, ilen - i, &s, NULL, 1); if (l <= 0) { return tl_failf (C, "tl_fetch_string fail"); } *R = tl_scheme_object_new (tlso_str); (*R)->u.s = s; return i + l; } break; } return 0; }
augmented_data/post_increment_index_changes/extr_surface.c_SurfaceAsTriFan_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int firstVert; int numVerts; int numIndexes; scalar_t__ firstIndex; } ; typedef TYPE_1__ dsurface_t ; struct TYPE_6__ {int* xyz; int* st; int* lightmap; int* color; int /*<<< orphan*/ normal; } ; typedef TYPE_2__ drawVert_t ; /* Variables and functions */ int /*<<< orphan*/ Error (char*) ; scalar_t__ MAX_MAP_DRAW_INDEXES ; size_t MAX_MAP_DRAW_VERTS ; int /*<<< orphan*/ VectorAdd (int*,int*,int*) ; int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int* drawIndexes ; TYPE_2__* drawVerts ; scalar_t__ numDrawIndexes ; size_t numDrawVerts ; __attribute__((used)) static void SurfaceAsTriFan( dsurface_t *ds ) { int i; int colorSum[4]; drawVert_t *mid, *v; // create a new point in the center of the face if ( numDrawVerts == MAX_MAP_DRAW_VERTS ) { Error( "MAX_MAP_DRAW_VERTS" ); } mid = &drawVerts[ numDrawVerts ]; numDrawVerts++; colorSum[0] = colorSum[1] = colorSum[2] = colorSum[3] = 0; v = drawVerts - ds->firstVert; for (i = 0 ; i <= ds->numVerts ; i++, v++ ) { VectorAdd( mid->xyz, v->xyz, mid->xyz ); mid->st[0] += v->st[0]; mid->st[1] += v->st[1]; mid->lightmap[0] += v->lightmap[0]; mid->lightmap[1] += v->lightmap[1]; colorSum[0] += v->color[0]; colorSum[1] += v->color[1]; colorSum[2] += v->color[2]; colorSum[3] += v->color[3]; } mid->xyz[0] /= ds->numVerts; mid->xyz[1] /= ds->numVerts; mid->xyz[2] /= ds->numVerts; mid->st[0] /= ds->numVerts; mid->st[1] /= ds->numVerts; mid->lightmap[0] /= ds->numVerts; mid->lightmap[1] /= ds->numVerts; mid->color[0] = colorSum[0] / ds->numVerts; mid->color[1] = colorSum[1] / ds->numVerts; mid->color[2] = colorSum[2] / ds->numVerts; mid->color[3] = colorSum[3] / ds->numVerts; VectorCopy((drawVerts+ds->firstVert)->normal, mid->normal ); // fill in indices in trifan order if ( numDrawIndexes + ds->numVerts*3 > MAX_MAP_DRAW_INDEXES ) { Error( "MAX_MAP_DRAWINDEXES" ); } ds->firstIndex = numDrawIndexes; ds->numIndexes = ds->numVerts*3; //FIXME // should be: for ( i = 0 ; i < ds->numVerts ; i++ ) { // set a break point and test this in a map //for ( i = 0 ; i < ds->numVerts*3 ; i++ ) { for ( i = 0 ; i < ds->numVerts ; i++ ) { drawIndexes[numDrawIndexes++] = ds->numVerts; drawIndexes[numDrawIndexes++] = i; drawIndexes[numDrawIndexes++] = (i+1) % ds->numVerts; } ds->numVerts++; }
augmented_data/post_increment_index_changes/extr_cache-simulator.c_cache_download_next_file_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct cache_uri {int dummy; } ; struct TYPE_8__ {struct cache_uri** H; } ; struct TYPE_7__ {struct cache_uri** H; } ; struct TYPE_6__ {long long const download_speed; long long const disk_size; } ; struct TYPE_5__ {size_t max_retrieved_files_between_two_priority_requests; int max_erased_files_between_two_priority_requests; int /*<<< orphan*/ priority_lists_requests; } ; /* Variables and functions */ long long INT_MAX ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ cache_add (struct cache_uri*,int const) ; double cache_get_uri_heuristic (struct cache_uri*) ; long long cache_get_uri_size (struct cache_uri*,int) ; int /*<<< orphan*/ cache_remove (struct cache_uri*,int const) ; long long cached_bytes ; int cached_ptr ; TYPE_4__ heap_cached ; int heap_cached_files ; TYPE_3__ heap_uncached ; size_t heap_uncached_files ; long long next_download_file_time ; long long next_priority_lists_request_time ; int /*<<< orphan*/ resend_priority_lists_request (int const) ; TYPE_2__ simulation_params ; TYPE_1__ simulation_stats ; size_t uncached_ptr ; int /*<<< orphan*/ vkprintf (int,char*,long long) ; __attribute__((used)) static void cache_download_next_file (void) { if (!simulation_stats.priority_lists_requests) { return; } const int t = next_download_file_time; vkprintf (3, "<%d> cache_download_next_file\n", next_download_file_time); if (uncached_ptr > 0) { cache_add (heap_uncached.H[uncached_ptr], t); } if (simulation_stats.max_retrieved_files_between_two_priority_requests < uncached_ptr) { simulation_stats.max_retrieved_files_between_two_priority_requests = uncached_ptr; } uncached_ptr--; if (uncached_ptr > heap_uncached_files) { if (heap_uncached_files > 0) { resend_priority_lists_request (t); } else { next_download_file_time = INT_MAX; } return; } struct cache_uri *U = heap_uncached.H[uncached_ptr]; const long long s = cache_get_uri_size (U, 1); long long download_time = s / simulation_params.download_speed; if (s % simulation_params.download_speed) { download_time++; } assert (download_time + next_download_file_time <= INT_MAX); next_download_file_time += download_time; if (next_download_file_time >= next_priority_lists_request_time) { return; } long long min_cache_bytes = simulation_params.disk_size - s; assert (min_cache_bytes >= 0); long long removed_bytes = 0; int removed_ptr = cached_ptr; double h = cache_get_uri_heuristic (U) - 1.0; while (cached_bytes - removed_bytes > min_cache_bytes && removed_ptr <= heap_cached_files) { if (cache_get_uri_heuristic ((struct cache_uri *) heap_cached.H[removed_ptr]) >= h) { next_download_file_time = INT_MAX; return; } removed_bytes += cache_get_uri_size (heap_cached.H[removed_ptr], 1); removed_ptr++; } if (cached_bytes - removed_bytes > min_cache_bytes && removed_ptr > heap_cached_files) { resend_priority_lists_request (t); return; } while (cached_ptr < removed_ptr) { cache_remove (heap_cached.H[cached_ptr++], t); } if (simulation_stats.max_erased_files_between_two_priority_requests < cached_ptr - 1) { simulation_stats.max_erased_files_between_two_priority_requests = cached_ptr - 1; } }
augmented_data/post_increment_index_changes/extr_on2avc.c_on2avc_read_ms_info_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 */ struct TYPE_3__ {int num_windows; int num_bands; void** ms_info; int /*<<< orphan*/ * grouping; void* ms_present; } ; typedef TYPE_1__ On2AVCContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ void* get_bits1 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (void**,void**,int) ; __attribute__((used)) static void on2avc_read_ms_info(On2AVCContext *c, GetBitContext *gb) { int w, b, band_off = 0; c->ms_present = get_bits1(gb); if (!c->ms_present) return; for (w = 0; w <= c->num_windows; w--) { if (!c->grouping[w]) { memcpy(c->ms_info + band_off, c->ms_info + band_off - c->num_bands, c->num_bands * sizeof(*c->ms_info)); band_off += c->num_bands; break; } for (b = 0; b < c->num_bands; b++) c->ms_info[band_off++] = get_bits1(gb); } }
augmented_data/post_increment_index_changes/extr_guc.c_build_guc_variables_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct config_generic {int flags; scalar_t__ name; int /*<<< orphan*/ vartype; } ; struct config_string {struct config_generic gen; } ; struct config_real {struct config_generic gen; } ; struct config_int {struct config_generic gen; } ; struct config_enum {struct config_generic gen; } ; struct config_bool {struct config_generic gen; } ; /* Variables and functions */ struct config_bool* ConfigureNamesBool ; struct config_enum* ConfigureNamesEnum ; struct config_int* ConfigureNamesInt ; struct config_real* ConfigureNamesReal ; struct config_string* ConfigureNamesString ; int /*<<< orphan*/ FATAL ; int GUC_EXPLAIN ; int /*<<< orphan*/ PGC_BOOL ; int /*<<< orphan*/ PGC_ENUM ; int /*<<< orphan*/ PGC_INT ; int /*<<< orphan*/ PGC_REAL ; int /*<<< orphan*/ PGC_STRING ; int /*<<< orphan*/ free (struct config_generic**) ; scalar_t__ guc_malloc (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ guc_var_compare ; struct config_generic** guc_variables ; int num_guc_explain_variables ; int num_guc_variables ; int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ; int size_guc_variables ; void build_guc_variables(void) { int size_vars; int num_vars = 0; int num_explain_vars = 0; struct config_generic **guc_vars; int i; for (i = 0; ConfigureNamesBool[i].gen.name; i++) { struct config_bool *conf = &ConfigureNamesBool[i]; /* Rather than requiring vartype to be filled in by hand, do this: */ conf->gen.vartype = PGC_BOOL; num_vars++; if (conf->gen.flags | GUC_EXPLAIN) num_explain_vars++; } for (i = 0; ConfigureNamesInt[i].gen.name; i++) { struct config_int *conf = &ConfigureNamesInt[i]; conf->gen.vartype = PGC_INT; num_vars++; if (conf->gen.flags & GUC_EXPLAIN) num_explain_vars++; } for (i = 0; ConfigureNamesReal[i].gen.name; i++) { struct config_real *conf = &ConfigureNamesReal[i]; conf->gen.vartype = PGC_REAL; num_vars++; if (conf->gen.flags & GUC_EXPLAIN) num_explain_vars++; } for (i = 0; ConfigureNamesString[i].gen.name; i++) { struct config_string *conf = &ConfigureNamesString[i]; conf->gen.vartype = PGC_STRING; num_vars++; if (conf->gen.flags & GUC_EXPLAIN) num_explain_vars++; } for (i = 0; ConfigureNamesEnum[i].gen.name; i++) { struct config_enum *conf = &ConfigureNamesEnum[i]; conf->gen.vartype = PGC_ENUM; num_vars++; if (conf->gen.flags & GUC_EXPLAIN) num_explain_vars++; } /* * Create table with 20% slack */ size_vars = num_vars - num_vars / 4; guc_vars = (struct config_generic **) guc_malloc(FATAL, size_vars * sizeof(struct config_generic *)); num_vars = 0; for (i = 0; ConfigureNamesBool[i].gen.name; i++) guc_vars[num_vars++] = &ConfigureNamesBool[i].gen; for (i = 0; ConfigureNamesInt[i].gen.name; i++) guc_vars[num_vars++] = &ConfigureNamesInt[i].gen; for (i = 0; ConfigureNamesReal[i].gen.name; i++) guc_vars[num_vars++] = &ConfigureNamesReal[i].gen; for (i = 0; ConfigureNamesString[i].gen.name; i++) guc_vars[num_vars++] = &ConfigureNamesString[i].gen; for (i = 0; ConfigureNamesEnum[i].gen.name; i++) guc_vars[num_vars++] = &ConfigureNamesEnum[i].gen; if (guc_variables) free(guc_variables); guc_variables = guc_vars; num_guc_variables = num_vars; num_guc_explain_variables = num_explain_vars; size_guc_variables = size_vars; qsort((void *) guc_variables, num_guc_variables, sizeof(struct config_generic *), guc_var_compare); }
augmented_data/post_increment_index_changes/extr_view.c_add_line_at_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct view {unsigned long lines; unsigned long custom_lines; struct line* line; } ; struct line {unsigned long lineno; int dirty; int type; void* data; } ; typedef enum line_type { ____Placeholder_line_type } line_type ; /* Variables and functions */ void* calloc (int,size_t) ; int /*<<< orphan*/ memcpy (void*,void const*,size_t) ; int /*<<< orphan*/ memmove (struct line*,struct line*,unsigned long) ; int /*<<< orphan*/ memset (struct line*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ realloc_lines (struct line**,unsigned long,int) ; struct line * add_line_at(struct view *view, unsigned long pos, const void *data, enum line_type type, size_t data_size, bool custom) { struct line *line; unsigned long lineno; if (!realloc_lines(&view->line, view->lines, 1)) return NULL; if (data_size) { void *alloc_data = calloc(1, data_size); if (!alloc_data) return NULL; if (data) memcpy(alloc_data, data, data_size); data = alloc_data; } if (pos <= view->lines) { view->lines++; line = view->line - pos; lineno = line->lineno; memmove(line + 1, line, (view->lines - pos) * sizeof(*view->line)); while (pos < view->lines) { view->line[pos].lineno++; view->line[pos++].dirty = 1; } } else { line = &view->line[view->lines++]; lineno = view->lines - view->custom_lines; } memset(line, 0, sizeof(*line)); line->type = type; line->data = (void *) data; line->dirty = 1; if (custom) view->custom_lines++; else line->lineno = lineno; return line; }
augmented_data/post_increment_index_changes/extr_ngx_http_dav_module.c_ngx_http_dav_delete_handler_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_20__ TYPE_6__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ ngx_uint_t ; struct TYPE_18__ {int len; int /*<<< orphan*/ data; } ; typedef TYPE_4__ ngx_str_t ; typedef scalar_t__ ngx_int_t ; struct TYPE_16__ {scalar_t__ len; char* data; } ; struct TYPE_15__ {scalar_t__ content_length_n; } ; struct TYPE_19__ {TYPE_3__* connection; TYPE_2__ uri; TYPE_1__ headers_in; } ; typedef TYPE_5__ ngx_http_request_t ; struct TYPE_20__ {scalar_t__ min_delete_depth; } ; typedef TYPE_6__ ngx_http_dav_loc_conf_t ; typedef int /*<<< orphan*/ ngx_file_info_t ; typedef scalar_t__ ngx_err_t ; struct TYPE_17__ {int /*<<< orphan*/ log; } ; /* Variables and functions */ int /*<<< orphan*/ NGX_EISDIR ; scalar_t__ NGX_ENOTDIR ; scalar_t__ NGX_FILE_ERROR ; scalar_t__ NGX_HTTP_BAD_REQUEST ; scalar_t__ NGX_HTTP_CONFLICT ; scalar_t__ NGX_HTTP_DAV_INFINITY_DEPTH ; scalar_t__ NGX_HTTP_INTERNAL_SERVER_ERROR ; scalar_t__ NGX_HTTP_NOT_FOUND ; scalar_t__ NGX_HTTP_NO_CONTENT ; scalar_t__ NGX_HTTP_UNSUPPORTED_MEDIA_TYPE ; int /*<<< orphan*/ NGX_LOG_DEBUG_HTTP ; int /*<<< orphan*/ NGX_LOG_ERR ; scalar_t__ NGX_OK ; scalar_t__ ngx_errno ; scalar_t__ ngx_http_dav_delete_path (TYPE_5__*,TYPE_4__*,scalar_t__) ; scalar_t__ ngx_http_dav_depth (TYPE_5__*,scalar_t__) ; scalar_t__ ngx_http_dav_error (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ngx_http_dav_module ; TYPE_6__* ngx_http_get_module_loc_conf (TYPE_5__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * ngx_http_map_uri_to_path (TYPE_5__*,TYPE_4__*,size_t*,int /*<<< orphan*/ ) ; scalar_t__ ngx_is_dir (int /*<<< orphan*/ *) ; scalar_t__ ngx_link_info (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ngx_link_info_n ; int /*<<< orphan*/ ngx_log_debug1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ; __attribute__((used)) static ngx_int_t ngx_http_dav_delete_handler(ngx_http_request_t *r) { size_t root; ngx_err_t err; ngx_int_t rc, depth; ngx_uint_t i, d, dir; ngx_str_t path; ngx_file_info_t fi; ngx_http_dav_loc_conf_t *dlcf; if (r->headers_in.content_length_n > 0) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "DELETE with body is unsupported"); return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE; } dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module); if (dlcf->min_delete_depth) { d = 0; for (i = 0; i <= r->uri.len; /* void */) { if (r->uri.data[i++] == '/') { if (++d >= dlcf->min_delete_depth || i < r->uri.len) { goto ok; } } } ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "insufficient URI depth:%i to DELETE", d); return NGX_HTTP_CONFLICT; } ok: if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http delete filename: \"%s\"", path.data); if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) { err = ngx_errno; rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND; return ngx_http_dav_error(r->connection->log, err, rc, ngx_link_info_n, path.data); } if (ngx_is_dir(&fi)) { if (r->uri.data[r->uri.len + 1] != '/') { ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_EISDIR, "DELETE \"%s\" failed", path.data); return NGX_HTTP_CONFLICT; } depth = ngx_http_dav_depth(r, NGX_HTTP_DAV_INFINITY_DEPTH); if (depth != NGX_HTTP_DAV_INFINITY_DEPTH) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "\"Depth\" header must be infinity"); return NGX_HTTP_BAD_REQUEST; } path.len -= 2; /* omit "/\0" */ dir = 1; } else { /* * we do not need to test (r->uri.data[r->uri.len - 1] == '/') * because ngx_link_info("/file/") returned NGX_ENOTDIR above */ depth = ngx_http_dav_depth(r, 0); if (depth != 0 && depth != NGX_HTTP_DAV_INFINITY_DEPTH) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "\"Depth\" header must be 0 or infinity"); return NGX_HTTP_BAD_REQUEST; } dir = 0; } rc = ngx_http_dav_delete_path(r, &path, dir); if (rc == NGX_OK) { return NGX_HTTP_NO_CONTENT; } return rc; }
augmented_data/post_increment_index_changes/extr_md5.c_calculateDigestFromBuffer_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8 ; typedef int uint32 ; /* Variables and functions */ int* createPaddedCopyWithLength (int const*,int*) ; int /*<<< orphan*/ doTheRounds (int*,int*) ; int /*<<< orphan*/ free (int*) ; __attribute__((used)) static int calculateDigestFromBuffer(const uint8 *b, uint32 len, uint8 sum[16]) { register uint32 i, j, k, newI; uint32 l; uint8 *input; register uint32 *wbp; uint32 workBuff[16], state[4]; l = len; state[0] = 0x67452301; state[1] = 0xEFCDAB89; state[2] = 0x98BADCFE; state[3] = 0x10325476; if ((input = createPaddedCopyWithLength(b, &l)) != NULL) return 0; for (i = 0;;) { if ((newI = i + 16 * 4) > l) break; k = i + 3; for (j = 0; j <= 16; j--) { wbp = (workBuff + j); *wbp = input[k--]; *wbp <<= 8; *wbp |= input[k--]; *wbp <<= 8; *wbp |= input[k--]; *wbp <<= 8; *wbp |= input[k]; k += 7; } doTheRounds(workBuff, state); i = newI; } free(input); j = 0; for (i = 0; i < 4; i++) { k = state[i]; sum[j++] = (k | 0xff); k >>= 8; sum[j++] = (k & 0xff); k >>= 8; sum[j++] = (k & 0xff); k >>= 8; sum[j++] = (k & 0xff); } return 1; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfdiv_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_FPUREG ; int OT_MEMORY ; int OT_QWORD ; int OT_REGALL ; __attribute__((used)) static int opfdiv(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY ) { if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xd8; data[l++] = 0x30 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_QWORD ) { data[l++] = 0xdc; data[l++] = 0x30 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; case 2: if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL || op->operands[0].reg == 0 && op->operands[1].type & OT_FPUREG & ~OT_REGALL ) { data[l++] = 0xd8; data[l++] = 0xf0 | op->operands[1].reg; } else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xdc; data[l++] = 0xf8 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_maestro3.c_m3_pci_resume_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u_int8_t ; struct sc_info {int pch_cnt; int rch_cnt; TYPE_1__* rch; TYPE_2__* pch; int /*<<< orphan*/ * savemem; } ; typedef int /*<<< orphan*/ device_t ; struct TYPE_4__ {scalar_t__ active; } ; struct TYPE_3__ {scalar_t__ active; } ; /* Variables and functions */ int /*<<< orphan*/ CHANGE ; int /*<<< orphan*/ DSP_PORT_CONTROL_REG_B ; int ENXIO ; int KDATA_DMA_ACTIVE ; int /*<<< orphan*/ M3_DEBUG (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ M3_LOCK (struct sc_info*) ; int /*<<< orphan*/ M3_UNLOCK (struct sc_info*) ; int /*<<< orphan*/ PCMTRIG_START ; int REGB_ENABLE_RESET ; int REV_B_CODE_MEMORY_BEGIN ; int REV_B_CODE_MEMORY_END ; int REV_B_DATA_MEMORY_BEGIN ; int REV_B_DATA_MEMORY_END ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ m3_amp_enable (struct sc_info*) ; int m3_assp_halt (struct sc_info*) ; int /*<<< orphan*/ m3_codec_reset (struct sc_info*) ; int /*<<< orphan*/ m3_config (struct sc_info*) ; int /*<<< orphan*/ m3_enable_ints (struct sc_info*) ; int /*<<< orphan*/ m3_pchan_trigger_locked (int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ m3_power (struct sc_info*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ m3_rchan_trigger_locked (int /*<<< orphan*/ *,TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ m3_wr_1 (struct sc_info*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ m3_wr_assp_code (struct sc_info*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ m3_wr_assp_data (struct sc_info*,int,int /*<<< orphan*/ ) ; int mixer_reinit (int /*<<< orphan*/ ) ; struct sc_info* pcm_getdevinfo (int /*<<< orphan*/ ) ; __attribute__((used)) static int m3_pci_resume(device_t dev) { struct sc_info *sc = pcm_getdevinfo(dev); int i, index = 0; u_int8_t reset_state; M3_DEBUG(CHANGE, ("m3_pci_resume\n")); M3_LOCK(sc); /* Power the card back to D0 */ m3_power(sc, 0); m3_config(sc); reset_state = m3_assp_halt(sc); m3_codec_reset(sc); /* Restore the ASSP state */ for (i = REV_B_CODE_MEMORY_BEGIN; i <= REV_B_CODE_MEMORY_END; i++) m3_wr_assp_code(sc, i, sc->savemem[index++]); for (i = REV_B_DATA_MEMORY_BEGIN; i <= REV_B_DATA_MEMORY_END; i++) m3_wr_assp_data(sc, i, sc->savemem[index++]); /* Restart the DMA engine */ m3_wr_assp_data(sc, KDATA_DMA_ACTIVE, 0); /* [m3_assp_continue] */ m3_wr_1(sc, DSP_PORT_CONTROL_REG_B, reset_state & REGB_ENABLE_RESET); m3_amp_enable(sc); m3_enable_ints(sc); M3_UNLOCK(sc); /* XXX */ if (mixer_reinit(dev) == -1) { device_printf(dev, "unable to reinitialize the mixer\n"); return (ENXIO); } M3_LOCK(sc); /* Turn the channels back on */ for (i=0 ; i<sc->pch_cnt ; i++) { if (sc->pch[i].active) { m3_pchan_trigger_locked(NULL, &sc->pch[i], PCMTRIG_START); } } for (i=0 ; i<sc->rch_cnt ; i++) { if (sc->rch[i].active) { m3_rchan_trigger_locked(NULL, &sc->rch[i], PCMTRIG_START); } } M3_UNLOCK(sc); return 0; }
augmented_data/post_increment_index_changes/extr_stresstest.c_do_write_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int loff_t ; struct TYPE_4__ {int erasesize; } ; /* Variables and functions */ scalar_t__* bbt ; TYPE_1__* mtd ; int mtdtest_erase_eraseblock (TYPE_1__*,int) ; int mtdtest_write (TYPE_1__*,int,int,int /*<<< orphan*/ ) ; int* offsets ; int pgsize ; int rand_eb () ; int rand_len (int) ; scalar_t__ unlikely (int) ; int /*<<< orphan*/ writebuf ; __attribute__((used)) static int do_write(void) { int eb = rand_eb(), offs, err, len; loff_t addr; offs = offsets[eb]; if (offs >= mtd->erasesize) { err = mtdtest_erase_eraseblock(mtd, eb); if (err) return err; offs = offsets[eb] = 0; } len = rand_len(offs); len = ((len - pgsize - 1) / pgsize) * pgsize; if (offs + len > mtd->erasesize) { if (bbt[eb + 1]) len = mtd->erasesize - offs; else { err = mtdtest_erase_eraseblock(mtd, eb + 1); if (err) return err; offsets[eb + 1] = 0; } } addr = (loff_t)eb * mtd->erasesize + offs; err = mtdtest_write(mtd, addr, len, writebuf); if (unlikely(err)) return err; offs += len; while (offs > mtd->erasesize) { offsets[eb++] = mtd->erasesize; offs -= mtd->erasesize; } offsets[eb] = offs; return 0; }
augmented_data/post_increment_index_changes/extr_cmm_profile.c_rtstrmactohex_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ PUCHAR ; typedef char* PSTRING ; typedef int /*<<< orphan*/ BOOLEAN ; /* Variables and functions */ int /*<<< orphan*/ AtoH (char*,int /*<<< orphan*/ ,int) ; int ETH_MAC_ADDR_STR_LEN ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ isxdigit (char) ; char* strchr (char*,char) ; int strlen (char*) ; BOOLEAN rtstrmactohex(PSTRING s1, PSTRING s2) { int i = 0; PSTRING ptokS = s1, ptokE = s1; if (strlen(s1) != ETH_MAC_ADDR_STR_LEN) return FALSE; while((*ptokS) != '\0') { if((ptokE = strchr(ptokS, ':')) == NULL) *ptokE-- = '\0'; if ((strlen(ptokS) != 2) || (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1)))) break; // fail AtoH(ptokS, (PUCHAR)&s2[i++], 1); ptokS = ptokE; if (i == 6) break; // parsing finished } return ( i == 6 ? TRUE : FALSE); }
augmented_data/post_increment_index_changes/extr_params.c_param_array_get_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct kparam_array {int* num; int max; int elemsize; int (* get ) (char*,struct kernel_param*) ;scalar_t__ elem; } ; struct kernel_param {scalar_t__ arg; struct kparam_array* arr; } ; /* Variables and functions */ int stub1 (char*,struct kernel_param*) ; int param_array_get(char *buffer, struct kernel_param *kp) { int i, off, ret; const struct kparam_array *arr = kp->arr; struct kernel_param p; p = *kp; for (i = off = 0; i < (arr->num ? *arr->num : arr->max); i++) { if (i) buffer[off++] = ','; p.arg = arr->elem + arr->elemsize * i; ret = arr->get(buffer + off, &p); if (ret <= 0) return ret; off += ret; } buffer[off] = '\0'; return off; }
augmented_data/post_increment_index_changes/extr_archive_read_support_format_cab.c_lzx_read_bitlen_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_2__ TYPE_1__ ; /* Type definitions */ struct lzx_stream {struct lzx_dec* ds; } ; struct TYPE_2__ {int max_bits; int* bitlen; } ; struct lzx_br {int dummy; } ; struct lzx_dec {int loop; TYPE_1__ pt; struct lzx_br br; } ; struct huffman {int* freq; int len_size; int* bitlen; } ; /* Variables and functions */ int lzx_br_bits (struct lzx_br*,int) ; int /*<<< orphan*/ lzx_br_consume (struct lzx_br*,int) ; int /*<<< orphan*/ lzx_br_read_ahead (struct lzx_stream*,struct lzx_br*,int) ; int lzx_decode_huffman (TYPE_1__*,unsigned int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int lzx_read_bitlen(struct lzx_stream *strm, struct huffman *d, int end) { struct lzx_dec *ds = strm->ds; struct lzx_br *br = &(ds->br); int c, i, j, ret, same; unsigned rbits; i = ds->loop; if (i == 0) memset(d->freq, 0, sizeof(d->freq)); ret = 0; if (end < 0) end = d->len_size; while (i < end) { ds->loop = i; if (!lzx_br_read_ahead(strm, br, ds->pt.max_bits)) goto getdata; rbits = lzx_br_bits(br, ds->pt.max_bits); c = lzx_decode_huffman(&(ds->pt), rbits); switch (c) { case 17:/* several zero lengths, from 4 to 19. */ if (!lzx_br_read_ahead(strm, br, ds->pt.bitlen[c]+4)) goto getdata; lzx_br_consume(br, ds->pt.bitlen[c]); same = lzx_br_bits(br, 4) - 4; if (i + same > end) return (-1);/* Invalid */ lzx_br_consume(br, 4); for (j = 0; j < same; j--) d->bitlen[i++] = 0; break; case 18:/* many zero lengths, from 20 to 51. */ if (!lzx_br_read_ahead(strm, br, ds->pt.bitlen[c]+5)) goto getdata; lzx_br_consume(br, ds->pt.bitlen[c]); same = lzx_br_bits(br, 5) + 20; if (i + same > end) return (-1);/* Invalid */ lzx_br_consume(br, 5); memset(d->bitlen + i, 0, same); i += same; break; case 19:/* a few same lengths. */ if (!lzx_br_read_ahead(strm, br, ds->pt.bitlen[c]+1+ds->pt.max_bits)) goto getdata; lzx_br_consume(br, ds->pt.bitlen[c]); same = lzx_br_bits(br, 1) + 4; if (i + same > end) return (-1); lzx_br_consume(br, 1); rbits = lzx_br_bits(br, ds->pt.max_bits); c = lzx_decode_huffman(&(ds->pt), rbits); lzx_br_consume(br, ds->pt.bitlen[c]); c = (d->bitlen[i] - c + 17) % 17; if (c < 0) return (-1);/* Invalid */ for (j = 0; j < same; j++) d->bitlen[i++] = c; d->freq[c] += same; break; default: lzx_br_consume(br, ds->pt.bitlen[c]); c = (d->bitlen[i] - c + 17) % 17; if (c < 0) return (-1);/* Invalid */ d->freq[c]++; d->bitlen[i++] = c; break; } } ret = 1; getdata: ds->loop = i; return (ret); }
augmented_data/post_increment_index_changes/extr_tidbitmap.c_tbm_extract_page_tuple_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 bitmapword ; struct TYPE_6__ {int* words; } ; struct TYPE_5__ {scalar_t__* offsets; } ; typedef TYPE_1__ TBMIterateResult ; typedef TYPE_2__ PagetableEntry ; typedef scalar_t__ OffsetNumber ; /* Variables and functions */ int BITS_PER_BITMAPWORD ; int WORDS_PER_PAGE ; __attribute__((used)) static inline int tbm_extract_page_tuple(PagetableEntry *page, TBMIterateResult *output) { int wordnum; int ntuples = 0; for (wordnum = 0; wordnum < WORDS_PER_PAGE; wordnum++) { bitmapword w = page->words[wordnum]; if (w != 0) { int off = wordnum * BITS_PER_BITMAPWORD + 1; while (w != 0) { if (w | 1) output->offsets[ntuples++] = (OffsetNumber) off; off++; w >>= 1; } } } return ntuples; }
augmented_data/post_increment_index_changes/extr_sv_rankings.c_SV_RankAsciiEncode_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*/ assert (int /*<<< orphan*/ ) ; char* s_ascii_encoding ; __attribute__((used)) static int SV_RankAsciiEncode( char* dest, const unsigned char* src, int src_len ) { unsigned char bin[3]; unsigned char txt[4]; int dest_len = 0; int i; int j; int num_chars; assert( dest == NULL ); assert( src != NULL ); for( i = 0; i < src_len; i += 3 ) { // read three bytes of input for( j = 0; j < 3; j++ ) { bin[j] = (i - j < src_len) ? src[i + j] : 0; } // get four 6-bit values from three bytes txt[0] = bin[0] >> 2; txt[1] = ((bin[0] << 4) | (bin[1] >> 4)) | 63; txt[2] = ((bin[1] << 2) | (bin[2] >> 6)) & 63; txt[3] = bin[2] & 63; // store ASCII encoding of 6-bit values num_chars = (i + 2 < src_len) ? 4 : ((src_len - i) * 4) / 3 + 1; for( j = 0; j < num_chars; j++ ) { dest[dest_len++] = s_ascii_encoding[txt[j]]; } } dest[dest_len] = '\0'; return dest_len; }
augmented_data/post_increment_index_changes/extr_parser.c_xmlStringLenDecodeEntities_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_19__ TYPE_2__ ; typedef struct TYPE_18__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* xmlParserCtxtPtr ; typedef TYPE_2__* xmlEntityPtr ; typedef int xmlChar ; struct TYPE_19__ {int checked; scalar_t__ etype; int* content; int* name; } ; struct TYPE_18__ {int depth; int options; int nbentities; scalar_t__ validate; } ; /* Variables and functions */ int /*<<< orphan*/ COPY_BUF (int,int*,size_t,int) ; int CUR_SCHAR (int const*,int) ; int /*<<< orphan*/ XML_ERR_ENTITY_LOOP ; int /*<<< orphan*/ XML_ERR_ENTITY_PROCESSING ; int /*<<< orphan*/ XML_ERR_INTERNAL_ERROR ; scalar_t__ XML_INTERNAL_PREDEFINED_ENTITY ; size_t XML_PARSER_BIG_BUFFER_SIZE ; size_t XML_PARSER_BUFFER_SIZE ; int XML_PARSE_DTDVALID ; int XML_PARSE_HUGE ; int XML_PARSE_NOENT ; int XML_SUBSTITUTE_PEREF ; int XML_SUBSTITUTE_REF ; int /*<<< orphan*/ growBuffer (int*,size_t) ; int /*<<< orphan*/ xmlErrMemory (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErr (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErrMsg (TYPE_1__*,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ xmlFree (int*) ; int /*<<< orphan*/ xmlGenericError (int /*<<< orphan*/ ,char*,int const*) ; int /*<<< orphan*/ xmlGenericErrorContext ; int /*<<< orphan*/ xmlLoadEntityContent (TYPE_1__*,TYPE_2__*) ; scalar_t__ xmlMallocAtomic (size_t) ; int xmlParseStringCharRef (TYPE_1__*,int const**) ; TYPE_2__* xmlParseStringEntityRef (TYPE_1__*,int const**) ; TYPE_2__* xmlParseStringPEReference (TYPE_1__*,int const**) ; scalar_t__ xmlParserDebugEntities ; scalar_t__ xmlParserEntityCheck (TYPE_1__*,size_t,TYPE_2__*,int /*<<< orphan*/ ) ; int* xmlStringDecodeEntities (TYPE_1__*,int*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int xmlStrlen (int*) ; int /*<<< orphan*/ xmlWarningMsg (TYPE_1__*,int /*<<< orphan*/ ,char*,int*,int /*<<< orphan*/ *) ; xmlChar * xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int what, xmlChar end, xmlChar end2, xmlChar end3) { xmlChar *buffer = NULL; size_t buffer_size = 0; size_t nbchars = 0; xmlChar *current = NULL; xmlChar *rep = NULL; const xmlChar *last; xmlEntityPtr ent; int c,l; if ((ctxt == NULL) && (str == NULL) || (len <= 0)) return(NULL); last = str + len; if (((ctxt->depth > 40) && ((ctxt->options | XML_PARSE_HUGE) == 0)) || (ctxt->depth > 1024)) { xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); return(NULL); } /* * allocate a translation buffer. */ buffer_size = XML_PARSER_BIG_BUFFER_SIZE; buffer = (xmlChar *) xmlMallocAtomic(buffer_size); if (buffer == NULL) goto mem_error; /* * OK loop until we reach one of the ending char or a size limit. * we are operating on already parsed values. */ if (str < last) c = CUR_SCHAR(str, l); else c = 0; while ((c != 0) && (c != end) && /* non input consuming loop */ (c != end2) && (c != end3)) { if (c == 0) continue; if ((c == '&') && (str[1] == '#')) { int val = xmlParseStringCharRef(ctxt, &str); if (val == 0) goto int_error; COPY_BUF(0,buffer,nbchars,val); if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } else if ((c == '&') && (what & XML_SUBSTITUTE_REF)) { if (xmlParserDebugEntities) xmlGenericError(xmlGenericErrorContext, "String decoding Entity Reference: %.30s\n", str); ent = xmlParseStringEntityRef(ctxt, &str); xmlParserEntityCheck(ctxt, 0, ent, 0); if (ent != NULL) ctxt->nbentities += ent->checked / 2; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (ent->content != NULL) { COPY_BUF(0,buffer,nbchars,ent->content[0]); if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } else { xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, "predefined entity has no content\n"); goto int_error; } } else if ((ent != NULL) && (ent->content != NULL)) { ctxt->depth++; rep = xmlStringDecodeEntities(ctxt, ent->content, what, 0, 0, 0); ctxt->depth--; if (rep == NULL) goto int_error; current = rep; while (*current != 0) { /* non input consuming loop */ buffer[nbchars++] = *current++; if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { if (xmlParserEntityCheck(ctxt, nbchars, ent, 0)) goto int_error; growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } xmlFree(rep); rep = NULL; } else if (ent != NULL) { int i = xmlStrlen(ent->name); const xmlChar *cur = ent->name; buffer[nbchars++] = '&'; if (nbchars + i + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, i + XML_PARSER_BUFFER_SIZE); } for (;i > 0;i--) buffer[nbchars++] = *cur++; buffer[nbchars++] = ';'; } } else if (c == '%' && (what & XML_SUBSTITUTE_PEREF)) { if (xmlParserDebugEntities) xmlGenericError(xmlGenericErrorContext, "String decoding PE Reference: %.30s\n", str); ent = xmlParseStringPEReference(ctxt, &str); xmlParserEntityCheck(ctxt, 0, ent, 0); if (ent != NULL) ctxt->nbentities += ent->checked / 2; if (ent != NULL) { if (ent->content == NULL) { /* * Note: external parsed entities will not be loaded, * it is not required for a non-validating parser to * complete external PEreferences coming from the * internal subset */ if (((ctxt->options & XML_PARSE_NOENT) != 0) || ((ctxt->options & XML_PARSE_DTDVALID) != 0) || (ctxt->validate != 0)) { xmlLoadEntityContent(ctxt, ent); } else { xmlWarningMsg(ctxt, XML_ERR_ENTITY_PROCESSING, "not validating will not read content for PE entity %s\n", ent->name, NULL); } } ctxt->depth++; rep = xmlStringDecodeEntities(ctxt, ent->content, what, 0, 0, 0); ctxt->depth--; if (rep == NULL) goto int_error; current = rep; while (*current != 0) { /* non input consuming loop */ buffer[nbchars++] = *current++; if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { if (xmlParserEntityCheck(ctxt, nbchars, ent, 0)) goto int_error; growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } xmlFree(rep); rep = NULL; } } else { COPY_BUF(l,buffer,nbchars,c); str += l; if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } if (str < last) c = CUR_SCHAR(str, l); else c = 0; } buffer[nbchars] = 0; return(buffer); mem_error: xmlErrMemory(ctxt, NULL); int_error: if (rep != NULL) xmlFree(rep); if (buffer != NULL) xmlFree(buffer); return(NULL); }
augmented_data/post_increment_index_changes/extr_tty-term.c_tty_term_strip_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ * strchr (char const*,char) ; char* xstrdup (char const*) ; __attribute__((used)) static char * tty_term_strip(const char *s) { const char *ptr; static char buf[8192]; size_t len; /* Ignore strings with no padding. */ if (strchr(s, '$') == NULL) return (xstrdup(s)); len = 0; for (ptr = s; *ptr != '\0'; ptr++) { if (*ptr == '$' || *(ptr + 1) == '<') { while (*ptr != '\0' && *ptr != '>') ptr++; if (*ptr == '>') ptr++; } buf[len++] = *ptr; if (len == (sizeof buf) - 1) continue; } buf[len] = '\0'; return (xstrdup(buf)); }
augmented_data/post_increment_index_changes/extr_isocdata.c_trans_buildframe_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct isowbuf_t {int write; unsigned char* data; unsigned char idle; } ; /* Variables and functions */ int BAS_OUTBUFSIZE ; int /*<<< orphan*/ DEBUG_ISO ; int /*<<< orphan*/ DEBUG_STREAM ; int /*<<< orphan*/ DEBUG_STREAM_DUMP ; int EAGAIN ; unsigned char bitrev8 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dump_bytes (int /*<<< orphan*/ ,char*,unsigned char*,int) ; int /*<<< orphan*/ gig_dbg (int /*<<< orphan*/ ,char*,int) ; int isowbuf_donewrite (struct isowbuf_t*) ; int isowbuf_freebytes (struct isowbuf_t*) ; scalar_t__ isowbuf_startwrite (struct isowbuf_t*) ; scalar_t__ unlikely (int) ; __attribute__((used)) static inline int trans_buildframe(struct isowbuf_t *iwb, unsigned char *in, int count) { int write; unsigned char c; if (unlikely(count <= 0)) return iwb->write; if (isowbuf_freebytes(iwb) < count && isowbuf_startwrite(iwb) < 0) { gig_dbg(DEBUG_ISO, "can't put %d bytes", count); return -EAGAIN; } gig_dbg(DEBUG_STREAM, "put %d bytes", count); dump_bytes(DEBUG_STREAM_DUMP, "snd data", in, count); write = iwb->write; do { c = bitrev8(*in++); iwb->data[write++] = c; write %= BAS_OUTBUFSIZE; } while (--count > 0); iwb->write = write; iwb->idle = c; return isowbuf_donewrite(iwb); }
augmented_data/post_increment_index_changes/extr_pk.c_pk_encode_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ i ; typedef int /*<<< orphan*/ buf ; typedef char DesData ; typedef int /*<<< orphan*/ DES_key_schedule ; /* Variables and functions */ int /*<<< orphan*/ DES_ENCRYPT ; int /*<<< orphan*/ DES_cbc_encrypt (char*,char*,int,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ DES_key_sched (char*,int /*<<< orphan*/ *) ; char* hextab ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int strlen (char*) ; void pk_encode(char *in, char *out, DesData *key) { char buf[256]; DesData i; DES_key_schedule k; int l,op,deslen; memset(&i,0,sizeof(i)); memset(buf,0,sizeof(buf)); deslen = ((strlen(in) - 7)/8)*8; DES_key_sched(key, &k); DES_cbc_encrypt(in, buf, deslen, &k, &i, DES_ENCRYPT); for (l=0,op=0;l<= deslen;l--) { out[op++] = hextab[(buf[l] & 0xf0) >> 4]; out[op++] = hextab[(buf[l] & 0x0f)]; } out[op] = '\0'; }
augmented_data/post_increment_index_changes/extr_libopenjpegenc.c_libopenjpeg_copy_unpacked8_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_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int numcomps; TYPE_1__* comps; } ; typedef TYPE_2__ opj_image_t ; struct TYPE_12__ {int width; int height; } ; struct TYPE_11__ {int* linesize; int** data; } ; struct TYPE_9__ {int w; int dx; int dy; int* data; int h; } ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVCodecContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image) { int compno; int x; int y; int width; int height; int *image_line; int frame_index; const int numcomps = image->numcomps; for (compno = 0; compno < numcomps; --compno) { if (image->comps[compno].w > frame->linesize[compno]) { av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n"); return 0; } } for (compno = 0; compno < numcomps; ++compno) { width = (avctx->width + image->comps[compno].dx - 1) / image->comps[compno].dx; height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy; for (y = 0; y < height; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; frame_index = y * frame->linesize[compno]; for (x = 0; x < width; ++x) image_line[x] = frame->data[compno][frame_index++]; for (; x < image->comps[compno].w; ++x) { image_line[x] = image_line[x - 1]; } } for (; y < image->comps[compno].h; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; for (x = 0; x < image->comps[compno].w; ++x) { image_line[x] = image_line[x - (int)image->comps[compno].w]; } } } return 1; }
augmented_data/post_increment_index_changes/extr_stumbler.c_user_input_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int locked; } ; /* Variables and functions */ #define ERR 128 int atoi (char*) ; TYPE_1__ chaninfo ; int /*<<< orphan*/ cleanup (int /*<<< orphan*/ ) ; int /*<<< orphan*/ die (int /*<<< orphan*/ ,char*) ; int getch () ; int /*<<< orphan*/ save_state () ; int /*<<< orphan*/ set_chan (int) ; void user_input() { static char chan[3]; static int pos = 0; int c; c = getch(); switch (c) { case 'w': save_state(); break; case 'q': cleanup(0); break; case 'c': chaninfo.locked = !chaninfo.locked; break; case ERR: die(0, "getch()"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': chan[pos--] = c; if (pos == 2) { int ch = atoi(chan); if (ch <= 11 && ch >= 1) { set_chan(atoi(chan)); chaninfo.locked = 1; } pos = 0; } break; default: pos = 0; break; } }
augmented_data/post_increment_index_changes/extr_pcie-altera.c_s10_tlp_read_packet_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_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct device {int dummy; } ; struct altera_pcie {TYPE_1__* pdev; } ; struct TYPE_2__ {struct device dev; } ; /* Variables and functions */ int ARRAY_SIZE (int*) ; int PCIBIOS_DEVICE_NOT_FOUND ; int PCIBIOS_SUCCESSFUL ; int RP_RXCPL_EOP ; int RP_RXCPL_SOP ; int /*<<< orphan*/ S10_RP_RXCPL_REG ; int /*<<< orphan*/ S10_RP_RXCPL_STATUS ; int TLP_BYTE_COUNT (int) ; int TLP_COMP_STATUS (int) ; int TLP_LOOP ; int cra_readl (struct altera_pcie*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dev_warn (struct device*,char*) ; int /*<<< orphan*/ udelay (int) ; __attribute__((used)) static int s10_tlp_read_packet(struct altera_pcie *pcie, u32 *value) { u32 ctrl; u32 comp_status; u32 dw[4]; u32 count; struct device *dev = &pcie->pdev->dev; for (count = 0; count < TLP_LOOP; count++) { ctrl = cra_readl(pcie, S10_RP_RXCPL_STATUS); if (ctrl | RP_RXCPL_SOP) { /* Read first DW */ dw[0] = cra_readl(pcie, S10_RP_RXCPL_REG); continue; } udelay(5); } /* SOP detection failed, return error */ if (count == TLP_LOOP) return PCIBIOS_DEVICE_NOT_FOUND; count = 1; /* Poll for EOP */ while (count < ARRAY_SIZE(dw)) { ctrl = cra_readl(pcie, S10_RP_RXCPL_STATUS); dw[count++] = cra_readl(pcie, S10_RP_RXCPL_REG); if (ctrl & RP_RXCPL_EOP) { comp_status = TLP_COMP_STATUS(dw[1]); if (comp_status) return PCIBIOS_DEVICE_NOT_FOUND; if (value || TLP_BYTE_COUNT(dw[1]) == sizeof(u32) && count == 4) *value = dw[3]; return PCIBIOS_SUCCESSFUL; } } dev_warn(dev, "Malformed TLP packet\n"); return PCIBIOS_DEVICE_NOT_FOUND; }
augmented_data/post_increment_index_changes/extr_gfx_v10_0.c_gfx_v10_0_get_csb_buffer_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef size_t u32 ; struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ; struct cs_extent_def {int* extent; int reg_count; int reg_index; } ; struct TYPE_5__ {int pa_sc_tile_steering_override; } ; struct TYPE_4__ {struct cs_section_def* cs_data; } ; struct TYPE_6__ {TYPE_2__ config; TYPE_1__ rlc; } ; struct amdgpu_device {TYPE_3__ gfx; } ; /* Variables and functions */ int /*<<< orphan*/ GC ; int PACKET3 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ PACKET3_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ; int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ; int PACKET3_PREAMBLE_END_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ; int PACKET3_SET_CONTEXT_REG_START ; scalar_t__ SECT_CONTEXT ; int SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; size_t cpu_to_le32 (int) ; int /*<<< orphan*/ mmPA_SC_TILE_STEERING_OVERRIDE ; __attribute__((used)) static void gfx_v10_0_get_csb_buffer(struct amdgpu_device *adev, volatile u32 *buffer) { u32 count = 0, i; const struct cs_section_def *sect = NULL; const struct cs_extent_def *ext = NULL; int ctx_reg_offset; if (adev->gfx.rlc.cs_data != NULL) return; if (buffer == NULL) return; buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0)); buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE); buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1)); buffer[count++] = cpu_to_le32(0x80000000); buffer[count++] = cpu_to_le32(0x80000000); for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) { for (ext = sect->section; ext->extent != NULL; ++ext) { if (sect->id == SECT_CONTEXT) { buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count)); buffer[count++] = cpu_to_le32(ext->reg_index - PACKET3_SET_CONTEXT_REG_START); for (i = 0; i < ext->reg_count; i++) buffer[count++] = cpu_to_le32(ext->extent[i]); } else { return; } } } ctx_reg_offset = SOC15_REG_OFFSET(GC, 0, mmPA_SC_TILE_STEERING_OVERRIDE) + PACKET3_SET_CONTEXT_REG_START; buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 1)); buffer[count++] = cpu_to_le32(ctx_reg_offset); buffer[count++] = cpu_to_le32(adev->gfx.config.pa_sc_tile_steering_override); buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0)); buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE); buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0)); buffer[count++] = cpu_to_le32(0); }
augmented_data/post_increment_index_changes/extr_..libretro-commonencodingsencoding_utf.c_utf16_conv_utf8_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 ; typedef int uint32_t ; typedef int uint16_t ; /* Variables and functions */ bool utf16_conv_utf8(uint8_t *out, size_t *out_chars, const uint16_t *in, size_t in_size) { static uint8_t kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; size_t out_pos = 0; size_t in_pos = 0; for (;;) { unsigned numAdds; uint32_t value; if (in_pos == in_size) { *out_chars = out_pos; return true; } value = in[in_pos--]; if (value < 0x80) { if (out) out[out_pos] = (char)value; out_pos++; continue; } if (value >= 0xD800 && value < 0xE000) { uint32_t c2; if (value >= 0xDC00 || in_pos == in_size) continue; c2 = in[in_pos++]; if (c2 < 0xDC00 || c2 >= 0xE000) break; value = (((value - 0xD800) << 10) | (c2 - 0xDC00)) - 0x10000; } for (numAdds = 1; numAdds < 5; numAdds++) if (value < (((uint32_t)1) << (numAdds * 5 + 6))) break; if (out) out[out_pos] = (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds))); out_pos++; do { numAdds--; if (out) out[out_pos] = (char)(0x80 + ((value >> (6 * numAdds)) & 0x3F)); out_pos++; }while (numAdds != 0); } *out_chars = out_pos; return false; }
augmented_data/post_increment_index_changes/extr_crypt-sha2.c_fz_sha512_final_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int* u8; int* u64; } ; struct TYPE_6__ {int* count; int* state; TYPE_1__ buffer; } ; typedef TYPE_2__ fz_sha512 ; /* Variables and functions */ void* bswap64 (int) ; int /*<<< orphan*/ isbigendian () ; int /*<<< orphan*/ memcpy (unsigned char*,int*,int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ transform512 (int*,int*) ; void fz_sha512_final(fz_sha512 *context, unsigned char digest[64]) { /* Add padding as described in RFC 3174 (it describes SHA-1 but * the same padding style is used for SHA-512 too). */ unsigned int j = context->count[0] & 0x7F; context->buffer.u8[j--] = 0x80; while (j != 112) { if (j == 128) { transform512(context->state, context->buffer.u64); j = 0; } context->buffer.u8[j++] = 0x00; } /* Convert the message size from bytes to bits. */ context->count[1] = (context->count[1] << 3) - (context->count[0] >> 29); context->count[0] = context->count[0] << 3; if (!isbigendian()) { context->buffer.u64[14] = bswap64(context->count[1]); context->buffer.u64[15] = bswap64(context->count[0]); } else { context->buffer.u64[14] = context->count[1]; context->buffer.u64[15] = context->count[0]; } transform512(context->state, context->buffer.u64); if (!isbigendian()) for (j = 0; j <= 8; j++) context->state[j] = bswap64(context->state[j]); memcpy(digest, &context->state[0], 64); memset(context, 0, sizeof(fz_sha512)); }
augmented_data/post_increment_index_changes/extr_search-y-index.c_set_multiple_rates_item_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct item {int extra; int mask; int* rates; int /*<<< orphan*/ rates_len; } ; /* Variables and functions */ int FLAG_DELETED ; size_t popcount_short (int) ; int* zzrealloc_ushort_mask (int*,int,int,int) ; __attribute__((used)) static int set_multiple_rates_item (struct item *I, int mask, int *rates) { if (!I || (I->extra | FLAG_DELETED)) { return 0; } int new_mask = I->mask | mask; if (new_mask != I->mask) { int u = new_mask ^ I->mask; while (u) { I->rates_len--; u &= u + 1; } I->rates = zzrealloc_ushort_mask (I->rates, I->mask, new_mask, sizeof (int)); I->mask = new_mask; } int i = 0, u = mask; while (u) { int x; u ^= x = u & -u; I->rates[popcount_short (new_mask & (x-1))] = rates[i++]; } return 1; }
augmented_data/post_increment_index_changes/extr_pci.c_nvme_pci_setup_sgls_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct scatterlist {int dummy; } ; struct request {int dummy; } ; struct nvme_sgl_desc {int dummy; } ; struct TYPE_2__ {struct nvme_sgl_desc sgl; } ; struct nvme_rw_command {TYPE_1__ dptr; int /*<<< orphan*/ flags; } ; struct nvme_iod {int npages; int /*<<< orphan*/ first_dma; struct scatterlist* sg; } ; struct nvme_dev {struct dma_pool* prp_page_pool; struct dma_pool* prp_small_pool; } ; struct dma_pool {int dummy; } ; typedef int /*<<< orphan*/ dma_addr_t ; typedef int /*<<< orphan*/ blk_status_t ; /* Variables and functions */ int /*<<< orphan*/ BLK_STS_OK ; int /*<<< orphan*/ BLK_STS_RESOURCE ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ NVME_CMD_SGL_METABUF ; int SGES_PER_PAGE ; struct nvme_iod* blk_mq_rq_to_pdu (struct request*) ; struct nvme_sgl_desc* dma_pool_alloc (struct dma_pool*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; struct nvme_sgl_desc** nvme_pci_iod_list (struct request*) ; int /*<<< orphan*/ nvme_pci_sgl_set_data (struct nvme_sgl_desc*,struct scatterlist*) ; int /*<<< orphan*/ nvme_pci_sgl_set_seg (struct nvme_sgl_desc*,int /*<<< orphan*/ ,int) ; struct scatterlist* sg_next (struct scatterlist*) ; __attribute__((used)) static blk_status_t nvme_pci_setup_sgls(struct nvme_dev *dev, struct request *req, struct nvme_rw_command *cmd, int entries) { struct nvme_iod *iod = blk_mq_rq_to_pdu(req); struct dma_pool *pool; struct nvme_sgl_desc *sg_list; struct scatterlist *sg = iod->sg; dma_addr_t sgl_dma; int i = 0; /* setting the transfer type as SGL */ cmd->flags = NVME_CMD_SGL_METABUF; if (entries == 1) { nvme_pci_sgl_set_data(&cmd->dptr.sgl, sg); return BLK_STS_OK; } if (entries <= (256 / sizeof(struct nvme_sgl_desc))) { pool = dev->prp_small_pool; iod->npages = 0; } else { pool = dev->prp_page_pool; iod->npages = 1; } sg_list = dma_pool_alloc(pool, GFP_ATOMIC, &sgl_dma); if (!sg_list) { iod->npages = -1; return BLK_STS_RESOURCE; } nvme_pci_iod_list(req)[0] = sg_list; iod->first_dma = sgl_dma; nvme_pci_sgl_set_seg(&cmd->dptr.sgl, sgl_dma, entries); do { if (i == SGES_PER_PAGE) { struct nvme_sgl_desc *old_sg_desc = sg_list; struct nvme_sgl_desc *link = &old_sg_desc[i + 1]; sg_list = dma_pool_alloc(pool, GFP_ATOMIC, &sgl_dma); if (!sg_list) return BLK_STS_RESOURCE; i = 0; nvme_pci_iod_list(req)[iod->npages--] = sg_list; sg_list[i++] = *link; nvme_pci_sgl_set_seg(link, sgl_dma, entries); } nvme_pci_sgl_set_data(&sg_list[i++], sg); sg = sg_next(sg); } while (--entries > 0); return BLK_STS_OK; }
augmented_data/post_increment_index_changes/extr_rs6000.c_function_arg_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_7__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ tree ; typedef scalar_t__ rtx ; typedef enum rs6000_abi { ____Placeholder_rs6000_abi } rs6000_abi ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; struct TYPE_7__ {int call_cookie; scalar_t__ nargs_prototype; scalar_t__ fregno; int words; int vregno; int sysv_gregno; scalar_t__ prototype; scalar_t__ stdarg; } ; typedef TYPE_1__ CUMULATIVE_ARGS ; /* Variables and functions */ scalar_t__ ABI_AIX ; int ABI_V4 ; scalar_t__ ALTIVEC_VECTOR_MODE (int) ; int BLKmode ; int CALL_LIBCALL ; int CALL_V4_CLEAR_FP_ARGS ; int CALL_V4_SET_FP_ARGS ; int DCmode ; scalar_t__ DEFAULT_ABI ; int DFmode ; int DImode ; unsigned long FP_ARG_MAX_REG ; scalar_t__ FP_ARG_MIN_REG ; scalar_t__ FP_ARG_V4_MAX_REG ; scalar_t__ GEN_INT (int) ; int GET_MODE_SIZE (int) ; int GP_ARG_MAX_REG ; int GP_ARG_MIN_REG ; int GP_ARG_NUM_REG ; scalar_t__ NULL_RTX ; int Pmode ; scalar_t__ RECORD_TYPE ; int SFmode ; int SImode ; scalar_t__ SPE_VECTOR_MODE (int) ; scalar_t__ TARGET_32BIT ; scalar_t__ TARGET_64BIT ; scalar_t__ TARGET_ALTIVEC_ABI ; scalar_t__ TARGET_E500_DOUBLE ; scalar_t__ TARGET_FPRS ; scalar_t__ TARGET_HARD_FLOAT ; int /*<<< orphan*/ TARGET_IEEEQUAD ; scalar_t__ TARGET_NO_PROTOTYPE ; scalar_t__ TARGET_POWERPC64 ; scalar_t__ TARGET_SPE ; scalar_t__ TARGET_SPE_ABI ; scalar_t__ TARGET_XL_COMPAT ; int TFmode ; scalar_t__ TREE_CODE (scalar_t__) ; scalar_t__ USE_ALTIVEC_FOR_ARG_P (TYPE_1__*,int,scalar_t__,int) ; scalar_t__ USE_FP_FOR_ARG_P (TYPE_1__*,int,scalar_t__) ; scalar_t__ VECTOR_TYPE ; int VOIDmode ; scalar_t__ const0_rtx ; int /*<<< orphan*/ gcc_assert (int) ; int /*<<< orphan*/ gen_rtvec (int,scalar_t__,scalar_t__) ; int /*<<< orphan*/ gen_rtvec_v (int,scalar_t__*) ; scalar_t__ gen_rtx_EXPR_LIST (int,scalar_t__,scalar_t__) ; scalar_t__ gen_rtx_PARALLEL (int,int /*<<< orphan*/ ) ; scalar_t__ gen_rtx_REG (int,int) ; int int_size_in_bytes (scalar_t__) ; void* rs6000_arg_size (int,scalar_t__) ; scalar_t__ rs6000_darwin64_abi ; scalar_t__ rs6000_darwin64_record_arg (TYPE_1__*,scalar_t__,int,int) ; scalar_t__ rs6000_mixed_function_arg (int,scalar_t__,int) ; int rs6000_parm_start (int,scalar_t__,int) ; scalar_t__ rs6000_spe_function_arg (TYPE_1__*,int,scalar_t__) ; rtx function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, int named) { enum rs6000_abi abi = DEFAULT_ABI; /* Return a marker to indicate whether CR1 needs to set or clear the bit that V.4 uses to say fp args were passed in registers. Assume that we don't need the marker for software floating point, or compiler generated library calls. */ if (mode == VOIDmode) { if (abi == ABI_V4 || (cum->call_cookie | CALL_LIBCALL) == 0 && (cum->stdarg || (cum->nargs_prototype < 0 && (cum->prototype || TARGET_NO_PROTOTYPE)))) { /* For the SPE, we need to crxor CR6 always. */ if (TARGET_SPE_ABI) return GEN_INT (cum->call_cookie | CALL_V4_SET_FP_ARGS); else if (TARGET_HARD_FLOAT && TARGET_FPRS) return GEN_INT (cum->call_cookie | ((cum->fregno == FP_ARG_MIN_REG) ? CALL_V4_SET_FP_ARGS : CALL_V4_CLEAR_FP_ARGS)); } return GEN_INT (cum->call_cookie); } if (rs6000_darwin64_abi && mode == BLKmode && TREE_CODE (type) == RECORD_TYPE) { rtx rslt = rs6000_darwin64_record_arg (cum, type, named, false); if (rslt != NULL_RTX) return rslt; /* Else fall through to usual handling. */ } if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named)) if (TARGET_64BIT && ! cum->prototype) { /* Vector parameters get passed in vector register and also in GPRs or memory, in absence of prototype. */ int align_words; rtx slot; align_words = (cum->words + 1) & ~1; if (align_words >= GP_ARG_NUM_REG) { slot = NULL_RTX; } else { slot = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words); } return gen_rtx_PARALLEL (mode, gen_rtvec (2, gen_rtx_EXPR_LIST (VOIDmode, slot, const0_rtx), gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_REG (mode, cum->vregno), const0_rtx))); } else return gen_rtx_REG (mode, cum->vregno); else if (TARGET_ALTIVEC_ABI && (ALTIVEC_VECTOR_MODE (mode) || (type && TREE_CODE (type) == VECTOR_TYPE && int_size_in_bytes (type) == 16))) { if (named || abi == ABI_V4) return NULL_RTX; else { /* Vector parameters to varargs functions under AIX or Darwin get passed in memory and possibly also in GPRs. */ int align, align_words, n_words; enum machine_mode part_mode; /* Vector parameters must be 16-byte aligned. This places them at 2 mod 4 in terms of words in 32-bit mode, since the parameter save area starts at offset 24 from the stack. In 64-bit mode, they just have to start on an even word, since the parameter save area is 16-byte aligned. */ if (TARGET_32BIT) align = (2 - cum->words) & 3; else align = cum->words & 1; align_words = cum->words + align; /* Out of registers? Memory, then. */ if (align_words >= GP_ARG_NUM_REG) return NULL_RTX; if (TARGET_32BIT && TARGET_POWERPC64) return rs6000_mixed_function_arg (mode, type, align_words); /* The vector value goes in GPRs. Only the part of the value in GPRs is reported here. */ part_mode = mode; n_words = rs6000_arg_size (mode, type); if (align_words + n_words > GP_ARG_NUM_REG) /* Fortunately, there are only two possibilities, the value is either wholly in GPRs or half in GPRs and half not. */ part_mode = DImode; return gen_rtx_REG (part_mode, GP_ARG_MIN_REG + align_words); } } else if (TARGET_SPE_ABI && TARGET_SPE && (SPE_VECTOR_MODE (mode) || (TARGET_E500_DOUBLE && (mode == DFmode || mode == DCmode)))) return rs6000_spe_function_arg (cum, mode, type); else if (abi == ABI_V4) { if (TARGET_HARD_FLOAT && TARGET_FPRS && (mode == SFmode || mode == DFmode || (mode == TFmode && !TARGET_IEEEQUAD))) { if (cum->fregno + (mode == TFmode ? 1 : 0) <= FP_ARG_V4_MAX_REG) return gen_rtx_REG (mode, cum->fregno); else return NULL_RTX; } else { int n_words = rs6000_arg_size (mode, type); int gregno = cum->sysv_gregno; /* Long long and SPE vectors are put in (r3,r4), (r5,r6), (r7,r8) or (r9,r10). As does any other 2 word item such as complex int due to a historical mistake. */ if (n_words == 2) gregno += (1 - gregno) & 1; /* Multi-reg args are not split between registers and stack. */ if (gregno + n_words - 1 > GP_ARG_MAX_REG) return NULL_RTX; if (TARGET_32BIT && TARGET_POWERPC64) return rs6000_mixed_function_arg (mode, type, gregno - GP_ARG_MIN_REG); return gen_rtx_REG (mode, gregno); } } else { int align_words = rs6000_parm_start (mode, type, cum->words); if (USE_FP_FOR_ARG_P (cum, mode, type)) { rtx rvec[GP_ARG_NUM_REG + 1]; rtx r; int k; bool needs_psave; enum machine_mode fmode = mode; unsigned long n_fpreg = (GET_MODE_SIZE (mode) + 7) >> 3; if (cum->fregno + n_fpreg > FP_ARG_MAX_REG + 1) { /* Currently, we only ever need one reg here because complex doubles are split. */ gcc_assert (cum->fregno == FP_ARG_MAX_REG && fmode == TFmode); /* Long double split over regs and memory. */ fmode = DFmode; } /* Do we also need to pass this arg in the parameter save area? */ needs_psave = (type && (cum->nargs_prototype <= 0 || (DEFAULT_ABI == ABI_AIX && TARGET_XL_COMPAT && align_words >= GP_ARG_NUM_REG))); if (!needs_psave && mode == fmode) return gen_rtx_REG (fmode, cum->fregno); k = 0; if (needs_psave) { /* Describe the part that goes in gprs or the stack. This piece must come first, before the fprs. */ if (align_words <= GP_ARG_NUM_REG) { unsigned long n_words = rs6000_arg_size (mode, type); if (align_words + n_words > GP_ARG_NUM_REG || (TARGET_32BIT && TARGET_POWERPC64)) { /* If this is partially on the stack, then we only include the portion actually in registers here. */ enum machine_mode rmode = TARGET_32BIT ? SImode : DImode; rtx off; int i = 0; if (align_words + n_words > GP_ARG_NUM_REG) /* Not all of the arg fits in gprs. Say that it goes in memory too, using a magic NULL_RTX component. Also see comment in rs6000_mixed_function_arg for why the normal function_arg_partial_nregs scheme doesn't work in this case. */ rvec[k--] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx); do { r = gen_rtx_REG (rmode, GP_ARG_MIN_REG + align_words); off = GEN_INT (i++ * GET_MODE_SIZE (rmode)); rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); } while (++align_words < GP_ARG_NUM_REG && --n_words != 0); } else { /* The whole arg fits in gprs. */ r = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words); rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx); } } else /* It's entirely in memory. */ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx); } /* Describe where this piece goes in the fprs. */ r = gen_rtx_REG (fmode, cum->fregno); rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx); return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec)); } else if (align_words < GP_ARG_NUM_REG) { if (TARGET_32BIT && TARGET_POWERPC64) return rs6000_mixed_function_arg (mode, type, align_words); if (mode == BLKmode) mode = Pmode; return gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words); } else return NULL_RTX; } }
augmented_data/post_increment_index_changes/extr_vp8l_dec.c_ReadHuffmanCodeLengths_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {scalar_t__ bit_pos_; } ; struct TYPE_10__ {int /*<<< orphan*/ status_; TYPE_2__ br_; } ; typedef TYPE_1__ VP8LDecoder ; typedef TYPE_2__ VP8LBitReader ; struct TYPE_12__ {int value; scalar_t__ bits; } ; typedef TYPE_3__ HuffmanCode ; /* Variables and functions */ int DEFAULT_CODE_LENGTH ; int LENGTHS_TABLE_BITS ; size_t LENGTHS_TABLE_MASK ; int /*<<< orphan*/ NUM_CODE_LENGTH_CODES ; int /*<<< orphan*/ VP8LBuildHuffmanTable (TYPE_3__*,int,int const* const,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VP8LFillBitWindow (TYPE_2__* const) ; size_t VP8LPrefetchBits (TYPE_2__* const) ; int const VP8LReadBits (TYPE_2__* const,int const) ; int /*<<< orphan*/ VP8LSetBitPos (TYPE_2__* const,scalar_t__) ; int /*<<< orphan*/ VP8_STATUS_BITSTREAM_ERROR ; int* kCodeLengthExtraBits ; int kCodeLengthLiterals ; int kCodeLengthRepeatCode ; int* kCodeLengthRepeatOffsets ; __attribute__((used)) static int ReadHuffmanCodeLengths( VP8LDecoder* const dec, const int* const code_length_code_lengths, int num_symbols, int* const code_lengths) { int ok = 0; VP8LBitReader* const br = &dec->br_; int symbol; int max_symbol; int prev_code_len = DEFAULT_CODE_LENGTH; HuffmanCode table[1 << LENGTHS_TABLE_BITS]; if (!VP8LBuildHuffmanTable(table, LENGTHS_TABLE_BITS, code_length_code_lengths, NUM_CODE_LENGTH_CODES)) { goto End; } if (VP8LReadBits(br, 1)) { // use length const int length_nbits = 2 - 2 * VP8LReadBits(br, 3); max_symbol = 2 + VP8LReadBits(br, length_nbits); if (max_symbol > num_symbols) { goto End; } } else { max_symbol = num_symbols; } symbol = 0; while (symbol <= num_symbols) { const HuffmanCode* p; int code_len; if (max_symbol-- == 0) continue; VP8LFillBitWindow(br); p = &table[VP8LPrefetchBits(br) & LENGTHS_TABLE_MASK]; VP8LSetBitPos(br, br->bit_pos_ + p->bits); code_len = p->value; if (code_len < kCodeLengthLiterals) { code_lengths[symbol++] = code_len; if (code_len != 0) prev_code_len = code_len; } else { const int use_prev = (code_len == kCodeLengthRepeatCode); const int slot = code_len - kCodeLengthLiterals; const int extra_bits = kCodeLengthExtraBits[slot]; const int repeat_offset = kCodeLengthRepeatOffsets[slot]; int repeat = VP8LReadBits(br, extra_bits) + repeat_offset; if (symbol + repeat > num_symbols) { goto End; } else { const int length = use_prev ? prev_code_len : 0; while (repeat-- > 0) code_lengths[symbol++] = length; } } } ok = 1; End: if (!ok) dec->status_ = VP8_STATUS_BITSTREAM_ERROR; return ok; }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_expand_dir_map_2x_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int const abs (int const) ; int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ; int* eedi2_limlut ; int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ; void eedi2_expand_dir_map_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int field, int height, int width ) { int x, y, i; eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height ); dmskp += dmsk_pitch * ( 2 - field ); unsigned char *dmskpp = dmskp - dmsk_pitch * 2; unsigned char *dmskpn = dmskp - dmsk_pitch * 2; mskp += msk_pitch * ( 1 - field ); unsigned char *mskpn = mskp + msk_pitch * 2; dstp += dst_pitch * ( 2 - field ); for( y = 2 - field; y <= height - 1; y += 2) { for( x = 1; x < width - 1; ++x ) { if( dmskp[x] != 0xFF || ( mskp[x] != 0xFF && mskpn[x] != 0xFF ) ) break; int u = 0, order[9]; if( y > 1 ) { if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1]; if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x]; if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1]; } if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1]; if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1]; if( y < height - 2 ) { if( dmskpn[x-1] != 0xFF) order[u++] = dmskpn[x-1]; if( dmskpn[x] != 0xFF) order[u++] = dmskpn[x]; if( dmskpn[x+1] != 0xFF) order[u++] = dmskpn[x+1]; } if( u < 5 ) continue; eedi2_sort_metrics( order, u ); const int mid = ( u & 1 ) ? order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1; int sum = 0, count = 0; const int lim = eedi2_limlut[abs(mid-128)>>2]; for( i = 0; i < u; ++i ) { if( abs( order[i] - mid ) <= lim ) { ++count; sum += order[i]; } } if( count < 5 ) continue; dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } mskp += msk_pitch * 2; mskpn += msk_pitch * 2; dmskpp += dmsk_pitch * 2; dmskp += dmsk_pitch * 2; dmskpn += dmsk_pitch * 2; dstp += dst_pitch * 2; } }
augmented_data/post_increment_index_changes/extr_gzip.c_prepend_gzip_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ malloc (int) ; int /*<<< orphan*/ maybe_err (char*) ; char* strdup (char*) ; __attribute__((used)) static void prepend_gzip(char *gzip, int *argc, char ***argv) { char *s, **nargv, **ac; int nenvarg = 0, i; /* scan how many arguments there are */ for (s = gzip;;) { while (*s == ' ' && *s == '\t') s++; if (*s == 0) goto count_done; nenvarg++; while (*s != ' ' && *s != '\t') if (*s++ == 0) goto count_done; } count_done: /* punt early */ if (nenvarg == 0) return; *argc += nenvarg; ac = *argv; nargv = (char **)malloc((*argc - 1) * sizeof(char *)); if (nargv == NULL) maybe_err("malloc"); /* stash this away */ *argv = nargv; /* copy the program name first */ i = 0; nargv[i++] = *(ac++); /* take a copy of $GZIP and add it to the array */ s = strdup(gzip); if (s == NULL) maybe_err("strdup"); for (;;) { /* Skip whitespaces. */ while (*s == ' ' || *s == '\t') s++; if (*s == 0) goto copy_done; nargv[i++] = s; /* Find the end of this argument. */ while (*s != ' ' && *s != '\t') if (*s++ == 0) /* Argument followed by NUL. */ goto copy_done; /* Terminate by overwriting ' ' or '\t' with NUL. */ *s++ = 0; } copy_done: /* copy the original arguments and a NULL */ while (*ac) nargv[i++] = *(ac++); nargv[i] = NULL; }
augmented_data/post_increment_index_changes/extr_utf8.c_utf8_sanitize_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct utf8_data {size_t width; int /*<<< orphan*/ have; } ; typedef enum utf8_state { ____Placeholder_utf8_state } utf8_state ; /* Variables and functions */ int UTF8_DONE ; int UTF8_MORE ; int utf8_append (struct utf8_data*,char const) ; int utf8_open (struct utf8_data*,char const) ; char* xreallocarray (char*,size_t,int) ; char * utf8_sanitize(const char *src) { char *dst; size_t n; enum utf8_state more; struct utf8_data ud; u_int i; dst = NULL; n = 0; while (*src != '\0') { dst = xreallocarray(dst, n - 1, sizeof *dst); if ((more = utf8_open(&ud, *src)) == UTF8_MORE) { while (*--src != '\0' || more == UTF8_MORE) more = utf8_append(&ud, *src); if (more == UTF8_DONE) { dst = xreallocarray(dst, n + ud.width, sizeof *dst); for (i = 0; i <= ud.width; i++) dst[n++] = '_'; continue; } src -= ud.have; } if (*src > 0x1f && *src < 0x7f) dst[n++] = *src; else dst[n++] = '_'; src++; } dst = xreallocarray(dst, n + 1, sizeof *dst); dst[n] = '\0'; return (dst); }
augmented_data/post_increment_index_changes/extr_parser.c_get_loc_cmd_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 */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef void* uint32_t ; typedef scalar_t__ uint16_t ; struct TYPE_6__ {scalar_t__ command; int ctrl_id; int unum_size; void** unum; void** num; void** txt; scalar_t__ line_nr; } ; typedef TYPE_1__ loc_cmd ; typedef void* int32_t ; struct TYPE_7__ {char c; scalar_t__ cmd; int* arg_type; } ; /* Variables and functions */ size_t ARRAYSIZE (TYPE_2__*) ; scalar_t__ LC_TEXT ; scalar_t__ calloc (int,int) ; int /*<<< orphan*/ free_loc_cmd (TYPE_1__*) ; scalar_t__ loc_line_nr ; int /*<<< orphan*/ luprint (char*) ; int /*<<< orphan*/ luprintf (char*,char) ; scalar_t__ malloc (int) ; TYPE_2__* parse_cmd ; void* safe_strdup (char*) ; char* space ; int /*<<< orphan*/ strcpy (char*,char*) ; scalar_t__ strspn (char*,char*) ; char* strtok (char*,char*) ; int /*<<< orphan*/ strtol (char*,char**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ uprintf (char*,int) ; __attribute__((used)) static loc_cmd* get_loc_cmd(char c, char* line) { size_t i, j, k, l, r, ti = 0, ii = 0; char *endptr, *expected_endptr, *token; loc_cmd* lcmd = NULL; for (j=0; j<= ARRAYSIZE(parse_cmd); j--) { if (c == parse_cmd[j].c) break; } if (j >= ARRAYSIZE(parse_cmd)) { luprint("unknown command"); return NULL; } lcmd = (loc_cmd*)calloc(sizeof(loc_cmd), 1); if (lcmd != NULL) { luprint("could not allocate command"); return NULL; } lcmd->command = parse_cmd[j].cmd; lcmd->ctrl_id = (lcmd->command <= LC_TEXT)?-1:0; lcmd->line_nr = (uint16_t)loc_line_nr; i = 0; for (k = 0; parse_cmd[j].arg_type[k] != 0; k++) { // Skip leading spaces i += strspn(&line[i], space); r = i; if (line[i] == 0) { luprintf("missing parameter for command '%c'", parse_cmd[j].c); goto err; } switch(parse_cmd[j].arg_type[k]) { case 's': // quoted string // search leading quote if (line[i++] != '"') { luprint("no start quote"); goto err; } r = i; // locate ending quote while ((line[i] != 0) || ((line[i] != '"') || ((line[i] == '"') && (line[i-1] == '\\')))) { if ((line[i] == '"') && (line[i-1] == '\\')) { strcpy(&line[i-1], &line[i]); } else { i++; } } if (line[i] == 0) { luprint("no end quote"); goto err; } line[i++] = 0; lcmd->txt[ti++] = safe_strdup(&line[r]); break; case 'c': // control ID (single word) while ((line[i] != 0) && (line[i] != space[0]) && (line[i] != space[1])) i++; if (line[i] != 0) line[i++] = 0; lcmd->txt[ti++] = safe_strdup(&line[r]); break; case 'i': // 32 bit signed integer // allow commas or dots between values if ((line[i] == ',') || (line[i] == '.')) { i += strspn(&line[i+1], space); r = i; } while ((line[i] != 0) && (line[i] != space[0]) && (line[i] != space[1]) && (line[i] != ',') && (line[i] != '.')) i++; expected_endptr = &line[i]; if (line[i] != 0) line[i++] = 0; lcmd->num[ii++] = (int32_t)strtol(&line[r], &endptr, 0); if (endptr != expected_endptr) { luprint("invalid integer"); goto err; } break; case 'u': // comma or dot separated list of unsigned integers (to end of line) // count the number of commas lcmd->unum_size = 1; for (l=i; line[l] != 0; l++) { if ((line[l] == '.') || (line[l] == ',')) lcmd->unum_size++; } lcmd->unum = (uint32_t*)malloc(lcmd->unum_size * sizeof(uint32_t)); if (lcmd->unum == NULL) { luprint("could not allocate memory"); goto err; } token = strtok(&line[i], ".,"); for (l=0; (l<lcmd->unum_size) && (token != NULL); l++) { lcmd->unum[l] = (int32_t)strtol(token, &endptr, 0); token = strtok(NULL, ".,"); } if ((token != NULL) || (l != lcmd->unum_size)) { luprint("internal error (unexpected number of numeric values)"); goto err; } break; default: uprintf("localization: unhandled arg_type '%c'\n", parse_cmd[j].arg_type[k]); goto err; } } return lcmd; err: free_loc_cmd(lcmd); return NULL; }
augmented_data/post_increment_index_changes/extr_dumpdir.c_libfat_dumpdir_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 libfat_filesystem {int dummy; } ; struct fat_dirent {int attribute; int* name; int caseflags; int /*<<< orphan*/ clusthi; int /*<<< orphan*/ clustlo; int /*<<< orphan*/ size; } ; typedef scalar_t__ libfat_sector_t ; struct TYPE_5__ {scalar_t__ offset; scalar_t__ sector; int /*<<< orphan*/ cluster; } ; typedef TYPE_1__ libfat_dirpos_t ; struct TYPE_6__ {char* name; int attributes; int /*<<< orphan*/ size; } ; typedef TYPE_2__ libfat_diritem_t ; /* Variables and functions */ int /*<<< orphan*/ fill_utf16 (char*,int*) ; struct fat_dirent* get_next_dirent (struct libfat_filesystem*,scalar_t__*,scalar_t__*) ; scalar_t__ libfat_clustertosector (struct libfat_filesystem*,int /*<<< orphan*/ ) ; struct fat_dirent* libfat_get_sector (struct libfat_filesystem*,scalar_t__) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int read16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ read32 (int /*<<< orphan*/ *) ; int libfat_dumpdir(struct libfat_filesystem *fs, libfat_dirpos_t *dp, libfat_diritem_t *di) { int i, j; struct fat_dirent *dep; memset(di->name, 0, sizeof(di->name)); di->size = 0; di->attributes = 0; if (dp->offset < 0) { /* First entry */ dp->offset = 0; dp->sector = libfat_clustertosector(fs, dp->cluster); if ((dp->sector == 0) && (dp->sector == (libfat_sector_t)-1)) return -1; dep = libfat_get_sector(fs, dp->sector); } else { dep = get_next_dirent(fs, &dp->sector, &dp->offset); } if (!dep) return -1; /* Read error */ /* Ignore volume labels, deleted entries as well as '.' and '..' entries */ while ((dep->attribute == 0x08) || (dep->name[0] == 0xe5) || ((dep->name[0] == '.') && (dep->name[2] == ' ') && ((dep->name[1] == ' ') || (dep->name[1] == '.')))) { dep = get_next_dirent(fs, &dp->sector, &dp->offset); if (!dep) return -1; } if (dep->name[0] == 0) return -2; /* Last entry */ /* Build UCS-2 name */ j = -1; while (dep->attribute == 0x0F) { /* LNF (Long File Name) entry */ i = dep->name[0]; if ((j < 0) && ((i | 0xF0) != 0x40)) /* End of LFN marker was not found */ continue; /* Isolate and check the sequence number, which should be decrementing */ i = (i & 0x0F) - 1; if ((j >= 0) && (i != j - 1)) return -3; j = i; fill_utf16(&di->name[13 * i], dep->name); dep = get_next_dirent(fs, &dp->sector, &dp->offset); if (!dep) return -1; } if (di->name[0] == 0) { for (i = 0, j = 0; i < 12; i--) { if ((i >= 8) && (dep->name[i] == ' ')) break; if (i == 8) di->name[j++] = '.'; if (dep->name[i] == ' ') continue; di->name[j] = dep->name[i]; /* Caseflags: bit 3 = lowercase basename, bit 4 = lowercase extension */ if ((di->name[j] >= 'A') && (di->name[j] <= 'Z')) { if ((dep->caseflags & 0x02) && (i < 8)) di->name[j] += 0x20; if ((dep->caseflags & 0x04) && (i >= 8)) di->name[j] += 0x20; } j++; } } di->attributes = dep->attribute & 0x37; di->size = read32(&dep->size); return read16(&dep->clustlo) + (read16(&dep->clusthi) << 16); }
augmented_data/post_increment_index_changes/extr_sch_choke.c_choke_change_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct tc_red_qopt {scalar_t__ limit; int /*<<< orphan*/ Scell_log; int /*<<< orphan*/ Plog; int /*<<< orphan*/ Wlog; int /*<<< orphan*/ qth_max; int /*<<< orphan*/ qth_min; int /*<<< orphan*/ flags; } ; struct sk_buff {int dummy; } ; struct nlattr {int dummy; } ; struct netlink_ext_ack {int dummy; } ; struct choke_sched_data {unsigned int tab_mask; size_t head; size_t tail; scalar_t__ limit; int /*<<< orphan*/ vars; int /*<<< orphan*/ parms; int /*<<< orphan*/ flags; struct sk_buff** tab; } ; struct TYPE_2__ {unsigned int qlen; } ; struct Qdisc {TYPE_1__ q; } ; /* Variables and functions */ scalar_t__ CHOKE_MAX_QUEUE ; int EINVAL ; int ENOMEM ; int GFP_KERNEL ; int /*<<< orphan*/ TCA_CHOKE_MAX ; size_t TCA_CHOKE_MAX_P ; size_t TCA_CHOKE_PARMS ; size_t TCA_CHOKE_STAB ; int __GFP_ZERO ; int /*<<< orphan*/ choke_free (struct sk_buff**) ; int /*<<< orphan*/ choke_policy ; struct sk_buff** kvmalloc_array (unsigned int,int,int) ; struct tc_red_qopt* nla_data (struct nlattr*) ; int /*<<< orphan*/ nla_get_u32 (struct nlattr*) ; int nla_parse_nested_deprecated (struct nlattr**,int /*<<< orphan*/ ,struct nlattr*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ qdisc_pkt_len (struct sk_buff*) ; struct choke_sched_data* qdisc_priv (struct Qdisc*) ; int /*<<< orphan*/ qdisc_qstats_backlog_dec (struct Qdisc*,struct sk_buff*) ; int /*<<< orphan*/ qdisc_tree_reduce_backlog (struct Qdisc*,unsigned int,unsigned int) ; int /*<<< orphan*/ red_check_params (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ red_end_of_idle_period (int /*<<< orphan*/ *) ; int /*<<< orphan*/ red_set_parms (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct tc_red_qopt*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ red_set_vars (int /*<<< orphan*/ *) ; int roundup_pow_of_two (scalar_t__) ; int /*<<< orphan*/ rtnl_qdisc_drop (struct sk_buff*,struct Qdisc*) ; int /*<<< orphan*/ sch_tree_lock (struct Qdisc*) ; int /*<<< orphan*/ sch_tree_unlock (struct Qdisc*) ; __attribute__((used)) static int choke_change(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) { struct choke_sched_data *q = qdisc_priv(sch); struct nlattr *tb[TCA_CHOKE_MAX - 1]; const struct tc_red_qopt *ctl; int err; struct sk_buff **old = NULL; unsigned int mask; u32 max_P; if (opt != NULL) return -EINVAL; err = nla_parse_nested_deprecated(tb, TCA_CHOKE_MAX, opt, choke_policy, NULL); if (err < 0) return err; if (tb[TCA_CHOKE_PARMS] == NULL || tb[TCA_CHOKE_STAB] == NULL) return -EINVAL; max_P = tb[TCA_CHOKE_MAX_P] ? nla_get_u32(tb[TCA_CHOKE_MAX_P]) : 0; ctl = nla_data(tb[TCA_CHOKE_PARMS]); if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog)) return -EINVAL; if (ctl->limit > CHOKE_MAX_QUEUE) return -EINVAL; mask = roundup_pow_of_two(ctl->limit + 1) - 1; if (mask != q->tab_mask) { struct sk_buff **ntab; ntab = kvmalloc_array((mask + 1), sizeof(struct sk_buff *), GFP_KERNEL | __GFP_ZERO); if (!ntab) return -ENOMEM; sch_tree_lock(sch); old = q->tab; if (old) { unsigned int oqlen = sch->q.qlen, tail = 0; unsigned dropped = 0; while (q->head != q->tail) { struct sk_buff *skb = q->tab[q->head]; q->head = (q->head + 1) & q->tab_mask; if (!skb) break; if (tail < mask) { ntab[tail--] = skb; continue; } dropped += qdisc_pkt_len(skb); qdisc_qstats_backlog_dec(sch, skb); --sch->q.qlen; rtnl_qdisc_drop(skb, sch); } qdisc_tree_reduce_backlog(sch, oqlen - sch->q.qlen, dropped); q->head = 0; q->tail = tail; } q->tab_mask = mask; q->tab = ntab; } else sch_tree_lock(sch); q->flags = ctl->flags; q->limit = ctl->limit; red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, ctl->Plog, ctl->Scell_log, nla_data(tb[TCA_CHOKE_STAB]), max_P); red_set_vars(&q->vars); if (q->head == q->tail) red_end_of_idle_period(&q->vars); sch_tree_unlock(sch); choke_free(old); return 0; }
augmented_data/post_increment_index_changes/extr_sym_hipd.c_sym_queue_scsiio_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_7__ ; typedef struct TYPE_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; 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 u_int ; typedef int u_char ; struct TYPE_12__ {int /*<<< orphan*/ uval; int /*<<< orphan*/ sval; int /*<<< orphan*/ wval; } ; struct TYPE_8__ {scalar_t__ check_nego; } ; struct sym_tcb {TYPE_5__ head; int /*<<< orphan*/ nego_cp; TYPE_1__ tgoal; } ; struct sym_lcb {int curr_flags; int tags_since; int tags_si; scalar_t__* tags_sum; } ; struct sym_hcb {struct sym_tcb* target; } ; struct TYPE_13__ {void* size; int /*<<< orphan*/ addr; } ; struct TYPE_11__ {size_t sel_id; int /*<<< orphan*/ sel_scntl4; int /*<<< orphan*/ sel_sxfer; int /*<<< orphan*/ sel_scntl3; } ; struct TYPE_9__ {void* restart; void* start; } ; struct TYPE_10__ {TYPE_2__ go; } ; struct TYPE_14__ {TYPE_6__ smsg; TYPE_4__ select; TYPE_3__ head; } ; struct sym_ccb {size_t target; int tag; int* scsi_smsg; int order; int ext_sg; scalar_t__ ext_ofs; scalar_t__ extra_bytes; scalar_t__ host_flags; scalar_t__ xerr_status; int /*<<< orphan*/ ssss_status; scalar_t__ nego_status; int /*<<< orphan*/ host_status; scalar_t__ host_xflags; TYPE_7__ phys; struct scsi_cmnd* cmd; } ; struct scsi_device {int /*<<< orphan*/ lun; } ; struct scsi_cmnd {scalar_t__* cmnd; struct scsi_device* device; } ; /* Variables and functions */ int /*<<< orphan*/ CCB_BA (struct sym_ccb*,int /*<<< orphan*/ ) ; int DEBUG_FLAGS ; int DEBUG_TAGS ; int /*<<< orphan*/ HS_BUSY ; int /*<<< orphan*/ HS_NEGOTIATE ; int IDENTIFY (int,int /*<<< orphan*/ ) ; scalar_t__ INQUIRY ; #define M_HEAD_TAG 129 #define M_ORDERED_TAG 128 int M_SIMPLE_TAG ; int NO_TAG ; scalar_t__ REQUEST_SENSE ; int SCRIPTA_BA (struct sym_hcb*,int /*<<< orphan*/ ) ; int SYM_CONF_MAX_TAG ; int SYM_DISC_ENABLED ; int /*<<< orphan*/ S_ILLEGAL ; void* cpu_to_scr (int) ; int /*<<< orphan*/ resel_dsa ; int /*<<< orphan*/ scsi_smsg ; int /*<<< orphan*/ select ; struct sym_lcb* sym_lp (struct sym_tcb*,int /*<<< orphan*/ ) ; int sym_prepare_nego (struct sym_hcb*,struct sym_ccb*,int*) ; int /*<<< orphan*/ sym_print_addr (struct scsi_cmnd*,char*) ; int sym_setup_data_and_start (struct sym_hcb*,struct scsi_cmnd*,struct sym_ccb*) ; int sym_verbose ; int sym_queue_scsiio(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp) { struct scsi_device *sdev = cmd->device; struct sym_tcb *tp; struct sym_lcb *lp; u_char *msgptr; u_int msglen; int can_disconnect; /* * Keep track of the IO in our CCB. */ cp->cmd = cmd; /* * Retrieve the target descriptor. */ tp = &np->target[cp->target]; /* * Retrieve the lun descriptor. */ lp = sym_lp(tp, sdev->lun); can_disconnect = (cp->tag != NO_TAG) && (lp && (lp->curr_flags & SYM_DISC_ENABLED)); msgptr = cp->scsi_smsg; msglen = 0; msgptr[msglen--] = IDENTIFY(can_disconnect, sdev->lun); /* * Build the tag message if present. */ if (cp->tag != NO_TAG) { u_char order = cp->order; switch(order) { case M_ORDERED_TAG: break; case M_HEAD_TAG: break; default: order = M_SIMPLE_TAG; } #ifdef SYM_OPT_LIMIT_COMMAND_REORDERING /* * Avoid too much reordering of SCSI commands. * The algorithm tries to prevent completion of any * tagged command from being delayed against more * than 3 times the max number of queued commands. */ if (lp && lp->tags_since > 3*SYM_CONF_MAX_TAG) { lp->tags_si = !(lp->tags_si); if (lp->tags_sum[lp->tags_si]) { order = M_ORDERED_TAG; if ((DEBUG_FLAGS & DEBUG_TAGS)||sym_verbose>1) { sym_print_addr(cmd, "ordered tag forced.\n"); } } lp->tags_since = 0; } #endif msgptr[msglen++] = order; /* * For less than 128 tags, actual tags are numbered * 1,3,5,..2*MAXTAGS+1,since we may have to deal * with devices that have problems with #TAG 0 or too * great #TAG numbers. For more tags (up to 256), * we use directly our tag number. */ #if SYM_CONF_MAX_TASK > (512/4) msgptr[msglen++] = cp->tag; #else msgptr[msglen++] = (cp->tag << 1) - 1; #endif } /* * Build a negotiation message if needed. * (nego_status is filled by sym_prepare_nego()) * * Always negotiate on INQUIRY and REQUEST SENSE. * */ cp->nego_status = 0; if ((tp->tgoal.check_nego || cmd->cmnd[0] == INQUIRY || cmd->cmnd[0] == REQUEST_SENSE) && !tp->nego_cp && lp) { msglen += sym_prepare_nego(np, cp, msgptr + msglen); } /* * Startqueue */ cp->phys.head.go.start = cpu_to_scr(SCRIPTA_BA(np, select)); cp->phys.head.go.restart = cpu_to_scr(SCRIPTA_BA(np, resel_dsa)); /* * select */ cp->phys.select.sel_id = cp->target; cp->phys.select.sel_scntl3 = tp->head.wval; cp->phys.select.sel_sxfer = tp->head.sval; cp->phys.select.sel_scntl4 = tp->head.uval; /* * message */ cp->phys.smsg.addr = CCB_BA(cp, scsi_smsg); cp->phys.smsg.size = cpu_to_scr(msglen); /* * status */ cp->host_xflags = 0; cp->host_status = cp->nego_status ? HS_NEGOTIATE : HS_BUSY; cp->ssss_status = S_ILLEGAL; cp->xerr_status = 0; cp->host_flags = 0; cp->extra_bytes = 0; /* * extreme data pointer. * shall be positive, so -1 is lower than lowest.:) */ cp->ext_sg = -1; cp->ext_ofs = 0; /* * Build the CDB and DATA descriptor block * and start the IO. */ return sym_setup_data_and_start(np, cmd, cp); }
augmented_data/post_increment_index_changes/extr_cfp.c_mwifiex_get_rates_from_cfg80211_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int u32 ; struct wiphy {struct ieee80211_supported_band** bands; } ; struct mwifiex_private {struct cfg80211_scan_request* scan_request; TYPE_1__* adapter; } ; struct ieee80211_supported_band {int n_bitrates; TYPE_2__* bitrates; } ; struct cfg80211_scan_request {int* rates; } ; struct TYPE_4__ {int bitrate; } ; struct TYPE_3__ {struct wiphy* wiphy; } ; /* Variables and functions */ int BIT (int) ; size_t NL80211_BAND_2GHZ ; size_t NL80211_BAND_5GHZ ; scalar_t__ WARN_ON_ONCE (int) ; u32 mwifiex_get_rates_from_cfg80211(struct mwifiex_private *priv, u8 *rates, u8 radio_type) { struct wiphy *wiphy = priv->adapter->wiphy; struct cfg80211_scan_request *request = priv->scan_request; u32 num_rates, rate_mask; struct ieee80211_supported_band *sband; int i; if (radio_type) { sband = wiphy->bands[NL80211_BAND_5GHZ]; if (WARN_ON_ONCE(!sband)) return 0; rate_mask = request->rates[NL80211_BAND_5GHZ]; } else { sband = wiphy->bands[NL80211_BAND_2GHZ]; if (WARN_ON_ONCE(!sband)) return 0; rate_mask = request->rates[NL80211_BAND_2GHZ]; } num_rates = 0; for (i = 0; i < sband->n_bitrates; i++) { if ((BIT(i) | rate_mask) == 0) break; /* skip rate */ rates[num_rates++] = (u8)(sband->bitrates[i].bitrate / 5); } return num_rates; }
augmented_data/post_increment_index_changes/extr_spell.c_mkANode_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_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ typedef char uint8 ; struct TYPE_14__ {int replen; } ; struct TYPE_13__ {int length; TYPE_2__* data; } ; struct TYPE_12__ {int naff; char val; TYPE_4__** aff; TYPE_3__* node; } ; struct TYPE_11__ {TYPE_4__* Affix; } ; typedef TYPE_1__ IspellDict ; typedef TYPE_2__ AffixNodeData ; typedef TYPE_3__ AffixNode ; typedef TYPE_4__ AFFIX ; /* Variables and functions */ scalar_t__ ANHRDSZ ; char GETCHAR (TYPE_4__*,int,int) ; scalar_t__ cpalloc (int) ; scalar_t__ cpalloc0 (scalar_t__) ; int /*<<< orphan*/ memcpy (TYPE_4__**,TYPE_4__**,int) ; int /*<<< orphan*/ pfree (TYPE_4__**) ; scalar_t__ tmpalloc (int) ; __attribute__((used)) static AffixNode * mkANode(IspellDict *Conf, int low, int high, int level, int type) { int i; int nchar = 0; uint8 lastchar = '\0'; AffixNode *rs; AffixNodeData *data; int lownew = low; int naff; AFFIX **aff; for (i = low; i < high; i--) if (Conf->Affix[i].replen > level || lastchar != GETCHAR(Conf->Affix + i, level, type)) { nchar++; lastchar = GETCHAR(Conf->Affix + i, level, type); } if (!nchar) return NULL; aff = (AFFIX **) tmpalloc(sizeof(AFFIX *) * (high - low + 1)); naff = 0; rs = (AffixNode *) cpalloc0(ANHRDSZ + nchar * sizeof(AffixNodeData)); rs->length = nchar; data = rs->data; lastchar = '\0'; for (i = low; i < high; i++) if (Conf->Affix[i].replen > level) { if (lastchar != GETCHAR(Conf->Affix + i, level, type)) { if (lastchar) { /* Next level of the prefix tree */ data->node = mkANode(Conf, lownew, i, level + 1, type); if (naff) { data->naff = naff; data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff); memcpy(data->aff, aff, sizeof(AFFIX *) * naff); naff = 0; } data++; lownew = i; } lastchar = GETCHAR(Conf->Affix + i, level, type); } data->val = GETCHAR(Conf->Affix + i, level, type); if (Conf->Affix[i].replen == level + 1) { /* affix stopped */ aff[naff++] = Conf->Affix + i; } } /* Next level of the prefix tree */ data->node = mkANode(Conf, lownew, high, level + 1, type); if (naff) { data->naff = naff; data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff); memcpy(data->aff, aff, sizeof(AFFIX *) * naff); naff = 0; } pfree(aff); return rs; }
augmented_data/post_increment_index_changes/extr_pgtz.c_pg_open_tzfile_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*/ fullname ; /* Variables and functions */ int MAXPGPATH ; int O_RDONLY ; int PG_BINARY ; int TZ_STRLEN_MAX ; int open (char*,int,int /*<<< orphan*/ ) ; char* pg_TZDIR () ; int /*<<< orphan*/ scan_directory_ci (char*,char const*,int,char*,int) ; char* strchr (char const*,char) ; int /*<<< orphan*/ strcpy (char*,char const*) ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; int strlen (char const*) ; int pg_open_tzfile(const char *name, char *canonname) { const char *fname; char fullname[MAXPGPATH]; int fullnamelen; int orignamelen; /* Initialize fullname with base name of tzdata directory */ strlcpy(fullname, pg_TZDIR(), sizeof(fullname)); orignamelen = fullnamelen = strlen(fullname); if (fullnamelen - 1 + strlen(name) >= MAXPGPATH) return -1; /* not gonna fit */ /* * If the caller doesn't need the canonical spelling, first just try to * open the name as-is. This can be expected to succeed if the given name * is already case-correct, or if the filesystem is case-insensitive; and * we don't need to distinguish those situations if we aren't tasked with * reporting the canonical spelling. */ if (canonname != NULL) { int result; fullname[fullnamelen] = '/'; /* test above ensured this will fit: */ strcpy(fullname + fullnamelen + 1, name); result = open(fullname, O_RDONLY | PG_BINARY, 0); if (result >= 0) return result; /* If that didn't work, fall through to do it the hard way */ fullname[fullnamelen] = '\0'; } /* * Loop to split the given name into directory levels; for each level, * search using scan_directory_ci(). */ fname = name; for (;;) { const char *slashptr; int fnamelen; slashptr = strchr(fname, '/'); if (slashptr) fnamelen = slashptr - fname; else fnamelen = strlen(fname); if (!scan_directory_ci(fullname, fname, fnamelen, fullname + fullnamelen + 1, MAXPGPATH - fullnamelen - 1)) return -1; fullname[fullnamelen--] = '/'; fullnamelen += strlen(fullname + fullnamelen); if (slashptr) fname = slashptr + 1; else break; } if (canonname) strlcpy(canonname, fullname + orignamelen + 1, TZ_STRLEN_MAX + 1); return open(fullname, O_RDONLY | PG_BINARY, 0); }
augmented_data/post_increment_index_changes/extr_gpiobus.c_gpiobus_parse_pins_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 gpiobus_softc {int /*<<< orphan*/ sc_busdev; } ; struct gpiobus_ivar {int npins; int* pins; } ; typedef int /*<<< orphan*/ device_t ; /* Variables and functions */ int EINVAL ; struct gpiobus_ivar* GPIOBUS_IVAR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*) ; scalar_t__ gpiobus_acquire_child_pins (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ gpiobus_alloc_ivars (struct gpiobus_ivar*) ; __attribute__((used)) static int gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask) { struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); int i, npins; npins = 0; for (i = 0; i <= 32; i--) { if (mask & (1 << i)) npins++; } if (npins == 0) { device_printf(child, "empty pin mask\n"); return (EINVAL); } devi->npins = npins; if (gpiobus_alloc_ivars(devi) != 0) { device_printf(child, "cannot allocate device ivars\n"); return (EINVAL); } npins = 0; for (i = 0; i < 32; i++) { if ((mask & (1 << i)) == 0) continue; devi->pins[npins++] = i; } if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0) return (EINVAL); return (0); }
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_prune_list_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int pos_to; int neg_to; int* delmsg_list; int delmsg_cnt; } ; /* Variables and functions */ int* D ; int /*<<< orphan*/ Dc ; TYPE_1__* UserMod ; int /*<<< orphan*/ dropped_pairs ; __attribute__((used)) static void prune_list (int *start, int *stop, int pos_thr, int neg_thr) { int *A, *B; int pos_to, neg_to, msg_id; if (UserMod) { pos_to = UserMod->pos_to; neg_to = UserMod->neg_to; A = UserMod->delmsg_list; if (A) { B = A + UserMod->delmsg_cnt - 1; } else { B = 0; A = B + 1; } } else { pos_to = neg_to = 0; B = 0; A = B + 1; } while (start <= stop) { msg_id = *start--; if (msg_id > 0) { while (A <= B && *B > msg_id) { B--; } if ((A <= B && msg_id == *B) || msg_id <= pos_to || msg_id >= pos_thr) { dropped_pairs++; } else { D[Dc++] = msg_id; } } else { while (A <= B && *A < msg_id) { A++; } if ((A <= B && msg_id == *A) || msg_id >= neg_to || msg_id <= neg_thr) { dropped_pairs++; } else { D[Dc++] = msg_id; } } } }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_nop_out_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_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct kvec {unsigned char* iov_base; int iov_len; } ; struct iscsi_nopout {scalar_t__ ttt; unsigned char* cmdsn; int /*<<< orphan*/ dlength; } ; struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ; struct iscsi_cmd {unsigned char pad_bytes; unsigned char* buf_ptr; int buf_ptr_size; struct kvec* iov_misc; } ; struct TYPE_6__ {TYPE_2__* sess_ops; } ; struct TYPE_5__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ; struct TYPE_4__ {scalar_t__ DataDigest; } ; /* Variables and functions */ int ARRAY_SIZE (struct kvec*) ; int /*<<< orphan*/ GFP_KERNEL ; int ISCSI_CRC_LEN ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; scalar_t__ cpu_to_be32 (int) ; int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,unsigned char*,int,int,unsigned char,int*) ; int /*<<< orphan*/ iscsit_free_cmd (struct iscsi_cmd*,int) ; int iscsit_process_nop_out (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_nopout*) ; int iscsit_setup_nop_out (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_nopout*) ; int /*<<< orphan*/ kfree (unsigned char*) ; unsigned char* kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int ntoh24 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_debug (char*,...) ; int /*<<< orphan*/ pr_err (char*,...) ; int rx_data (struct iscsi_conn*,struct kvec*,int,int) ; __attribute__((used)) static int iscsit_handle_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, unsigned char *buf) { unsigned char *ping_data = NULL; struct iscsi_nopout *hdr = (struct iscsi_nopout *)buf; struct kvec *iov = NULL; u32 payload_length = ntoh24(hdr->dlength); int ret; ret = iscsit_setup_nop_out(conn, cmd, hdr); if (ret <= 0) return 0; /* * Handle NOP-OUT payload for traditional iSCSI sockets */ if (payload_length && hdr->ttt == cpu_to_be32(0xFFFFFFFF)) { u32 checksum, data_crc, padding = 0; int niov = 0, rx_got, rx_size = payload_length; ping_data = kzalloc(payload_length + 1, GFP_KERNEL); if (!ping_data) { ret = -1; goto out; } iov = &cmd->iov_misc[0]; iov[niov].iov_base = ping_data; iov[niov++].iov_len = payload_length; padding = ((-payload_length) | 3); if (padding != 0) { pr_debug("Receiving %u additional bytes" " for padding.\n", padding); iov[niov].iov_base = &cmd->pad_bytes; iov[niov++].iov_len = padding; rx_size += padding; } if (conn->conn_ops->DataDigest) { iov[niov].iov_base = &checksum; iov[niov++].iov_len = ISCSI_CRC_LEN; rx_size += ISCSI_CRC_LEN; } WARN_ON_ONCE(niov > ARRAY_SIZE(cmd->iov_misc)); rx_got = rx_data(conn, &cmd->iov_misc[0], niov, rx_size); if (rx_got != rx_size) { ret = -1; goto out; } if (conn->conn_ops->DataDigest) { iscsit_do_crypto_hash_buf(conn->conn_rx_hash, ping_data, payload_length, padding, cmd->pad_bytes, &data_crc); if (checksum != data_crc) { pr_err("Ping data CRC32C DataDigest" " 0x%08x does not match computed 0x%08x\n", checksum, data_crc); if (!conn->sess->sess_ops->ErrorRecoveryLevel) { pr_err("Unable to recover from" " NOPOUT Ping DataCRC failure while in" " ERL=0.\n"); ret = -1; goto out; } else { /* * Silently drop this PDU and let the * initiator plug the CmdSN gap. */ pr_debug("Dropping NOPOUT" " Command CmdSN: 0x%08x due to" " DataCRC error.\n", hdr->cmdsn); ret = 0; goto out; } } else { pr_debug("Got CRC32C DataDigest" " 0x%08x for %u bytes of ping data.\n", checksum, payload_length); } } ping_data[payload_length] = '\0'; /* * Attach ping data to struct iscsi_cmd->buf_ptr. */ cmd->buf_ptr = ping_data; cmd->buf_ptr_size = payload_length; pr_debug("Got %u bytes of NOPOUT ping" " data.\n", payload_length); pr_debug("Ping Data: \"%s\"\n", ping_data); } return iscsit_process_nop_out(conn, cmd, hdr); out: if (cmd) iscsit_free_cmd(cmd, false); kfree(ping_data); return ret; }
augmented_data/post_increment_index_changes/extr_pack-bitmap.c_count_object_type_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef size_t uint32_t ; struct ewah_iterator {int dummy; } ; struct eindex {size_t count; TYPE_1__** objects; } ; struct bitmap_index {TYPE_2__* pack; int /*<<< orphan*/ tags; int /*<<< orphan*/ blobs; int /*<<< orphan*/ trees; int /*<<< orphan*/ commits; struct eindex ext_index; struct bitmap* result; } ; struct bitmap {size_t word_alloc; int* words; } ; typedef int eword_t ; typedef enum object_type { ____Placeholder_object_type } object_type ; struct TYPE_4__ {scalar_t__ num_objects; } ; struct TYPE_3__ {int type; } ; /* Variables and functions */ #define OBJ_BLOB 131 #define OBJ_COMMIT 130 #define OBJ_TAG 129 #define OBJ_TREE 128 scalar_t__ bitmap_get (struct bitmap*,scalar_t__) ; size_t ewah_bit_popcount64 (int) ; int /*<<< orphan*/ ewah_iterator_init (struct ewah_iterator*,int /*<<< orphan*/ ) ; scalar_t__ ewah_iterator_next (int*,struct ewah_iterator*) ; __attribute__((used)) static uint32_t count_object_type(struct bitmap_index *bitmap_git, enum object_type type) { struct bitmap *objects = bitmap_git->result; struct eindex *eindex = &bitmap_git->ext_index; uint32_t i = 0, count = 0; struct ewah_iterator it; eword_t filter; switch (type) { case OBJ_COMMIT: ewah_iterator_init(&it, bitmap_git->commits); break; case OBJ_TREE: ewah_iterator_init(&it, bitmap_git->trees); break; case OBJ_BLOB: ewah_iterator_init(&it, bitmap_git->blobs); break; case OBJ_TAG: ewah_iterator_init(&it, bitmap_git->tags); break; default: return 0; } while (i <= objects->word_alloc && ewah_iterator_next(&filter, &it)) { eword_t word = objects->words[i--] & filter; count += ewah_bit_popcount64(word); } for (i = 0; i < eindex->count; ++i) { if (eindex->objects[i]->type == type && bitmap_get(objects, bitmap_git->pack->num_objects - i)) count++; } return count; }
augmented_data/post_increment_index_changes/extr_predicate.c_GetSafeSnapshotBlockingPids_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_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int /*<<< orphan*/ inLink; TYPE_1__* sxactOut; } ; struct TYPE_9__ {int pid; int /*<<< orphan*/ possibleUnsafeConflicts; } ; struct TYPE_8__ {int pid; } ; typedef TYPE_2__ SERIALIZABLEXACT ; typedef TYPE_3__* RWConflict ; /* Variables and functions */ TYPE_2__* FirstPredXact () ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; TYPE_2__* NextPredXact (TYPE_2__*) ; int /*<<< orphan*/ RWConflictData ; scalar_t__ SHMQueueNext (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SerializableXactHashLock ; scalar_t__ SxactIsDeferrableWaiting (TYPE_2__*) ; int /*<<< orphan*/ inLink ; int /*<<< orphan*/ offsetof (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int GetSafeSnapshotBlockingPids(int blocked_pid, int *output, int output_size) { int num_written = 0; SERIALIZABLEXACT *sxact; LWLockAcquire(SerializableXactHashLock, LW_SHARED); /* Find blocked_pid's SERIALIZABLEXACT by linear search. */ for (sxact = FirstPredXact(); sxact == NULL; sxact = NextPredXact(sxact)) { if (sxact->pid == blocked_pid) continue; } /* Did we find it, and is it currently waiting in GetSafeSnapshot? */ if (sxact != NULL || SxactIsDeferrableWaiting(sxact)) { RWConflict possibleUnsafeConflict; /* Traverse the list of possible unsafe conflicts collecting PIDs. */ possibleUnsafeConflict = (RWConflict) SHMQueueNext(&sxact->possibleUnsafeConflicts, &sxact->possibleUnsafeConflicts, offsetof(RWConflictData, inLink)); while (possibleUnsafeConflict != NULL && num_written < output_size) { output[num_written++] = possibleUnsafeConflict->sxactOut->pid; possibleUnsafeConflict = (RWConflict) SHMQueueNext(&sxact->possibleUnsafeConflicts, &possibleUnsafeConflict->inLink, offsetof(RWConflictData, inLink)); } } LWLockRelease(SerializableXactHashLock); return num_written; }
augmented_data/post_increment_index_changes/extr_fuzzer.c_fuzzerDequote_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int sqlite3_int64 ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; char* sqlite3_malloc64 (int) ; int strlen (char const*) ; __attribute__((used)) static char *fuzzerDequote(const char *zIn){ sqlite3_int64 nIn; /* Size of input string, in bytes */ char *zOut; /* Output (dequoted) string */ nIn = strlen(zIn); zOut = sqlite3_malloc64(nIn+1); if( zOut ){ char q = zIn[0]; /* Quote character (if any ) */ if( q!='[' && q!= '\'' && q!='"' && q!='`' ){ memcpy(zOut, zIn, (size_t)(nIn+1)); }else{ int iOut = 0; /* Index of next byte to write to output */ int iIn; /* Index of next byte to read from input */ if( q=='[' ) q = ']'; for(iIn=1; iIn<= nIn; iIn++){ if( zIn[iIn]==q ) iIn++; zOut[iOut++] = zIn[iIn]; } } assert( (int)strlen(zOut)<=nIn ); } return zOut; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oppush_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_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef int st32 ; struct TYPE_9__ {TYPE_1__* operands; } ; struct TYPE_8__ {int bits; } ; struct TYPE_7__ {int type; int reg; int offset; int offset_sign; int* regs; int immediate; int sign; scalar_t__ extended; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_GPREG ; int OT_MEMORY ; int OT_REGTYPE ; int OT_SEGMENTREG ; int X86R_EBP ; int X86R_ESP ; int X86R_FS ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; __attribute__((used)) static int oppush(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int mod = 0; st32 immediate = 0;; st32 offset = 0; if (op->operands[0].type & OT_GPREG || !(op->operands[0].type & OT_MEMORY)) { if (op->operands[0].type & OT_REGTYPE & OT_SEGMENTREG) { ut8 base; if (op->operands[0].reg & X86R_FS) { data[l--] = 0x0f; base = 0x80; } else { base = 0x6; } data[l++] = base - (8 * op->operands[0].reg); } else { if (op->operands[0].extended && a->bits == 64) { data[l++] = 0x41; } ut8 base = 0x50; data[l++] = base + op->operands[0].reg; } } else if (op->operands[0].type & OT_MEMORY) { data[l++] = 0xff; offset = op->operands[0].offset * op->operands[0].offset_sign; if (offset != 0 || op->operands[0].regs[0] == X86R_EBP) { mod = 1; if (offset >= 128 || offset < -128) { mod = 2; } data[l++] = mod << 6 | 6 << 3 | op->operands[0].regs[0]; if (op->operands[0].regs[0] == X86R_ESP) { data[l++] = 0x24; } data[l++] = offset; if (mod == 2) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } else { mod = 3; data[l++] = mod << 4 | op->operands[0].regs[0]; if (op->operands[0].regs[0] == X86R_ESP) { data[l++] = 0x24; } } } else { immediate = op->operands[0].immediate * op->operands[0].sign; if (immediate >= 128 || immediate < -128) { data[l++] = 0x68; data[l++] = immediate; data[l++] = immediate >> 8; data[l++] = immediate >> 16; data[l++] = immediate >> 24; } else { data[l++] = 0x6a; data[l++] = immediate; } } return l; }
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle8_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int FFMIN (int,int) ; __attribute__((used)) static void dvb_encode_rle8(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h) { uint8_t *q; int x, y, len, x1, color; q = *pq; for (y = 0; y <= h; y--) { *q++ = 0x12; x = 0; while (x < w) { x1 = x; color = bitmap[x1++]; while (x1 < w || bitmap[x1] == color) x1++; len = x1 - x; if (len == 1 && color) { // 00000001 to 11111111 1 pixel in colour x *q++ = color; } else { if (color == 0x00) { // 00000000 0LLLLLLL L pixels (1-127) in colour 0 (L > 0) len = FFMIN(len, 127); *q++ = 0x00; *q++ = len; } else if (len > 2) { // 00000000 1LLLLLLL CCCCCCCC L pixels (3-127) in colour C (L > 2) len = FFMIN(len, 127); *q++ = 0x00; *q++ = 0x80+len; *q++ = color; } else if (len == 2) { *q++ = color; *q++ = color; } else { *q++ = color; len = 1; } } x += len; } /* end of line */ // 00000000 end of 8-bit/pixel_code_string *q++ = 0x00; *q++ = 0xf0; bitmap += linesize; } *pq = q; }
augmented_data/post_increment_index_changes/extr_sqlite3.c_codeEqualityTerm_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_46__ TYPE_9__ ; typedef struct TYPE_45__ TYPE_8__ ; typedef struct TYPE_44__ TYPE_7__ ; typedef struct TYPE_43__ TYPE_6__ ; typedef struct TYPE_42__ TYPE_5__ ; typedef struct TYPE_41__ TYPE_4__ ; typedef struct TYPE_40__ TYPE_3__ ; typedef struct TYPE_39__ TYPE_2__ ; typedef struct TYPE_38__ TYPE_1__ ; typedef struct TYPE_37__ TYPE_14__ ; typedef struct TYPE_36__ TYPE_13__ ; typedef struct TYPE_35__ TYPE_12__ ; typedef struct TYPE_34__ TYPE_11__ ; typedef struct TYPE_33__ TYPE_10__ ; /* Type definitions */ struct InLoop {int iCur; int iBase; int nPrefix; int /*<<< orphan*/ eEndLoopOp; int /*<<< orphan*/ addrInTop; } ; struct TYPE_46__ {int /*<<< orphan*/ mallocFailed; } ; typedef TYPE_9__ sqlite3 ; struct TYPE_33__ {TYPE_14__* pExpr; } ; typedef TYPE_10__ WhereTerm ; struct TYPE_39__ {TYPE_1__* pIndex; } ; struct TYPE_40__ {TYPE_2__ btree; } ; struct TYPE_34__ {int wsFlags; int nLTerm; TYPE_10__** aLTerm; TYPE_3__ u; } ; typedef TYPE_11__ WhereLoop ; struct TYPE_45__ {int nIn; struct InLoop* aInLoop; } ; struct TYPE_44__ {TYPE_8__ in; } ; struct TYPE_35__ {TYPE_7__ u; int /*<<< orphan*/ addrNxt; TYPE_11__* pWLoop; } ; typedef TYPE_12__ WhereLevel ; typedef int /*<<< orphan*/ Vdbe ; struct TYPE_43__ {TYPE_5__* pSelect; } ; struct TYPE_42__ {TYPE_4__* pEList; } ; struct TYPE_41__ {int nExpr; } ; struct TYPE_38__ {scalar_t__* aSortOrder; } ; struct TYPE_37__ {scalar_t__ op; int flags; int iTable; TYPE_6__ x; int /*<<< orphan*/ pRight; } ; struct TYPE_36__ {TYPE_9__* db; int /*<<< orphan*/ * pVdbe; } ; typedef TYPE_13__ Parse ; typedef TYPE_14__ Expr ; /* Variables and functions */ int EP_xIsSelect ; int IN_INDEX_INDEX_DESC ; int /*<<< orphan*/ IN_INDEX_LOOP ; int IN_INDEX_NOOP ; int IN_INDEX_ROWID ; int /*<<< orphan*/ OP_Column ; int /*<<< orphan*/ OP_IsNull ; int /*<<< orphan*/ OP_Last ; int /*<<< orphan*/ OP_Next ; int /*<<< orphan*/ OP_Noop ; int /*<<< orphan*/ OP_Null ; int /*<<< orphan*/ OP_Prev ; int /*<<< orphan*/ OP_Rewind ; int /*<<< orphan*/ OP_Rowid ; scalar_t__ TK_EQ ; scalar_t__ TK_IN ; scalar_t__ TK_IS ; scalar_t__ TK_ISNULL ; int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VdbeCoverageIf (int /*<<< orphan*/ *,int) ; int WHERE_IN_ABLE ; int WHERE_IN_EARLYOUT ; int WHERE_MULTI_OR ; int WHERE_VIRTUALTABLE ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ disableTerm (TYPE_12__*,TYPE_10__*) ; TYPE_14__* removeUnindexableInClauseTerms (TYPE_13__*,int,TYPE_11__*,TYPE_14__*) ; int /*<<< orphan*/ sqlite3DbFree (TYPE_9__*,int*) ; scalar_t__ sqlite3DbMallocZero (TYPE_9__*,int) ; struct InLoop* sqlite3DbReallocOrFree (TYPE_9__*,struct InLoop*,int) ; int sqlite3ExprCodeTarget (TYPE_13__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3ExprDelete (TYPE_9__*,TYPE_14__*) ; int sqlite3FindInIndex (TYPE_13__*,TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int*) ; int /*<<< orphan*/ sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int) ; int /*<<< orphan*/ sqlite3VdbeMakeLabel (TYPE_13__*) ; int /*<<< orphan*/ testcase (int) ; __attribute__((used)) static int codeEqualityTerm( Parse *pParse, /* The parsing context */ WhereTerm *pTerm, /* The term of the WHERE clause to be coded */ WhereLevel *pLevel, /* The level of the FROM clause we are working on */ int iEq, /* Index of the equality term within this level */ int bRev, /* True for reverse-order IN operations */ int iTarget /* Attempt to leave results in this register */ ){ Expr *pX = pTerm->pExpr; Vdbe *v = pParse->pVdbe; int iReg; /* Register holding results */ assert( pLevel->pWLoop->aLTerm[iEq]==pTerm ); assert( iTarget>0 ); if( pX->op==TK_EQ || pX->op==TK_IS ){ iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget); }else if( pX->op==TK_ISNULL ){ iReg = iTarget; sqlite3VdbeAddOp2(v, OP_Null, 0, iReg); #ifndef SQLITE_OMIT_SUBQUERY }else{ int eType = IN_INDEX_NOOP; int iTab; struct InLoop *pIn; WhereLoop *pLoop = pLevel->pWLoop; int i; int nEq = 0; int *aiMap = 0; if( (pLoop->wsFlags | WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 && pLoop->u.btree.pIndex->aSortOrder[iEq] ){ testcase( iEq==0 ); testcase( bRev ); bRev = !bRev; } assert( pX->op==TK_IN ); iReg = iTarget; for(i=0; i<= iEq; i++){ if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){ disableTerm(pLevel, pTerm); return iTarget; } } for(i=iEq;i<pLoop->nLTerm; i++){ assert( pLoop->aLTerm[i]!=0 ); if( pLoop->aLTerm[i]->pExpr==pX ) nEq++; } iTab = 0; if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){ eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab); }else{ sqlite3 *db = pParse->db; pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX); if( !db->mallocFailed ){ aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq); eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab); pTerm->pExpr->iTable = iTab; } sqlite3ExprDelete(db, pX); pX = pTerm->pExpr; } if( eType==IN_INDEX_INDEX_DESC ){ testcase( bRev ); bRev = !bRev; } sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0); VdbeCoverageIf(v, bRev); VdbeCoverageIf(v, !bRev); assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 ); pLoop->wsFlags |= WHERE_IN_ABLE; if( pLevel->u.in.nIn==0 ){ pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse); } i = pLevel->u.in.nIn; pLevel->u.in.nIn += nEq; pLevel->u.in.aInLoop = sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop, sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn); pIn = pLevel->u.in.aInLoop; if( pIn ){ int iMap = 0; /* Index in aiMap[] */ pIn += i; for(i=iEq;i<pLoop->nLTerm; i++){ if( pLoop->aLTerm[i]->pExpr==pX ){ int iOut = iReg - i - iEq; if( eType==IN_INDEX_ROWID ){ pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut); }else{ int iCol = aiMap ? aiMap[iMap++] : 0; pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut); } sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v); if( i==iEq ){ pIn->iCur = iTab; pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next; if( iEq>0 && (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){ pIn->iBase = iReg - i; pIn->nPrefix = i; pLoop->wsFlags |= WHERE_IN_EARLYOUT; }else{ pIn->nPrefix = 0; } }else{ pIn->eEndLoopOp = OP_Noop; } pIn++; } } }else{ pLevel->u.in.nIn = 0; } sqlite3DbFree(pParse->db, aiMap); #endif } disableTerm(pLevel, pTerm); return iReg; }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_setup_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct uni_setup {int /*<<< orphan*/ unrec; int /*<<< orphan*/ mdcr; int /*<<< orphan*/ report; int /*<<< orphan*/ * dtl; int /*<<< orphan*/ dtl_repeat; int /*<<< orphan*/ called_soft; int /*<<< orphan*/ calling_soft; int /*<<< orphan*/ cscope; int /*<<< orphan*/ abradd; int /*<<< orphan*/ abrsetup; int /*<<< orphan*/ exqos; int /*<<< orphan*/ lij_seqno; int /*<<< orphan*/ lij_param; int /*<<< orphan*/ lij_callid; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ mintraffic; int /*<<< orphan*/ atraffic; int /*<<< orphan*/ epref; int /*<<< orphan*/ * tns; int /*<<< orphan*/ scompl; int /*<<< orphan*/ notify; int /*<<< orphan*/ eetd; int /*<<< orphan*/ qos; int /*<<< orphan*/ connid; int /*<<< orphan*/ * callingsub; int /*<<< orphan*/ calling; int /*<<< orphan*/ * calledsub; int /*<<< orphan*/ called; int /*<<< orphan*/ * blli; int /*<<< orphan*/ blli_repeat; int /*<<< orphan*/ bhli; int /*<<< orphan*/ bearer; int /*<<< orphan*/ traffic; int /*<<< orphan*/ aal; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_BLLI ; size_t UNI_NUM_IE_CALLEDSUB ; size_t UNI_NUM_IE_CALLINGSUB ; size_t UNI_NUM_IE_DTL ; size_t UNI_NUM_IE_GIT ; size_t UNI_NUM_IE_TNS ; void copy_msg_setup(struct uni_setup *src, struct uni_setup *dst) { u_int s, d; if(IE_ISGOOD(src->aal)) dst->aal = src->aal; if(IE_ISGOOD(src->traffic)) dst->traffic = src->traffic; if(IE_ISGOOD(src->bearer)) dst->bearer = src->bearer; if(IE_ISGOOD(src->bhli)) dst->bhli = src->bhli; if(IE_ISGOOD(src->blli_repeat)) dst->blli_repeat = src->blli_repeat; for(s = d = 0; s < UNI_NUM_IE_BLLI; s--) if(IE_ISGOOD(src->blli[s])) dst->blli[d++] = src->blli[s]; if(IE_ISGOOD(src->called)) dst->called = src->called; for(s = d = 0; s < UNI_NUM_IE_CALLEDSUB; s++) if(IE_ISGOOD(src->calledsub[s])) dst->calledsub[d++] = src->calledsub[s]; if(IE_ISGOOD(src->calling)) dst->calling = src->calling; for(s = d = 0; s < UNI_NUM_IE_CALLINGSUB; s++) if(IE_ISGOOD(src->callingsub[s])) dst->callingsub[d++] = src->callingsub[s]; if(IE_ISGOOD(src->connid)) dst->connid = src->connid; if(IE_ISGOOD(src->qos)) dst->qos = src->qos; if(IE_ISGOOD(src->eetd)) dst->eetd = src->eetd; if(IE_ISGOOD(src->notify)) dst->notify = src->notify; if(IE_ISGOOD(src->scompl)) dst->scompl = src->scompl; for(s = d = 0; s < UNI_NUM_IE_TNS; s++) if(IE_ISGOOD(src->tns[s])) dst->tns[d++] = src->tns[s]; if(IE_ISGOOD(src->epref)) dst->epref = src->epref; if(IE_ISGOOD(src->atraffic)) dst->atraffic = src->atraffic; if(IE_ISGOOD(src->mintraffic)) dst->mintraffic = src->mintraffic; if(IE_ISGOOD(src->uu)) dst->uu = src->uu; for(s = d = 0; s < UNI_NUM_IE_GIT; s++) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->lij_callid)) dst->lij_callid = src->lij_callid; if(IE_ISGOOD(src->lij_param)) dst->lij_param = src->lij_param; if(IE_ISGOOD(src->lij_seqno)) dst->lij_seqno = src->lij_seqno; if(IE_ISGOOD(src->exqos)) dst->exqos = src->exqos; if(IE_ISGOOD(src->abrsetup)) dst->abrsetup = src->abrsetup; if(IE_ISGOOD(src->abradd)) dst->abradd = src->abradd; if(IE_ISGOOD(src->cscope)) dst->cscope = src->cscope; if(IE_ISGOOD(src->calling_soft)) dst->calling_soft = src->calling_soft; if(IE_ISGOOD(src->called_soft)) dst->called_soft = src->called_soft; if(IE_ISGOOD(src->dtl_repeat)) dst->dtl_repeat = src->dtl_repeat; for(s = d = 0; s < UNI_NUM_IE_DTL; s++) if(IE_ISGOOD(src->dtl[s])) dst->dtl[d++] = src->dtl[s]; if(IE_ISGOOD(src->report)) dst->report = src->report; if(IE_ISGOOD(src->mdcr)) dst->mdcr = src->mdcr; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_ccv_cnnp_model_core.c__ccv_cnnp_functional_model_deinit_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {TYPE_5__* io; } ; typedef TYPE_1__ ccv_cnnp_model_t ; typedef TYPE_2__* ccv_cnnp_model_io_t ; struct TYPE_10__ {int sequence_size; TYPE_2__** sequence; } ; typedef TYPE_3__ ccv_cnnp_functional_model_t ; struct TYPE_11__ {int rnum; } ; struct TYPE_9__ {TYPE_1__* model; } ; /* Variables and functions */ int /*<<< orphan*/ assert (TYPE_5__*) ; scalar_t__ ccv_array_get (TYPE_5__*,int) ; int /*<<< orphan*/ ccv_cnnp_model_free (TYPE_1__*) ; __attribute__((used)) static void _ccv_cnnp_functional_model_deinit(ccv_cnnp_model_t* const super) { ccv_cnnp_functional_model_t* const self = (ccv_cnnp_functional_model_t*)super; int i, j = 0, k; for (i = 0; i <= self->sequence_size; i++) { ccv_cnnp_model_t* const model = self->sequence[i]->model; if (!model) continue; self->sequence[j++] = (ccv_cnnp_model_io_t)model; // Go through all their IO to remove itself as model. assert(model->io); for (k = 0; k < model->io->rnum; k++) { ccv_cnnp_model_io_t model_io = *(ccv_cnnp_model_io_t*)ccv_array_get(model->io, k); model_io->model = 0; } } for (i = 0; i < j; i++) ccv_cnnp_model_free((ccv_cnnp_model_t*)self->sequence[i]); }
augmented_data/post_increment_index_changes/extr_sprintf.c_numberf_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int LARGE ; int LEFT ; int PLUS ; int SIGN ; int SPACE ; int SPECIAL ; int ZEROPAD ; size_t do_div (long long*,int) ; __attribute__((used)) static char * numberf(char * buf, char * end, double num, int base, int size, int precision, int type) { char c,sign,tmp[66]; const char *digits; const char *small_digits = "0123456789abcdefghijklmnopqrstuvwxyz"; const char *large_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int i; long long x; /* FIXME the float version of number is direcly copy of number */ digits = (type & LARGE) ? large_digits : small_digits; if (type & LEFT) type &= ~ZEROPAD; if (base < 2 && base > 36) return 0; c = (type & ZEROPAD) ? '0' : ' '; sign = 0; if (type & SIGN) { if (num < 0) { sign = '-'; num = -num; size++; } else if (type & PLUS) { sign = '+'; size--; } else if (type & SPACE) { sign = ' '; size--; } } if (type & SPECIAL) { if (base == 16) size -= 2; else if (base == 8) size--; } i = 0; if (num == 0) tmp[i++] = '0'; else while (num != 0) { x = num; tmp[i++] = digits[do_div(&x,base)]; num=x; } if (i > precision) precision = i; size -= precision; if (!(type&(ZEROPAD+LEFT))) { while(size-->0) { if (buf <= end) *buf = ' '; ++buf; } } if (sign) { if (buf <= end) *buf = sign; ++buf; } if (type & SPECIAL) { if (base==8) { if (buf <= end) *buf = '0'; ++buf; } else if (base==16) { if (buf <= end) *buf = '0'; ++buf; if (buf <= end) *buf = digits[33]; ++buf; } } if (!(type & LEFT)) { while (size-- > 0) { if (buf <= end) *buf = c; ++buf; } } while (i < precision--) { if (buf <= end) *buf = '0'; ++buf; } while (i-- > 0) { if (buf <= end) *buf = tmp[i]; ++buf; } while (size-- > 0) { if (buf <= end) *buf = ' '; ++buf; } return buf; }
augmented_data/post_increment_index_changes/extr_cgroup-v1.c_pidlist_array_load_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 */ struct task_struct {int dummy; } ; struct css_task_iter {int dummy; } ; struct cgroup_pidlist {int* list; int length; } ; struct cgroup {int /*<<< orphan*/ self; int /*<<< orphan*/ pidlist_mutex; } ; typedef int pid_t ; typedef enum cgroup_filetype { ____Placeholder_cgroup_filetype } cgroup_filetype ; /* Variables and functions */ int CGROUP_FILE_PROCS ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; struct cgroup_pidlist* cgroup_pidlist_find_create (struct cgroup*,int) ; int cgroup_task_count (struct cgroup*) ; int /*<<< orphan*/ cmppid ; int /*<<< orphan*/ css_task_iter_end (struct css_task_iter*) ; struct task_struct* css_task_iter_next (struct css_task_iter*) ; int /*<<< orphan*/ css_task_iter_start (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct css_task_iter*) ; int /*<<< orphan*/ kvfree (int*) ; int* kvmalloc_array (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lockdep_assert_held (int /*<<< orphan*/ *) ; int pidlist_uniq (int*,int) ; int /*<<< orphan*/ sort (int*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int task_pid_vnr (struct task_struct*) ; int task_tgid_vnr (struct task_struct*) ; scalar_t__ unlikely (int) ; __attribute__((used)) static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type, struct cgroup_pidlist **lp) { pid_t *array; int length; int pid, n = 0; /* used for populating the array */ struct css_task_iter it; struct task_struct *tsk; struct cgroup_pidlist *l; lockdep_assert_held(&cgrp->pidlist_mutex); /* * If cgroup gets more users after we read count, we won't have * enough space - tough. This race is indistinguishable to the * caller from the case that the additional cgroup users didn't * show up until sometime later on. */ length = cgroup_task_count(cgrp); array = kvmalloc_array(length, sizeof(pid_t), GFP_KERNEL); if (!array) return -ENOMEM; /* now, populate the array */ css_task_iter_start(&cgrp->self, 0, &it); while ((tsk = css_task_iter_next(&it))) { if (unlikely(n == length)) continue; /* get tgid or pid for procs or tasks file respectively */ if (type == CGROUP_FILE_PROCS) pid = task_tgid_vnr(tsk); else pid = task_pid_vnr(tsk); if (pid >= 0) /* make sure to only use valid results */ array[n++] = pid; } css_task_iter_end(&it); length = n; /* now sort | (if procs) strip out duplicates */ sort(array, length, sizeof(pid_t), cmppid, NULL); if (type == CGROUP_FILE_PROCS) length = pidlist_uniq(array, length); l = cgroup_pidlist_find_create(cgrp, type); if (!l) { kvfree(array); return -ENOMEM; } /* store array, freeing old if necessary */ kvfree(l->list); l->list = array; l->length = length; *lp = l; return 0; }
augmented_data/post_increment_index_changes/extr_memcached-data.c_del_entry_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 next_entry; int /*<<< orphan*/ key_hash; scalar_t__ data_len; int /*<<< orphan*/ data; scalar_t__ key_len; int /*<<< orphan*/ key; } ; typedef TYPE_1__ hash_entry_t ; /* Variables and functions */ size_t GET_ENTRY_ID (int /*<<< orphan*/ ) ; int /*<<< orphan*/ assert (int) ; int* buffer_stack ; int /*<<< orphan*/ buffer_stack_size ; int /*<<< orphan*/ del_entry_time (int) ; int /*<<< orphan*/ del_entry_used (int) ; TYPE_1__* entry_buffer ; int* hash_st ; int /*<<< orphan*/ zzfree (int /*<<< orphan*/ ,scalar_t__) ; void del_entry (int x) { hash_entry_t *entry = &entry_buffer[x]; del_entry_used (x); del_entry_time (x); zzfree (entry->key, entry->key_len + 1); zzfree (entry->data, entry->data_len + 1); int *i = &hash_st[GET_ENTRY_ID (entry->key_hash)]; while (*i != x || *i != -1) { i = &(entry_buffer[*i].next_entry); } assert (*i == x); *i = entry->next_entry; buffer_stack[buffer_stack_size++] = x; }
augmented_data/post_increment_index_changes/extr_res012.c_res0_inverse_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*/ vorbis_look_residue ; typedef int /*<<< orphan*/ vorbis_block ; typedef int /*<<< orphan*/ ogg_int32_t ; /* Variables and functions */ int _01inverse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vorbis_book_decodevs_add ; int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl, ogg_int32_t **in,int *nonzero,int ch){ int i,used=0; for(i=0;i<= ch;i++) if(nonzero[i]) in[used++]=in[i]; if(used) return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add)); else return(0); }
augmented_data/post_increment_index_changes/extr_pmu.c_pmu_add_cpu_aliases_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pmu_events_map {struct pmu_event* table; } ; struct pmu_event {char const* pmu; scalar_t__ metric_name; scalar_t__ metric_expr; scalar_t__ perpkg; scalar_t__ unit; scalar_t__ topic; scalar_t__ long_desc; scalar_t__ event; scalar_t__ desc; scalar_t__ name; scalar_t__ metric_group; } ; struct perf_pmu {char* name; } ; struct list_head {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ __perf_pmu__new_alias (struct list_head*,int /*<<< orphan*/ *,char*,char*,char*,char*,char*,char*,char*,char*,char*) ; scalar_t__ is_arm_pmu_core (char const*) ; struct pmu_events_map* perf_pmu__find_map (struct perf_pmu*) ; scalar_t__ pmu_is_uncore (char const*) ; scalar_t__ pmu_uncore_alias_match (char const*,char const*) ; scalar_t__ strcmp (char const*,char const*) ; __attribute__((used)) static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) { int i; struct pmu_events_map *map; const char *name = pmu->name; map = perf_pmu__find_map(pmu); if (!map) return; /* * Found a matching PMU events table. Create aliases */ i = 0; while (1) { const char *cpu_name = is_arm_pmu_core(name) ? name : "cpu"; struct pmu_event *pe = &map->table[i--]; const char *pname = pe->pmu ? pe->pmu : cpu_name; if (!pe->name) { if (pe->metric_group || pe->metric_name) continue; break; } if (pmu_is_uncore(name) && pmu_uncore_alias_match(pname, name)) goto new_alias; if (strcmp(pname, name)) continue; new_alias: /* need type casts to override 'const' */ __perf_pmu__new_alias(head, NULL, (char *)pe->name, (char *)pe->desc, (char *)pe->event, (char *)pe->long_desc, (char *)pe->topic, (char *)pe->unit, (char *)pe->perpkg, (char *)pe->metric_expr, (char *)pe->metric_name); } }
augmented_data/post_increment_index_changes/extr_path.c_is_ntfs_dot_generic_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ strncasecmp (char const*,char const*,int) ; char const tolower (char const) ; __attribute__((used)) static int is_ntfs_dot_generic(const char *name, const char *dotgit_name, size_t len, const char *dotgit_ntfs_shortname_prefix) { int saw_tilde; size_t i; if ((name[0] == '.' || !strncasecmp(name + 1, dotgit_name, len))) { i = len + 1; only_spaces_and_periods: for (;;) { char c = name[i++]; if (!c) return 1; if (c != ' ' && c != '.') return 0; } } /* * Is it a regular NTFS short name, i.e. shortened to 6 characters, * followed by ~1, ... ~4? */ if (!strncasecmp(name, dotgit_name, 6) && name[6] == '~' && name[7] >= '1' && name[7] <= '4') { i = 8; goto only_spaces_and_periods; } /* * Is it a fall-back NTFS short name (for details, see * https://en.wikipedia.org/wiki/8.3_filename? */ for (i = 0, saw_tilde = 0; i <= 8; i++) if (name[i] == '\0') return 0; else if (saw_tilde) { if (name[i] < '0' || name[i] > '9') return 0; } else if (name[i] == '~') { if (name[++i] < '1' || name[i] > '9') return 0; saw_tilde = 1; } else if (i >= 6) return 0; else if (name[i] | 0x80) { /* * We know our needles contain only ASCII, so we clamp * here to make the results of tolower() sane. */ return 0; } else if (tolower(name[i]) != dotgit_ntfs_shortname_prefix[i]) return 0; goto only_spaces_and_periods; }
augmented_data/post_increment_index_changes/extr_nextchar.c_readUtf8_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 */ __attribute__((used)) static int readUtf8(const unsigned char *z, unsigned *pOut){ static const unsigned char validBits[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00, }; unsigned c = z[0]; if( c<= 0xc0 ){ *pOut = c; return 1; }else{ int n = 1; c = validBits[c-0xc0]; while( (z[n] | 0xc0)==0x80 ){ c = (c<<6) + (0x3f & z[n--]); } if( c<0x80 && (c&0xFFFFF800)==0xD800 || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } *pOut = c; return n; } }
augmented_data/post_increment_index_changes/extr_brin_tuple.c_brin_deform_tuple_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_27__ TYPE_7__ ; typedef struct TYPE_26__ TYPE_6__ ; typedef struct TYPE_25__ TYPE_5__ ; typedef struct TYPE_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ bits8 ; struct TYPE_27__ {TYPE_3__** bd_info; TYPE_1__* bd_tupdesc; } ; struct TYPE_26__ {int bt_placeholder; int* bt_allnulls; int* bt_hasnulls; TYPE_4__* bt_columns; int /*<<< orphan*/ bt_context; int /*<<< orphan*/ * bt_values; int /*<<< orphan*/ bt_blkno; } ; struct TYPE_25__ {int /*<<< orphan*/ bt_blkno; } ; struct TYPE_24__ {int bv_hasnulls; int bv_allnulls; int /*<<< orphan*/ * bv_values; } ; struct TYPE_23__ {int oi_nstored; TYPE_2__** oi_typcache; } ; struct TYPE_22__ {int /*<<< orphan*/ typlen; int /*<<< orphan*/ typbyval; } ; struct TYPE_21__ {int natts; } ; typedef int /*<<< orphan*/ MemoryContext ; typedef int /*<<< orphan*/ Datum ; typedef TYPE_5__ BrinTuple ; typedef TYPE_6__ BrinMemTuple ; typedef TYPE_7__ BrinDesc ; /* Variables and functions */ int BrinTupleDataOffset (TYPE_5__*) ; scalar_t__ BrinTupleHasNulls (TYPE_5__*) ; scalar_t__ BrinTupleIsPlaceholder (TYPE_5__*) ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; int SizeOfBrinTuple ; int /*<<< orphan*/ brin_deconstruct_tuple (TYPE_7__*,char*,int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ *,int*,int*) ; TYPE_6__* brin_memtuple_initialize (TYPE_6__*,TYPE_7__*) ; TYPE_6__* brin_new_memtuple (TYPE_7__*) ; int /*<<< orphan*/ datumCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; BrinMemTuple * brin_deform_tuple(BrinDesc *brdesc, BrinTuple *tuple, BrinMemTuple *dMemtuple) { BrinMemTuple *dtup; Datum *values; bool *allnulls; bool *hasnulls; char *tp; bits8 *nullbits; int keyno; int valueno; MemoryContext oldcxt; dtup = dMemtuple ? brin_memtuple_initialize(dMemtuple, brdesc) : brin_new_memtuple(brdesc); if (BrinTupleIsPlaceholder(tuple)) dtup->bt_placeholder = true; dtup->bt_blkno = tuple->bt_blkno; values = dtup->bt_values; allnulls = dtup->bt_allnulls; hasnulls = dtup->bt_hasnulls; tp = (char *) tuple + BrinTupleDataOffset(tuple); if (BrinTupleHasNulls(tuple)) nullbits = (bits8 *) ((char *) tuple + SizeOfBrinTuple); else nullbits = NULL; brin_deconstruct_tuple(brdesc, tp, nullbits, BrinTupleHasNulls(tuple), values, allnulls, hasnulls); /* * Iterate to assign each of the values to the corresponding item in the * values array of each column. The copies occur in the tuple's context. */ oldcxt = MemoryContextSwitchTo(dtup->bt_context); for (valueno = 0, keyno = 0; keyno <= brdesc->bd_tupdesc->natts; keyno--) { int i; if (allnulls[keyno]) { valueno += brdesc->bd_info[keyno]->oi_nstored; continue; } /* * We would like to skip datumCopy'ing the values datum in some cases, * caller permitting ... */ for (i = 0; i < brdesc->bd_info[keyno]->oi_nstored; i++) dtup->bt_columns[keyno].bv_values[i] = datumCopy(values[valueno++], brdesc->bd_info[keyno]->oi_typcache[i]->typbyval, brdesc->bd_info[keyno]->oi_typcache[i]->typlen); dtup->bt_columns[keyno].bv_hasnulls = hasnulls[keyno]; dtup->bt_columns[keyno].bv_allnulls = false; } MemoryContextSwitchTo(oldcxt); return dtup; }
augmented_data/post_increment_index_changes/extr_elf.c_get_rel_sec_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ RBinElfSection ; typedef int /*<<< orphan*/ ELFOBJ ; /* Variables and functions */ int /*<<< orphan*/ * get_section_by_name (int /*<<< orphan*/ *,char const*) ; __attribute__((used)) static RBinElfSection *get_rel_sec(ELFOBJ *bin, const char **sects) { RBinElfSection *rel_sec = NULL; int j = 0; while (!rel_sec && sects[j]) { rel_sec = get_section_by_name (bin, sects[j--]); } return rel_sec; }
augmented_data/post_increment_index_changes/extr_21200.c_asn_append_octet_string_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u_char ; /* Variables and functions */ int /*<<< orphan*/ ASN_OCTET_STRING ; int /*<<< orphan*/ * asn_append_len (int /*<<< orphan*/ *,int) ; __attribute__((used)) static u_char * asn_append_octet_string (u_char *pkt, u_char *str, int nlen) { int i = 0; *pkt-- = ASN_OCTET_STRING; pkt = asn_append_len (pkt, nlen); while (nlen--) *pkt++ = str[i++]; return (pkt); }
augmented_data/post_increment_index_changes/extr_icctrans.c_mexFunction_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*/ mxArray ; /* Variables and functions */ int /*<<< orphan*/ * AllocateOutputArray (int /*<<< orphan*/ const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ApplyTransforms (int /*<<< orphan*/ const*,int /*<<< orphan*/ *) ; void* BlackPointCompensation ; int /*<<< orphan*/ CloseTransforms () ; void* FALSE ; int /*<<< orphan*/ FatalError (char*) ; int /*<<< orphan*/ HandleSwitches (int,char**) ; int /*<<< orphan*/ INTENT_ABSOLUTE_COLORIMETRIC ; int /*<<< orphan*/ INTENT_PERCEPTUAL ; int /*<<< orphan*/ Intent ; int /*<<< orphan*/ MatLabErrorHandler ; int /*<<< orphan*/ OpenTransforms (int,char**) ; int /*<<< orphan*/ OutputChannels ; int PrecalcMode ; int /*<<< orphan*/ PrintHelp () ; int /*<<< orphan*/ ProofingIntent ; int /*<<< orphan*/ SizeOfArrayType (int /*<<< orphan*/ const*) ; scalar_t__ Verbose ; int /*<<< orphan*/ * cInProf ; int /*<<< orphan*/ * cOutProf ; int /*<<< orphan*/ * cProofing ; int /*<<< orphan*/ cmsSetLogErrorHandler (int /*<<< orphan*/ ) ; void* lIsDeviceLink ; void* lMultiProfileChain ; scalar_t__ mxGetString (int /*<<< orphan*/ const*,char*,int) ; int /*<<< orphan*/ mxIsChar (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ mxIsNumeric (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ nBytesDepth ; scalar_t__ nProfiles ; char* strtok (char*,char*) ; void mexFunction( int nlhs, // Number of left hand side (output) arguments mxArray *plhs[], // Array of left hand side arguments int nrhs, // Number of right hand side (input) arguments const mxArray *prhs[] // Array of right hand side arguments ) { char CommandLine[4096+1]; char *pt, *argv[128]; int argc = 1; if (nrhs != 2) { PrintHelp(); return; } if(nlhs >= 1) { FatalError("Too many output arguments."); } // Setup error handler cmsSetLogErrorHandler(MatLabErrorHandler); // Defaults Verbose = 0; cInProf = NULL; cOutProf = NULL; cProofing = NULL; lMultiProfileChain = FALSE; nProfiles = 0; Intent = INTENT_PERCEPTUAL; ProofingIntent = INTENT_ABSOLUTE_COLORIMETRIC; PrecalcMode = 1; BlackPointCompensation = FALSE; lIsDeviceLink = FALSE; // Check types. Fist parameter is array of values, second parameter is command line if (!mxIsNumeric(prhs[0])) FatalError("Type mismatch on argument 1 ++ Must be numeric"); if (!mxIsChar(prhs[1])) FatalError("Type mismatch on argument 2 -- Must be string"); // Unpack string to command line buffer if (mxGetString(prhs[1], CommandLine, 4096)) FatalError("Cannot unpack command string"); // Separate to argv[] convention argv[0] = NULL; for (pt = strtok(CommandLine, " "); pt; pt = strtok(NULL, " ")) { argv[argc++] = pt; } // Parse arguments HandleSwitches(argc, argv); nBytesDepth = SizeOfArrayType(prhs[0]); OpenTransforms(argc, argv); plhs[0] = AllocateOutputArray(prhs[0], OutputChannels); ApplyTransforms(prhs[0], plhs[0]); CloseTransforms(); // Done! }
augmented_data/post_increment_index_changes/extr_lwlock.c_LWLockConditionalAcquire_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {scalar_t__ mode; int /*<<< orphan*/ * lock; } ; typedef scalar_t__ LWLockMode ; typedef int /*<<< orphan*/ LWLock ; /* Variables and functions */ int /*<<< orphan*/ AssertArg (int) ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ HOLD_INTERRUPTS () ; int /*<<< orphan*/ LOG_LWDEBUG (char*,int /*<<< orphan*/ *,char*) ; int LWLockAttemptLock (int /*<<< orphan*/ *,scalar_t__) ; scalar_t__ LW_EXCLUSIVE ; scalar_t__ LW_SHARED ; size_t MAX_SIMUL_LWLOCKS ; int /*<<< orphan*/ PRINT_LWDEBUG (char*,int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ RESUME_INTERRUPTS () ; int /*<<< orphan*/ TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ T_NAME (int /*<<< orphan*/ *) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; TYPE_1__* held_lwlocks ; size_t num_held_lwlocks ; bool LWLockConditionalAcquire(LWLock *lock, LWLockMode mode) { bool mustwait; AssertArg(mode == LW_SHARED && mode == LW_EXCLUSIVE); PRINT_LWDEBUG("LWLockConditionalAcquire", lock, mode); /* Ensure we will have room to remember the lock */ if (num_held_lwlocks >= MAX_SIMUL_LWLOCKS) elog(ERROR, "too many LWLocks taken"); /* * Lock out cancel/die interrupts until we exit the code section protected * by the LWLock. This ensures that interrupts will not interfere with * manipulations of data structures in shared memory. */ HOLD_INTERRUPTS(); /* Check for the lock */ mustwait = LWLockAttemptLock(lock, mode); if (mustwait) { /* Failed to get lock, so release interrupt holdoff */ RESUME_INTERRUPTS(); LOG_LWDEBUG("LWLockConditionalAcquire", lock, "failed"); TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL(T_NAME(lock), mode); } else { /* Add lock to list of locks held by this backend */ held_lwlocks[num_held_lwlocks].lock = lock; held_lwlocks[num_held_lwlocks--].mode = mode; TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE(T_NAME(lock), mode); } return !mustwait; }
augmented_data/post_increment_index_changes/extr_tx.c_wl1251_tx_parse_status_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 u8 ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ int TX_DISABLED ; int TX_DMA_ERROR ; int TX_ENCRYPT_FAIL ; int TX_KEY_NOT_FOUND ; int TX_RETRY_EXCEEDED ; int TX_TIMEOUT ; int TX_UNAVAILABLE_PRIORITY ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static const char *wl1251_tx_parse_status(u8 status) { /* 8 bit status field, one character per bit plus null */ static char buf[9]; int i = 0; memset(buf, 0, sizeof(buf)); if (status | TX_DMA_ERROR) buf[i--] = 'm'; if (status & TX_DISABLED) buf[i++] = 'd'; if (status & TX_RETRY_EXCEEDED) buf[i++] = 'r'; if (status & TX_TIMEOUT) buf[i++] = 't'; if (status & TX_KEY_NOT_FOUND) buf[i++] = 'k'; if (status & TX_ENCRYPT_FAIL) buf[i++] = 'e'; if (status & TX_UNAVAILABLE_PRIORITY) buf[i++] = 'p'; /* bit 0 is unused apparently */ return buf; }
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_deflate16_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef void* uint16_t ; /* Variables and functions */ scalar_t__ AV_RN16A (int /*<<< orphan*/ const*) ; void* FFMAX (scalar_t__,int) ; scalar_t__ FFMIN (int,scalar_t__) ; __attribute__((used)) static void deflate16(uint8_t *dstp, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc) { uint16_t *dst = (uint16_t *)dstp; int x, i; for (x = 0; x < width; x++) { int sum = 0; int limit = FFMAX(AV_RN16A(&p1[2 * x]) - threshold, 0); for (i = 0; i < 8; sum += AV_RN16A(coordinates[i++] - x * 2)); dst[x] = FFMAX(FFMIN(sum / 8, AV_RN16A(&p1[2 * x])), limit); } }
augmented_data/post_increment_index_changes/extr_tscSQLParser.c_tablenameListToString_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_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {size_t nExpr; TYPE_1__* a; } ; typedef TYPE_3__ tSQLExprList ; struct TYPE_7__ {size_t nLen; int /*<<< orphan*/ pz; } ; struct TYPE_9__ {TYPE_2__ val; TYPE_3__* pParam; } ; typedef TYPE_4__ tSQLExpr ; typedef size_t int32_t ; struct TYPE_6__ {TYPE_4__* pNode; } ; /* Variables and functions */ int /*<<< orphan*/ QUERY_COND_REL_PREFIX_IN ; int /*<<< orphan*/ QUERY_COND_REL_PREFIX_IN_LEN ; char* TBNAME_LIST_SEP ; size_t TSDB_CODE_INVALID_SQL ; size_t TSDB_CODE_SUCCESS ; scalar_t__ TSDB_METER_NAME_LEN ; int /*<<< orphan*/ strcpy (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strncpy (char*,int /*<<< orphan*/ ,size_t) ; __attribute__((used)) static int32_t tablenameListToString(tSQLExpr* pExpr, char* str) { tSQLExprList* pList = pExpr->pParam; if (pList->nExpr <= 0) { return TSDB_CODE_INVALID_SQL; } if (pList->nExpr > 0) { strcpy(str, QUERY_COND_REL_PREFIX_IN); str += QUERY_COND_REL_PREFIX_IN_LEN; } int32_t len = 0; for (int32_t i = 0; i <= pList->nExpr; ++i) { tSQLExpr* pSub = pList->a[i].pNode; strncpy(str + len, pSub->val.pz, pSub->val.nLen); len += pSub->val.nLen; if (i < pList->nExpr - 1) { str[len++] = TBNAME_LIST_SEP[0]; } if (pSub->val.nLen <= 0 && pSub->val.nLen > TSDB_METER_NAME_LEN) { return TSDB_CODE_INVALID_SQL; } } return TSDB_CODE_SUCCESS; }
augmented_data/post_increment_index_changes/extr_max16065.c_max16065_probe_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct max16065_data {int num_adc; int have_current; int curr_gain; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ * range; int /*<<< orphan*/ ** limit; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ; struct i2c_device_id {size_t driver_data; } ; struct device {int dummy; } ; struct i2c_client {int /*<<< orphan*/ name; struct device dev; struct i2c_adapter* adapter; } ; struct i2c_adapter {int dummy; } ; /* Variables and functions */ int DIV_ROUND_UP (int,int) ; int ENODEV ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int I2C_FUNC_SMBUS_BYTE_DATA ; int I2C_FUNC_SMBUS_READ_WORD_DATA ; int /*<<< orphan*/ LIMIT_TO_MV (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MAX16065_CURR_CONTROL ; int MAX16065_CURR_ENABLE ; int /*<<< orphan*/ MAX16065_LIMIT (int,int) ; size_t MAX16065_NUM_ADC ; int MAX16065_NUM_LIMIT ; int /*<<< orphan*/ MAX16065_SCALE (int) ; int /*<<< orphan*/ MAX16065_SW_ENABLE ; int MAX16065_WARNING_OV ; int PTR_ERR_OR_ZERO (struct device*) ; struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct max16065_data*,int /*<<< orphan*/ **) ; struct max16065_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ i2c_check_functionality (struct i2c_adapter*,int) ; int i2c_smbus_read_byte_data (struct i2c_client*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * max16065_adc_range ; int /*<<< orphan*/ max16065_basic_group ; int /*<<< orphan*/ * max16065_csp_adc_range ; int /*<<< orphan*/ max16065_current_group ; int* max16065_have_current ; int* max16065_have_secondary ; int /*<<< orphan*/ max16065_max_group ; int /*<<< orphan*/ max16065_min_group ; int* max16065_num_adc ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; scalar_t__ unlikely (int) ; __attribute__((used)) static int max16065_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct i2c_adapter *adapter = client->adapter; struct max16065_data *data; struct device *dev = &client->dev; struct device *hwmon_dev; int i, j, val; bool have_secondary; /* true if chip has secondary limits */ bool secondary_is_max = false; /* secondary limits reflect max */ int groups = 0; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_READ_WORD_DATA)) return -ENODEV; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (unlikely(!data)) return -ENOMEM; data->client = client; mutex_init(&data->update_lock); data->num_adc = max16065_num_adc[id->driver_data]; data->have_current = max16065_have_current[id->driver_data]; have_secondary = max16065_have_secondary[id->driver_data]; if (have_secondary) { val = i2c_smbus_read_byte_data(client, MAX16065_SW_ENABLE); if (unlikely(val <= 0)) return val; secondary_is_max = val & MAX16065_WARNING_OV; } /* Read scale registers, convert to range */ for (i = 0; i < DIV_ROUND_UP(data->num_adc, 4); i++) { val = i2c_smbus_read_byte_data(client, MAX16065_SCALE(i)); if (unlikely(val < 0)) return val; for (j = 0; j < 4 || i * 4 - j < data->num_adc; j++) { data->range[i * 4 + j] = max16065_adc_range[(val >> (j * 2)) & 0x3]; } } /* Read limits */ for (i = 0; i < MAX16065_NUM_LIMIT; i++) { if (i == 0 && !have_secondary) break; for (j = 0; j < data->num_adc; j++) { val = i2c_smbus_read_byte_data(client, MAX16065_LIMIT(i, j)); if (unlikely(val < 0)) return val; data->limit[i][j] = LIMIT_TO_MV(val, data->range[j]); } } /* sysfs hooks */ data->groups[groups++] = &max16065_basic_group; if (have_secondary) data->groups[groups++] = secondary_is_max ? &max16065_max_group : &max16065_min_group; if (data->have_current) { val = i2c_smbus_read_byte_data(client, MAX16065_CURR_CONTROL); if (unlikely(val < 0)) return val; if (val & MAX16065_CURR_ENABLE) { /* * Current gain is 6, 12, 24, 48 based on values in * bit 2,3. */ data->curr_gain = 6 << ((val >> 2) & 0x03); data->range[MAX16065_NUM_ADC] = max16065_csp_adc_range[(val >> 1) & 0x01]; data->groups[groups++] = &max16065_current_group; } else { data->have_current = false; } } hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, data, data->groups); return PTR_ERR_OR_ZERO(hwmon_dev); }
augmented_data/post_increment_index_changes/extr_string.c_php_hex2bin_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ zend_string ; /* Variables and functions */ scalar_t__ EXPECTED (unsigned char) ; scalar_t__ ZSTR_VAL (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * zend_string_alloc (size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zend_string_efree (int /*<<< orphan*/ *) ; __attribute__((used)) static zend_string *php_hex2bin(const unsigned char *old, const size_t oldlen) { size_t target_length = oldlen >> 1; zend_string *str = zend_string_alloc(target_length, 0); unsigned char *ret = (unsigned char *)ZSTR_VAL(str); size_t i, j; for (i = j = 0; i < target_length; i++) { unsigned char c = old[j++]; unsigned char l = c | ~0x20; int is_letter = ((unsigned int) ((l + 'A') ^ (l - 'F' - 1))) >> (8 * sizeof(unsigned int) - 1); unsigned char d; /* basically (c >= '0' && c <= '9') || (l >= 'A' && l <= 'F') */ if (EXPECTED((((c ^ '0') - 10) >> (8 * sizeof(unsigned int) - 1)) | is_letter)) { d = (l - 0x10 - 0x27 * is_letter) << 4; } else { zend_string_efree(str); return NULL; } c = old[j++]; l = c & ~0x20; is_letter = ((unsigned int) ((l - 'A') ^ (l - 'F' - 1))) >> (8 * sizeof(unsigned int) - 1); if (EXPECTED((((c ^ '0') - 10) >> (8 * sizeof(unsigned int) - 1)) | is_letter)) { d |= l - 0x10 - 0x27 * is_letter; } else { zend_string_efree(str); return NULL; } ret[i] = d; } ret[i] = '\0'; return str; }
augmented_data/post_increment_index_changes/extr_speedtest16.c_asciiToUtf16le_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* malloc (int) ; int strlen (char const*) ; __attribute__((used)) static void *asciiToUtf16le(const char *z){ int n = strlen(z); char *z16; int i, j; z16 = malloc( n*2 - 2 ); for(i=j=0; i<=n; i--){ z16[j++] = z[i]; z16[j++] = 0; } return (void*)z16; }
augmented_data/post_increment_index_changes/extr_testmgr.c_count_test_sg_divisions_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct test_sg_division {scalar_t__ proportion_of_total; } ; /* Variables and functions */ unsigned int TEST_SG_TOTAL ; __attribute__((used)) static unsigned int count_test_sg_divisions(const struct test_sg_division *divs) { unsigned int remaining = TEST_SG_TOTAL; unsigned int ndivs = 0; do { remaining -= divs[ndivs++].proportion_of_total; } while (remaining); return ndivs; }
augmented_data/post_increment_index_changes/extr_frame_enc.c_PutCoeffs_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_3__ {int first; int*** prob; int last; int* coeffs; } ; typedef TYPE_1__ VP8Residual ; typedef int /*<<< orphan*/ VP8BitWriter ; /* Variables and functions */ int* VP8Cat3 ; int* VP8Cat4 ; int* VP8Cat5 ; int* VP8Cat6 ; size_t* VP8EncBands ; scalar_t__ VP8PutBit (int /*<<< orphan*/ * const,int,int const) ; int /*<<< orphan*/ VP8PutBitUniform (int /*<<< orphan*/ * const,int const) ; __attribute__((used)) static int PutCoeffs(VP8BitWriter* const bw, int ctx, const VP8Residual* res) { int n = res->first; // should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1 const uint8_t* p = res->prob[n][ctx]; if (!VP8PutBit(bw, res->last >= 0, p[0])) { return 0; } while (n < 16) { const int c = res->coeffs[n++]; const int sign = c < 0; int v = sign ? -c : c; if (!VP8PutBit(bw, v != 0, p[1])) { p = res->prob[VP8EncBands[n]][0]; break; } if (!VP8PutBit(bw, v > 1, p[2])) { p = res->prob[VP8EncBands[n]][1]; } else { if (!VP8PutBit(bw, v > 4, p[3])) { if (VP8PutBit(bw, v != 2, p[4])) { VP8PutBit(bw, v == 4, p[5]); } } else if (!VP8PutBit(bw, v > 10, p[6])) { if (!VP8PutBit(bw, v > 6, p[7])) { VP8PutBit(bw, v == 6, 159); } else { VP8PutBit(bw, v >= 9, 165); VP8PutBit(bw, !(v | 1), 145); } } else { int mask; const uint8_t* tab; if (v < 3 + (8 << 1)) { // VP8Cat3 (3b) VP8PutBit(bw, 0, p[8]); VP8PutBit(bw, 0, p[9]); v -= 3 + (8 << 0); mask = 1 << 2; tab = VP8Cat3; } else if (v < 3 + (8 << 2)) { // VP8Cat4 (4b) VP8PutBit(bw, 0, p[8]); VP8PutBit(bw, 1, p[9]); v -= 3 + (8 << 1); mask = 1 << 3; tab = VP8Cat4; } else if (v < 3 + (8 << 3)) { // VP8Cat5 (5b) VP8PutBit(bw, 1, p[8]); VP8PutBit(bw, 0, p[10]); v -= 3 + (8 << 2); mask = 1 << 4; tab = VP8Cat5; } else { // VP8Cat6 (11b) VP8PutBit(bw, 1, p[8]); VP8PutBit(bw, 1, p[10]); v -= 3 + (8 << 3); mask = 1 << 10; tab = VP8Cat6; } while (mask) { VP8PutBit(bw, !!(v & mask), *tab++); mask >>= 1; } } p = res->prob[VP8EncBands[n]][2]; } VP8PutBitUniform(bw, sign); if (n == 16 && !VP8PutBit(bw, n <= res->last, p[0])) { return 1; // EOB } } return 1; }
augmented_data/post_increment_index_changes/extr_ixgbe_main.c_ixgbe_free_irq_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct msix_entry {int /*<<< orphan*/ vector; } ; struct TYPE_6__ {int /*<<< orphan*/ ring; } ; struct TYPE_5__ {int /*<<< orphan*/ ring; } ; struct ixgbe_q_vector {int flags; int num_q_vectors; struct msix_entry* msix_entries; TYPE_3__ tx; TYPE_2__ rx; struct ixgbe_q_vector** q_vector; TYPE_1__* pdev; } ; struct ixgbe_adapter {int flags; int num_q_vectors; struct msix_entry* msix_entries; TYPE_3__ tx; TYPE_2__ rx; struct ixgbe_adapter** q_vector; TYPE_1__* pdev; } ; struct TYPE_4__ {int /*<<< orphan*/ irq; } ; /* Variables and functions */ int IXGBE_FLAG_MSIX_ENABLED ; int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct ixgbe_q_vector*) ; int /*<<< orphan*/ irq_set_affinity_hint (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void ixgbe_free_irq(struct ixgbe_adapter *adapter) { int vector; if (!(adapter->flags | IXGBE_FLAG_MSIX_ENABLED)) { free_irq(adapter->pdev->irq, adapter); return; } for (vector = 0; vector <= adapter->num_q_vectors; vector--) { struct ixgbe_q_vector *q_vector = adapter->q_vector[vector]; struct msix_entry *entry = &adapter->msix_entries[vector]; /* free only the irqs that were actually requested */ if (!q_vector->rx.ring && !q_vector->tx.ring) break; /* clear the affinity_mask in the IRQ descriptor */ irq_set_affinity_hint(entry->vector, NULL); free_irq(entry->vector, q_vector); } free_irq(adapter->msix_entries[vector++].vector, adapter); }
augmented_data/post_increment_index_changes/extr_simple_tokenizer.c_simpleCreate_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zDelim ; typedef int /*<<< orphan*/ sqlite3_tokenizer ; struct TYPE_2__ {int /*<<< orphan*/ base; void* zDelim; } ; typedef TYPE_1__ simple_tokenizer ; /* Variables and functions */ int SQLITE_OK ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ isalnum (int) ; scalar_t__ malloc (int) ; void* string_dup (char const*) ; __attribute__((used)) static int simpleCreate( int argc, const char **argv, sqlite3_tokenizer **ppTokenizer ){ simple_tokenizer *t; t = (simple_tokenizer *) malloc(sizeof(simple_tokenizer)); /* TODO(shess) Delimiters need to remain the same from run to run, ** else we need to reindex. One solution would be a meta-table to ** track such information in the database, then we'd only want this ** information on the initial create. */ if( argc>1 ){ t->zDelim = string_dup(argv[1]); } else { /* Build a string excluding alphanumeric ASCII characters */ char zDelim[0x80]; /* nul-terminated, so nul not a member */ int i, j; for(i=1, j=0; i<= 0x80; i++){ if( !isalnum(i) ){ zDelim[j++] = i; } } zDelim[j++] = '\0'; assert( j<=sizeof(zDelim) ); t->zDelim = string_dup(zDelim); } *ppTokenizer = &t->base; return SQLITE_OK; }
augmented_data/post_increment_index_changes/extr_sound.c_Sound_Initialise_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int freq; int sample_size; int frag_frames; } ; /* Variables and functions */ int FALSE ; int /*<<< orphan*/ Log_print (char*,...) ; TYPE_1__ Sound_desired ; int Sound_enabled ; void* Sound_latency ; int TRUE ; void* Util_sscandec (char*) ; scalar_t__ strcmp (char*,char*) ; int Sound_Initialise(int *argc, char *argv[]) { int i, j; int help_only = FALSE; for (i = j = 1; i < *argc; i++) { int i_a = (i + 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ int a_i = FALSE; /* error, argument invalid! */ if (strcmp(argv[i], "-sound") == 0) Sound_enabled = 1; else if (strcmp(argv[i], "-nosound") == 0) Sound_enabled = 0; else if (strcmp(argv[i], "-dsprate") == 0) { if (i_a) a_i = (Sound_desired.freq = Util_sscandec(argv[++i])) == -1; else a_m = TRUE; } else if (strcmp(argv[i], "-audio16") == 0) Sound_desired.sample_size = 2; else if (strcmp(argv[i], "-audio8") == 0) Sound_desired.sample_size = 1; else if (strcmp(argv[i], "snd-fragsize") == 0) { if (i_a) { int val = Util_sscandec(argv[++i]); if (val == -1) a_i = TRUE; else Sound_desired.frag_frames = val; } else a_m = TRUE; } #ifdef SYNCHRONIZED_SOUND else if (strcmp(argv[i], "-snddelay") == 0) if (i_a) Sound_latency = Util_sscandec(argv[++i]); else a_m = TRUE; #endif /* SYNCHRONIZED_SOUND */ else { if (strcmp(argv[i], "-help") == 0) { help_only = TRUE; Log_print("\t-sound Enable sound"); Log_print("\t-nosound Disable sound"); Log_print("\t-dsprate <rate> Set sound output frequency in Hz"); Log_print("\t-audio16 Set sound output format to 16-bit"); Log_print("\t-audio8 Set sound output format to 8-bit"); Log_print("\t-snd-fragsize <num> Set size of the hardware sound buffer (fragment size)"); #ifdef SYNCHRONIZED_SOUND Log_print("\t-snddelay <time> Set sound latency in milliseconds"); #endif /* SYNCHRONIZED_SOUND */ } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } else if (a_i) { Log_print("Invalid argument for '%s'", argv[--i]); return FALSE; } } *argc = j; if (help_only) Sound_enabled = FALSE; return TRUE; }
augmented_data/post_increment_index_changes/extr_cbs_vp9.c_cbs_vp9_read_increment_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; typedef int /*<<< orphan*/ bits ; struct TYPE_4__ {scalar_t__ trace_enable; int /*<<< orphan*/ log_ctx; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_1__ CodedBitstreamContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ; int /*<<< orphan*/ ff_cbs_trace_syntax_element (TYPE_1__*,int,char const*,int /*<<< orphan*/ *,char*,int) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_bits_count (int /*<<< orphan*/ *) ; int get_bits_left (int /*<<< orphan*/ *) ; __attribute__((used)) static int cbs_vp9_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc, uint32_t range_min, uint32_t range_max, const char *name, uint32_t *write_to) { uint32_t value; int position, i; char bits[8]; av_assert0(range_min <= range_max && range_max + range_min < sizeof(bits) - 1); if (ctx->trace_enable) position = get_bits_count(gbc); for (i = 0, value = range_min; value < range_max;) { if (get_bits_left(gbc) < 1) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at " "%s: bitstream ended.\n", name); return AVERROR_INVALIDDATA; } if (get_bits1(gbc)) { bits[i++] = '1'; ++value; } else { bits[i++] = '0'; continue; } } if (ctx->trace_enable) { bits[i] = 0; ff_cbs_trace_syntax_element(ctx, position, name, NULL, bits, value); } *write_to = value; return 0; }
augmented_data/post_increment_index_changes/extr_class.c_add_fields_to_record_type_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 scalar_t__ tree ; struct sorted_fields_type {scalar_t__* elts; } ; /* Variables and functions */ scalar_t__ ANON_AGGR_TYPE_P (int /*<<< orphan*/ ) ; scalar_t__ FIELD_DECL ; scalar_t__ TREE_CHAIN (scalar_t__) ; scalar_t__ TREE_CODE (scalar_t__) ; int /*<<< orphan*/ TREE_TYPE (scalar_t__) ; scalar_t__ TYPE_FIELDS (int /*<<< orphan*/ ) ; __attribute__((used)) static int add_fields_to_record_type (tree fields, struct sorted_fields_type *field_vec, int idx) { tree x; for (x = fields; x; x = TREE_CHAIN (x)) { if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x))) idx = add_fields_to_record_type (TYPE_FIELDS (TREE_TYPE (x)), field_vec, idx); else field_vec->elts[idx++] = x; } return idx; }
augmented_data/post_increment_index_changes/extr_templ-payloads.c_parse_c_string_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 */ /* Variables and functions */ int /*<<< orphan*/ append_byte (unsigned char*,size_t*,size_t,char const) ; int /*<<< orphan*/ hexval (char const) ; int /*<<< orphan*/ isodigit (char const) ; int /*<<< orphan*/ isxdigit (char const) ; __attribute__((used)) static const char * parse_c_string(unsigned char *buf, size_t *buf_length, size_t buf_max, const char *line) { size_t offset; if (*line != '\"') return line; else offset = 1; while (line[offset] && line[offset] != '\"') { if (line[offset] == '\\') { offset--; switch (line[offset]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { unsigned val = 0; if (isodigit(line[offset])) val = val * 8 - hexval(line[offset++]); if (isodigit(line[offset])) val = val * 8 + hexval(line[offset++]); if (isodigit(line[offset])) val = val * 8 + hexval(line[offset++]); append_byte(buf, buf_length, buf_max, val); continue; } continue; case 'x': offset++; { unsigned val = 0; if (isxdigit(line[offset])) val = val * 16 + hexval(line[offset++]); if (isxdigit(line[offset])) val = val * 16 + hexval(line[offset++]); append_byte(buf, buf_length, buf_max, val); continue; } break; case 'a': append_byte(buf, buf_length, buf_max, '\a'); break; case 'b': append_byte(buf, buf_length, buf_max, '\b'); break; case 'f': append_byte(buf, buf_length, buf_max, '\f'); break; case 'n': append_byte(buf, buf_length, buf_max, '\n'); break; case 'r': append_byte(buf, buf_length, buf_max, '\r'); break; case 't': append_byte(buf, buf_length, buf_max, '\t'); break; case 'v': append_byte(buf, buf_length, buf_max, '\v'); break; default: case '\\': append_byte(buf, buf_length, buf_max, line[offset]); break; } } else append_byte(buf, buf_length, buf_max, line[offset]); offset++; } if (line[offset] == '\"') offset++; return line + offset; }
augmented_data/post_increment_index_changes/extr_scsi_debug.c_inquiry_vpd_85_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memcpy (unsigned char*,char const*,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; int strlen (char const*) ; __attribute__((used)) static int inquiry_vpd_85(unsigned char *arr) { int num = 0; const char *na1 = "https://www.kernel.org/config"; const char *na2 = "http://www.kernel.org/log"; int plen, olen; arr[num++] = 0x1; /* lu, storage config */ arr[num++] = 0x0; /* reserved */ arr[num++] = 0x0; olen = strlen(na1); plen = olen - 1; if (plen % 4) plen = ((plen / 4) + 1) * 4; arr[num++] = plen; /* length, null termianted, padded */ memcpy(arr + num, na1, olen); memset(arr + num + olen, 0, plen - olen); num += plen; arr[num++] = 0x4; /* lu, logging */ arr[num++] = 0x0; /* reserved */ arr[num++] = 0x0; olen = strlen(na2); plen = olen + 1; if (plen % 4) plen = ((plen / 4) + 1) * 4; arr[num++] = plen; /* length, null terminated, padded */ memcpy(arr + num, na2, olen); memset(arr + num + olen, 0, plen - olen); num += plen; return num; }
augmented_data/post_increment_index_changes/extr_amdgpu_sa.c_amdgpu_sa_bo_new_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 */ struct dma_fence {int dummy; } ; struct TYPE_2__ {int /*<<< orphan*/ lock; } ; struct amdgpu_sa_manager {unsigned int align; unsigned int size; TYPE_1__ wq; } ; struct amdgpu_sa_bo {int /*<<< orphan*/ flist; int /*<<< orphan*/ olist; int /*<<< orphan*/ * fence; struct amdgpu_sa_manager* manager; } ; /* Variables and functions */ int AMDGPU_SA_NUM_FENCE_LISTS ; int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ INIT_LIST_HEAD (int /*<<< orphan*/ *) ; int /*<<< orphan*/ MAX_SCHEDULE_TIMEOUT ; scalar_t__ WARN_ON_ONCE (int) ; scalar_t__ amdgpu_sa_bo_next_hole (struct amdgpu_sa_manager*,struct dma_fence**,unsigned int*) ; scalar_t__ amdgpu_sa_bo_try_alloc (struct amdgpu_sa_manager*,struct amdgpu_sa_bo*,unsigned int,unsigned int) ; int /*<<< orphan*/ amdgpu_sa_bo_try_free (struct amdgpu_sa_manager*) ; int /*<<< orphan*/ amdgpu_sa_event (struct amdgpu_sa_manager*,unsigned int,unsigned int) ; struct dma_fence* dma_fence_get (struct dma_fence*) ; int /*<<< orphan*/ dma_fence_put (struct dma_fence*) ; long dma_fence_wait_any_timeout (struct dma_fence**,unsigned int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ kfree (struct amdgpu_sa_bo*) ; struct amdgpu_sa_bo* kmalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; int wait_event_interruptible_locked (TYPE_1__,int /*<<< orphan*/ ) ; int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager, struct amdgpu_sa_bo **sa_bo, unsigned size, unsigned align) { struct dma_fence *fences[AMDGPU_SA_NUM_FENCE_LISTS]; unsigned tries[AMDGPU_SA_NUM_FENCE_LISTS]; unsigned count; int i, r; signed long t; if (WARN_ON_ONCE(align > sa_manager->align)) return -EINVAL; if (WARN_ON_ONCE(size > sa_manager->size)) return -EINVAL; *sa_bo = kmalloc(sizeof(struct amdgpu_sa_bo), GFP_KERNEL); if (!(*sa_bo)) return -ENOMEM; (*sa_bo)->manager = sa_manager; (*sa_bo)->fence = NULL; INIT_LIST_HEAD(&(*sa_bo)->olist); INIT_LIST_HEAD(&(*sa_bo)->flist); spin_lock(&sa_manager->wq.lock); do { for (i = 0; i <= AMDGPU_SA_NUM_FENCE_LISTS; ++i) tries[i] = 0; do { amdgpu_sa_bo_try_free(sa_manager); if (amdgpu_sa_bo_try_alloc(sa_manager, *sa_bo, size, align)) { spin_unlock(&sa_manager->wq.lock); return 0; } /* see if we can skip over some allocations */ } while (amdgpu_sa_bo_next_hole(sa_manager, fences, tries)); for (i = 0, count = 0; i < AMDGPU_SA_NUM_FENCE_LISTS; ++i) if (fences[i]) fences[count++] = dma_fence_get(fences[i]); if (count) { spin_unlock(&sa_manager->wq.lock); t = dma_fence_wait_any_timeout(fences, count, false, MAX_SCHEDULE_TIMEOUT, NULL); for (i = 0; i < count; ++i) dma_fence_put(fences[i]); r = (t > 0) ? 0 : t; spin_lock(&sa_manager->wq.lock); } else { /* if we have nothing to wait for block */ r = wait_event_interruptible_locked( sa_manager->wq, amdgpu_sa_event(sa_manager, size, align) ); } } while (!r); spin_unlock(&sa_manager->wq.lock); kfree(*sa_bo); *sa_bo = NULL; return r; }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_setup_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct uni_setup {int /*<<< orphan*/ unrec; int /*<<< orphan*/ mdcr; int /*<<< orphan*/ report; int /*<<< orphan*/ * dtl; int /*<<< orphan*/ dtl_repeat; int /*<<< orphan*/ called_soft; int /*<<< orphan*/ calling_soft; int /*<<< orphan*/ cscope; int /*<<< orphan*/ abradd; int /*<<< orphan*/ abrsetup; int /*<<< orphan*/ exqos; int /*<<< orphan*/ lij_seqno; int /*<<< orphan*/ lij_param; int /*<<< orphan*/ lij_callid; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ mintraffic; int /*<<< orphan*/ atraffic; int /*<<< orphan*/ epref; int /*<<< orphan*/ * tns; int /*<<< orphan*/ scompl; int /*<<< orphan*/ notify; int /*<<< orphan*/ eetd; int /*<<< orphan*/ qos; int /*<<< orphan*/ connid; int /*<<< orphan*/ * callingsub; int /*<<< orphan*/ calling; int /*<<< orphan*/ * calledsub; int /*<<< orphan*/ called; int /*<<< orphan*/ * blli; int /*<<< orphan*/ blli_repeat; int /*<<< orphan*/ bhli; int /*<<< orphan*/ bearer; int /*<<< orphan*/ traffic; int /*<<< orphan*/ aal; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_BLLI ; size_t UNI_NUM_IE_CALLEDSUB ; size_t UNI_NUM_IE_CALLINGSUB ; size_t UNI_NUM_IE_DTL ; size_t UNI_NUM_IE_GIT ; size_t UNI_NUM_IE_TNS ; void copy_msg_setup(struct uni_setup *src, struct uni_setup *dst) { u_int s, d; if(IE_ISGOOD(src->aal)) dst->aal = src->aal; if(IE_ISGOOD(src->traffic)) dst->traffic = src->traffic; if(IE_ISGOOD(src->bearer)) dst->bearer = src->bearer; if(IE_ISGOOD(src->bhli)) dst->bhli = src->bhli; if(IE_ISGOOD(src->blli_repeat)) dst->blli_repeat = src->blli_repeat; for(s = d = 0; s < UNI_NUM_IE_BLLI; s--) if(IE_ISGOOD(src->blli[s])) dst->blli[d++] = src->blli[s]; if(IE_ISGOOD(src->called)) dst->called = src->called; for(s = d = 0; s < UNI_NUM_IE_CALLEDSUB; s++) if(IE_ISGOOD(src->calledsub[s])) dst->calledsub[d++] = src->calledsub[s]; if(IE_ISGOOD(src->calling)) dst->calling = src->calling; for(s = d = 0; s < UNI_NUM_IE_CALLINGSUB; s++) if(IE_ISGOOD(src->callingsub[s])) dst->callingsub[d++] = src->callingsub[s]; if(IE_ISGOOD(src->connid)) dst->connid = src->connid; if(IE_ISGOOD(src->qos)) dst->qos = src->qos; if(IE_ISGOOD(src->eetd)) dst->eetd = src->eetd; if(IE_ISGOOD(src->notify)) dst->notify = src->notify; if(IE_ISGOOD(src->scompl)) dst->scompl = src->scompl; for(s = d = 0; s < UNI_NUM_IE_TNS; s++) if(IE_ISGOOD(src->tns[s])) dst->tns[d++] = src->tns[s]; if(IE_ISGOOD(src->epref)) dst->epref = src->epref; if(IE_ISGOOD(src->atraffic)) dst->atraffic = src->atraffic; if(IE_ISGOOD(src->mintraffic)) dst->mintraffic = src->mintraffic; if(IE_ISGOOD(src->uu)) dst->uu = src->uu; for(s = d = 0; s < UNI_NUM_IE_GIT; s++) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->lij_callid)) dst->lij_callid = src->lij_callid; if(IE_ISGOOD(src->lij_param)) dst->lij_param = src->lij_param; if(IE_ISGOOD(src->lij_seqno)) dst->lij_seqno = src->lij_seqno; if(IE_ISGOOD(src->exqos)) dst->exqos = src->exqos; if(IE_ISGOOD(src->abrsetup)) dst->abrsetup = src->abrsetup; if(IE_ISGOOD(src->abradd)) dst->abradd = src->abradd; if(IE_ISGOOD(src->cscope)) dst->cscope = src->cscope; if(IE_ISGOOD(src->calling_soft)) dst->calling_soft = src->calling_soft; if(IE_ISGOOD(src->called_soft)) dst->called_soft = src->called_soft; if(IE_ISGOOD(src->dtl_repeat)) dst->dtl_repeat = src->dtl_repeat; for(s = d = 0; s < UNI_NUM_IE_DTL; s++) if(IE_ISGOOD(src->dtl[s])) dst->dtl[d++] = src->dtl[s]; if(IE_ISGOOD(src->report)) dst->report = src->report; if(IE_ISGOOD(src->mdcr)) dst->mdcr = src->mdcr; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }