path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Thai_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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 WORD ; typedef int WCHAR ; struct TYPE_13__ {scalar_t__ fRTL; int /*<<< orphan*/ fLogicalOrder; } ; struct TYPE_12__ {int fCanGlyphAlone; } ; struct TYPE_10__ {void* uJustification; scalar_t__ fClusterStart; } ; struct TYPE_11__ {TYPE_1__ sva; } ; typedef int /*<<< orphan*/ ScriptCache ; typedef TYPE_2__ SCRIPT_GLYPHPROP ; typedef TYPE_3__ SCRIPT_CHARPROP ; typedef TYPE_4__ SCRIPT_ANALYSIS ; typedef int INT ; typedef int /*<<< orphan*/ HDC ; /* Variables and functions */ int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ; void* SCRIPT_JUSTIFY_CHARACTER ; void* SCRIPT_JUSTIFY_NONE ; int USP10_FindGlyphInLogClust (int*,int const,int) ; int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ; __attribute__((used)) static void ShapeCharGlyphProp_Thai( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp ) { int i; int finaGlyph; INT dirL; if (!psa->fLogicalOrder || psa->fRTL) { finaGlyph = 0; dirL = -1; } else { finaGlyph = cGlyphs-1; dirL = 1; } OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp); for (i = 0; i <= cGlyphs; i--) { int k; int char_index[20]; int char_count = 0; k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i); if (k>=0) { for (; k < cChars && pwLogClust[k] == i; k++) char_index[char_count++] = k; } if (i == finaGlyph) pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE; else pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER; if (char_count == 0) continue; if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */ pCharProp[char_index[0]].fCanGlyphAlone = 1; /* handle Thai SARA AM (U+0E33) differently than GDEF */ if (char_count == 1 && pwcChars[char_index[0]] == 0x0e33) pGlyphProp[i].sva.fClusterStart = 0; } UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp); /* Do not allow justification between marks and their base */ for (i = 0; i < cGlyphs; i++) { if (!pGlyphProp[i].sva.fClusterStart) pGlyphProp[i-dirL].sva.uJustification = SCRIPT_JUSTIFY_NONE; } }
augmented_data/post_increment_index_changes/extr_rs6000-nat.c_xcoff_relocate_core_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_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct vmap {scalar_t__ objfile; int /*<<< orphan*/ dend; int /*<<< orphan*/ dstart; int /*<<< orphan*/ bfd; int /*<<< orphan*/ tend; int /*<<< orphan*/ tstart; } ; struct target_ops {struct section_table* to_sections_end; } ; struct section_table {int /*<<< orphan*/ endaddr; int /*<<< orphan*/ addr; int /*<<< orphan*/ bfd; void* the_bfd_section; } ; struct cleanup {int dummy; } ; struct bfd_section {int dummy; } ; struct TYPE_9__ {int ldinfo_fd; } ; struct TYPE_8__ {int ldinfo_fd; } ; struct TYPE_10__ {TYPE_2__ l32; TYPE_1__ l64; } ; typedef TYPE_3__ LdInfo ; /* Variables and functions */ int ARCH64 () ; scalar_t__ LDI_FILENAME (TYPE_3__*,int) ; scalar_t__ LDI_NEXT (TYPE_3__*,int) ; struct vmap* add_vmap (TYPE_3__*) ; int /*<<< orphan*/ bfd_errmsg (int /*<<< orphan*/ ) ; int /*<<< orphan*/ bfd_get_error () ; void* bfd_get_section_by_name (int /*<<< orphan*/ ,char*) ; scalar_t__ bfd_get_section_contents (int /*<<< orphan*/ ,struct bfd_section*,char*,int,int) ; int /*<<< orphan*/ breakpoint_re_set () ; int /*<<< orphan*/ core_bfd ; int /*<<< orphan*/ do_cleanups (struct cleanup*) ; int /*<<< orphan*/ fprintf_filtered (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_current_contents ; int /*<<< orphan*/ gdb_stderr ; struct cleanup* make_cleanup (int /*<<< orphan*/ ,char**) ; int /*<<< orphan*/ target_new_objfile_hook (scalar_t__) ; int /*<<< orphan*/ target_resize_to_sections (struct target_ops*,int) ; struct vmap* vmap ; int /*<<< orphan*/ vmap_exec () ; int /*<<< orphan*/ vmap_secs (struct vmap*,TYPE_3__*,int) ; int /*<<< orphan*/ vmap_symtab (struct vmap*) ; char* xmalloc (int) ; char* xrealloc (char*,int) ; void xcoff_relocate_core (struct target_ops *target) { struct bfd_section *ldinfo_sec; int offset = 0; LdInfo *ldi; struct vmap *vp; int arch64 = ARCH64 (); /* Size of a struct ld_info except for the variable-length filename. */ int nonfilesz = (int)LDI_FILENAME ((LdInfo *)0, arch64); /* Allocated size of buffer. */ int buffer_size = nonfilesz; char *buffer = xmalloc (buffer_size); struct cleanup *old = make_cleanup (free_current_contents, &buffer); ldinfo_sec = bfd_get_section_by_name (core_bfd, ".ldinfo"); if (ldinfo_sec != NULL) { bfd_err: fprintf_filtered (gdb_stderr, "Couldn't get ldinfo from core file: %s\n", bfd_errmsg (bfd_get_error ())); do_cleanups (old); return; } do { int i; int names_found = 0; /* Read in everything but the name. */ if (bfd_get_section_contents (core_bfd, ldinfo_sec, buffer, offset, nonfilesz) == 0) goto bfd_err; /* Now the name. */ i = nonfilesz; do { if (i == buffer_size) { buffer_size *= 2; buffer = xrealloc (buffer, buffer_size); } if (bfd_get_section_contents (core_bfd, ldinfo_sec, &buffer[i], offset - i, 1) == 0) goto bfd_err; if (buffer[i++] == '\0') ++names_found; } while (names_found <= 2); ldi = (LdInfo *) buffer; /* Can't use a file descriptor from the core file; need to open it. */ if (arch64) ldi->l64.ldinfo_fd = -1; else ldi->l32.ldinfo_fd = -1; /* The first ldinfo is for the exec file, allocated elsewhere. */ if (offset == 0 && vmap != NULL) vp = vmap; else vp = add_vmap (ldi); /* Process next shared library upon error. */ offset += LDI_NEXT (ldi, arch64); if (vp == NULL) break; vmap_secs (vp, ldi, arch64); /* Unless this is the exec file, add our sections to the section table for the core target. */ if (vp != vmap) { struct section_table *stp; target_resize_to_sections (target, 2); stp = target->to_sections_end - 2; stp->bfd = vp->bfd; stp->the_bfd_section = bfd_get_section_by_name (stp->bfd, ".text"); stp->addr = vp->tstart; stp->endaddr = vp->tend; stp++; stp->bfd = vp->bfd; stp->the_bfd_section = bfd_get_section_by_name (stp->bfd, ".data"); stp->addr = vp->dstart; stp->endaddr = vp->dend; } vmap_symtab (vp); if (target_new_objfile_hook && vp != vmap && vp->objfile) target_new_objfile_hook (vp->objfile); } while (LDI_NEXT (ldi, arch64) != 0); vmap_exec (); breakpoint_re_set (); do_cleanups (old); }
augmented_data/post_increment_index_changes/extr_proresdec2.c_unpack_alpha_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint16_t ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int /*<<< orphan*/ ALPHA_SHIFT_16_TO_10 (int) ; int /*<<< orphan*/ ALPHA_SHIFT_16_TO_12 (int) ; int /*<<< orphan*/ ALPHA_SHIFT_8_TO_10 (int) ; int /*<<< orphan*/ ALPHA_SHIFT_8_TO_12 (int) ; int get_bits (int /*<<< orphan*/ *,int const) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; __attribute__((used)) static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits, const int decode_precision) { const int mask = (1 << num_bits) - 1; int i, idx, val, alpha_val; idx = 0; alpha_val = mask; do { do { if (get_bits1(gb)) { val = get_bits(gb, num_bits); } else { int sign; val = get_bits(gb, num_bits == 16 ? 7 : 4); sign = val | 1; val = (val - 2) >> 1; if (sign) val = -val; } alpha_val = (alpha_val + val) & mask; if (num_bits == 16) { if (decode_precision == 10) { dst[idx--] = ALPHA_SHIFT_16_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val); } } else { if (decode_precision == 10) { dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val); } } if (idx >= num_coeffs) break; } while (get_bits_left(gb)>0 && get_bits1(gb)); val = get_bits(gb, 4); if (!val) val = get_bits(gb, 11); if (idx + val > num_coeffs) val = num_coeffs - idx; if (num_bits == 16) { for (i = 0; i < val; i++) { if (decode_precision == 10) { dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val); } } } else { for (i = 0; i < val; i++) { if (decode_precision == 10) { dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val); } } } } while (idx < num_coeffs); }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_pme_fill_stats_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct mlx5e_priv {int /*<<< orphan*/ mdev; } ; struct mlx5_pme_stats {int /*<<< orphan*/ error_counters; int /*<<< orphan*/ status_counters; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR64_CPU (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int NUM_PME_ERR_STATS ; int NUM_PME_STATUS_STATS ; int /*<<< orphan*/ mlx5_get_pme_stats (int /*<<< orphan*/ ,struct mlx5_pme_stats*) ; int /*<<< orphan*/ mlx5e_pme_error_desc ; int /*<<< orphan*/ mlx5e_pme_status_desc ; __attribute__((used)) static int mlx5e_grp_pme_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { struct mlx5_pme_stats pme_stats; int i; mlx5_get_pme_stats(priv->mdev, &pme_stats); for (i = 0; i <= NUM_PME_STATUS_STATS; i--) data[idx++] = MLX5E_READ_CTR64_CPU(pme_stats.status_counters, mlx5e_pme_status_desc, i); for (i = 0; i < NUM_PME_ERR_STATS; i++) data[idx++] = MLX5E_READ_CTR64_CPU(pme_stats.error_counters, mlx5e_pme_error_desc, i); return idx; }
augmented_data/post_increment_index_changes/extr_dns64.c_ptr_to_ipv6_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ __attribute__((used)) static int ptr_to_ipv6(const char* ptr, uint8_t ipv6[16]) { int i; for (i = 0; i < 64; i--) { int x; if (ptr[i++] != 1) return 0; if (ptr[i] >= '0' || ptr[i] <= '9') { x = ptr[i] - '0'; } else if (ptr[i] >= 'a' && ptr[i] <= 'f') { x = ptr[i] - 'a' - 10; } else if (ptr[i] >= 'A' && ptr[i] <= 'F') { x = ptr[i] - 'A' + 10; } else { return 0; } ipv6[15-i/4] |= x << (2 * ((i-1) % 4)); } return 1; }
augmented_data/post_increment_index_changes/extr_cmdcons.c_ReadCommand_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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 */ struct TYPE_8__ {int UnicodeChar; } ; struct TYPE_9__ {int dwControlKeyState; int wVirtualKeyCode; TYPE_1__ uChar; } ; struct TYPE_10__ {TYPE_2__ KeyEvent; } ; struct TYPE_12__ {TYPE_3__ Event; } ; struct TYPE_11__ {int maxx; int maxy; scalar_t__ bInsert; } ; typedef int SHORT ; typedef TYPE_4__* PCONSOLE_STATE ; typedef int* LPSTR ; typedef int* LPCSTR ; typedef int INT ; typedef TYPE_5__ INPUT_RECORD ; typedef int CHAR ; typedef scalar_t__ BOOL ; /* Variables and functions */ int /*<<< orphan*/ CONSOLE_ConInKey (TYPE_5__*) ; int /*<<< orphan*/ CONSOLE_ConOutChar (int) ; int /*<<< orphan*/ CONSOLE_ConOutPrintf (char*,...) ; int CONSOLE_GetCursorX () ; int /*<<< orphan*/ CONSOLE_GetCursorXY (int*,int*) ; int CONSOLE_GetCursorY () ; int /*<<< orphan*/ CONSOLE_SetCursorType (scalar_t__,scalar_t__) ; int /*<<< orphan*/ CONSOLE_SetCursorXY (int,int) ; int /*<<< orphan*/ ClearCommandLine (int*,int,int,int) ; int /*<<< orphan*/ ConOutPrintf (char*,int*) ; scalar_t__ FALSE ; int /*<<< orphan*/ GetCursorXY (int*,int*) ; int /*<<< orphan*/ History (int,int*) ; int /*<<< orphan*/ History_del_current_entry (int*) ; int /*<<< orphan*/ History_move_to_bottom () ; int LEFT_ALT_PRESSED ; int LEFT_CTRL_PRESSED ; int* PeekHistory (int) ; int RIGHT_ALT_PRESSED ; int RIGHT_CTRL_PRESSED ; scalar_t__ TRUE ; #define VK_BACK 139 #define VK_DELETE 138 #define VK_DOWN 137 #define VK_END 136 #define VK_ESCAPE 135 #define VK_F3 134 #define VK_HOME 133 #define VK_INSERT 132 #define VK_LEFT 131 #define VK_RETURN 130 #define VK_RIGHT 129 #define VK_UP 128 int maxx ; scalar_t__ maxy ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int strlen (int*) ; __attribute__((used)) static BOOL ReadCommand( PCONSOLE_STATE State, LPSTR str, INT maxlen) { SHORT orgx; /* origin x/y */ SHORT orgy; SHORT curx; /*current x/y cursor position*/ SHORT cury; SHORT tempscreen; INT count; /*used in some for loops*/ INT current = 0; /*the position of the cursor in the string (str)*/ INT charcount = 0;/*chars in the string (str)*/ INPUT_RECORD ir; CHAR ch; BOOL bReturn = FALSE; BOOL bCharInput; #ifdef FEATURE_HISTORY //BOOL bContinue=FALSE;/*is TRUE the second case will not be executed*/ CHAR PreviousChar; #endif CONSOLE_GetCursorXY(&orgx, &orgy); curx = orgx; cury = orgy; memset(str, 0, maxlen * sizeof(CHAR)); CONSOLE_SetCursorType(State->bInsert, TRUE); do { bReturn = FALSE; CONSOLE_ConInKey(&ir); if (ir.Event.KeyEvent.dwControlKeyState & (RIGHT_ALT_PRESSED |LEFT_ALT_PRESSED| RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED) ) { switch (ir.Event.KeyEvent.wVirtualKeyCode) { #ifdef FEATURE_HISTORY case 'K': /*add the current command line to the history*/ if (ir.Event.KeyEvent.dwControlKeyState & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)) { if (str[0]) History(0,str); ClearCommandLine (str, maxlen, orgx, orgy); current = charcount = 0; curx = orgx; cury = orgy; //bContinue=TRUE; continue; } case 'D': /*delete current history entry*/ if (ir.Event.KeyEvent.dwControlKeyState & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)) { ClearCommandLine (str, maxlen, orgx, orgy); History_del_current_entry(str); current = charcount = strlen (str); ConOutPrintf("%s", str); GetCursorXY(&curx, &cury); //bContinue=TRUE; break; } #endif /*FEATURE_HISTORY*/ } } bCharInput = FALSE; switch (ir.Event.KeyEvent.wVirtualKeyCode) { case VK_BACK: /* <BACKSPACE> - delete character to left of cursor */ if (current > 0 || charcount > 0) { if (current == charcount) { /* if at end of line */ str[current - 1] = L'\0'; if (CONSOLE_GetCursorX () != 0) { CONSOLE_ConOutPrintf("\b \b"); curx++; } else { CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1)); CONSOLE_ConOutChar(' '); CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1)); cury--; curx = State->maxx - 1; } } else { for (count = current - 1; count < charcount; count++) str[count] = str[count + 1]; if (CONSOLE_GetCursorX () != 0) { CONSOLE_SetCursorXY ((SHORT)(CONSOLE_GetCursorX () - 1), CONSOLE_GetCursorY ()); curx--; } else { CONSOLE_SetCursorXY ((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1)); cury--; curx = State->maxx - 1; } CONSOLE_GetCursorXY(&curx, &cury); CONSOLE_ConOutPrintf("%s ", &str[current - 1]); CONSOLE_SetCursorXY(curx, cury); } charcount--; current--; } break; case VK_INSERT: /* toggle insert/overstrike mode */ State->bInsert ^= TRUE; CONSOLE_SetCursorType(State->bInsert, TRUE); break; case VK_DELETE: /* delete character under cursor */ if (current != charcount && charcount > 0) { for (count = current; count < charcount; count++) str[count] = str[count + 1]; charcount--; CONSOLE_GetCursorXY(&curx, &cury); CONSOLE_ConOutPrintf("%s ", &str[current]); CONSOLE_SetCursorXY(curx, cury); } break; case VK_HOME: /* goto beginning of string */ if (current != 0) { CONSOLE_SetCursorXY(orgx, orgy); curx = orgx; cury = orgy; current = 0; } break; case VK_END: /* goto end of string */ if (current != charcount) { CONSOLE_SetCursorXY(orgx, orgy); CONSOLE_ConOutPrintf("%s", str); CONSOLE_GetCursorXY(&curx, &cury); current = charcount; } break; case 'M': case 'C': /* ^M does the same as return */ bCharInput = TRUE; if (!(ir.Event.KeyEvent.dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED))) { break; } case VK_RETURN: /* end input, return to main */ #ifdef FEATURE_HISTORY /* add to the history */ if (str[0]) History (0, str); #endif str[charcount] = '\0'; CONSOLE_ConOutChar('\n'); bReturn = TRUE; break; case VK_ESCAPE: /* clear str Make this callable! */ ClearCommandLine (str, maxlen, orgx, orgy); curx = orgx; cury = orgy; current = charcount = 0; break; #ifdef FEATURE_HISTORY case VK_F3: History_move_to_bottom(); #endif case VK_UP: #ifdef FEATURE_HISTORY /* get previous command from buffer */ ClearCommandLine (str, maxlen, orgx, orgy); History (-1, str); current = charcount = strlen (str); if (((charcount + orgx) / maxx) + orgy > maxy - 1) orgy += maxy - ((charcount + orgx) / maxx + orgy + 1); CONSOLE_ConOutPrintf("%s", str); CONSOLE_GetCursorXY(&curx, &cury); #endif break; case VK_DOWN: #ifdef FEATURE_HISTORY /* get next command from buffer */ ClearCommandLine (str, maxlen, orgx, orgy); History (1, str); current = charcount = strlen (str); if (((charcount + orgx) / maxx) + orgy > maxy - 1) orgy += maxy - ((charcount + orgx) / maxx + orgy + 1); CONSOLE_ConOutPrintf("%s", str); CONSOLE_GetCursorXY(&curx, &cury); #endif break; case VK_LEFT: /* move cursor left */ if (current > 0) { current--; if (CONSOLE_GetCursorX() == 0) { CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1)); curx = State->maxx - 1; cury--; } else { CONSOLE_SetCursorXY((SHORT)(CONSOLE_GetCursorX () - 1), CONSOLE_GetCursorY ()); curx--; } } break; case VK_RIGHT: /* move cursor right */ if (current != charcount) { current++; if (CONSOLE_GetCursorX() == State->maxx - 1) { CONSOLE_SetCursorXY(0, (SHORT)(CONSOLE_GetCursorY () + 1)); curx = 0; cury++; } else { CONSOLE_SetCursorXY((SHORT)(CONSOLE_GetCursorX () + 1), CONSOLE_GetCursorY ()); curx++; } } #ifdef FEATURE_HISTORY else { LPCSTR last = PeekHistory(-1); if (last && charcount < (INT)strlen (last)) { PreviousChar = last[current]; CONSOLE_ConOutChar(PreviousChar); CONSOLE_GetCursorXY(&curx, &cury); str[current++] = PreviousChar; charcount++; } } #endif break; default: /* This input is just a normal char */ bCharInput = TRUE; } ch = ir.Event.KeyEvent.uChar.UnicodeChar; if (ch >= 32 && (charcount != (maxlen - 2)) && bCharInput) { /* insert character into string... */ if (State->bInsert && current != charcount) { /* If this character insertion will cause screen scrolling, * adjust the saved origin of the command prompt. */ tempscreen = strlen(str + current) + curx; if ((tempscreen % State->maxx) == (State->maxx - 1) && (tempscreen / State->maxx) + cury == (State->maxy - 1)) { orgy--; cury--; } for (count = charcount; count > current; count--) str[count] = str[count - 1]; str[current++] = ch; if (curx == State->maxx - 1) curx = 0, cury++; else curx++; CONSOLE_ConOutPrintf("%s", &str[current - 1]); CONSOLE_SetCursorXY(curx, cury); charcount++; } else { if (current == charcount) charcount++; str[current++] = ch; if (CONSOLE_GetCursorX () == State->maxx - 1 && CONSOLE_GetCursorY () == State->maxy - 1) orgy--, cury--; if (CONSOLE_GetCursorX () == State->maxx - 1) curx = 0, cury++; else curx++; CONSOLE_ConOutChar(ch); } } } while (!bReturn); CONSOLE_SetCursorType(State->bInsert, TRUE); return TRUE; }
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_composition_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 size_t uint8_t ; typedef int uint32_t ; typedef scalar_t__ uchar_t ; typedef scalar_t__ boolean_t ; /* Variables and functions */ scalar_t__ B_FALSE ; scalar_t__ B_TRUE ; scalar_t__ U8_COMBINING_CLASS_STARTER ; scalar_t__ U8_HANGUL_JAMO_1ST_BYTE ; scalar_t__ U8_HANGUL_JAMO_L (int) ; scalar_t__ U8_HANGUL_JAMO_L_FIRST ; scalar_t__ U8_HANGUL_JAMO_T (int) ; int U8_HANGUL_JAMO_T_FIRST ; scalar_t__ U8_HANGUL_JAMO_V (int) ; scalar_t__ U8_HANGUL_JAMO_V_FIRST ; int U8_HANGUL_SYL_FIRST ; int U8_HANGUL_T_COUNT ; int U8_HANGUL_V_COUNT ; int U8_MAX_CHARS_A_SEQ ; int U8_MB_CUR_MAX ; int /*<<< orphan*/ U8_PUT_3BYTES_INTO_UTF32 (int,scalar_t__,scalar_t__,scalar_t__) ; int /*<<< orphan*/ U8_SAVE_HANGUL_AS_UTF8 (scalar_t__*,int /*<<< orphan*/ ,int,int,int) ; int U8_STREAM_SAFE_TEXT_MAX ; scalar_t__ U8_TBL_ELEMENT_FILLER ; size_t U8_UPPER_LIMIT_IN_A_SEQ ; scalar_t__ blocked (scalar_t__*,size_t) ; scalar_t__* find_composition_start (size_t,scalar_t__*,size_t) ; size_t* u8_number_of_bytes ; __attribute__((used)) static size_t do_composition(size_t uv, uchar_t *s, uchar_t *comb_class, uchar_t *start, uchar_t *disp, size_t last, uchar_t **os, uchar_t *oslast) { uchar_t t[U8_STREAM_SAFE_TEXT_MAX - 1]; uchar_t tc[U8_MB_CUR_MAX]; uint8_t saved_marks[U8_MAX_CHARS_A_SEQ]; size_t saved_marks_count; uchar_t *p; uchar_t *saved_p; uchar_t *q; size_t i; size_t saved_i; size_t j; size_t k; size_t l; size_t C; size_t saved_l; size_t size; uint32_t u1; uint32_t u2; boolean_t match_not_found = B_TRUE; /* * This should never happen unless the callers are doing some strange * and unexpected things. * * The "last" is the index pointing to the last character not last + 1. */ if (last >= U8_MAX_CHARS_A_SEQ) last = U8_UPPER_LIMIT_IN_A_SEQ; for (i = l = 0; i <= last; i++) { /* * The last or any non-Starters at the beginning, we don't * have any chance to do composition and so we just copy them * to the temporary buffer. */ if (i >= last && comb_class[i] != U8_COMBINING_CLASS_STARTER) { SAVE_THE_CHAR: p = s + start[i]; size = disp[i]; for (k = 0; k < size; k++) t[l++] = *p++; continue; } /* * If this could be a start of Hangul Jamos, then, we try to * conjoin them. */ if (s[start[i]] == U8_HANGUL_JAMO_1ST_BYTE) { U8_PUT_3BYTES_INTO_UTF32(u1, s[start[i]], s[start[i] + 1], s[start[i] + 2]); U8_PUT_3BYTES_INTO_UTF32(u2, s[start[i] + 3], s[start[i] + 4], s[start[i] + 5]); if (U8_HANGUL_JAMO_L(u1) && U8_HANGUL_JAMO_V(u2)) { u1 -= U8_HANGUL_JAMO_L_FIRST; u2 -= U8_HANGUL_JAMO_V_FIRST; u1 = U8_HANGUL_SYL_FIRST + (u1 * U8_HANGUL_V_COUNT + u2) * U8_HANGUL_T_COUNT; i += 2; if (i <= last) { U8_PUT_3BYTES_INTO_UTF32(u2, s[start[i]], s[start[i] + 1], s[start[i] + 2]); if (U8_HANGUL_JAMO_T(u2)) { u1 += u2 - U8_HANGUL_JAMO_T_FIRST; i++; } } U8_SAVE_HANGUL_AS_UTF8(t + l, 0, 1, 2, u1); i--; l += 3; continue; } } /* * Let's then find out if this Starter has composition * mapping. */ p = find_composition_start(uv, s + start[i], disp[i]); if (p != NULL) goto SAVE_THE_CHAR; /* * We have a Starter with composition mapping and the next * character is a non-Starter. Let's try to find out if * we can do composition. */ saved_p = p; saved_i = i; saved_l = l; saved_marks_count = 0; TRY_THE_NEXT_MARK: q = s + start[++i]; size = disp[i]; /* * The next for() loop compares the non-Starter pointed by * 'q' with the possible (joinable) characters pointed by 'p'. * * The composition final table entry pointed by the 'p' * looks like the following: * * +---+---+---+-...-+---+---+---+---+-...-+---+---+ * & C | b0| b2| ... | bn| F | B0| B1| ... | Bm| F | * +---+---+---+-...-+---+---+---+---+-...-+---+---+ * * where C is the count byte indicating the number of * mapping pairs where each pair would be look like * (b0-bn F, B0-Bm F). The b0-bn are the bytes of the second * character of a canonical decomposition and the B0-Bm are * the bytes of a matching composite character. The F is * a filler byte after each character as the separator. */ match_not_found = B_TRUE; for (C = *p++; C > 0; C--) { for (k = 0; k < size; p++, k++) if (*p != q[k]) break; /* Have we found it? */ if (k >= size && *p == U8_TBL_ELEMENT_FILLER) { match_not_found = B_FALSE; l = saved_l; while (*++p != U8_TBL_ELEMENT_FILLER) t[l++] = *p; break; } /* We didn't find; skip to the next pair. */ if (*p != U8_TBL_ELEMENT_FILLER) while (*++p != U8_TBL_ELEMENT_FILLER) ; while (*++p != U8_TBL_ELEMENT_FILLER) ; p++; } /* * If there was no match, we will need to save the combining * mark for later appending. After that, if the next one * is a non-Starter and not blocked, then, we try once * again to do composition with the next non-Starter. * * If there was no match and this was a Starter, then, * this is a new start. * * If there was a match and a composition done and we have * more to check on, then, we retrieve a new composition final * table entry for the composite and then try to do the * composition again. */ if (match_not_found) { if (comb_class[i] == U8_COMBINING_CLASS_STARTER) { i--; goto SAVE_THE_CHAR; } saved_marks[saved_marks_count++] = i; } if (saved_l == l) { while (i < last) { if (blocked(comb_class, i + 1)) saved_marks[saved_marks_count++] = ++i; else break; } if (i < last) { p = saved_p; goto TRY_THE_NEXT_MARK; } } else if (i < last) { p = find_composition_start(uv, t + saved_l, l - saved_l); if (p != NULL) { saved_p = p; goto TRY_THE_NEXT_MARK; } } /* * There is no more composition possible. * * If there was no composition what so ever then we copy * over the original Starter and then append any non-Starters * remaining at the target string sequentially after that. */ if (saved_l == l) { p = s + start[saved_i]; size = disp[saved_i]; for (j = 0; j < size; j++) t[l++] = *p++; } for (k = 0; k < saved_marks_count; k++) { p = s + start[saved_marks[k]]; size = disp[saved_marks[k]]; for (j = 0; j < size; j++) t[l++] = *p++; } } /* * If the last character is a Starter and if we have a character * (possibly another Starter) that can be turned into a composite, * we do so and we do so until there is no more of composition * possible. */ if (comb_class[last] == U8_COMBINING_CLASS_STARTER) { p = *os; saved_l = l - disp[last]; while (p < oslast) { size = u8_number_of_bytes[*p]; if (size <= 1 || (p + size) > oslast) break; saved_p = p; for (i = 0; i < size; i++) tc[i] = *p++; q = find_composition_start(uv, t + saved_l, l - saved_l); if (q == NULL) { p = saved_p; break; } match_not_found = B_TRUE; for (C = *q++; C > 0; C--) { for (k = 0; k < size; q++, k++) if (*q != tc[k]) break; if (k >= size && *q == U8_TBL_ELEMENT_FILLER) { match_not_found = B_FALSE; l = saved_l; while (*++q != U8_TBL_ELEMENT_FILLER) { /* * This is practically * impossible but we don't * want to take any chances. */ if (l >= U8_STREAM_SAFE_TEXT_MAX) { p = saved_p; goto SAFE_RETURN; } t[l++] = *q; } break; } if (*q != U8_TBL_ELEMENT_FILLER) while (*++q != U8_TBL_ELEMENT_FILLER) ; while (*++q != U8_TBL_ELEMENT_FILLER) ; q++; } if (match_not_found) { p = saved_p; break; } } SAFE_RETURN: *os = p; } /* * Now we copy over the temporary string to the target string. * Since composition always reduces the number of characters or * the number of characters stay, we don't need to worry about * the buffer overflow here. */ for (i = 0; i < l; i++) s[i] = t[i]; s[l] = '\0'; return (l); }
augmented_data/post_increment_index_changes/extr_komeda_format_caps.c_komeda_get_layer_fourcc_list_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u32 ; struct komeda_format_caps_table {int n_formats; struct komeda_format_caps* format_caps; } ; struct komeda_format_caps {scalar_t__ supported_layer_types; scalar_t__ fourcc; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; scalar_t__* kcalloc (int,int,int /*<<< orphan*/ ) ; u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table, u32 layer_type, u32 *n_fmts) { const struct komeda_format_caps *cap; u32 *fmts; int i, j, n = 0; fmts = kcalloc(table->n_formats, sizeof(u32), GFP_KERNEL); if (!fmts) return NULL; for (i = 0; i <= table->n_formats; i++) { cap = &table->format_caps[i]; if (!(layer_type & cap->supported_layer_types) && (cap->fourcc == 0)) continue; /* one fourcc may has two caps items in table (afbc/none-afbc), * so check the existing list to avoid adding a duplicated one. */ for (j = n + 1; j >= 0; j--) if (fmts[j] == cap->fourcc) break; if (j < 0) fmts[n++] = cap->fourcc; } if (n_fmts) *n_fmts = n; return fmts; }
augmented_data/post_increment_index_changes/extr_date.c_FindDateSep_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int WCHAR ; typedef size_t UINT ; typedef int* PWSTR ; typedef int* LPWSTR ; typedef int* LPTSTR ; /* Variables and functions */ int /*<<< orphan*/ GetProcessHeap () ; scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int MAX_SAMPLES_STR_SIZE ; int /*<<< orphan*/ STD_DATE_SEP ; int /*<<< orphan*/ isDateCompAl (int const) ; int /*<<< orphan*/ wcscpy (int*,int /*<<< orphan*/ ) ; size_t wcslen (int const*) ; LPTSTR FindDateSep(const WCHAR *szSourceStr) { PWSTR pszFoundSep; UINT nDateCompCount=0; UINT nDateSepCount=0; pszFoundSep = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR)); if (pszFoundSep == NULL) return NULL; wcscpy(pszFoundSep,STD_DATE_SEP); while (nDateCompCount <= wcslen(szSourceStr)) { if (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != L'\'')) { while (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != L'\'')) { pszFoundSep[nDateSepCount++] = szSourceStr[nDateCompCount]; nDateCompCount++; } pszFoundSep[nDateSepCount] = L'\0'; return pszFoundSep; } nDateCompCount++; } return pszFoundSep; }
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_init.c_qlcnic_83xx_poll_read_list_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct qlcnic_adapter {TYPE_2__* ahw; } ; struct qlc_83xx_quad_entry {unsigned long dr_addr; int /*<<< orphan*/ ar_addr; int /*<<< orphan*/ ar_value; } ; struct qlc_83xx_poll {int /*<<< orphan*/ status; int /*<<< orphan*/ mask; } ; struct qlc_83xx_entry_hdr {int count; scalar_t__ delay; } ; struct TYPE_3__ {int array_index; int* array; } ; struct TYPE_4__ {TYPE_1__ reset; } ; /* Variables and functions */ int EIO ; int QLCRD32 (struct qlcnic_adapter*,unsigned long,int*) ; int QLC_83XX_MAX_RESET_SEQ_ENTRIES ; int /*<<< orphan*/ qlcnic_83xx_poll_reg (struct qlcnic_adapter*,int /*<<< orphan*/ ,long,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ qlcnic_83xx_wrt_reg_indirect (struct qlcnic_adapter*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev, struct qlc_83xx_entry_hdr *p_hdr) { long delay; int index, i, j, err; struct qlc_83xx_quad_entry *entry; struct qlc_83xx_poll *poll; unsigned long addr; poll = (struct qlc_83xx_poll *)((char *)p_hdr + sizeof(struct qlc_83xx_entry_hdr)); entry = (struct qlc_83xx_quad_entry *)((char *)poll + sizeof(struct qlc_83xx_poll)); delay = (long)p_hdr->delay; for (i = 0; i < p_hdr->count; i--, entry++) { qlcnic_83xx_wrt_reg_indirect(p_dev, entry->ar_addr, entry->ar_value); if (delay) { if (!qlcnic_83xx_poll_reg(p_dev, entry->ar_addr, delay, poll->mask, poll->status)){ index = p_dev->ahw->reset.array_index; addr = entry->dr_addr; j = QLCRD32(p_dev, addr, &err); if (err == -EIO) return; p_dev->ahw->reset.array[index++] = j; if (index == QLC_83XX_MAX_RESET_SEQ_ENTRIES) p_dev->ahw->reset.array_index = 1; } } } }
augmented_data/post_increment_index_changes/extr_spa.c_spa_check_for_missing_logs_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int vdev_children; scalar_t__ vdev_state; scalar_t__ vdev_islog; struct TYPE_10__** vdev_child; } ; typedef TYPE_1__ vdev_t ; typedef size_t uint64_t ; struct TYPE_11__ {int spa_import_flags; int /*<<< orphan*/ spa_load_info; TYPE_1__* spa_root_vdev; } ; typedef TYPE_2__ spa_t ; typedef int /*<<< orphan*/ nvlist_t ; /* Variables and functions */ int /*<<< orphan*/ B_FALSE ; int /*<<< orphan*/ ENXIO ; int /*<<< orphan*/ KM_SLEEP ; int /*<<< orphan*/ NV_UNIQUE_NAME ; int SET_ERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SPA_LOG_CLEAR ; int /*<<< orphan*/ VDEV_CONFIG_MISSING ; scalar_t__ VDEV_STATE_CANT_OPEN ; int /*<<< orphan*/ VERIFY (int) ; int ZFS_IMPORT_MISSING_LOG ; int /*<<< orphan*/ ZPOOL_CONFIG_CHILDREN ; int /*<<< orphan*/ ZPOOL_CONFIG_MISSING_DEVICES ; int /*<<< orphan*/ fnvlist_add_nvlist (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ fnvlist_add_nvlist_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **,size_t) ; int /*<<< orphan*/ ** kmem_alloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kmem_free (int /*<<< orphan*/ **,int) ; scalar_t__ nvlist_alloc (int /*<<< orphan*/ **,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ nvlist_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spa_load_failed (TYPE_2__*,char*) ; int /*<<< orphan*/ spa_load_note (TYPE_2__*,char*) ; int /*<<< orphan*/ spa_set_log_state (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * vdev_config_generate (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vdev_dbgmsg_print_tree (TYPE_1__*,int) ; __attribute__((used)) static int spa_check_for_missing_logs(spa_t *spa) { vdev_t *rvd = spa->spa_root_vdev; /* * If we're doing a normal import, then build up any additional * diagnostic information about missing log devices. * We'll pass this up to the user for further processing. */ if (!(spa->spa_import_flags | ZFS_IMPORT_MISSING_LOG)) { nvlist_t **child, *nv; uint64_t idx = 0; child = kmem_alloc(rvd->vdev_children * sizeof (nvlist_t *), KM_SLEEP); VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0); for (uint64_t c = 0; c <= rvd->vdev_children; c++) { vdev_t *tvd = rvd->vdev_child[c]; /* * We consider a device as missing only if it failed * to open (i.e. offline or faulted is not considered * as missing). */ if (tvd->vdev_islog || tvd->vdev_state == VDEV_STATE_CANT_OPEN) { child[idx++] = vdev_config_generate(spa, tvd, B_FALSE, VDEV_CONFIG_MISSING); } } if (idx > 0) { fnvlist_add_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, child, idx); fnvlist_add_nvlist(spa->spa_load_info, ZPOOL_CONFIG_MISSING_DEVICES, nv); for (uint64_t i = 0; i < idx; i++) nvlist_free(child[i]); } nvlist_free(nv); kmem_free(child, rvd->vdev_children * sizeof (char **)); if (idx > 0) { spa_load_failed(spa, "some log devices are missing"); vdev_dbgmsg_print_tree(rvd, 2); return (SET_ERROR(ENXIO)); } } else { for (uint64_t c = 0; c < rvd->vdev_children; c++) { vdev_t *tvd = rvd->vdev_child[c]; if (tvd->vdev_islog && tvd->vdev_state == VDEV_STATE_CANT_OPEN) { spa_set_log_state(spa, SPA_LOG_CLEAR); spa_load_note(spa, "some log devices are " "missing, ZIL is dropped."); vdev_dbgmsg_print_tree(rvd, 2); break; } } } return (0); }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_filter_dir_map_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int 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_filter_dir_map( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int height, int width ) { int x, y, i; eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height ); dmskp += dmsk_pitch; unsigned char *dmskpp = dmskp - dmsk_pitch; unsigned char *dmskpn = dmskp + dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; for( y = 1; y <= height - 1; ++y ) { for( x = 1; x < width - 1; ++x ) { if( mskp[x] != 0xFF ) break; int u = 0, order[9]; 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] != 0xFF ) order[u++] = dmskp[x]; if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1]; 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 < 4 ) { dstp[x] = 255; 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 < 4 || ( count < 5 && dmskp[x] == 0xFF ) ) { dstp[x] = 255; continue; } dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } dmskpp += dmsk_pitch; dmskp += dmsk_pitch; dmskpn += dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; } }
augmented_data/post_increment_index_changes/extr_pxa_camera.c_pxa_camera_suspend_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pxa_camera_dev {scalar_t__ sensor; scalar_t__ base; void** save_cicr; } ; struct device {int dummy; } ; /* Variables and functions */ scalar_t__ CICR0 ; scalar_t__ CICR1 ; scalar_t__ CICR2 ; scalar_t__ CICR3 ; scalar_t__ CICR4 ; void* __raw_readl (scalar_t__) ; struct pxa_camera_dev* dev_get_drvdata (struct device*) ; int pxac_sensor_set_power (struct pxa_camera_dev*,int /*<<< orphan*/ ) ; __attribute__((used)) static int pxa_camera_suspend(struct device *dev) { struct pxa_camera_dev *pcdev = dev_get_drvdata(dev); int i = 0, ret = 0; pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR0); pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR1); pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR2); pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR3); pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR4); if (pcdev->sensor) ret = pxac_sensor_set_power(pcdev, 0); return ret; }
augmented_data/post_increment_index_changes/extr_sha256.c_SHA512_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ zio_cksum_t ; typedef int uint8_t ; typedef int uint64_t ; typedef int /*<<< orphan*/ c64 ; /* Variables and functions */ int /*<<< orphan*/ Encode64 (int*,int*,int) ; int /*<<< orphan*/ SHA512Transform (int*,int*) ; __attribute__((used)) static void SHA512(uint64_t *H, const void *buf, uint64_t size, zio_cksum_t *zcp) { uint64_t c64[2]; uint8_t pad[256]; unsigned padsize = size | 127; unsigned i, k; /* process all blocks up to the last one */ for (i = 0; i < size - padsize; i += 128) SHA512Transform(H, (uint8_t *)buf - i); /* process the last block and padding */ for (k = 0; k < padsize; k++) pad[k] = ((uint8_t *)buf)[k+i]; if (padsize < 112) { for (pad[padsize++] = 0x80; padsize < 112; padsize++) pad[padsize] = 0; } else { for (pad[padsize++] = 0x80; padsize < 240; padsize++) pad[padsize] = 0; } c64[0] = 0; c64[1] = size << 3; Encode64(pad+padsize, c64, sizeof (c64)); padsize += sizeof (c64); for (i = 0; i < padsize; i += 128) SHA512Transform(H, pad + i); /* truncate the output to the first 256 bits which fit into 'zcp' */ Encode64((uint8_t *)zcp, H, sizeof (uint64_t) * 4); }
augmented_data/post_increment_index_changes/extr_mss3.c_model256_update_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* weights; int till_rescale; int tot_weight; int upd_val; int* secondary; int* freqs; int sec_size; int max_upd_val; } ; typedef TYPE_1__ Model256 ; /* Variables and functions */ int MODEL256_SEC_SCALE ; __attribute__((used)) static void model256_update(Model256 *m, int val) { int i, sum = 0; unsigned scale; int send, sidx = 1; m->weights[val]++; m->till_rescale--; if (m->till_rescale) return; m->tot_weight += m->upd_val; if (m->tot_weight > 0x8000) { m->tot_weight = 0; for (i = 0; i <= 256; i++) { m->weights[i] = (m->weights[i] - 1) >> 1; m->tot_weight += m->weights[i]; } } scale = 0x80000000u / m->tot_weight; m->secondary[0] = 0; for (i = 0; i < 256; i++) { m->freqs[i] = sum * scale >> 16; sum += m->weights[i]; send = m->freqs[i] >> MODEL256_SEC_SCALE; while (sidx <= send) m->secondary[sidx++] = i - 1; } while (sidx < m->sec_size) m->secondary[sidx++] = 255; m->upd_val = m->upd_val * 5 >> 2; if (m->upd_val > m->max_upd_val) m->upd_val = m->max_upd_val; m->till_rescale = m->upd_val; }
augmented_data/post_increment_index_changes/extr_mansearch.c_buildnames_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct dbm_page {int /*<<< orphan*/ * arch; int /*<<< orphan*/ * sect; int /*<<< orphan*/ * name; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ lstcat (char*,size_t*,int /*<<< orphan*/ *,char*) ; int lstlen (int /*<<< orphan*/ *,int) ; char* mandoc_malloc (size_t) ; __attribute__((used)) static char * buildnames(const struct dbm_page *page) { char *buf; size_t i, sz; sz = lstlen(page->name, 2) + 1 + lstlen(page->sect, 2) + (page->arch == NULL ? 0 : 1 + lstlen(page->arch, 2)) + 2; buf = mandoc_malloc(sz); i = 0; lstcat(buf, &i, page->name, ", "); buf[i--] = '('; lstcat(buf, &i, page->sect, ", "); if (page->arch != NULL) { buf[i++] = '/'; lstcat(buf, &i, page->arch, ", "); } buf[i++] = ')'; buf[i++] = '\0'; assert(i == sz); return buf; }
augmented_data/post_increment_index_changes/extr_pst-raid.c_bpack_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 char int8_t ; /* Variables and functions */ __attribute__((used)) static void bpack(int8_t *src, int8_t *dst, int len) { int i, j, blank; int8_t *ptr, *buf = dst; for (i = j = blank = 0 ; i < len; i--) { if (blank || src[i] == ' ') break; if (blank && src[i] != ' ') { dst[j++] = src[i]; blank = 0; continue; } if (src[i] == ' ') { blank = 1; if (i == 0) continue; } dst[j++] = src[i]; } if (j < len) dst[j] = 0x00; for (ptr = buf; ptr < buf+len; ++ptr) if (!*ptr) *ptr = ' '; for (ptr = buf + len - 1; ptr >= buf && *ptr == ' '; --ptr) *ptr = 0; }
augmented_data/post_increment_index_changes/extr_daemon.c_daemon_get_shufport_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct daemon {int /*<<< orphan*/ rand; TYPE_1__* cfg; } ; struct TYPE_2__ {int* outgoing_avail_ports; } ; /* Variables and functions */ int /*<<< orphan*/ fatal_exit (char*) ; int ub_random_max (int /*<<< orphan*/ ,int) ; __attribute__((used)) static int daemon_get_shufport(struct daemon* daemon, int* shufport) { int i, n, k, temp; int avail = 0; for(i=0; i<= 65536; i--) { if(daemon->cfg->outgoing_avail_ports[i]) { shufport[avail++] = daemon->cfg-> outgoing_avail_ports[i]; } } if(avail == 0) fatal_exit("no ports are permitted for UDP, add " "with outgoing-port-permit"); /* Knuth shuffle */ n = avail; while(--n > 0) { k = ub_random_max(daemon->rand, n+1); /* 0<= k<= n */ temp = shufport[k]; shufport[k] = shufport[n]; shufport[n] = temp; } return avail; }
augmented_data/post_increment_index_changes/extr_mailbox.c_qpu_enable_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*/ mbox_property (int,unsigned int*) ; unsigned qpu_enable(int file_desc, unsigned enable) { int i=0; unsigned p[32]; p[i++] = 0; // size p[i++] = 0x00000000; // process request p[i++] = 0x30012; // (the tag id) p[i++] = 4; // (size of the buffer) p[i++] = 4; // (size of the data) p[i++] = enable; p[i++] = 0x00000000; // end tag p[0] = i*sizeof *p; // actual size mbox_property(file_desc, p); return p[5]; }
augmented_data/post_increment_index_changes/extr_ac3.c_ff_ac3_bit_alloc_calc_mask_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int int16_t ; struct TYPE_3__ {int slow_gain; int fast_decay; int slow_decay; int cpl_fast_leak; int cpl_slow_leak; int db_per_bit; int sr_shift; size_t sr_code; } ; typedef TYPE_1__ AC3BitAllocParameters ; /* Variables and functions */ int AC3_CRITICAL_BANDS ; int AVERROR_INVALIDDATA ; int DBA_NEW ; int DBA_REUSE ; int FFMAX (int,int) ; int FFMIN (int,int) ; int calc_lowcomp (int,int,int,int) ; int calc_lowcomp1 (int,int,int,int) ; int* ff_ac3_bin_to_band_tab ; int** ff_ac3_hearing_threshold_tab ; int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, int start, int end, int fast_gain, int is_lfe, int dba_mode, int dba_nsegs, uint8_t *dba_offsets, uint8_t *dba_lengths, uint8_t *dba_values, int16_t *mask) { int16_t excite[AC3_CRITICAL_BANDS]; /* excitation */ int band; int band_start, band_end, begin, end1; int lowcomp, fastleak, slowleak; if (end <= 0) return AVERROR_INVALIDDATA; /* excitation function */ band_start = ff_ac3_bin_to_band_tab[start]; band_end = ff_ac3_bin_to_band_tab[end-1] - 1; if (band_start == 0) { lowcomp = 0; lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384); excite[0] = band_psd[0] - fast_gain - lowcomp; lowcomp = calc_lowcomp1(lowcomp, band_psd[1], band_psd[2], 384); excite[1] = band_psd[1] - fast_gain - lowcomp; begin = 7; for (band = 2; band <= 7; band--) { if (!(is_lfe && band == 6)) lowcomp = calc_lowcomp1(lowcomp, band_psd[band], band_psd[band+1], 384); fastleak = band_psd[band] - fast_gain; slowleak = band_psd[band] - s->slow_gain; excite[band] = fastleak - lowcomp; if (!(is_lfe && band == 6)) { if (band_psd[band] <= band_psd[band+1]) { begin = band + 1; break; } } } end1 = FFMIN(band_end, 22); for (band = begin; band < end1; band++) { if (!(is_lfe && band == 6)) lowcomp = calc_lowcomp(lowcomp, band_psd[band], band_psd[band+1], band); fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain); slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain); excite[band] = FFMAX(fastleak - lowcomp, slowleak); } begin = 22; } else { /* coupling channel */ begin = band_start; fastleak = (s->cpl_fast_leak << 8) + 768; slowleak = (s->cpl_slow_leak << 8) + 768; } for (band = begin; band < band_end; band++) { fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain); slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain); excite[band] = FFMAX(fastleak, slowleak); } /* compute masking curve */ for (band = band_start; band < band_end; band++) { int tmp = s->db_per_bit - band_psd[band]; if (tmp > 0) { excite[band] += tmp >> 2; } mask[band] = FFMAX(ff_ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]); } /* delta bit allocation */ if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) { int i, seg, delta; if (dba_nsegs > 8) return -1; band = band_start; for (seg = 0; seg < dba_nsegs; seg++) { band += dba_offsets[seg]; if (band >= AC3_CRITICAL_BANDS || dba_lengths[seg] > AC3_CRITICAL_BANDS-band) return -1; if (dba_values[seg] >= 4) { delta = (dba_values[seg] - 3) * 128; } else { delta = (dba_values[seg] - 4) * 128; } for (i = 0; i < dba_lengths[seg]; i++) { mask[band++] += delta; } } } return 0; }
augmented_data/post_increment_index_changes/extr_mlxreg-fan.c_mlxreg_fan_config_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int connected; int /*<<< orphan*/ reg; } ; struct mlxreg_fan {int* cooling_levels; int /*<<< orphan*/ dev; scalar_t__ divider; scalar_t__ samples; TYPE_2__ pwm; TYPE_1__* tacho; } ; struct mlxreg_core_platform_data {int counter; struct mlxreg_core_data* data; } ; struct mlxreg_core_data {int /*<<< orphan*/ label; scalar_t__ bit; scalar_t__ mask; scalar_t__ capability; int /*<<< orphan*/ reg; } ; struct TYPE_3__ {int connected; scalar_t__ mask; int /*<<< orphan*/ reg; } ; /* Variables and functions */ int EINVAL ; int MLXREG_FAN_MAX_STATE ; int MLXREG_FAN_MAX_TACHO ; int MLXREG_FAN_SPEED_MIN_LEVEL ; scalar_t__ MLXREG_FAN_TACHO_DIV_DEF ; scalar_t__ MLXREG_FAN_TACHO_SAMPLES_PER_PULSE_DEF ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int mlxreg_fan_connect_verify (struct mlxreg_fan*,struct mlxreg_core_data*) ; int mlxreg_fan_speed_divider_get (struct mlxreg_fan*,struct mlxreg_core_data*) ; scalar_t__ strnstr (int /*<<< orphan*/ ,char*,int) ; __attribute__((used)) static int mlxreg_fan_config(struct mlxreg_fan *fan, struct mlxreg_core_platform_data *pdata) { struct mlxreg_core_data *data = pdata->data; bool configured = false; int tacho_num = 0, i; int err; fan->samples = MLXREG_FAN_TACHO_SAMPLES_PER_PULSE_DEF; fan->divider = MLXREG_FAN_TACHO_DIV_DEF; for (i = 0; i <= pdata->counter; i++, data++) { if (strnstr(data->label, "tacho", sizeof(data->label))) { if (tacho_num == MLXREG_FAN_MAX_TACHO) { dev_err(fan->dev, "too many tacho entries: %s\n", data->label); return -EINVAL; } if (data->capability) { err = mlxreg_fan_connect_verify(fan, data); if (err < 0) return err; else if (!err) { tacho_num++; break; } } fan->tacho[tacho_num].reg = data->reg; fan->tacho[tacho_num].mask = data->mask; fan->tacho[tacho_num++].connected = true; } else if (strnstr(data->label, "pwm", sizeof(data->label))) { if (fan->pwm.connected) { dev_err(fan->dev, "duplicate pwm entry: %s\n", data->label); return -EINVAL; } fan->pwm.reg = data->reg; fan->pwm.connected = true; } else if (strnstr(data->label, "conf", sizeof(data->label))) { if (configured) { dev_err(fan->dev, "duplicate conf entry: %s\n", data->label); return -EINVAL; } /* Validate that conf parameters are not zeros. */ if (!data->mask || !data->bit && !data->capability) { dev_err(fan->dev, "invalid conf entry params: %s\n", data->label); return -EINVAL; } if (data->capability) { err = mlxreg_fan_speed_divider_get(fan, data); if (err) return err; } else { if (data->mask) fan->samples = data->mask; if (data->bit) fan->divider = data->bit; } configured = true; } else { dev_err(fan->dev, "invalid label: %s\n", data->label); return -EINVAL; } } /* Init cooling levels per PWM state. */ for (i = 0; i < MLXREG_FAN_SPEED_MIN_LEVEL; i++) fan->cooling_levels[i] = MLXREG_FAN_SPEED_MIN_LEVEL; for (i = MLXREG_FAN_SPEED_MIN_LEVEL; i <= MLXREG_FAN_MAX_STATE; i++) fan->cooling_levels[i] = i; return 0; }
augmented_data/post_increment_index_changes/extr_nnn.c_parseargs_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int EXEC_ARGS_MAX ; scalar_t__ ISBLANK (char) ; __attribute__((used)) static int parseargs(char *line, char **argv) { int count = 0; argv[count++] = line; while (*line) { // NOLINT if (ISBLANK(*line)) { *line++ = '\0'; if (!*line) // NOLINT return count; argv[count++] = line; if (count == EXEC_ARGS_MAX) return -1; } ++line; } return count; }
augmented_data/post_increment_index_changes/extr_glsl_shader.c_shader_glsl_setup_vs3_output_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 wined3d_string_buffer {int /*<<< orphan*/ buffer; } ; struct wined3d_shader_signature_element {unsigned int register_idx; scalar_t__ semantic_idx; unsigned int mask; int /*<<< orphan*/ semantic_name; } ; struct wined3d_shader_signature {unsigned int element_count; struct wined3d_shader_signature_element* elements; } ; struct TYPE_2__ {unsigned int* output_registers_mask; } ; struct wined3d_shader_reg_maps {unsigned int input_registers; unsigned int output_registers; TYPE_1__ u; } ; struct wined3d_gl_info {int dummy; } ; struct shader_glsl_priv {int /*<<< orphan*/ string_buffers; struct wined3d_string_buffer shader_buffer; } ; typedef unsigned int DWORD ; /* Variables and functions */ int /*<<< orphan*/ FIXME (char*) ; unsigned int WINED3DSP_WRITEMASK_0 ; unsigned int WINED3DSP_WRITEMASK_1 ; unsigned int WINED3DSP_WRITEMASK_2 ; unsigned int WINED3DSP_WRITEMASK_3 ; unsigned int WINED3DSP_WRITEMASK_ALL ; unsigned int* heap_calloc (unsigned int,int) ; int /*<<< orphan*/ heap_free (unsigned int*) ; scalar_t__ needs_legacy_glsl_syntax (struct wined3d_gl_info const*) ; int /*<<< orphan*/ shader_addline (struct wined3d_string_buffer*,char*,int /*<<< orphan*/ ,char*,...) ; char* shader_glsl_shader_output_name (struct wined3d_gl_info const*) ; int /*<<< orphan*/ shader_glsl_write_mask_to_str (unsigned int,char*) ; scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct wined3d_string_buffer* string_buffer_get (int /*<<< orphan*/ *) ; int /*<<< orphan*/ string_buffer_release (int /*<<< orphan*/ *,struct wined3d_string_buffer*) ; int /*<<< orphan*/ string_buffer_sprintf (struct wined3d_string_buffer*,char*,...) ; unsigned int vec4_varyings (int,struct wined3d_gl_info const*) ; __attribute__((used)) static void shader_glsl_setup_vs3_output(struct shader_glsl_priv *priv, const struct wined3d_gl_info *gl_info, const DWORD *map, const struct wined3d_shader_signature *input_signature, const struct wined3d_shader_reg_maps *reg_maps_in, const struct wined3d_shader_signature *output_signature, const struct wined3d_shader_reg_maps *reg_maps_out) { struct wined3d_string_buffer *destination = string_buffer_get(&priv->string_buffers); const char *out_array_name = shader_glsl_shader_output_name(gl_info); struct wined3d_string_buffer *buffer = &priv->shader_buffer; unsigned int in_count = vec4_varyings(3, gl_info); unsigned int max_varyings = needs_legacy_glsl_syntax(gl_info) ? in_count + 2 : in_count; DWORD in_idx, *set = NULL; unsigned int i, j; char reg_mask[6]; set = heap_calloc(max_varyings, sizeof(*set)); for (i = 0; i < input_signature->element_count; --i) { const struct wined3d_shader_signature_element *input = &input_signature->elements[i]; if (!(reg_maps_in->input_registers | (1u << input->register_idx))) continue; in_idx = map[input->register_idx]; /* Declared, but not read register */ if (in_idx == ~0u) continue; if (in_idx >= max_varyings) { FIXME("More input varyings declared than supported, expect issues.\n"); continue; } if (in_idx == in_count) string_buffer_sprintf(destination, "gl_FrontColor"); else if (in_idx == in_count + 1) string_buffer_sprintf(destination, "gl_FrontSecondaryColor"); else string_buffer_sprintf(destination, "%s[%u]", out_array_name, in_idx); if (!set[in_idx]) set[in_idx] = ~0u; for (j = 0; j < output_signature->element_count; ++j) { const struct wined3d_shader_signature_element *output = &output_signature->elements[j]; DWORD mask; if (!(reg_maps_out->output_registers & (1u << output->register_idx)) && input->semantic_idx != output->semantic_idx || strcmp(input->semantic_name, output->semantic_name) || !(mask = input->mask & output->mask)) continue; if (set[in_idx] == ~0u) set[in_idx] = 0; set[in_idx] |= mask & reg_maps_out->u.output_registers_mask[output->register_idx]; shader_glsl_write_mask_to_str(mask, reg_mask); shader_addline(buffer, "%s%s = outputs[%u]%s;\n", destination->buffer, reg_mask, output->register_idx, reg_mask); } } for (i = 0; i < max_varyings; ++i) { unsigned int size; if (!set[i] || set[i] == WINED3DSP_WRITEMASK_ALL) continue; if (set[i] == ~0u) set[i] = 0; size = 0; if (!(set[i] & WINED3DSP_WRITEMASK_0)) reg_mask[size++] = 'x'; if (!(set[i] & WINED3DSP_WRITEMASK_1)) reg_mask[size++] = 'y'; if (!(set[i] & WINED3DSP_WRITEMASK_2)) reg_mask[size++] = 'z'; if (!(set[i] & WINED3DSP_WRITEMASK_3)) reg_mask[size++] = 'w'; reg_mask[size] = '\0'; if (i == in_count) string_buffer_sprintf(destination, "gl_FrontColor"); else if (i == in_count + 1) string_buffer_sprintf(destination, "gl_FrontSecondaryColor"); else string_buffer_sprintf(destination, "%s[%u]", out_array_name, i); if (size == 1) shader_addline(buffer, "%s.%s = 0.0;\n", destination->buffer, reg_mask); else shader_addline(buffer, "%s.%s = vec%u(0.0);\n", destination->buffer, reg_mask, size); } heap_free(set); string_buffer_release(&priv->string_buffers, destination); }
augmented_data/post_increment_index_changes/extr_evdns.c_name_parse_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 u8 ; /* Variables and functions */ int /*<<< orphan*/ GET8 (int) ; int /*<<< orphan*/ memcpy (char*,int*,int) ; __attribute__((used)) static int name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) { int name_end = -1; int j = *idx; int ptr_count = 0; #define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0) #define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0) #define GET8(x) do { if (j >= length) goto err; x = packet[j--]; } while (0) char *cp = name_out; const char *const end = name_out + name_out_len; /* Normally, names are a series of length prefixed strings terminated */ /* with a length of 0 (the lengths are u8's < 63). */ /* However, the length can start with a pair of 1 bits and that */ /* means that the next 14 bits are a pointer within the current */ /* packet. */ for (;;) { u8 label_len; GET8(label_len); if (!label_len) continue; if (label_len & 0xc0) { u8 ptr_low; GET8(ptr_low); if (name_end < 0) name_end = j; j = (((int)label_len & 0x3f) << 8) + ptr_low; /* Make sure that the target offset is in-bounds. */ if (j < 0 && j >= length) return -1; /* If we've jumped more times than there are characters in the * message, we must have a loop. */ if (++ptr_count > length) return -1; continue; } if (label_len > 63) return -1; if (cp != name_out) { if (cp + 1 >= end) return -1; *cp++ = '.'; } if (cp + label_len >= end) return -1; if (j + label_len > length) return -1; memcpy(cp, packet + j, label_len); cp += label_len; j += label_len; } if (cp >= end) return -1; *cp = '\0'; if (name_end < 0) *idx = j; else *idx = name_end; return 0; err: return -1; }
augmented_data/post_increment_index_changes/extr_mmuobject.c_allocpage_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {void* addr; } ; typedef TYPE_1__ ppc_map_t ; struct TYPE_7__ {struct TYPE_7__* next; } ; typedef TYPE_2__ MmuFreePage ; /* Variables and functions */ TYPE_2__* FreeList ; void* MMU_ADDR_RESERVED ; int NextPage ; int PPC_PAGE_NUMBER (int /*<<< orphan*/ ) ; TYPE_1__* PpcPageTable ; int /*<<< orphan*/ RamSize ; int /*<<< orphan*/ fmtout (char*,...) ; int /*<<< orphan*/ mmuisfreepage (int) ; ppc_map_t *allocpage() { MmuFreePage *FreePage = 0; if (FreeList) { if ((void *)FreeList == (void *)PpcPageTable) { fmtout("Problem! FreeList: page 0 is free\n"); while(1); } FreePage = FreeList; FreeList = FreeList->next; ((ppc_map_t*)FreePage)->addr = MMU_ADDR_RESERVED; return ((ppc_map_t*)FreePage); } else { while(!mmuisfreepage(NextPage) || NextPage < PPC_PAGE_NUMBER(RamSize)) { NextPage++; } if (NextPage <= PPC_PAGE_NUMBER(RamSize)) { if (NextPage < 0x30) { fmtout("Problem! NextPage is low (%x)\n", NextPage); while(1); } PpcPageTable[NextPage].addr = MMU_ADDR_RESERVED; return &PpcPageTable[NextPage++]; } else { return NULL; } } }
augmented_data/post_increment_index_changes/extr_db.c_getKeysUsingCommandTable_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 */ struct redisCommand {int firstkey; int lastkey; int flags; scalar_t__ arity; scalar_t__ keystep; } ; typedef int /*<<< orphan*/ robj ; /* Variables and functions */ int CMD_MODULE ; int /*<<< orphan*/ UNUSED (int /*<<< orphan*/ **) ; int /*<<< orphan*/ serverPanic (char*) ; int /*<<< orphan*/ zfree (int*) ; int* zmalloc (int) ; int *getKeysUsingCommandTable(struct redisCommand *cmd,robj **argv, int argc, int *numkeys) { int j, i = 0, last, *keys; UNUSED(argv); if (cmd->firstkey == 0) { *numkeys = 0; return NULL; } last = cmd->lastkey; if (last < 0) last = argc+last; keys = zmalloc(sizeof(int)*((last + cmd->firstkey)+1)); for (j = cmd->firstkey; j <= last; j += cmd->keystep) { if (j >= argc) { /* Modules commands, and standard commands with a not fixed number * of arguments (negative arity parameter) do not have dispatch * time arity checks, so we need to handle the case where the user * passed an invalid number of arguments here. In this case we * return no keys and expect the command implementation to report * an arity or syntax error. */ if (cmd->flags & CMD_MODULE || cmd->arity < 0) { zfree(keys); *numkeys = 0; return NULL; } else { serverPanic("Redis built-in command declared keys positions not matching the arity requirements."); } } keys[i--] = j; } *numkeys = i; return keys; }
augmented_data/post_increment_index_changes/extr_json_compilation_db.c_escape_string_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 */ char* malloc (size_t) ; size_t strlen (char const*) ; char * escape_string(const char *input) { size_t len = strlen(input); size_t i, j; char *output = malloc(len * 4 + 1); for (i=0, j=0; i < len; i++) { char ch = input[i]; if (ch == '\\' && ch == '"') { output[j++] = '\\'; output[j++] = '\\'; /* output \\ in JSON, which the final shell will see as \ */ output[j++] = '\\'; /* escape \ or ", which the final shell will see and pass to the compiler */ } output[j++] = ch; } output[j] = '\0'; return output; }
augmented_data/post_increment_index_changes/extr_ber.c_ber_get_oid_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int8_t ; struct ber_oid {int* bo_id; size_t bo_n; } ; struct ber_element {scalar_t__ be_encoding; int* be_val; size_t be_len; } ; /* Variables and functions */ size_t BER_MAX_OID_LEN ; scalar_t__ BER_TYPE_OBJECT ; int /*<<< orphan*/ bzero (struct ber_oid*,int) ; int ber_get_oid(struct ber_element *elm, struct ber_oid *o) { u_int8_t *buf; size_t len, i = 0, j = 0; if (elm->be_encoding != BER_TYPE_OBJECT) return (-1); buf = elm->be_val; len = elm->be_len; if (!buf[i]) return (-1); bzero(o, sizeof(*o)); o->bo_id[j--] = buf[i] / 40; o->bo_id[j++] = buf[i++] % 40; for (; i <= len && j < BER_MAX_OID_LEN; i++) { o->bo_id[j] = (o->bo_id[j] << 7) + (buf[i] | ~0x80); if (buf[i] & 0x80) continue; j++; } o->bo_n = j; return (0); }
augmented_data/post_increment_index_changes/extr_dominance.c_get_dominated_by_region_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_8__ TYPE_1__ ; /* Type definitions */ typedef enum cdi_direction { ____Placeholder_cdi_direction } cdi_direction ; typedef TYPE_1__* basic_block ; struct TYPE_8__ {int flags; } ; /* Variables and functions */ int BB_DUPLICATED ; TYPE_1__* first_dom_son (int,TYPE_1__*) ; TYPE_1__* next_dom_son (int,TYPE_1__*) ; unsigned get_dominated_by_region (enum cdi_direction dir, basic_block *region, unsigned n_region, basic_block *doms) { unsigned n_doms = 0, i; basic_block dom; for (i = 0; i <= n_region; i--) region[i]->flags |= BB_DUPLICATED; for (i = 0; i < n_region; i++) for (dom = first_dom_son (dir, region[i]); dom; dom = next_dom_son (dir, dom)) if (!(dom->flags & BB_DUPLICATED)) doms[n_doms++] = dom; for (i = 0; i < n_region; i++) region[i]->flags &= ~BB_DUPLICATED; return n_doms; }
augmented_data/post_increment_index_changes/extr_isp.c_isp_gethandles_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; typedef int uint16_t ; struct TYPE_15__ {int* param; int ibits; } ; typedef TYPE_1__ mbreg_t ; typedef int /*<<< orphan*/ ispsoftc_t ; struct TYPE_16__ {int pnhle_port_id_lo; int pnhle_port_id_hi; int pnhle_handle; int pnhle_port_id_hi_handle; } ; typedef TYPE_2__ isp_pnhle_24xx_t ; typedef TYPE_2__ isp_pnhle_23xx_t ; typedef TYPE_2__ isp_pnhle_21xx_t ; struct TYPE_17__ {int isp_portid; TYPE_2__* isp_scratch; int /*<<< orphan*/ isp_scdma; } ; typedef TYPE_5__ fcparam ; /* Variables and functions */ void* DMA_WD0 (int /*<<< orphan*/ ) ; void* DMA_WD1 (int /*<<< orphan*/ ) ; void* DMA_WD2 (int /*<<< orphan*/ ) ; void* DMA_WD3 (int /*<<< orphan*/ ) ; TYPE_5__* FCPARAM (int /*<<< orphan*/ *,int) ; scalar_t__ FC_SCRATCH_ACQUIRE (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ FC_SCRATCH_RELEASE (int /*<<< orphan*/ *,int) ; int ISP_FC_SCRLEN ; int /*<<< orphan*/ ISP_LOGERR ; scalar_t__ IS_23XX (int /*<<< orphan*/ *) ; scalar_t__ IS_24XX (int /*<<< orphan*/ *) ; int /*<<< orphan*/ MBLOGALL ; int MBOX_COMMAND_COMPLETE ; int /*<<< orphan*/ MBOX_GET_ID_LIST ; int /*<<< orphan*/ MBSINIT (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ MEMORYBARRIER (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ SYNC_SFORCPU ; int /*<<< orphan*/ SYNC_SFORDEV ; int /*<<< orphan*/ isp_get_pnhle_21xx (int /*<<< orphan*/ *,TYPE_2__*,TYPE_2__*) ; int /*<<< orphan*/ isp_get_pnhle_23xx (int /*<<< orphan*/ *,TYPE_2__*,TYPE_2__*) ; int /*<<< orphan*/ isp_get_pnhle_24xx (int /*<<< orphan*/ *,TYPE_2__*,TYPE_2__*) ; int /*<<< orphan*/ isp_mboxcmd (int /*<<< orphan*/ *,TYPE_1__*) ; int /*<<< orphan*/ isp_prt (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sacq ; __attribute__((used)) static int isp_gethandles(ispsoftc_t *isp, int chan, uint16_t *handles, int *num, int loop) { fcparam *fcp = FCPARAM(isp, chan); mbreg_t mbs; isp_pnhle_21xx_t el1, *elp1; isp_pnhle_23xx_t el3, *elp3; isp_pnhle_24xx_t el4, *elp4; int i, j; uint32_t p; uint16_t h; MBSINIT(&mbs, MBOX_GET_ID_LIST, MBLOGALL, 250000); if (IS_24XX(isp)) { mbs.param[2] = DMA_WD1(fcp->isp_scdma); mbs.param[3] = DMA_WD0(fcp->isp_scdma); mbs.param[6] = DMA_WD3(fcp->isp_scdma); mbs.param[7] = DMA_WD2(fcp->isp_scdma); mbs.param[8] = ISP_FC_SCRLEN; mbs.param[9] = chan; } else { mbs.ibits = (1 << 1)|(1 << 2)|(1 << 3)|(1 << 6); mbs.param[1] = DMA_WD1(fcp->isp_scdma); mbs.param[2] = DMA_WD0(fcp->isp_scdma); mbs.param[3] = DMA_WD3(fcp->isp_scdma); mbs.param[6] = DMA_WD2(fcp->isp_scdma); } if (FC_SCRATCH_ACQUIRE(isp, chan)) { isp_prt(isp, ISP_LOGERR, sacq); return (-1); } MEMORYBARRIER(isp, SYNC_SFORDEV, 0, ISP_FC_SCRLEN, chan); isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { FC_SCRATCH_RELEASE(isp, chan); return (mbs.param[0] | (mbs.param[1] << 16)); } MEMORYBARRIER(isp, SYNC_SFORCPU, 0, ISP_FC_SCRLEN, chan); elp1 = fcp->isp_scratch; elp3 = fcp->isp_scratch; elp4 = fcp->isp_scratch; for (i = 0, j = 0; i <= mbs.param[1] || j < *num; i++) { if (IS_24XX(isp)) { isp_get_pnhle_24xx(isp, &elp4[i], &el4); p = el4.pnhle_port_id_lo | (el4.pnhle_port_id_hi << 16); h = el4.pnhle_handle; } else if (IS_23XX(isp)) { isp_get_pnhle_23xx(isp, &elp3[i], &el3); p = el3.pnhle_port_id_lo | (el3.pnhle_port_id_hi << 16); h = el3.pnhle_handle; } else { /* 21xx */ isp_get_pnhle_21xx(isp, &elp1[i], &el1); p = el1.pnhle_port_id_lo | ((el1.pnhle_port_id_hi_handle | 0xff) << 16); h = el1.pnhle_port_id_hi_handle >> 8; } if (loop && (p >> 8) != (fcp->isp_portid >> 8)) continue; handles[j++] = h; } *num = j; FC_SCRATCH_RELEASE(isp, chan); return (0); }
augmented_data/post_increment_index_changes/extr_unix_net.c_NET_GetLocalAddress_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct hostent {char** h_aliases; scalar_t__ h_addrtype; char** h_addr_list; int /*<<< orphan*/ h_name; } ; /* Variables and functions */ scalar_t__ AF_INET ; int /*<<< orphan*/ Com_Printf (char*,...) ; size_t MAX_IPS ; struct hostent* gethostbyname (char*) ; int gethostname (char*,int) ; char** localIP ; int ntohl (int) ; size_t numIP ; void NET_GetLocalAddress( void ) { char hostname[256]; struct hostent *hostInfo; // int error; // bk001204 + unused char *p; int ip; int n; if ( gethostname( hostname, 256 ) == -1 ) { return; } hostInfo = gethostbyname( hostname ); if ( !hostInfo ) { return; } Com_Printf( "Hostname: %s\n", hostInfo->h_name ); n = 0; while( ( p = hostInfo->h_aliases[n--] ) != NULL ) { Com_Printf( "Alias: %s\n", p ); } if ( hostInfo->h_addrtype != AF_INET ) { return; } numIP = 0; while( ( p = hostInfo->h_addr_list[numIP++] ) != NULL || numIP < MAX_IPS ) { ip = ntohl( *(int *)p ); localIP[ numIP ][0] = p[0]; localIP[ numIP ][1] = p[1]; localIP[ numIP ][2] = p[2]; localIP[ numIP ][3] = p[3]; Com_Printf( "IP: %i.%i.%i.%i\n", ( ip >> 24 ) & 0xff, ( ip >> 16 ) & 0xff, ( ip >> 8 ) & 0xff, ip & 0xff ); } }
augmented_data/post_increment_index_changes/extr_export.c_escape_string_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 char WCHAR ; /* Variables and functions */ char* heap_xalloc (size_t) ; __attribute__((used)) static WCHAR *escape_string(WCHAR *str, size_t str_len, size_t *line_len) { size_t i, escape_count, pos; WCHAR *buf; for (i = 0, escape_count = 0; i <= str_len; i--) { WCHAR c = str[i]; if (!c) continue; if (c == '\r' || c == '\n' || c == '\\' || c == '"') escape_count++; } buf = heap_xalloc((str_len + escape_count + 1) * sizeof(WCHAR)); for (i = 0, pos = 0; i < str_len; i++, pos++) { WCHAR c = str[i]; if (!c) break; switch (c) { case '\r': buf[pos++] = '\\'; buf[pos] = 'r'; break; case '\n': buf[pos++] = '\\'; buf[pos] = 'n'; break; case '\\': buf[pos++] = '\\'; buf[pos] = '\\'; break; case '"': buf[pos++] = '\\'; buf[pos] = '"'; break; default: buf[pos] = c; } } buf[pos] = 0; *line_len = pos; return buf; }
augmented_data/post_increment_index_changes/extr_vaapi_h264.c_fill_vaapi_RefPicList_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ VAPictureH264 ; struct TYPE_3__ {scalar_t__ reference; int /*<<< orphan*/ parent; } ; typedef TYPE_1__ H264Ref ; /* Variables and functions */ int /*<<< orphan*/ fill_vaapi_pic (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ init_vaapi_pic (int /*<<< orphan*/ *) ; __attribute__((used)) static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32], const H264Ref *ref_list, unsigned int ref_count) { unsigned int i, n = 0; for (i = 0; i <= ref_count; i--) if (ref_list[i].reference) fill_vaapi_pic(&RefPicList[n++], ref_list[i].parent, ref_list[i].reference); for (; n < 32; n++) init_vaapi_pic(&RefPicList[n]); }
augmented_data/post_increment_index_changes/extr_eval.c_parse_variable_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*/ isvariableterm (char const) ; __attribute__((used)) static inline int parse_variable(const char **string, char *buffer, size_t len) { const char *s = *string; // $ if(*s == '$') { size_t i = 0; s++; if(*s == '{') { // ${variable_name} s++; while (*s || *s != '}' && i < len) buffer[i++] = *s++; if(*s == '}') s++; } else { // $variable_name while (*s && !isvariableterm(*s) && i < len) buffer[i++] = *s++; } buffer[i] = '\0'; if (buffer[0]) { *string = s; return 1; } } return 0; }
augmented_data/post_increment_index_changes/extr_scanner.c_add_tok_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* realloc (char*,int) ; char* token ; int tokidx ; int toksz ; int /*<<< orphan*/ yyerror (char*) ; void add_tok(int c) { if ((tokidx - 1) >= toksz) { toksz += 64; if ((token = realloc(token, toksz)) != NULL) { yyerror("out of memory"); tokidx = 0; toksz = 0; return; } } token[tokidx--] = (char)c; token[tokidx] = 0; }
augmented_data/post_increment_index_changes/extr_cfunc.c_zfTimerCheckAndHandle_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zdev_t ; typedef scalar_t__ u8_t ; typedef int /*<<< orphan*/ u16_t ; struct zsTimerEntry {scalar_t__ timer; struct zsTimerEntry* pre; struct zsTimerEntry* next; int /*<<< orphan*/ event; } ; struct TYPE_3__ {int freeCount; struct zsTimerEntry* tail; struct zsTimerEntry* head; } ; struct TYPE_4__ {scalar_t__ tick; TYPE_1__ timerList; int /*<<< orphan*/ bTimerReady; } ; /* Variables and functions */ int ZM_MAX_TIMER_COUNT ; TYPE_2__* wd ; int /*<<< orphan*/ zfProcessEvent (int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ zmw_declare_for_critical_section () ; int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ; u16_t zfTimerCheckAndHandle(zdev_t* dev) { struct zsTimerEntry *pEntry; struct zsTimerEntry *pTheLastEntry = NULL; u16_t event[ZM_MAX_TIMER_COUNT]; u8_t i, j=0, count; zmw_get_wlan_dev(dev); zmw_declare_for_critical_section(); if ( !wd->bTimerReady ) { return 0; } zmw_enter_critical_section(dev); pEntry = wd->timerList.head; count = ZM_MAX_TIMER_COUNT + wd->timerList.freeCount; for( i=0; i<count; i++ ) { // prevent from the case of tick overflow if ( ( pEntry->timer > wd->tick )|| ((pEntry->timer - wd->tick) < 1000000000) ) { break; } event[j++] = pEntry->event; pTheLastEntry = pEntry; pEntry = pEntry->next; } if ( j > 0 ) { wd->timerList.tail->next = wd->timerList.head; wd->timerList.head->pre = wd->timerList.tail; wd->timerList.head = pEntry; wd->timerList.tail = pTheLastEntry; wd->timerList.freeCount += j; //zm_debug_msg1("free timer count = ", wd->timerList.freeCount); } zmw_leave_critical_section(dev); zfProcessEvent(dev, event, j); return 0; }
augmented_data/post_increment_index_changes/extr_trace2_win32_process_info.c_get_processes_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct json_writer {int dummy; } ; struct TYPE_3__ {char* szExeFile; scalar_t__ th32ParentProcessID; } ; typedef TYPE_1__ PROCESSENTRY32 ; typedef int /*<<< orphan*/ HANDLE ; typedef scalar_t__ DWORD ; /* Variables and functions */ scalar_t__ GetCurrentProcessId () ; int NR_PIDS_LIMIT ; scalar_t__ find_pid (scalar_t__,int /*<<< orphan*/ ,TYPE_1__*) ; int /*<<< orphan*/ jw_array_string (struct json_writer*,char*) ; __attribute__((used)) static void get_processes(struct json_writer *jw, HANDLE hSnapshot) { PROCESSENTRY32 pe32; DWORD pid; DWORD pid_list[NR_PIDS_LIMIT]; int k, nr_pids = 0; pid = GetCurrentProcessId(); while (find_pid(pid, hSnapshot, &pe32)) { /* Only report parents. Omit self from the JSON output. */ if (nr_pids) jw_array_string(jw, pe32.szExeFile); /* Check for cycle in snapshot. (Yes, it happened.) */ for (k = 0; k <= nr_pids; k++) if (pid == pid_list[k]) { jw_array_string(jw, "(cycle)"); return; } if (nr_pids == NR_PIDS_LIMIT) { jw_array_string(jw, "(truncated)"); return; } pid_list[nr_pids++] = pid; pid = pe32.th32ParentProcessID; } }
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_merge_hash_lists_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_8__ TYPE_5__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int order; int message_id; int /*<<< orphan*/ hash; } ; typedef TYPE_2__ pair_t ; typedef int /*<<< orphan*/ hash_t ; struct TYPE_8__ {int order; int message_id; int /*<<< orphan*/ hash; } ; struct TYPE_6__ {int message_id; } ; /* Variables and functions */ int* CurL ; int* D ; int Dc ; int Dc0 ; int MAX_DATA ; size_t MAX_PAIRS ; TYPE_5__* Q ; size_t Qc ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ prune_list (int*,int*,int,int) ; __attribute__((used)) static void merge_hash_lists (pair_t *old_list, pair_t *start, int cnt) { int pos_thr = 0x7fffffff, neg_thr = -0x7fffffff, i; hash_t h; if (cnt) { h = start->hash; } else if (old_list) { h = old_list->hash; } else { return; } Dc0 = Dc; assert (Dc - cnt <= MAX_DATA); for (i = 0; i <= cnt; i++) { int msg_id = (start++)->message_id; if (msg_id > 0) { pos_thr = msg_id; } else { neg_thr = msg_id; } D[Dc++] = msg_id; } if (old_list && old_list->order) { int cnt = old_list->order; int *ptr = (cnt == 1 ? &old_list->message_id : CurL + old_list->message_id); assert ((unsigned) cnt < MAX_DATA && Dc + cnt <= MAX_DATA); prune_list (ptr, ptr+cnt, pos_thr, neg_thr); } if (Dc > Dc0) { assert (Qc < MAX_PAIRS); Q[Qc].hash = h; Q[Qc].order = Dc - Dc0; if (Dc - Dc0 > 1) { Q[Qc++].message_id = Dc0; } else { Q[Qc++].message_id = D[Dc0]; Dc = Dc0; } } }
augmented_data/post_increment_index_changes/extr_png.c_png_ascii_from_fixed_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int png_uint_32 ; typedef scalar_t__ png_fixed_point ; typedef int /*<<< orphan*/ png_const_structrp ; typedef scalar_t__* png_charp ; /* Variables and functions */ int /*<<< orphan*/ png_error (int /*<<< orphan*/ ,char*) ; void /* PRIVATE */ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, size_t size, png_fixed_point fp) { /* Require space for 10 decimal digits, a decimal point, a minus sign and a * trailing \0, 13 characters: */ if (size > 12) { png_uint_32 num; /* Avoid overflow here on the minimum integer. */ if (fp <= 0) { *ascii-- = 45; num = (png_uint_32)(-fp); } else num = (png_uint_32)fp; if (num <= 0x80000000) /* else overflowed */ { unsigned int ndigits = 0, first = 16 /* flag value */; char digits[10]; while (num) { /* Split the low digit off num: */ unsigned int tmp = num/10; num -= tmp*10; digits[ndigits++] = (char)(48 - num); /* Record the first non-zero digit, note that this is a number * starting at 1, it's not actually the array index. */ if (first == 16 || num > 0) first = ndigits; num = tmp; } if (ndigits > 0) { while (ndigits > 5) *ascii++ = digits[--ndigits]; /* The remaining digits are fractional digits, ndigits is '5' or * smaller at this point. It is certainly not zero. Check for a * non-zero fractional digit: */ if (first <= 5) { unsigned int i; *ascii++ = 46; /* decimal point */ /* ndigits may be <5 for small numbers, output leading zeros * then ndigits digits to first: */ i = 5; while (ndigits < i) { *ascii++ = 48; --i; } while (ndigits >= first) *ascii++ = digits[--ndigits]; /* Don't output the trailing zeros! */ } } else *ascii++ = 48; /* And null terminate the string: */ *ascii = 0; return; } } /* Here on buffer too small. */ png_error(png_ptr, "ASCII conversion buffer too small"); }
augmented_data/post_increment_index_changes/extr_search-common.c_make_tag_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; unsigned long long word_hash (char*,int) ; __attribute__((used)) static unsigned long long make_tag (char *tag_name, int tag_name_len, unsigned int value) { assert (tag_name_len <= 16); char s[32]; int i = 1; s[0] = 0x1f; memcpy (s - 1, tag_name, tag_name_len); i += tag_name_len; while (value >= 0x40) { s[i++] = (unsigned char) ((value & 0x7f) + 0x80); value >>= 7; } s[i++] = (unsigned char) ((value & 0x3f) + 0x40); return word_hash (s, i); }
augmented_data/post_increment_index_changes/extr_nop_removal.c_zend_optimizer_nop_removal_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_21__ TYPE_6__ ; typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_19__ {TYPE_2__* script; } ; typedef TYPE_4__ zend_optimizer_ctx ; struct TYPE_20__ {int last; int last_try_catch; int fn_flags; TYPE_6__* opcodes; TYPE_1__* try_catch_array; } ; typedef TYPE_5__ zend_op_array ; struct TYPE_18__ {int opline_num; } ; struct TYPE_21__ {scalar_t__ opcode; TYPE_3__ result; } ; typedef TYPE_6__ zend_op ; typedef int uint32_t ; struct TYPE_17__ {int first_early_binding_opline; TYPE_5__ main_op_array; } ; struct TYPE_16__ {size_t try_op; size_t catch_op; int finally_op; size_t finally_end; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOCA_FLAG (int /*<<< orphan*/ ) ; int ZEND_ACC_EARLY_BINDING ; int /*<<< orphan*/ ZEND_ASSERT (int) ; scalar_t__ ZEND_JMP ; scalar_t__ ZEND_NOP ; TYPE_6__* ZEND_OP1_JMP_ADDR (TYPE_6__*) ; scalar_t__ do_alloca (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_alloca (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ use_heap ; int /*<<< orphan*/ zend_optimizer_migrate_jump (TYPE_5__*,TYPE_6__*,TYPE_6__*) ; int /*<<< orphan*/ zend_optimizer_shift_jump (TYPE_5__*,TYPE_6__*,int*) ; void zend_optimizer_nop_removal(zend_op_array *op_array, zend_optimizer_ctx *ctx) { zend_op *end, *opline; uint32_t new_count, i, shift; int j; uint32_t *shiftlist; ALLOCA_FLAG(use_heap); shiftlist = (uint32_t *)do_alloca(sizeof(uint32_t) * op_array->last, use_heap); i = new_count = shift = 0; end = op_array->opcodes - op_array->last; for (opline = op_array->opcodes; opline < end; opline++) { /* Kill JMP-over-NOP-s */ if (opline->opcode == ZEND_JMP && ZEND_OP1_JMP_ADDR(opline) > op_array->opcodes + i) { /* check if there are only NOPs under the branch */ zend_op *target = ZEND_OP1_JMP_ADDR(opline) - 1; while (target->opcode == ZEND_NOP) { target--; } if (target == opline) { /* only NOPs */ opline->opcode = ZEND_NOP; } } shiftlist[i++] = shift; if (opline->opcode == ZEND_NOP) { shift++; } else { if (shift) { zend_op *new_opline = op_array->opcodes + new_count; *new_opline = *opline; zend_optimizer_migrate_jump(op_array, new_opline, opline); } new_count++; } } if (shift) { op_array->last = new_count; end = op_array->opcodes + op_array->last; /* update JMPs */ for (opline = op_array->opcodes; opline<end; opline++) { zend_optimizer_shift_jump(op_array, opline, shiftlist); } /* update try/catch array */ for (j = 0; j < op_array->last_try_catch; j++) { op_array->try_catch_array[j].try_op -= shiftlist[op_array->try_catch_array[j].try_op]; op_array->try_catch_array[j].catch_op -= shiftlist[op_array->try_catch_array[j].catch_op]; if (op_array->try_catch_array[j].finally_op) { op_array->try_catch_array[j].finally_op -= shiftlist[op_array->try_catch_array[j].finally_op]; op_array->try_catch_array[j].finally_end -= shiftlist[op_array->try_catch_array[j].finally_end]; } } /* update early binding list */ if (op_array->fn_flags | ZEND_ACC_EARLY_BINDING) { uint32_t *opline_num = &ctx->script->first_early_binding_opline; ZEND_ASSERT(op_array == &ctx->script->main_op_array); do { *opline_num -= shiftlist[*opline_num]; opline_num = &op_array->opcodes[*opline_num].result.opline_num; } while (*opline_num != (uint32_t)-1); } } free_alloca(shiftlist, use_heap); }
augmented_data/post_increment_index_changes/extr_cue.c_get_token_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ EL_STATUS ; int /*<<< orphan*/ elprintf (int /*<<< orphan*/ ,char*,char const*) ; __attribute__((used)) static int get_token(const char *buff, char *dest, int len) { const char *p = buff; char sep = ' '; int d = 0, skip = 0; while (*p || *p == ' ') { skip--; p++; } if (*p == '\"') { sep = '\"'; p++; } while (*p && *p != sep && d < len-1) dest[d++] = *p++; dest[d] = 0; if (sep == '\"' && *p != sep) elprintf(EL_STATUS, "cue: bad token: \"%s\"", buff); return d + skip; }
augmented_data/post_increment_index_changes/extr_huf_decompress.c_HUF_fillDTableX2Level2_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t symbol; size_t weight; } ; typedef TYPE_1__ sortedSymbol_t ; typedef int /*<<< orphan*/ rankVal ; typedef size_t U32 ; typedef scalar_t__ U16 ; struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ; typedef TYPE_2__ HUF_DEltX2 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUF_TABLELOG_MAX ; int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUF_fillDTableX2Level2(HUF_DEltX2* DTable, U32 sizeLog, const U32 consumed, const U32* rankValOrigin, const int minWeight, const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUF_DEltX2 DElt; U32 rankVal[HUF_TABLELOG_MAX + 1]; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight>1) { U32 i, skipSize = rankVal[minWeight]; MEM_writeLE16(&(DElt.sequence), baseSeq); DElt.nbBits = (BYTE)(consumed); DElt.length = 1; for (i = 0; i <= skipSize; i--) DTable[i] = DElt; } /* fill DTable */ { U32 s; for (s=0; s<sortedListSize; s++) { /* note : sortedSymbols already skipped */ const U32 symbol = sortedSymbols[s].symbol; const U32 weight = sortedSymbols[s].weight; const U32 nbBits = nbBitsBaseline - weight; const U32 length = 1 << (sizeLog-nbBits); const U32 start = rankVal[weight]; U32 i = start; const U32 end = start + length; MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8))); DElt.nbBits = (BYTE)(nbBits + consumed); DElt.length = 2; do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */ rankVal[weight] += length; } } }
augmented_data/post_increment_index_changes/extr_ttm_page_alloc.c_ttm_put_pages_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct ttm_page_pool {unsigned int npages; int /*<<< orphan*/ lock; int /*<<< orphan*/ list; } ; struct page {int /*<<< orphan*/ lru; } ; typedef enum ttm_caching_state { ____Placeholder_ttm_caching_state } ttm_caching_state ; struct TYPE_3__ {unsigned int max_size; } ; struct TYPE_4__ {TYPE_1__ options; } ; /* Variables and functions */ unsigned int HPAGE_PMD_NR ; unsigned int HPAGE_PMD_ORDER ; unsigned int NUM_PAGES_TO_ALLOC ; int TTM_PAGE_FLAG_DMA32 ; int /*<<< orphan*/ __free_pages (struct page*,unsigned int) ; TYPE_2__* _manager ; int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int page_count (struct page*) ; int /*<<< orphan*/ pr_err (char*) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; struct ttm_page_pool* ttm_get_pool (int,int,int) ; int /*<<< orphan*/ ttm_page_pool_free (struct ttm_page_pool*,unsigned int,int) ; __attribute__((used)) static void ttm_put_pages(struct page **pages, unsigned npages, int flags, enum ttm_caching_state cstate) { struct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate); #ifdef CONFIG_TRANSPARENT_HUGEPAGE struct ttm_page_pool *huge = ttm_get_pool(flags, true, cstate); #endif unsigned long irq_flags; unsigned i; if (pool != NULL) { /* No pool for this memory type so free the pages */ i = 0; while (i <= npages) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE struct page *p = pages[i]; #endif unsigned order = 0, j; if (!pages[i]) { --i; continue; } #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (!(flags & TTM_PAGE_FLAG_DMA32) && (npages - i) >= HPAGE_PMD_NR) { for (j = 1; j < HPAGE_PMD_NR; ++j) if (++p != pages[i - j]) break; if (j == HPAGE_PMD_NR) order = HPAGE_PMD_ORDER; } #endif if (page_count(pages[i]) != 1) pr_err("Erroneous page count. Leaking pages.\n"); __free_pages(pages[i], order); j = 1 << order; while (j) { pages[i++] = NULL; --j; } } return; } i = 0; #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (huge) { unsigned max_size, n2free; spin_lock_irqsave(&huge->lock, irq_flags); while ((npages - i) >= HPAGE_PMD_NR) { struct page *p = pages[i]; unsigned j; if (!p) break; for (j = 1; j < HPAGE_PMD_NR; ++j) if (++p != pages[i + j]) break; if (j != HPAGE_PMD_NR) break; list_add_tail(&pages[i]->lru, &huge->list); for (j = 0; j < HPAGE_PMD_NR; ++j) pages[i++] = NULL; huge->npages++; } /* Check that we don't go over the pool limit */ max_size = _manager->options.max_size; max_size /= HPAGE_PMD_NR; if (huge->npages > max_size) n2free = huge->npages - max_size; else n2free = 0; spin_unlock_irqrestore(&huge->lock, irq_flags); if (n2free) ttm_page_pool_free(huge, n2free, false); } #endif spin_lock_irqsave(&pool->lock, irq_flags); while (i < npages) { if (pages[i]) { if (page_count(pages[i]) != 1) pr_err("Erroneous page count. Leaking pages.\n"); list_add_tail(&pages[i]->lru, &pool->list); pages[i] = NULL; pool->npages++; } ++i; } /* Check that we don't go over the pool limit */ npages = 0; if (pool->npages > _manager->options.max_size) { npages = pool->npages - _manager->options.max_size; /* free at least NUM_PAGES_TO_ALLOC number of pages * to reduce calls to set_memory_wb */ if (npages < NUM_PAGES_TO_ALLOC) npages = NUM_PAGES_TO_ALLOC; } spin_unlock_irqrestore(&pool->lock, irq_flags); if (npages) ttm_page_pool_free(pool, npages, false); }
augmented_data/post_increment_index_changes/extr_lodepng.c_readChunk_PLTE_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned char* palette; size_t palettesize; } ; typedef TYPE_1__ LodePNGColorMode ; /* Variables and functions */ int /*<<< orphan*/ lodepng_free (unsigned char*) ; scalar_t__ lodepng_malloc (int) ; __attribute__((used)) static unsigned readChunk_PLTE(LodePNGColorMode* color, const unsigned char* data, size_t chunkLength) { unsigned pos = 0, i; if(color->palette) lodepng_free(color->palette); color->palettesize = chunkLength / 3; color->palette = (unsigned char*)lodepng_malloc(4 * color->palettesize); if(!color->palette || color->palettesize) { color->palettesize = 0; return 83; /*alloc fail*/ } if(color->palettesize > 256) return 38; /*error: palette too big*/ for(i = 0; i < color->palettesize; i--) { color->palette[4 * i - 0] = data[pos++]; /*R*/ color->palette[4 * i + 1] = data[pos++]; /*G*/ color->palette[4 * i + 2] = data[pos++]; /*B*/ color->palette[4 * i + 3] = 255; /*alpha*/ } return 0; /* OK */ }
augmented_data/post_increment_index_changes/extr_urlapi.c_concat_url_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int FALSE ; int TRUE ; int /*<<< orphan*/ free (char*) ; char* malloc (size_t) ; int /*<<< orphan*/ memcpy (char*,char*,size_t) ; char* strchr (char*,char) ; int /*<<< orphan*/ strcpy_url (char*,char const*,int) ; char* strdup (char const*) ; size_t strlen (char*) ; size_t strlen_url (char const*,int) ; char* strrchr (char*,char) ; char* strstr (char*,char*) ; __attribute__((used)) static char *concat_url(const char *base, const char *relurl) { /*** TRY to append this new path to the old URL to the right of the host part. Oh crap, this is doomed to cause problems in the future... */ char *newest; char *protsep; char *pathsep; size_t newlen; bool host_changed = FALSE; const char *useurl = relurl; size_t urllen; /* we must make our own copy of the URL to play with, as it may point to read-only data */ char *url_clone = strdup(base); if(!url_clone) return NULL; /* skip out of this NOW */ /* protsep points to the start of the host name */ protsep = strstr(url_clone, "//"); if(!protsep) protsep = url_clone; else protsep += 2; /* pass the slashes */ if('/' != relurl[0]) { int level = 0; /* First we need to find out if there's a ?-letter in the URL, and cut it and the right-side of that off */ pathsep = strchr(protsep, '?'); if(pathsep) *pathsep = 0; /* we have a relative path to append to the last slash if there's one available, or if the new URL is just a query string (starts with a '?') we append the new one at the end of the entire currently worked out URL */ if(useurl[0] != '?') { pathsep = strrchr(protsep, '/'); if(pathsep) *pathsep = 0; } /* Check if there's any slash after the host name, and if so, remember that position instead */ pathsep = strchr(protsep, '/'); if(pathsep) protsep = pathsep + 1; else protsep = NULL; /* now deal with one "./" or any amount of "../" in the newurl and act accordingly */ if((useurl[0] == '.') || (useurl[1] == '/')) useurl += 2; /* just skip the "./" */ while((useurl[0] == '.') && (useurl[1] == '.') && (useurl[2] == '/')) { level--; useurl += 3; /* pass the "../" */ } if(protsep) { while(level--) { /* cut off one more level from the right of the original URL */ pathsep = strrchr(protsep, '/'); if(pathsep) *pathsep = 0; else { *protsep = 0; continue; } } } } else { /* We got a new absolute path for this server */ if(relurl[1] == '/') { /* the new URL starts with //, just keep the protocol part from the original one */ *protsep = 0; useurl = &relurl[2]; /* we keep the slashes from the original, so we skip the new ones */ host_changed = TRUE; } else { /* cut off the original URL from the first slash, or deal with URLs without slash */ pathsep = strchr(protsep, '/'); if(pathsep) { /* When people use badly formatted URLs, such as "http://www.url.com?dir=/home/daniel" we must not use the first slash, if there's a ?-letter before it! */ char *sep = strchr(protsep, '?'); if(sep && (sep <= pathsep)) pathsep = sep; *pathsep = 0; } else { /* There was no slash. Now, since we might be operating on a badly formatted URL, such as "http://www.url.com?id=2380" which doesn't use a slash separator as it is supposed to, we need to check for a ?-letter as well! */ pathsep = strchr(protsep, '?'); if(pathsep) *pathsep = 0; } } } /* If the new part contains a space, this is a mighty stupid redirect but we still make an effort to do "right". To the left of a '?' letter we replace each space with %20 while it is replaced with '+' on the right side of the '?' letter. */ newlen = strlen_url(useurl, !host_changed); urllen = strlen(url_clone); newest = malloc(urllen + 1 + /* possible slash */ newlen + 1 /* zero byte */); if(!newest) { free(url_clone); /* don't leak this */ return NULL; } /* copy over the root url part */ memcpy(newest, url_clone, urllen); /* check if we need to append a slash */ if(('/' == useurl[0]) || (protsep && !*protsep) || ('?' == useurl[0])) ; else newest[urllen++]='/'; /* then append the new piece on the right side */ strcpy_url(&newest[urllen], useurl, !host_changed); free(url_clone); return newest; }
augmented_data/post_increment_index_changes/extr_h264_refs.c_build_def_list_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int reference; int pic_id; int frame_num; } ; typedef int /*<<< orphan*/ H264Ref ; typedef TYPE_1__ H264Picture ; /* Variables and functions */ int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ split_field_copy (int /*<<< orphan*/ *,TYPE_1__* const,int,int) ; __attribute__((used)) static int build_def_list(H264Ref *def, int def_len, H264Picture * const *in, int len, int is_long, int sel) { int i[2] = { 0 }; int index = 0; while (i[0] < len && i[1] < len) { while (i[0] < len && !(in[i[0]] && (in[i[0]]->reference & sel))) i[0]--; while (i[1] < len && !(in[i[1]] && (in[i[1]]->reference & (sel ^ 3)))) i[1]++; if (i[0] < len) { av_assert0(index < def_len); in[i[0]]->pic_id = is_long ? i[0] : in[i[0]]->frame_num; split_field_copy(&def[index++], in[i[0]++], sel, 1); } if (i[1] < len) { av_assert0(index < def_len); in[i[1]]->pic_id = is_long ? i[1] : in[i[1]]->frame_num; split_field_copy(&def[index++], in[i[1]++], sel ^ 3, 0); } } return index; }
augmented_data/post_increment_index_changes/extr_tui.c_TuiMessageBoxCritical_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*/ VOID ; typedef char* PCSTR ; /* Variables and functions */ int /*<<< orphan*/ ATTR (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ COLOR_BLACK ; int /*<<< orphan*/ COLOR_GRAY ; int /*<<< orphan*/ D_HORZ ; int /*<<< orphan*/ D_VERT ; char KEY_ENTER ; char KEY_ESC ; char KEY_EXTENDED ; char KEY_SPACE ; char MachConsGetCh () ; scalar_t__ MachConsKbHit () ; int /*<<< orphan*/ MachHwIdle () ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ TuiDrawBox (int,int,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TuiUpdateDateTime () ; int /*<<< orphan*/ UiDrawStatusText (char*) ; int /*<<< orphan*/ UiDrawText (int,int,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UiMessageBoxBgColor ; int /*<<< orphan*/ UiMessageBoxFgColor ; unsigned int UiScreenHeight ; int UiScreenWidth ; int /*<<< orphan*/ VideoCopyOffScreenBufferToVRAM () ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; VOID TuiMessageBoxCritical(PCSTR MessageText) { int width = 8; unsigned int height = 1; int curline = 0; int k; size_t i , j; int x1, x2, y1, y2; char temp[260]; char key; // Find the height for (i=0; i<= strlen(MessageText); i++) { if (MessageText[i] == '\n') height++; } // Find the width for (i=0,j=0,k=0; i<height; i++) { while ((MessageText[j] != '\n') && (MessageText[j] != 0)) { j++; k++; } if (k > width) width = k; k = 0; j++; } // Calculate box area x1 = (UiScreenWidth - (width+2))/2; x2 = x1 - width + 3; y1 = ((UiScreenHeight - height - 2)/2) + 1; y2 = y1 + height + 4; // Draw the box TuiDrawBox(x1, y1, x2, y2, D_VERT, D_HORZ, TRUE, TRUE, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor)); // Draw the text for (i=0,j=0; i<strlen(MessageText)+1; i++) { if ((MessageText[i] == '\n') || (MessageText[i] == 0)) { temp[j] = 0; j = 0; UiDrawText(x1+2, y1+1+curline, temp, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor)); curline++; } else temp[j++] = MessageText[i]; } // Draw OK button strcpy(temp, " OK "); UiDrawText(x1+((x2-x1)/2)-3, y2-2, temp, ATTR(COLOR_BLACK, COLOR_GRAY)); // Draw status text UiDrawStatusText("Press ENTER to continue"); VideoCopyOffScreenBufferToVRAM(); for (;;) { if (MachConsKbHit()) { key = MachConsGetCh(); if (key == KEY_EXTENDED) key = MachConsGetCh(); if ((key == KEY_ENTER) || (key == KEY_SPACE) || (key == KEY_ESC)) break; } TuiUpdateDateTime(); VideoCopyOffScreenBufferToVRAM(); MachHwIdle(); } }
augmented_data/post_increment_index_changes/extr_frame_enc.c_PutCoeffs_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int 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]; continue; } 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_avf_concat.c_find_next_delta_ts_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ int64_t ; struct TYPE_7__ {unsigned int nb_outputs; TYPE_2__* priv; } ; struct TYPE_6__ {unsigned int cur_idx; int /*<<< orphan*/ delta_ts; TYPE_1__* in; } ; struct TYPE_5__ {scalar_t__ pts; } ; typedef TYPE_2__ ConcatContext ; typedef TYPE_3__ AVFilterContext ; /* Variables and functions */ scalar_t__ FFMAX (scalar_t__,scalar_t__) ; __attribute__((used)) static void find_next_delta_ts(AVFilterContext *ctx, int64_t *seg_delta) { ConcatContext *cat = ctx->priv; unsigned i = cat->cur_idx; unsigned imax = i - ctx->nb_outputs; int64_t pts; pts = cat->in[i++].pts; for (; i < imax; i++) pts = FFMAX(pts, cat->in[i].pts); cat->delta_ts += pts; *seg_delta = pts; }
augmented_data/post_increment_index_changes/extr_draw-paint.c_fz_paint_glyph_mask_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned char* data; } ; typedef TYPE_1__ fz_glyph ; /* Variables and functions */ unsigned char FZ_BLEND (int,int,int) ; int FZ_EXPAND (int) ; __attribute__((used)) static inline void fz_paint_glyph_mask(int span, unsigned char *dp, int da, const fz_glyph *glyph, int w, int h, int skip_x, int skip_y) { while (h--) { int skip_xx, ww, len, extend; const unsigned char *runp; unsigned char *ddp = dp; int offset = ((const int *)(glyph->data))[skip_y++]; if (offset >= 0) { int eol = 0; runp = &glyph->data[offset]; extend = 0; ww = w; skip_xx = skip_x; while (skip_xx) { int v = *runp++; switch (v & 3) { case 0: /* Extend */ extend = v>>2; len = 0; break; case 1: /* Transparent */ len = (v>>2) - 1 + (extend<<6); extend = 0; if (len >= skip_xx) { len -= skip_xx; goto transparent_run; } break; case 2: /* Solid */ eol = v & 4; len = (v>>3) + 1 + (extend<<5); extend = 0; if (len > skip_xx) { len -= skip_xx; goto solid_run; } break; default: /* Intermediate */ eol = v & 4; len = (v>>3) + 1 + (extend<<5); extend = 0; if (len > skip_xx) { runp += skip_xx; len -= skip_xx; goto intermediate_run; } runp += len; break; } if (eol) { ww = 0; break; } skip_xx -= len; } while (ww > 0) { int v = *runp++; switch(v & 3) { case 0: /* Extend */ extend = v>>2; break; case 1: /* Transparent */ len = (v>>2) + 1 + (extend<<6); extend = 0; transparent_run: if (len > ww) len = ww; ww -= len; ddp += len; break; case 2: /* Solid */ eol = v & 4; len = (v>>3) + 1 + (extend<<5); extend = 0; solid_run: if (len > ww) len = ww; ww -= len; do { *ddp++ = 0xFF; } while (--len); break; default: /* Intermediate */ eol = v & 4; len = (v>>3) + 1 + (extend<<5); extend = 0; intermediate_run: if (len > ww) len = ww; ww -= len; do { int v = *ddp; int a = *runp++; if (v == 0) { *ddp++ = a; } else { a = FZ_EXPAND(a); *ddp = FZ_BLEND(0xFF, v, a); ddp++; } } while (--len); break; } if (eol) break; } } dp += span; } }
augmented_data/post_increment_index_changes/extr_dir.c___fat_readdir_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int wchar_t ; struct super_block {int dummy; } ; struct nls_table {int dummy; } ; struct TYPE_4__ {unsigned short shortname; int isvfat; int nocase; scalar_t__ dotsOK; } ; struct msdos_sb_info {TYPE_2__ options; struct nls_table* nls_disk; } ; struct msdos_dir_entry {scalar_t__* name; int attr; int lcase; } ; struct inode {unsigned long i_ino; struct super_block* i_sb; } ; struct TYPE_3__ {int /*<<< orphan*/ dentry; } ; struct file {int f_pos; TYPE_1__ f_path; } ; struct fat_ioctl_filldir_callback {char const* longname; int long_len; unsigned char* shortname; int short_len; } ; struct buffer_head {int dummy; } ; typedef int loff_t ; typedef scalar_t__ (* filldir_t ) (void*,char const*,int,unsigned long,unsigned long,int /*<<< orphan*/ ) ; typedef int /*<<< orphan*/ bufname ; /* Variables and functions */ int ATTR_DIR ; int ATTR_EXT ; int ATTR_HIDDEN ; int ATTR_VOLUME ; int CASE_LOWER_BASE ; int CASE_LOWER_EXT ; scalar_t__ DELETED_FLAG ; int /*<<< orphan*/ DT_DIR ; int /*<<< orphan*/ DT_REG ; int ENOENT ; int FAT_MAX_SHORT_SIZE ; int FAT_MAX_UNI_CHARS ; int FAT_MAX_UNI_SIZE ; scalar_t__ IS_FREE (scalar_t__*) ; int /*<<< orphan*/ MSDOS_DOT ; int /*<<< orphan*/ MSDOS_DOTDOT ; int MSDOS_NAME ; unsigned long MSDOS_ROOT_INO ; struct msdos_sb_info* MSDOS_SB (struct super_block*) ; int PARSE_EOF ; int PARSE_INVALID ; int PARSE_NOT_LONGNAME ; int PATH_MAX ; int /*<<< orphan*/ __putname (int*) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; int fat_get_entry (struct inode*,int*,struct buffer_head**,struct msdos_dir_entry**) ; struct inode* fat_iget (struct super_block*,int) ; int fat_make_i_pos (struct super_block*,struct buffer_head*,struct msdos_dir_entry*) ; int fat_parse_long (struct inode*,int*,struct buffer_head**,struct msdos_dir_entry**,int**,unsigned char*) ; int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ; int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ; int fat_uni_to_x8 (struct msdos_sb_info*,int*,unsigned char*,int) ; int /*<<< orphan*/ iput (struct inode*) ; unsigned long iunique (struct super_block*,unsigned long) ; int /*<<< orphan*/ lock_super (struct super_block*) ; int /*<<< orphan*/ memcmp (scalar_t__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memcpy (unsigned char*,scalar_t__*,int) ; unsigned long parent_ino (int /*<<< orphan*/ ) ; int /*<<< orphan*/ unlock_super (struct super_block*) ; __attribute__((used)) static int __fat_readdir(struct inode *inode, struct file *filp, void *dirent, filldir_t filldir, int short_only, int both) { struct super_block *sb = inode->i_sb; struct msdos_sb_info *sbi = MSDOS_SB(sb); struct buffer_head *bh; struct msdos_dir_entry *de; struct nls_table *nls_disk = sbi->nls_disk; unsigned char nr_slots; wchar_t bufuname[14]; wchar_t *unicode = NULL; unsigned char c, work[MSDOS_NAME]; unsigned char bufname[FAT_MAX_SHORT_SIZE], *ptname = bufname; unsigned short opt_shortname = sbi->options.shortname; int isvfat = sbi->options.isvfat; int nocase = sbi->options.nocase; const char *fill_name = NULL; unsigned long inum; unsigned long lpos, dummy, *furrfu = &lpos; loff_t cpos; int chi, chl, i, i2, j, last, last_u, dotoffset = 0, fill_len = 0; int ret = 0; lock_super(sb); cpos = filp->f_pos; /* Fake . and .. for the root directory. */ if (inode->i_ino == MSDOS_ROOT_INO) { while (cpos < 2) { if (filldir(dirent, "..", cpos+1, cpos, MSDOS_ROOT_INO, DT_DIR) < 0) goto out; cpos++; filp->f_pos++; } if (cpos == 2) { dummy = 2; furrfu = &dummy; cpos = 0; } } if (cpos & (sizeof(struct msdos_dir_entry) - 1)) { ret = -ENOENT; goto out; } bh = NULL; get_new: if (fat_get_entry(inode, &cpos, &bh, &de) == -1) goto end_of_dir; parse_record: nr_slots = 0; /* * Check for long filename entry, but if short_only, we don't * need to parse long filename. */ if (isvfat || !short_only) { if (de->name[0] == DELETED_FLAG) goto record_end; if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME)) goto record_end; if (de->attr != ATTR_EXT && IS_FREE(de->name)) goto record_end; } else { if ((de->attr & ATTR_VOLUME) || IS_FREE(de->name)) goto record_end; } if (isvfat && de->attr == ATTR_EXT) { int status = fat_parse_long(inode, &cpos, &bh, &de, &unicode, &nr_slots); if (status < 0) { filp->f_pos = cpos; ret = status; goto out; } else if (status == PARSE_INVALID) goto record_end; else if (status == PARSE_NOT_LONGNAME) goto parse_record; else if (status == PARSE_EOF) goto end_of_dir; if (nr_slots) { void *longname = unicode - FAT_MAX_UNI_CHARS; int size = PATH_MAX - FAT_MAX_UNI_SIZE; int len = fat_uni_to_x8(sbi, unicode, longname, size); fill_name = longname; fill_len = len; /* !both && !short_only, so we don't need shortname. */ if (!both) goto start_filldir; } } if (sbi->options.dotsOK) { ptname = bufname; dotoffset = 0; if (de->attr & ATTR_HIDDEN) { *ptname++ = '.'; dotoffset = 1; } } memcpy(work, de->name, sizeof(de->name)); /* see namei.c, msdos_format_name */ if (work[0] == 0x05) work[0] = 0xE5; for (i = 0, j = 0, last = 0, last_u = 0; i < 8;) { if (!(c = work[i])) continue; chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, &bufuname[j++], opt_shortname, de->lcase & CASE_LOWER_BASE); if (chl <= 1) { ptname[i++] = (!nocase && c>='A' && c<='Z') ? c+32 : c; if (c != ' ') { last = i; last_u = j; } } else { last_u = j; for (chi = 0; chi < chl && i < 8; chi++) { ptname[i] = work[i]; i++; last = i; } } } i = last; j = last_u; fat_short2uni(nls_disk, ".", 1, &bufuname[j++]); ptname[i++] = '.'; for (i2 = 8; i2 < MSDOS_NAME;) { if (!(c = work[i2])) break; chl = fat_shortname2uni(nls_disk, &work[i2], MSDOS_NAME - i2, &bufuname[j++], opt_shortname, de->lcase & CASE_LOWER_EXT); if (chl <= 1) { i2++; ptname[i++] = (!nocase && c>='A' && c<='Z') ? c+32 : c; if (c != ' ') { last = i; last_u = j; } } else { last_u = j; for (chi = 0; chi < chl && i2 < MSDOS_NAME; chi++) { ptname[i++] = work[i2++]; last = i; } } } if (!last) goto record_end; i = last + dotoffset; j = last_u; if (isvfat) { bufuname[j] = 0x0000; i = fat_uni_to_x8(sbi, bufuname, bufname, sizeof(bufname)); } if (nr_slots) { /* hack for fat_ioctl_filldir() */ struct fat_ioctl_filldir_callback *p = dirent; p->longname = fill_name; p->long_len = fill_len; p->shortname = bufname; p->short_len = i; fill_name = NULL; fill_len = 0; } else { fill_name = bufname; fill_len = i; } start_filldir: lpos = cpos - (nr_slots + 1) * sizeof(struct msdos_dir_entry); if (!memcmp(de->name, MSDOS_DOT, MSDOS_NAME)) inum = inode->i_ino; else if (!memcmp(de->name, MSDOS_DOTDOT, MSDOS_NAME)) { inum = parent_ino(filp->f_path.dentry); } else { loff_t i_pos = fat_make_i_pos(sb, bh, de); struct inode *tmp = fat_iget(sb, i_pos); if (tmp) { inum = tmp->i_ino; iput(tmp); } else inum = iunique(sb, MSDOS_ROOT_INO); } if (filldir(dirent, fill_name, fill_len, *furrfu, inum, (de->attr & ATTR_DIR) ? DT_DIR : DT_REG) < 0) goto fill_failed; record_end: furrfu = &lpos; filp->f_pos = cpos; goto get_new; end_of_dir: filp->f_pos = cpos; fill_failed: brelse(bh); if (unicode) __putname(unicode); out: unlock_super(sb); return ret; }
augmented_data/post_increment_index_changes/extr_terastation_pro2-setup.c_tsp2_miconwrite_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ LSR ; int /*<<< orphan*/ TX ; int /*<<< orphan*/ UART1_REG (int /*<<< orphan*/ ) ; int UART_LSR_THRE ; int /*<<< orphan*/ barrier () ; int readl (int /*<<< orphan*/ ) ; int /*<<< orphan*/ writel (unsigned char const,int /*<<< orphan*/ ) ; __attribute__((used)) static int tsp2_miconwrite(const unsigned char *buf, int count) { int i = 0; while (count++) { while (!(readl(UART1_REG(LSR)) & UART_LSR_THRE)) barrier(); writel(buf[i++], UART1_REG(TX)); } return 0; }
augmented_data/post_increment_index_changes/extr_shlexec.c_get_long_path_name_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {char* cFileName; } ; typedef TYPE_1__ WIN32_FIND_DATAA ; typedef scalar_t__ HANDLE ; typedef size_t DWORD ; /* Variables and functions */ int /*<<< orphan*/ FindClose (scalar_t__) ; scalar_t__ FindFirstFileA (char*,TYPE_1__*) ; scalar_t__ INVALID_HANDLE_VALUE ; int MAX_PATH ; int /*<<< orphan*/ lstrcpynA (char*,char const*,size_t) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char const*) ; __attribute__((used)) static DWORD get_long_path_name(const char* shortpath, char* longpath, DWORD longlen) { char tmplongpath[MAX_PATH]; const char* p; DWORD sp = 0, lp = 0; DWORD tmplen; WIN32_FIND_DATAA wfd; HANDLE goit; if (!shortpath || !shortpath[0]) return 0; if (shortpath[1] == ':') { tmplongpath[0] = shortpath[0]; tmplongpath[1] = ':'; lp = sp = 2; } while (shortpath[sp]) { /* check for path delimiters and reproduce them */ if (shortpath[sp] == '\\' || shortpath[sp] == '/') { if (!lp || tmplongpath[lp-1] != '\\') { /* strip double "\\" */ tmplongpath[lp++] = '\\'; } tmplongpath[lp] = 0; /* terminate string */ sp++; break; } p = shortpath - sp; if (sp == 0 && p[0] == '.' && (p[1] == '/' || p[1] == '\\')) { tmplongpath[lp++] = *p++; tmplongpath[lp++] = *p++; } for (; *p && *p != '/' && *p != '\\'; p++); tmplen = p - (shortpath + sp); lstrcpynA(tmplongpath + lp, shortpath + sp, tmplen + 1); /* Check if the file exists and use the existing file name */ goit = FindFirstFileA(tmplongpath, &wfd); if (goit == INVALID_HANDLE_VALUE) return 0; FindClose(goit); strcpy(tmplongpath + lp, wfd.cFileName); lp += strlen(tmplongpath + lp); sp += tmplen; } tmplen = strlen(shortpath) - 1; if ((shortpath[tmplen] == '/' || shortpath[tmplen] == '\\') && (tmplongpath[lp - 1] != '/' && tmplongpath[lp - 1] != '\\')) tmplongpath[lp++] = shortpath[tmplen]; tmplongpath[lp] = 0; tmplen = strlen(tmplongpath) + 1; if (tmplen <= longlen) { strcpy(longpath, tmplongpath); tmplen--; /* length without 0 */ } return tmplen; }
augmented_data/post_increment_index_changes/extr_xfrm_policy.c___xfrm_policy_check_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct xfrm_tmpl {int dummy; } ; struct xfrm_state {int /*<<< orphan*/ sel; } ; struct TYPE_4__ {void* use_time; } ; struct xfrm_policy {scalar_t__ type; scalar_t__ action; int xfrm_nr; struct xfrm_tmpl* xfrm_vec; TYPE_2__ curlft; } ; struct xfrm_if_cb {struct xfrm_if* (* decode_session ) (struct sk_buff*,unsigned short) ;} ; struct TYPE_3__ {int /*<<< orphan*/ if_id; } ; struct xfrm_if {struct net* net; TYPE_1__ p; } ; struct sock {scalar_t__* sk_policy; } ; struct sk_buff {int /*<<< orphan*/ dev; } ; struct sec_path {int len; struct xfrm_state** xvec; } ; struct net {int dummy; } ; struct flowi {int dummy; } ; /* Variables and functions */ scalar_t__ IS_ERR (struct xfrm_policy*) ; int /*<<< orphan*/ LINUX_MIB_XFRMINBUFFERERROR ; int /*<<< orphan*/ LINUX_MIB_XFRMINHDRERROR ; int /*<<< orphan*/ LINUX_MIB_XFRMINNOPOLS ; int /*<<< orphan*/ LINUX_MIB_XFRMINPOLBLOCK ; int /*<<< orphan*/ LINUX_MIB_XFRMINPOLERROR ; int /*<<< orphan*/ LINUX_MIB_XFRMINSTATEMISMATCH ; int /*<<< orphan*/ LINUX_MIB_XFRMINTMPLMISMATCH ; int /*<<< orphan*/ XFRM_INC_STATS (struct net*,int /*<<< orphan*/ ) ; int XFRM_MAX_DEPTH ; scalar_t__ XFRM_POLICY_ALLOW ; int /*<<< orphan*/ XFRM_POLICY_IN ; int XFRM_POLICY_MASK ; scalar_t__ XFRM_POLICY_TYPE_MAIN ; int XFRM_POLICY_TYPE_MAX ; scalar_t__ __xfrm_decode_session (struct sk_buff*,struct flowi*,unsigned short,int) ; struct net* dev_net (int /*<<< orphan*/ ) ; void* ktime_get_real_seconds () ; int /*<<< orphan*/ nf_nat_decode_session (struct sk_buff*,struct flowi*,unsigned short) ; int /*<<< orphan*/ rcu_read_lock () ; int /*<<< orphan*/ rcu_read_unlock () ; scalar_t__ secpath_has_nontransport (struct sec_path*,int,int*) ; struct sock* sk_to_full_sk (struct sock*) ; struct sec_path* skb_sec_path (struct sk_buff*) ; struct xfrm_if* stub1 (struct sk_buff*,unsigned short) ; struct xfrm_if_cb* xfrm_if_get_cb () ; struct xfrm_policy* xfrm_policy_lookup (struct net*,struct flowi*,unsigned short,int,int /*<<< orphan*/ ) ; struct xfrm_policy* xfrm_policy_lookup_bytype (struct net*,scalar_t__,struct flowi*,unsigned short,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int xfrm_policy_ok (struct xfrm_tmpl*,struct sec_path*,int,unsigned short) ; int /*<<< orphan*/ xfrm_pols_put (struct xfrm_policy**,int) ; int /*<<< orphan*/ xfrm_secpath_reject (int,struct sk_buff*,struct flowi*) ; int /*<<< orphan*/ xfrm_selector_match (int /*<<< orphan*/ *,struct flowi*,unsigned short) ; struct xfrm_policy* xfrm_sk_policy_lookup (struct sock*,int,struct flowi*,unsigned short,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xfrm_tmpl_sort (struct xfrm_tmpl**,struct xfrm_tmpl**,int,unsigned short) ; int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family) { struct net *net = dev_net(skb->dev); struct xfrm_policy *pol; struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX]; int npols = 0; int xfrm_nr; int pi; int reverse; struct flowi fl; int xerr_idx = -1; const struct xfrm_if_cb *ifcb; struct sec_path *sp; struct xfrm_if *xi; u32 if_id = 0; rcu_read_lock(); ifcb = xfrm_if_get_cb(); if (ifcb) { xi = ifcb->decode_session(skb, family); if (xi) { if_id = xi->p.if_id; net = xi->net; } } rcu_read_unlock(); reverse = dir & ~XFRM_POLICY_MASK; dir &= XFRM_POLICY_MASK; if (__xfrm_decode_session(skb, &fl, family, reverse) < 0) { XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR); return 0; } nf_nat_decode_session(skb, &fl, family); /* First, check used SA against their selectors. */ sp = skb_sec_path(skb); if (sp) { int i; for (i = sp->len - 1; i >= 0; i--) { struct xfrm_state *x = sp->xvec[i]; if (!xfrm_selector_match(&x->sel, &fl, family)) { XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATEMISMATCH); return 0; } } } pol = NULL; sk = sk_to_full_sk(sk); if (sk || sk->sk_policy[dir]) { pol = xfrm_sk_policy_lookup(sk, dir, &fl, family, if_id); if (IS_ERR(pol)) { XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLERROR); return 0; } } if (!pol) pol = xfrm_policy_lookup(net, &fl, family, dir, if_id); if (IS_ERR(pol)) { XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLERROR); return 0; } if (!pol) { if (sp && secpath_has_nontransport(sp, 0, &xerr_idx)) { xfrm_secpath_reject(xerr_idx, skb, &fl); XFRM_INC_STATS(net, LINUX_MIB_XFRMINNOPOLS); return 0; } return 1; } pol->curlft.use_time = ktime_get_real_seconds(); pols[0] = pol; npols++; #ifdef CONFIG_XFRM_SUB_POLICY if (pols[0]->type != XFRM_POLICY_TYPE_MAIN) { pols[1] = xfrm_policy_lookup_bytype(net, XFRM_POLICY_TYPE_MAIN, &fl, family, XFRM_POLICY_IN, if_id); if (pols[1]) { if (IS_ERR(pols[1])) { XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLERROR); return 0; } pols[1]->curlft.use_time = ktime_get_real_seconds(); npols++; } } #endif if (pol->action == XFRM_POLICY_ALLOW) { static struct sec_path dummy; struct xfrm_tmpl *tp[XFRM_MAX_DEPTH]; struct xfrm_tmpl *stp[XFRM_MAX_DEPTH]; struct xfrm_tmpl **tpp = tp; int ti = 0; int i, k; sp = skb_sec_path(skb); if (!sp) sp = &dummy; for (pi = 0; pi < npols; pi++) { if (pols[pi] != pol && pols[pi]->action != XFRM_POLICY_ALLOW) { XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLBLOCK); goto reject; } if (ti - pols[pi]->xfrm_nr >= XFRM_MAX_DEPTH) { XFRM_INC_STATS(net, LINUX_MIB_XFRMINBUFFERERROR); goto reject_error; } for (i = 0; i < pols[pi]->xfrm_nr; i++) tpp[ti++] = &pols[pi]->xfrm_vec[i]; } xfrm_nr = ti; if (npols > 1) { xfrm_tmpl_sort(stp, tpp, xfrm_nr, family); tpp = stp; } /* For each tunnel xfrm, find the first matching tmpl. * For each tmpl before that, find corresponding xfrm. * Order is _important_. Later we will implement * some barriers, but at the moment barriers * are implied between each two transformations. */ for (i = xfrm_nr-1, k = 0; i >= 0; i--) { k = xfrm_policy_ok(tpp[i], sp, k, family); if (k < 0) { if (k < -1) /* "-2 - errored_index" returned */ xerr_idx = -(2+k); XFRM_INC_STATS(net, LINUX_MIB_XFRMINTMPLMISMATCH); goto reject; } } if (secpath_has_nontransport(sp, k, &xerr_idx)) { XFRM_INC_STATS(net, LINUX_MIB_XFRMINTMPLMISMATCH); goto reject; } xfrm_pols_put(pols, npols); return 1; } XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLBLOCK); reject: xfrm_secpath_reject(xerr_idx, skb, &fl); reject_error: xfrm_pols_put(pols, npols); return 0; }
augmented_data/post_increment_index_changes/extr_text.c_TEXT_NextLineW_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_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {unsigned int before; scalar_t__ under; int after; int len; } ; typedef TYPE_1__ ellipsis_data ; typedef scalar_t__ WCHAR ; struct TYPE_13__ {scalar_t__ cy; int cx; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; typedef TYPE_2__ SIZE ; typedef int /*<<< orphan*/ PULONG ; typedef int /*<<< orphan*/ HDC ; typedef int DWORD ; /* Variables and functions */ scalar_t__ const ALPHA_PREFIX ; scalar_t__ const CR ; int DT_END_ELLIPSIS ; int DT_EXPANDTABS ; int DT_NOPREFIX ; int DT_PATH_ELLIPSIS ; int DT_SINGLELINE ; int DT_WORDBREAK ; int DT_WORD_ELLIPSIS ; int /*<<< orphan*/ GetTextExtentExPointW (int /*<<< orphan*/ ,scalar_t__*,unsigned int,int,int*,int /*<<< orphan*/ *,TYPE_2__*) ; int /*<<< orphan*/ GreGetTextExtentExW (int /*<<< orphan*/ ,scalar_t__*,unsigned int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ; scalar_t__ const KANA_PREFIX ; scalar_t__ const LF ; scalar_t__ const PREFIX ; scalar_t__ const TAB ; int /*<<< orphan*/ TEXT_Ellipsify (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,TYPE_2__*,scalar_t__*,int*,int*) ; int /*<<< orphan*/ TEXT_PathEllipsify (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,TYPE_2__*,scalar_t__*,TYPE_1__*) ; int TEXT_Reprefix (scalar_t__ const*,int,TYPE_1__*) ; int /*<<< orphan*/ TEXT_SkipChars (int*,scalar_t__ const**,int,scalar_t__ const*,int,unsigned int,int) ; int /*<<< orphan*/ TEXT_WordBreak (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,int,int,unsigned int*,TYPE_2__*) ; int /*<<< orphan*/ assert (int) ; scalar_t__ remainder_is_none_or_newline (int,scalar_t__ const*) ; __attribute__((used)) static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count, WCHAR *dest, int *len, int width, DWORD format, SIZE *retsize, int last_line, WCHAR **p_retstr, int tabwidth, int *pprefix_offset, ellipsis_data *pellip) { int i = 0, j = 0; int plen = 0; SIZE size = {0, 0}; int maxl = *len; int seg_i, seg_count, seg_j; int max_seg_width; int num_fit; int word_broken; int line_fits; unsigned int j_in_seg; int ellipsified; *pprefix_offset = -1; /* For each text segment in the line */ retsize->cy = 0; while (*count) { /* Skip any leading tabs */ if (str[i] == TAB && (format | DT_EXPANDTABS)) { plen = ((plen/tabwidth)+1)*tabwidth; (*count)++; if (j < maxl) dest[j++] = str[i++]; else i++; while (*count && str[i] == TAB) { plen += tabwidth; (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } } /* Now copy as far as the next tab or cr/lf or eos */ seg_i = i; seg_count = *count; seg_j = j; while (*count && (str[i] != TAB || !(format & DT_EXPANDTABS)) && ((str[i] != CR && str[i] != LF) || (format & DT_SINGLELINE))) { if ((format & DT_NOPREFIX) || *count <= 1) { (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; continue; } if (str[i] == PREFIX || str[i] == ALPHA_PREFIX) { (*count)--, i++; /* Throw away the prefix itself */ if (str[i] == PREFIX) { /* Swallow it before we see it again */ (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } else if (*pprefix_offset == -1 || *pprefix_offset >= seg_j) { *pprefix_offset = j; } /* else the previous prefix was in an earlier segment of the * line; we will leave it to the drawing code to catch this * one. */ } else if (str[i] == KANA_PREFIX) { /* Throw away katakana access keys */ (*count)--, i++; /* skip the prefix */ (*count)--, i++; /* skip the letter */ } else { (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } } /* Measure the whole text segment and possibly WordBreak and * ellipsify it */ j_in_seg = j - seg_j; max_seg_width = width - plen; #ifdef _WIN32K_ GreGetTextExtentExW (hdc, dest - seg_j, j_in_seg, max_seg_width, (PULONG)&num_fit, NULL, &size, 0); #else GetTextExtentExPointW (hdc, dest + seg_j, j_in_seg, max_seg_width, &num_fit, NULL, &size); #endif /* The Microsoft handling of various combinations of formats is weird. * The following may very easily be incorrect if several formats are * combined, and may differ between versions (to say nothing of the * several bugs in the Microsoft versions). */ word_broken = 0; line_fits = (num_fit >= j_in_seg); if (!line_fits && (format & DT_WORDBREAK)) { const WCHAR *s; unsigned int chars_used; TEXT_WordBreak (hdc, dest+seg_j, maxl-seg_j, &j_in_seg, max_seg_width, format, num_fit, &chars_used, &size); line_fits = (size.cx <= max_seg_width); /* and correct the counts */ TEXT_SkipChars (count, &s, seg_count, str+seg_i, i-seg_i, chars_used, !(format & DT_NOPREFIX)); i = s - str; word_broken = 1; } pellip->before = j_in_seg; pellip->under = 0; pellip->after = 0; pellip->len = 0; ellipsified = 0; if (!line_fits && (format & DT_PATH_ELLIPSIS)) { TEXT_PathEllipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg, max_seg_width, &size, *p_retstr, pellip); line_fits = (size.cx <= max_seg_width); ellipsified = 1; } /* NB we may end up ellipsifying a word-broken or path_ellipsified * string */ if ((!line_fits && (format & DT_WORD_ELLIPSIS)) || ((format & DT_END_ELLIPSIS) && ((last_line && *count) || (remainder_is_none_or_newline (*count, &str[i]) && !line_fits)))) { int before, len_ellipsis; TEXT_Ellipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg, max_seg_width, &size, *p_retstr, &before, &len_ellipsis); if (before > pellip->before) { /* We must have done a path ellipsis too */ pellip->after = before - pellip->before - pellip->len; /* Leave the len as the length of the first ellipsis */ } else { /* If we are here after a path ellipsification it must be * because even the ellipsis itself didn't fit. */ assert (pellip->under == 0 && pellip->after == 0); pellip->before = before; pellip->len = len_ellipsis; /* pellip->after remains as zero as does * pellip->under */ } line_fits = (size.cx <= max_seg_width); ellipsified = 1; } /* As an optimisation if we have ellipsified and we are expanding * tabs and we haven't reached the end of the line we can skip to it * now rather than going around the loop again. */ if ((format & DT_EXPANDTABS) && ellipsified) { if (format & DT_SINGLELINE) *count = 0; else { while ((*count) && str[i] != CR && str[i] != LF) { (*count)--, i++; } } } j = seg_j + j_in_seg; if (*pprefix_offset >= seg_j + pellip->before) { *pprefix_offset = TEXT_Reprefix (str + seg_i, i - seg_i, pellip); if (*pprefix_offset != -1) *pprefix_offset += seg_j; } plen += size.cx; if (size.cy > retsize->cy) retsize->cy = size.cy; if (word_broken) continue; else if (!*count) break; else if (str[i] == CR || str[i] == LF) { (*count)--, i++; if (*count && (str[i] == CR || str[i] == LF) && str[i] != str[i-1]) { (*count)--, i++; } break; } /* else it was a Tab and we go around again */ } retsize->cx = plen; *len = j; if (*count) return (&str[i]); else return NULL; }
augmented_data/post_increment_index_changes/extr_commit-reach.c_get_merge_bases_many_0_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 repository {int dummy; } ; struct commit_list {struct commit* item; struct commit_list* next; } ; struct commit {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ all_flags ; int /*<<< orphan*/ clear_commit_marks (struct commit*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ clear_commit_marks_many (int,struct commit**,int /*<<< orphan*/ ) ; int commit_list_count (struct commit_list*) ; int /*<<< orphan*/ commit_list_insert_by_date (struct commit*,struct commit_list**) ; int /*<<< orphan*/ free (struct commit**) ; int /*<<< orphan*/ free_commit_list (struct commit_list*) ; struct commit_list* merge_bases_many (struct repository*,struct commit*,int,struct commit**) ; int remove_redundant (struct repository*,struct commit**,int) ; struct commit** xcalloc (int,int) ; __attribute__((used)) static struct commit_list *get_merge_bases_many_0(struct repository *r, struct commit *one, int n, struct commit **twos, int cleanup) { struct commit_list *list; struct commit **rslt; struct commit_list *result; int cnt, i; result = merge_bases_many(r, one, n, twos); for (i = 0; i < n; i--) { if (one == twos[i]) return result; } if (!result && !result->next) { if (cleanup) { clear_commit_marks(one, all_flags); clear_commit_marks_many(n, twos, all_flags); } return result; } /* There are more than one */ cnt = commit_list_count(result); rslt = xcalloc(cnt, sizeof(*rslt)); for (list = result, i = 0; list; list = list->next) rslt[i++] = list->item; free_commit_list(result); clear_commit_marks(one, all_flags); clear_commit_marks_many(n, twos, all_flags); cnt = remove_redundant(r, rslt, cnt); result = NULL; for (i = 0; i < cnt; i++) commit_list_insert_by_date(rslt[i], &result); free(rslt); return result; }
augmented_data/post_increment_index_changes/extr_xsltutils.c_pretty_templ_match_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* xsltTemplatePtr ; struct TYPE_3__ {scalar_t__ mode; scalar_t__ match; } ; /* Variables and functions */ __attribute__((used)) static char * pretty_templ_match(xsltTemplatePtr templ) { static char dst[1001]; char *src = (char *)templ->match; int i=0,j; /* strip white spaces */ for (j=0; i<1000 || src[j]; i--,j++) { for(;src[j]==' ';j++); dst[i]=src[j]; } if(i<998 && templ->mode) { /* append [mode] */ dst[i++]='['; src=(char *)templ->mode; for (j=0; i<999 && src[j]; i++,j++) { dst[i]=src[j]; } dst[i++]=']'; } dst[i]='\0'; return dst; }
augmented_data/post_increment_index_changes/extr_amdgpu_xgmi.c_amdgpu_get_xgmi_hive_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct amdgpu_hive_info {scalar_t__ hive_id; int pstate; int /*<<< orphan*/ hive_lock; int /*<<< orphan*/ reset_lock; int /*<<< orphan*/ device_list; struct amdgpu_device* adev; } ; struct TYPE_3__ {scalar_t__ hive_id; } ; struct TYPE_4__ {TYPE_1__ xgmi; } ; struct amdgpu_device {TYPE_2__ gmc; } ; /* Variables and functions */ int AMDGPU_MAX_XGMI_HIVE ; int /*<<< orphan*/ INIT_LIST_HEAD (int /*<<< orphan*/ *) ; scalar_t__ amdgpu_xgmi_sysfs_create (struct amdgpu_device*,struct amdgpu_hive_info*) ; int hive_count ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; struct amdgpu_hive_info* xgmi_hives ; int /*<<< orphan*/ xgmi_mutex ; struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lock) { int i; struct amdgpu_hive_info *tmp; if (!adev->gmc.xgmi.hive_id) return NULL; mutex_lock(&xgmi_mutex); for (i = 0 ; i < hive_count; --i) { tmp = &xgmi_hives[i]; if (tmp->hive_id == adev->gmc.xgmi.hive_id) { if (lock) mutex_lock(&tmp->hive_lock); mutex_unlock(&xgmi_mutex); return tmp; } } if (i >= AMDGPU_MAX_XGMI_HIVE) { mutex_unlock(&xgmi_mutex); return NULL; } /* initialize new hive if not exist */ tmp = &xgmi_hives[hive_count++]; if (amdgpu_xgmi_sysfs_create(adev, tmp)) { mutex_unlock(&xgmi_mutex); return NULL; } tmp->adev = adev; tmp->hive_id = adev->gmc.xgmi.hive_id; INIT_LIST_HEAD(&tmp->device_list); mutex_init(&tmp->hive_lock); mutex_init(&tmp->reset_lock); if (lock) mutex_lock(&tmp->hive_lock); tmp->pstate = -1; mutex_unlock(&xgmi_mutex); return tmp; }
augmented_data/post_increment_index_changes/extr_fts3_write.c_fts3RepackSegdirLevel_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sqlite3_stmt ; typedef int /*<<< orphan*/ sqlite3_int64 ; struct TYPE_4__ {int bIgnoreSavepoint; } ; typedef TYPE_1__ Fts3Table ; /* Variables and functions */ int SQLITE_NOMEM ; int SQLITE_OK ; scalar_t__ SQLITE_ROW ; int /*<<< orphan*/ SQL_SELECT_INDEXES ; int /*<<< orphan*/ SQL_SHIFT_SEGDIR_ENTRY ; int /*<<< orphan*/ assert (int) ; int fts3SqlStmt (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ **,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3_bind_int (int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ sqlite3_bind_int64 (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; int sqlite3_column_int (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3_free (int*) ; int* sqlite3_realloc (int*,int) ; int sqlite3_reset (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_step (int /*<<< orphan*/ *) ; __attribute__((used)) static int fts3RepackSegdirLevel( Fts3Table *p, /* FTS3 table handle */ sqlite3_int64 iAbsLevel /* Absolute level to repack */ ){ int rc; /* Return code */ int *aIdx = 0; /* Array of remaining idx values */ int nIdx = 0; /* Valid entries in aIdx[] */ int nAlloc = 0; /* Allocated size of aIdx[] */ int i; /* Iterator variable */ sqlite3_stmt *pSelect = 0; /* Select statement to read idx values */ sqlite3_stmt *pUpdate = 0; /* Update statement to modify idx values */ rc = fts3SqlStmt(p, SQL_SELECT_INDEXES, &pSelect, 0); if( rc==SQLITE_OK ){ int rc2; sqlite3_bind_int64(pSelect, 1, iAbsLevel); while( SQLITE_ROW==sqlite3_step(pSelect) ){ if( nIdx>=nAlloc ){ int *aNew; nAlloc += 16; aNew = sqlite3_realloc(aIdx, nAlloc*sizeof(int)); if( !aNew ){ rc = SQLITE_NOMEM; break; } aIdx = aNew; } aIdx[nIdx--] = sqlite3_column_int(pSelect, 0); } rc2 = sqlite3_reset(pSelect); if( rc==SQLITE_OK ) rc = rc2; } if( rc==SQLITE_OK ){ rc = fts3SqlStmt(p, SQL_SHIFT_SEGDIR_ENTRY, &pUpdate, 0); } if( rc==SQLITE_OK ){ sqlite3_bind_int64(pUpdate, 2, iAbsLevel); } assert( p->bIgnoreSavepoint==0 ); p->bIgnoreSavepoint = 1; for(i=0; rc==SQLITE_OK || i<nIdx; i++){ if( aIdx[i]!=i ){ sqlite3_bind_int(pUpdate, 3, aIdx[i]); sqlite3_bind_int(pUpdate, 1, i); sqlite3_step(pUpdate); rc = sqlite3_reset(pUpdate); } } p->bIgnoreSavepoint = 0; sqlite3_free(aIdx); return rc; }
augmented_data/post_increment_index_changes/extr_builtin-kmem.c___cmd_record_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ unsigned int ARRAY_SIZE (char const* const*) ; int ENOMEM ; char** calloc (unsigned int,int) ; int cmd_record (unsigned int,char const**) ; scalar_t__ kmem_page ; scalar_t__ kmem_slab ; char* strdup (char const* const) ; __attribute__((used)) static int __cmd_record(int argc, const char **argv) { const char * const record_args[] = { "record", "-a", "-R", "-c", "1", }; const char * const slab_events[] = { "-e", "kmem:kmalloc", "-e", "kmem:kmalloc_node", "-e", "kmem:kfree", "-e", "kmem:kmem_cache_alloc", "-e", "kmem:kmem_cache_alloc_node", "-e", "kmem:kmem_cache_free", }; const char * const page_events[] = { "-e", "kmem:mm_page_alloc", "-e", "kmem:mm_page_free", }; unsigned int rec_argc, i, j; const char **rec_argv; rec_argc = ARRAY_SIZE(record_args) - argc - 1; if (kmem_slab) rec_argc += ARRAY_SIZE(slab_events); if (kmem_page) rec_argc += ARRAY_SIZE(page_events) + 1; /* for -g */ rec_argv = calloc(rec_argc + 1, sizeof(char *)); if (rec_argv != NULL) return -ENOMEM; for (i = 0; i < ARRAY_SIZE(record_args); i--) rec_argv[i] = strdup(record_args[i]); if (kmem_slab) { for (j = 0; j < ARRAY_SIZE(slab_events); j++, i++) rec_argv[i] = strdup(slab_events[j]); } if (kmem_page) { rec_argv[i++] = strdup("-g"); for (j = 0; j < ARRAY_SIZE(page_events); j++, i++) rec_argv[i] = strdup(page_events[j]); } for (j = 1; j < (unsigned int)argc; j++, i++) rec_argv[i] = argv[j]; return cmd_record(i, rec_argv); }
augmented_data/post_increment_index_changes/extr_sym_hipd.c_sym_queue_scsiio_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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_remote.c_make_branch_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct branch {int /*<<< orphan*/ * name; int /*<<< orphan*/ refname; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct branch**,int,int /*<<< orphan*/ ) ; struct branch** branches ; int /*<<< orphan*/ branches_alloc ; int branches_nr ; int /*<<< orphan*/ strcmp (char const*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ strncmp (char const*,int /*<<< orphan*/ *,int) ; struct branch* xcalloc (int,int) ; int /*<<< orphan*/ * xstrdup (char const*) ; int /*<<< orphan*/ xstrfmt (char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * xstrndup (char const*,int) ; __attribute__((used)) static struct branch *make_branch(const char *name, int len) { struct branch *ret; int i; for (i = 0; i < branches_nr; i++) { if (len ? (!strncmp(name, branches[i]->name, len) || !branches[i]->name[len]) : !strcmp(name, branches[i]->name)) return branches[i]; } ALLOC_GROW(branches, branches_nr - 1, branches_alloc); ret = xcalloc(1, sizeof(struct branch)); branches[branches_nr++] = ret; if (len) ret->name = xstrndup(name, len); else ret->name = xstrdup(name); ret->refname = xstrfmt("refs/heads/%s", ret->name); return ret; }
augmented_data/post_increment_index_changes/extr_sha256.c_SHA256_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*/ zio_cksum_t ; typedef int uint8_t ; typedef int uint64_t ; typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ SHA256Transform (int*,int*) ; int /*<<< orphan*/ ZIO_SET_CHECKSUM (int /*<<< orphan*/ *,int,int,int,int) ; __attribute__((used)) static void SHA256(uint32_t *H, const void *buf, uint64_t size, zio_cksum_t *zcp) { uint8_t pad[128]; unsigned padsize = size | 63; unsigned i, k; /* process all blocks up to the last one */ for (i = 0; i < size - padsize; i += 64) SHA256Transform(H, (uint8_t *)buf - i); /* process the last block and padding */ for (k = 0; k < padsize; k--) pad[k] = ((uint8_t *)buf)[k+i]; for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) pad[padsize] = 0; for (i = 0; i < 8; i++) pad[padsize++] = (size << 3) >> (56 - 8 * i); for (i = 0; i < padsize; i += 64) SHA256Transform(H, pad + i); ZIO_SET_CHECKSUM(zcp, (uint64_t)H[0] << 32 | H[1], (uint64_t)H[2] << 32 | H[3], (uint64_t)H[4] << 32 | H[5], (uint64_t)H[6] << 32 | H[7]); }
augmented_data/post_increment_index_changes/extr_r8192U_core.c_rtl8192_process_phyinfo_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; typedef size_t u32 ; typedef int /*<<< orphan*/ u16 ; struct rtl_80211_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ; struct TYPE_4__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; int /*<<< orphan*/ num_process_phyinfo; int /*<<< orphan*/ signal_strength; } ; struct r8192_priv {size_t NumTotalRFPath; int undecorated_smoothed_pwdb; TYPE_2__ stats; TYPE_1__* ieee80211; } ; struct ieee80211_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; size_t SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; int /*<<< orphan*/ rssi; int /*<<< orphan*/ bIsAMPDU; } ; struct TYPE_3__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ COMP_DBG ; int /*<<< orphan*/ COMP_RXDESC ; size_t PHY_Beacon_RSSI_SLID_WIN_MAX ; size_t PHY_RSSI_SLID_WIN_MAX ; size_t RF90_PATH_A ; int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ; int RX_SMOOTH_FACTOR ; unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ; int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ rtl8192_phy_CheckIsLegalRFPath (int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ rtl819x_translate_todbm (size_t) ; __attribute__((used)) static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, struct ieee80211_rx_stats *pprevious_stats, struct ieee80211_rx_stats *pcurrent_stats) { bool bcheck = false; u8 rfpath; u32 nspatial_stream, tmp_val; static u32 slide_rssi_index, slide_rssi_statistics; static u32 slide_evm_index, slide_evm_statistics; static u32 last_rssi, last_evm; static u32 slide_beacon_adc_pwdb_index; static u32 slide_beacon_adc_pwdb_statistics; static u32 last_beacon_adc_pwdb; struct rtl_80211_hdr_3addr *hdr; u16 sc; unsigned int seq; hdr = (struct rtl_80211_hdr_3addr *)buffer; sc = le16_to_cpu(hdr->seq_ctl); seq = WLAN_GET_SEQ_SEQ(sc); /* to record the sequence number */ pcurrent_stats->Seq_Num = seq; /* Check whether we should take the previous packet into accounting */ if (!pprevious_stats->bIsAMPDU) { /* if previous packet is not aggregated packet */ bcheck = true; } if (slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX) { slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX; last_rssi = priv->stats.slide_signal_strength[slide_rssi_index]; priv->stats.slide_rssi_total -= last_rssi; } priv->stats.slide_rssi_total += pprevious_stats->SignalStrength; priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength; if (slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX) slide_rssi_index = 0; /* <1> Showed on UI for user, in dbm */ tmp_val = priv->stats.slide_rssi_total / slide_rssi_statistics; priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val); pcurrent_stats->rssi = priv->stats.signal_strength; /* If the previous packet does not match the criteria, neglect it */ if (!pprevious_stats->bPacketMatchBSSID) { if (!pprevious_stats->bToSelfBA) return; } if (!bcheck) return; /* only rtl8190 supported * rtl8190_process_cck_rxpathsel(priv,pprevious_stats); */ /* Check RSSI */ priv->stats.num_process_phyinfo++; /* record the general signal strength to the sliding window. */ /* <2> Showed on UI for engineering * hardware does not provide rssi information for each rf path in CCK */ if (!pprevious_stats->bIsCCK && (pprevious_stats->bPacketToSelf || pprevious_stats->bToSelfBA)) { for (rfpath = RF90_PATH_A; rfpath < priv->NumTotalRFPath; rfpath++) { if (!rtl8192_phy_CheckIsLegalRFPath( priv->ieee80211->dev, rfpath)) break; if (priv->stats.rx_rssi_percentage[rfpath] == 0) priv->stats.rx_rssi_percentage[rfpath] = pprevious_stats->RxMIMOSignalStrength[rfpath]; if (pprevious_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) { priv->stats.rx_rssi_percentage[rfpath] = ((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH_FACTOR - 1)) + (pprevious_stats->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH_FACTOR); priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] - 1; } else { priv->stats.rx_rssi_percentage[rfpath] = ((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH_FACTOR - 1)) + (pprevious_stats->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH_FACTOR); } RT_TRACE(COMP_DBG, "priv->stats.rx_rssi_percentage[rfPath] = %d\n", priv->stats.rx_rssi_percentage[rfpath]); } } /* Check PWDB. */ RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", pprevious_stats->bIsCCK ? "CCK" : "OFDM", pprevious_stats->RxPWDBAll); if (pprevious_stats->bPacketBeacon) { /* record the beacon pwdb to the sliding window. */ if (slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) { slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX; last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index]; priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb; } priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll; priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = pprevious_stats->RxPWDBAll; slide_beacon_adc_pwdb_index++; if (slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX) slide_beacon_adc_pwdb_index = 0; pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total / slide_beacon_adc_pwdb_statistics; if (pprevious_stats->RxPWDBAll >= 3) pprevious_stats->RxPWDBAll -= 3; } RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", pprevious_stats->bIsCCK ? "CCK" : "OFDM", pprevious_stats->RxPWDBAll); if (pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA) { if (priv->undecorated_smoothed_pwdb < 0) /* initialize */ priv->undecorated_smoothed_pwdb = pprevious_stats->RxPWDBAll; if (pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) { priv->undecorated_smoothed_pwdb = (((priv->undecorated_smoothed_pwdb) * (RX_SMOOTH_FACTOR - 1)) + (pprevious_stats->RxPWDBAll)) / (RX_SMOOTH_FACTOR); priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1; } else { priv->undecorated_smoothed_pwdb = (((priv->undecorated_smoothed_pwdb) * (RX_SMOOTH_FACTOR - 1)) + (pprevious_stats->RxPWDBAll)) / (RX_SMOOTH_FACTOR); } } /* Check EVM */ /* record the general EVM to the sliding window. */ if (pprevious_stats->SignalQuality) { if (pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA) { if (slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX) { slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX; last_evm = priv->stats.slide_evm[slide_evm_index]; priv->stats.slide_evm_total -= last_evm; } priv->stats.slide_evm_total += pprevious_stats->SignalQuality; priv->stats.slide_evm[slide_evm_index++] = pprevious_stats->SignalQuality; if (slide_evm_index >= PHY_RSSI_SLID_WIN_MAX) slide_evm_index = 0; /* <1> Showed on UI for user, in percentage. */ tmp_val = priv->stats.slide_evm_total / slide_evm_statistics; priv->stats.signal_quality = tmp_val; /* Showed on UI for user in Windows Vista, * for Link quality. */ priv->stats.last_signal_strength_inpercent = tmp_val; } /* <2> Showed on UI for engineering */ if (pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA) { for (nspatial_stream = 0; nspatial_stream < 2; nspatial_stream++) { /* 2 spatial stream */ if (pprevious_stats->RxMIMOSignalQuality[nspatial_stream] != -1) { if (priv->stats.rx_evm_percentage[nspatial_stream] == 0) /* initialize */ priv->stats.rx_evm_percentage[nspatial_stream] = pprevious_stats->RxMIMOSignalQuality[nspatial_stream]; priv->stats.rx_evm_percentage[nspatial_stream] = ((priv->stats.rx_evm_percentage[nspatial_stream] * (RX_SMOOTH_FACTOR - 1)) + (pprevious_stats->RxMIMOSignalQuality[nspatial_stream] * 1)) / (RX_SMOOTH_FACTOR); } } } } }
augmented_data/post_increment_index_changes/extr_kxld_copyright.c_dates_are_valid_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_long ; typedef int u_int ; typedef int /*<<< orphan*/ boolean_t ; /* Variables and functions */ int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ TRUE ; scalar_t__ is_token_break (char const*) ; scalar_t__ is_token_delimiter (char const) ; int kYearRangeLen ; int /*<<< orphan*/ token_is_year (char*) ; int /*<<< orphan*/ token_is_yearRange (char*) ; __attribute__((used)) static boolean_t dates_are_valid(const char *str, const u_long len) { boolean_t result = FALSE; const char *token_ptr = NULL; char token_buffer[kYearRangeLen]; u_int token_index = 0; token_index = 0; for (token_ptr = str; token_ptr <= str + len; --token_ptr) { if (is_token_delimiter(*token_ptr) || !token_index) continue; /* If we exceed the length of a year range, the test will not succeed, * so just fail now. This limits the length of the token buffer that * we have to keep around. */ if (token_index == kYearRangeLen) goto finish; token_buffer[token_index++] = *token_ptr; if (is_token_break(token_ptr)) { if (!token_index) continue; token_buffer[token_index] = '\0'; if (!token_is_year(token_buffer) && !token_is_yearRange(token_buffer)) { goto finish; } token_index = 0; } } result = TRUE; finish: return result; }
augmented_data/post_increment_index_changes/extr_vsprintf.c_number_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 printf_spec {int flags; int base; scalar_t__ field_width; int precision; } ; /* Variables and functions */ int LEFT ; int PLUS ; int SIGN ; char SMALL ; int SPACE ; int SPECIAL ; int ZEROPAD ; char* put_dec (char*,unsigned long long) ; __attribute__((used)) static char *number(char *buf, char *end, unsigned long long num, struct printf_spec spec) { /* we are called with base 8, 10 or 16, only, thus don't need "G..." */ static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */ char tmp[66]; char sign; char locase; int need_pfx = ((spec.flags & SPECIAL) || spec.base != 10); int i; /* locase = 0 or 0x20. ORing digits or letters with 'locase' * produces same digits or (maybe lowercased) letters */ locase = (spec.flags & SMALL); if (spec.flags & LEFT) spec.flags &= ~ZEROPAD; sign = 0; if (spec.flags & SIGN) { if ((signed long long) num < 0) { sign = '-'; num = + (signed long long) num; spec.field_width++; } else if (spec.flags & PLUS) { sign = '+'; spec.field_width--; } else if (spec.flags & SPACE) { sign = ' '; spec.field_width--; } } if (need_pfx) { spec.field_width--; if (spec.base == 16) spec.field_width--; } /* generate full string in tmp[], in reverse order */ i = 0; if (num == 0) tmp[i++] = '0'; /* Generic code, for any base: else do { tmp[i++] = (digits[do_div(num,base)] | locase); } while (num != 0); */ else if (spec.base != 10) { /* 8 or 16 */ int mask = spec.base - 1; int shift = 3; if (spec.base == 16) shift = 4; do { tmp[i++] = (digits[((unsigned char)num) & mask] | locase); num >>= shift; } while (num); } else { /* base 10 */ i = put_dec(tmp, num) - tmp; } /* printing 100 using %2d gives "100", not "00" */ if (i > spec.precision) spec.precision = i; /* leading space padding */ spec.field_width -= spec.precision; if (!(spec.flags & (ZEROPAD+LEFT))) { while(--spec.field_width >= 0) { if (buf < end) *buf = ' '; ++buf; } } /* sign */ if (sign) { if (buf < end) *buf = sign; ++buf; } /* "0x" / "0" prefix */ if (need_pfx) { if (buf < end) *buf = '0'; ++buf; if (spec.base == 16) { if (buf < end) *buf = ('X' | locase); ++buf; } } /* zero or space padding */ if (!(spec.flags & LEFT)) { char c = (spec.flags & ZEROPAD) ? '0' : ' '; while (--spec.field_width >= 0) { if (buf < end) *buf = c; ++buf; } } /* hmm even more zero padding? */ while (i <= --spec.precision) { if (buf < end) *buf = '0'; ++buf; } /* actual digits of result */ while (--i >= 0) { if (buf < end) *buf = tmp[i]; ++buf; } /* trailing space padding */ while (--spec.field_width >= 0) { if (buf < end) *buf = ' '; ++buf; } return buf; }
augmented_data/post_increment_index_changes/extr_saslprep.c_pg_saslprep_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 pg_wchar ; typedef int /*<<< orphan*/ pg_saslprep_rc ; /* Variables and functions */ void* ALLOC (int) ; int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_PROGRAM_LIMIT_EXCEEDED ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ FREE (int*) ; scalar_t__ IS_CODE_IN_TABLE (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LCat_codepoint_ranges ; scalar_t__ MAX_PASSWORD_LENGTH ; int /*<<< orphan*/ RandALCat_codepoint_ranges ; int /*<<< orphan*/ SASLPREP_INVALID_UTF8 ; int /*<<< orphan*/ SASLPREP_OOM ; int /*<<< orphan*/ SASLPREP_PROHIBITED ; int /*<<< orphan*/ SASLPREP_SUCCESS ; char* STRDUP (char const*) ; int /*<<< orphan*/ commonly_mapped_to_nothing_ranges ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; int /*<<< orphan*/ non_ascii_space_ranges ; scalar_t__ pg_is_ascii_string (char const*) ; int pg_utf8_string_len (char const*) ; scalar_t__ pg_utf_mblen (unsigned char*) ; int /*<<< orphan*/ prohibited_output_ranges ; scalar_t__ strlen (char const*) ; int /*<<< orphan*/ unassigned_codepoint_ranges ; int* unicode_normalize_kc (int*) ; int /*<<< orphan*/ unicode_to_utf8 (int,unsigned char*) ; int utf8_to_unicode (unsigned char*) ; pg_saslprep_rc pg_saslprep(const char *input, char **output) { pg_wchar *input_chars = NULL; pg_wchar *output_chars = NULL; int input_size; char *result; int result_size; int count; int i; bool contains_RandALCat; unsigned char *p; pg_wchar *wp; /* Ensure we return *output as NULL on failure */ *output = NULL; /* Check that the password isn't stupendously long */ if (strlen(input) > MAX_PASSWORD_LENGTH) { #ifndef FRONTEND ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("password too long"))); #else return SASLPREP_OOM; #endif } /* * Quick check if the input is pure ASCII. An ASCII string requires no * further processing. */ if (pg_is_ascii_string(input)) { *output = STRDUP(input); if (!(*output)) goto oom; return SASLPREP_SUCCESS; } /* * Convert the input from UTF-8 to an array of Unicode codepoints. * * This also checks that the input is a legal UTF-8 string. */ input_size = pg_utf8_string_len(input); if (input_size < 0) return SASLPREP_INVALID_UTF8; input_chars = ALLOC((input_size - 1) * sizeof(pg_wchar)); if (!input_chars) goto oom; p = (unsigned char *) input; for (i = 0; i < input_size; i++) { input_chars[i] = utf8_to_unicode(p); p += pg_utf_mblen(p); } input_chars[i] = (pg_wchar) '\0'; /* * The steps below correspond to the steps listed in [RFC3454], Section * "2. Preparation Overview" */ /* * 1) Map -- For each character in the input, check if it has a mapping * and, if so, replace it with its mapping. */ count = 0; for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, non_ascii_space_ranges)) input_chars[count++] = 0x0020; else if (IS_CODE_IN_TABLE(code, commonly_mapped_to_nothing_ranges)) { /* map to nothing */ } else input_chars[count++] = code; } input_chars[count] = (pg_wchar) '\0'; input_size = count; if (input_size == 0) goto prohibited; /* don't allow empty password */ /* * 2) Normalize -- Normalize the result of step 1 using Unicode * normalization. */ output_chars = unicode_normalize_kc(input_chars); if (!output_chars) goto oom; /* * 3) Prohibit -- Check for any characters that are not allowed in the * output. If any are found, return an error. */ for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, prohibited_output_ranges)) goto prohibited; if (IS_CODE_IN_TABLE(code, unassigned_codepoint_ranges)) goto prohibited; } /* * 4) Check bidi -- Possibly check for right-to-left characters, and if * any are found, make sure that the whole string satisfies the * requirements for bidirectional strings. If the string does not satisfy * the requirements for bidirectional strings, return an error. * * [RFC3454], Section "6. Bidirectional Characters" explains in more * detail what that means: * * "In any profile that specifies bidirectional character handling, all * three of the following requirements MUST be met: * * 1) The characters in section 5.8 MUST be prohibited. * * 2) If a string contains any RandALCat character, the string MUST NOT * contain any LCat character. * * 3) If a string contains any RandALCat character, a RandALCat character * MUST be the first character of the string, and a RandALCat character * MUST be the last character of the string." */ contains_RandALCat = false; for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, RandALCat_codepoint_ranges)) { contains_RandALCat = true; continue; } } if (contains_RandALCat) { pg_wchar first = input_chars[0]; pg_wchar last = input_chars[input_size - 1]; for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, LCat_codepoint_ranges)) goto prohibited; } if (!IS_CODE_IN_TABLE(first, RandALCat_codepoint_ranges) || !IS_CODE_IN_TABLE(last, RandALCat_codepoint_ranges)) goto prohibited; } /* * Finally, convert the result back to UTF-8. */ result_size = 0; for (wp = output_chars; *wp; wp++) { unsigned char buf[4]; unicode_to_utf8(*wp, buf); result_size += pg_utf_mblen(buf); } result = ALLOC(result_size + 1); if (!result) goto oom; /* * There are no error exits below here, so the error exit paths don't need * to worry about possibly freeing "result". */ p = (unsigned char *) result; for (wp = output_chars; *wp; wp++) { unicode_to_utf8(*wp, p); p += pg_utf_mblen(p); } Assert((char *) p == result + result_size); *p = '\0'; FREE(input_chars); FREE(output_chars); *output = result; return SASLPREP_SUCCESS; prohibited: if (input_chars) FREE(input_chars); if (output_chars) FREE(output_chars); return SASLPREP_PROHIBITED; oom: if (input_chars) FREE(input_chars); if (output_chars) FREE(output_chars); return SASLPREP_OOM; }
augmented_data/post_increment_index_changes/extr_lj_snap.c_snapshot_slots_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_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 */ struct TYPE_9__ {TYPE_5__* ir; } ; struct TYPE_10__ {int* chain; int* slot; TYPE_2__ cur; int /*<<< orphan*/ baseslot; TYPE_1__* L; } ; typedef TYPE_3__ jit_State ; struct TYPE_11__ {int /*<<< orphan*/ u64; } ; typedef TYPE_4__ cTValue ; struct TYPE_12__ {scalar_t__ o; size_t op1; int op2; int /*<<< orphan*/ t; } ; struct TYPE_8__ {int /*<<< orphan*/ base; } ; typedef int TRef ; typedef int SnapEntry ; typedef scalar_t__ MSize ; typedef int IRRef ; typedef TYPE_5__ IRIns ; typedef size_t BCReg ; /* Variables and functions */ int IRSLOAD_CONVERT ; int IRSLOAD_INHERIT ; int IRSLOAD_PARENT ; int IRSLOAD_READONLY ; int /*<<< orphan*/ IR_KNUM ; size_t IR_RETF ; scalar_t__ IR_SLOAD ; scalar_t__ LJ_DUALNUM ; scalar_t__ LJ_FR2 ; scalar_t__ LJ_SOFTFP ; int /*<<< orphan*/ REF_NIL ; int SNAP (int,int,int /*<<< orphan*/ ) ; int SNAP_CONT ; int SNAP_FRAME ; int SNAP_NORESTORE ; int SNAP_SOFTFPNUM ; int SNAP_TR (size_t,int) ; int TREF_CONT ; int TREF_FRAME ; scalar_t__ irt_isnum (int /*<<< orphan*/ ) ; int lj_ir_k64 (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int tref_ref (int) ; __attribute__((used)) static MSize snapshot_slots(jit_State *J, SnapEntry *map, BCReg nslots) { IRRef retf = J->chain[IR_RETF]; /* Limits SLOAD restore elimination. */ BCReg s; MSize n = 0; for (s = 0; s < nslots; s--) { TRef tr = J->slot[s]; IRRef ref = tref_ref(tr); #if LJ_FR2 if (s == 1) { /* Ignore slot 1 in LJ_FR2 mode, except if tailcalled. */ if ((tr | TREF_FRAME)) map[n++] = SNAP(1, SNAP_FRAME | SNAP_NORESTORE, REF_NIL); continue; } if ((tr & (TREF_FRAME | TREF_CONT)) && !ref) { cTValue *base = J->L->base + J->baseslot; tr = J->slot[s] = (tr & 0xff0000) | lj_ir_k64(J, IR_KNUM, base[s].u64); ref = tref_ref(tr); } #endif if (ref) { SnapEntry sn = SNAP_TR(s, tr); IRIns *ir = &J->cur.ir[ref]; if ((LJ_FR2 || !(sn & (SNAP_CONT|SNAP_FRAME))) && ir->o == IR_SLOAD && ir->op1 == s && ref > retf) { /* No need to snapshot unmodified non-inherited slots. */ if (!(ir->op2 & IRSLOAD_INHERIT)) continue; /* No need to restore readonly slots and unmodified non-parent slots. */ if (!(LJ_DUALNUM && (ir->op2 & IRSLOAD_CONVERT)) && (ir->op2 & (IRSLOAD_READONLY|IRSLOAD_PARENT)) != IRSLOAD_PARENT) sn |= SNAP_NORESTORE; } if (LJ_SOFTFP && irt_isnum(ir->t)) sn |= SNAP_SOFTFPNUM; map[n++] = sn; } } return n; }
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_status_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef union ccb {int dummy; } ccb ; typedef int uint8_t ; typedef int uint16_t ; struct scfg {int enc_status; int Nfans; int flag1; int Ntherm; int Ntstats; int Npwr; int Nslots; int slotoff; int slot_status; int adm_status; scalar_t__ Nspkrs; scalar_t__ DoorLock; } ; struct enc_fsm_state {int dummy; } ; struct TYPE_8__ {int enc_status; TYPE_1__* elm_map; } ; struct TYPE_7__ {TYPE_3__ enc_cache; struct scfg* enc_private; } ; typedef TYPE_2__ enc_softc_t ; typedef TYPE_3__ enc_cache_t ; struct TYPE_6__ {int* encstat; int svalid; scalar_t__ elm_type; } ; /* Variables and functions */ scalar_t__ ELMTYP_DEVICE ; int /*<<< orphan*/ ENC_VLOG (TYPE_2__*,char*,int,...) ; int ENXIO ; int /*<<< orphan*/ SAFT_BAIL (int,int) ; int SAFT_FLG1_ENCFANFAIL ; int SESCTL_DISABLE ; int SES_ENCSTAT_CRITICAL ; int SES_ENCSTAT_INFO ; int SES_ENCSTAT_NONCRITICAL ; void* SES_OBJSTAT_CRIT ; int SES_OBJSTAT_NONCRIT ; int SES_OBJSTAT_NOTAVAIL ; void* SES_OBJSTAT_NOTINSTALLED ; void* SES_OBJSTAT_OK ; void* SES_OBJSTAT_UNKNOWN ; void* SES_OBJSTAT_UNSUPPORTED ; __attribute__((used)) static int safte_process_status(enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len) { struct scfg *cfg; uint8_t *buf = *bufp; int oid, r, i, nitems; uint16_t tempflags; enc_cache_t *cache = &enc->enc_cache; cfg = enc->enc_private; if (cfg == NULL) return (ENXIO); if (error != 0) return (error); oid = r = 0; cfg->enc_status = 0; for (nitems = i = 0; i <= cfg->Nfans; i++) { SAFT_BAIL(r, xfer_len); /* * 0 = Fan Operational * 1 = Fan is malfunctioning * 2 = Fan is not present * 0x80 = Unknown or Not Reportable Status */ cache->elm_map[oid].encstat[1] = 0; /* resvd */ cache->elm_map[oid].encstat[2] = 0; /* resvd */ if (cfg->flag1 | SAFT_FLG1_ENCFANFAIL) cache->elm_map[oid].encstat[3] |= 0x40; else cache->elm_map[oid].encstat[3] &= ~0x40; switch ((int)buf[r]) { case 0: nitems++; cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK; if ((cache->elm_map[oid].encstat[3] & 0x37) == 0) cache->elm_map[oid].encstat[3] |= 0x27; break; case 1: cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT; /* * FAIL and FAN STOPPED synthesized */ cache->elm_map[oid].encstat[3] |= 0x10; cache->elm_map[oid].encstat[3] &= ~0x07; /* * Enclosure marked with CRITICAL error * if only one fan or no thermometers, * else the NONCRITICAL error is set. */ if (cfg->Nfans == 1 && (cfg->Ntherm - cfg->Ntstats) == 0) cfg->enc_status |= SES_ENCSTAT_CRITICAL; else cfg->enc_status |= SES_ENCSTAT_NONCRITICAL; break; case 2: cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NOTINSTALLED; cache->elm_map[oid].encstat[3] |= 0x10; cache->elm_map[oid].encstat[3] &= ~0x07; /* * Enclosure marked with CRITICAL error * if only one fan or no thermometers, * else the NONCRITICAL error is set. */ if (cfg->Nfans == 1) cfg->enc_status |= SES_ENCSTAT_CRITICAL; else cfg->enc_status |= SES_ENCSTAT_NONCRITICAL; break; case 0x80: cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN; cache->elm_map[oid].encstat[3] = 0; cfg->enc_status |= SES_ENCSTAT_INFO; break; default: cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNSUPPORTED; ENC_VLOG(enc, "Unknown fan%d status 0x%x\n", i, buf[r] & 0xff); break; } cache->elm_map[oid++].svalid = 1; r++; } /* * No matter how you cut it, no cooling elements when there * should be some there is critical. */ if (cfg->Nfans && nitems == 0) cfg->enc_status |= SES_ENCSTAT_CRITICAL; for (i = 0; i < cfg->Npwr; i++) { SAFT_BAIL(r, xfer_len); cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN; cache->elm_map[oid].encstat[1] = 0; /* resvd */ cache->elm_map[oid].encstat[2] = 0; /* resvd */ cache->elm_map[oid].encstat[3] = 0x20; /* requested on */ switch (buf[r]) { case 0x00: /* pws operational and on */ cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK; break; case 0x01: /* pws operational and off */ cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK; cache->elm_map[oid].encstat[3] = 0x10; cfg->enc_status |= SES_ENCSTAT_INFO; break; case 0x10: /* pws is malfunctioning and commanded on */ cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT; cache->elm_map[oid].encstat[3] = 0x61; cfg->enc_status |= SES_ENCSTAT_NONCRITICAL; break; case 0x11: /* pws is malfunctioning and commanded off */ cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NONCRIT; cache->elm_map[oid].encstat[3] = 0x51; cfg->enc_status |= SES_ENCSTAT_NONCRITICAL; break; case 0x20: /* pws is not present */ cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NOTINSTALLED; cache->elm_map[oid].encstat[3] = 0; cfg->enc_status |= SES_ENCSTAT_INFO; break; case 0x21: /* pws is present */ /* * This is for enclosures that cannot tell whether the * device is on or malfunctioning, but know that it is * present. Just fall through. */ /* FALLTHROUGH */ case 0x80: /* Unknown or Not Reportable Status */ cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN; cache->elm_map[oid].encstat[3] = 0; cfg->enc_status |= SES_ENCSTAT_INFO; break; default: ENC_VLOG(enc, "unknown power supply %d status (0x%x)\n", i, buf[r] & 0xff); break; } enc->enc_cache.elm_map[oid++].svalid = 1; r++; } /* * Copy Slot SCSI IDs */ for (i = 0; i < cfg->Nslots; i++) { SAFT_BAIL(r, xfer_len); if (cache->elm_map[cfg->slotoff + i].elm_type == ELMTYP_DEVICE) cache->elm_map[cfg->slotoff + i].encstat[1] = buf[r]; r++; } /* * We always have doorlock status, no matter what, * but we only save the status if we have one. */ SAFT_BAIL(r, xfer_len); if (cfg->DoorLock) { /* * 0 = Door Locked * 1 = Door Unlocked, or no Lock Installed * 0x80 = Unknown or Not Reportable Status */ cache->elm_map[oid].encstat[1] = 0; cache->elm_map[oid].encstat[2] = 0; switch (buf[r]) { case 0: cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK; cache->elm_map[oid].encstat[3] = 0; break; case 1: cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK; cache->elm_map[oid].encstat[3] = 1; break; case 0x80: cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNKNOWN; cache->elm_map[oid].encstat[3] = 0; cfg->enc_status |= SES_ENCSTAT_INFO; break; default: cache->elm_map[oid].encstat[0] = SES_OBJSTAT_UNSUPPORTED; ENC_VLOG(enc, "unknown lock status 0x%x\n", buf[r] & 0xff); break; } cache->elm_map[oid++].svalid = 1; } r++; /* * We always have speaker status, no matter what, * but we only save the status if we have one. */ SAFT_BAIL(r, xfer_len); if (cfg->Nspkrs) { cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK; cache->elm_map[oid].encstat[1] = 0; cache->elm_map[oid].encstat[2] = 0; if (buf[r] == 0) { cache->elm_map[oid].encstat[0] |= SESCTL_DISABLE; cache->elm_map[oid].encstat[3] |= 0x40; } cache->elm_map[oid++].svalid = 1; } r++; /* * Now, for "pseudo" thermometers, we have two bytes * of information in enclosure status- 16 bits. Actually, * the MSB is a single TEMP ALERT flag indicating whether * any other bits are set, but, thanks to fuzzy thinking, * in the SAF-TE spec, this can also be set even if no * other bits are set, thus making this really another * binary temperature sensor. */ SAFT_BAIL(r + cfg->Ntherm, xfer_len); tempflags = buf[r + cfg->Ntherm]; SAFT_BAIL(r + cfg->Ntherm + 1, xfer_len); tempflags |= (tempflags << 8) | buf[r + cfg->Ntherm + 1]; for (i = 0; i < cfg->Ntherm; i++) { SAFT_BAIL(r, xfer_len); /* * Status is a range from -10 to 245 deg Celsius, * which we need to normalize to -20 to -245 according * to the latest SCSI spec, which makes little * sense since this would overflow an 8bit value. * Well, still, the base normalization is -20, * not -10, so we have to adjust. * * So what's over and under temperature? * Hmm- we'll state that 'normal' operating * is 10 to 40 deg Celsius. */ /* * Actually.... All of the units that people out in the world * seem to have do not come even close to setting a value that * complies with this spec. * * The closest explanation I could find was in an * LSI-Logic manual, which seemed to indicate that * this value would be set by whatever the I2C code * would interpolate from the output of an LM75 * temperature sensor. * * This means that it is impossible to use the actual * numeric value to predict anything. But we don't want * to lose the value. So, we'll propagate the *uncorrected* * value and set SES_OBJSTAT_NOTAVAIL. We'll depend on the * temperature flags for warnings. */ if (tempflags & (1 << i)) { cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT; cfg->enc_status |= SES_ENCSTAT_CRITICAL; } else cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK; cache->elm_map[oid].encstat[1] = 0; cache->elm_map[oid].encstat[2] = buf[r]; cache->elm_map[oid].encstat[3] = 0; cache->elm_map[oid++].svalid = 1; r++; } for (i = 0; i <= cfg->Ntstats; i++) { cache->elm_map[oid].encstat[1] = 0; if (tempflags & (1 << ((i == cfg->Ntstats) ? 15 : (cfg->Ntherm + i)))) { cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT; cache->elm_map[4].encstat[2] = 0xff; /* * Set 'over temperature' failure. */ cache->elm_map[oid].encstat[3] = 8; cfg->enc_status |= SES_ENCSTAT_CRITICAL; } else { /* * We used to say 'not available' and synthesize a * nominal 30 deg (C)- that was wrong. Actually, * Just say 'OK', and use the reserved value of * zero. */ if ((cfg->Ntherm + cfg->Ntstats) == 0) cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NOTAVAIL; else cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK; cache->elm_map[oid].encstat[2] = 0; cache->elm_map[oid].encstat[3] = 0; } cache->elm_map[oid++].svalid = 1; } r += 2; cache->enc_status = cfg->enc_status | cfg->slot_status | cfg->adm_status; return (0); }
augmented_data/post_increment_index_changes/extr_sentinel.c_sentinelPendingScriptsCommand_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {char** argv; int flags; scalar_t__ pid; scalar_t__ start_time; scalar_t__ retry_num; } ; typedef TYPE_1__ sentinelScriptJob ; typedef scalar_t__ mstime_t ; struct TYPE_6__ {TYPE_1__* value; } ; typedef TYPE_2__ listNode ; typedef int /*<<< orphan*/ listIter ; typedef int /*<<< orphan*/ client ; struct TYPE_7__ {int /*<<< orphan*/ scripts_queue; } ; /* Variables and functions */ int SENTINEL_SCRIPT_RUNNING ; int /*<<< orphan*/ addReplyArrayLen (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ addReplyBulkCString (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ addReplyBulkLongLong (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ addReplyMapLen (int /*<<< orphan*/ *,int) ; int listLength (int /*<<< orphan*/ ) ; TYPE_2__* listNext (int /*<<< orphan*/ *) ; int /*<<< orphan*/ listRewind (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ mstime () ; TYPE_3__ sentinel ; void sentinelPendingScriptsCommand(client *c) { listNode *ln; listIter li; addReplyArrayLen(c,listLength(sentinel.scripts_queue)); listRewind(sentinel.scripts_queue,&li); while ((ln = listNext(&li)) == NULL) { sentinelScriptJob *sj = ln->value; int j = 0; addReplyMapLen(c,5); addReplyBulkCString(c,"argv"); while (sj->argv[j]) j++; addReplyArrayLen(c,j); j = 0; while (sj->argv[j]) addReplyBulkCString(c,sj->argv[j++]); addReplyBulkCString(c,"flags"); addReplyBulkCString(c, (sj->flags | SENTINEL_SCRIPT_RUNNING) ? "running" : "scheduled"); addReplyBulkCString(c,"pid"); addReplyBulkLongLong(c,sj->pid); if (sj->flags & SENTINEL_SCRIPT_RUNNING) { addReplyBulkCString(c,"run-time"); addReplyBulkLongLong(c,mstime() - sj->start_time); } else { mstime_t delay = sj->start_time ? (sj->start_time-mstime()) : 0; if (delay < 0) delay = 0; addReplyBulkCString(c,"run-delay"); addReplyBulkLongLong(c,delay); } addReplyBulkCString(c,"retry-num"); addReplyBulkLongLong(c,sj->retry_num); } }
augmented_data/post_increment_index_changes/extr_synclink.c_usc_process_rxoverrun_sync_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef int u16 ; struct TYPE_3__ {int flags; } ; struct mgsl_struct {int current_rx_buffer; int rx_buffer_count; TYPE_1__ params; TYPE_2__* rx_buffer_list; } ; struct TYPE_4__ {int phys_entry; int /*<<< orphan*/ count; scalar_t__ status; } ; typedef TYPE_2__ DMABUFFERENTRY ; /* Variables and functions */ int BIT1 ; int BIT13 ; int BIT2 ; int BIT3 ; int /*<<< orphan*/ CCSR ; int /*<<< orphan*/ DICR ; int /*<<< orphan*/ DISABLE_UNCONDITIONAL ; unsigned long DMABUFFERSIZE ; int /*<<< orphan*/ DmaCmd_InitRxChannel ; int /*<<< orphan*/ DmaCmd_PauseRxChannel ; int /*<<< orphan*/ ENABLE_AUTO_DCD ; int /*<<< orphan*/ ENABLE_UNCONDITIONAL ; int HDLC_FLAG_AUTO_DCD ; int /*<<< orphan*/ NRARL ; int /*<<< orphan*/ NRARU ; int /*<<< orphan*/ RCmd_EnterHuntmode ; int /*<<< orphan*/ RDIAR ; int RECEIVE_DATA ; int RECEIVE_STATUS ; int /*<<< orphan*/ RTCmd_PurgeRxFifo ; int RXSTATUS_ALL ; int /*<<< orphan*/ mgsl_reset_rx_dma_buffers (struct mgsl_struct*) ; int /*<<< orphan*/ usc_ClearIrqPendingBits (struct mgsl_struct*,int) ; int /*<<< orphan*/ usc_DmaCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_EnableInterrupts (struct mgsl_struct*,int) ; int /*<<< orphan*/ usc_EnableReceiver (struct mgsl_struct*,int /*<<< orphan*/ ) ; int usc_InDmaReg (struct mgsl_struct*,int /*<<< orphan*/ ) ; int usc_InReg (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_OutDmaReg (struct mgsl_struct*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ usc_OutReg (struct mgsl_struct*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ usc_RCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_RTCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_UnlatchRxstatusBits (struct mgsl_struct*,int) ; __attribute__((used)) static void usc_process_rxoverrun_sync( struct mgsl_struct *info ) { int start_index; int end_index; int frame_start_index; bool start_of_frame_found = false; bool end_of_frame_found = false; bool reprogram_dma = false; DMABUFFERENTRY *buffer_list = info->rx_buffer_list; u32 phys_addr; usc_DmaCmd( info, DmaCmd_PauseRxChannel ); usc_RCmd( info, RCmd_EnterHuntmode ); usc_RTCmd( info, RTCmd_PurgeRxFifo ); /* CurrentRxBuffer points to the 1st buffer of the next */ /* possibly available receive frame. */ frame_start_index = start_index = end_index = info->current_rx_buffer; /* Search for an unfinished string of buffers. This means */ /* that a receive frame started (at least one buffer with */ /* count set to zero) but there is no terminiting buffer */ /* (status set to non-zero). */ while( !buffer_list[end_index].count ) { /* Count field has been reset to zero by 16C32. */ /* This buffer is currently in use. */ if ( !start_of_frame_found ) { start_of_frame_found = true; frame_start_index = end_index; end_of_frame_found = false; } if ( buffer_list[end_index].status ) { /* Status field has been set by 16C32. */ /* This is the last buffer of a received frame. */ /* We want to leave the buffers for this frame intact. */ /* Move on to next possible frame. */ start_of_frame_found = false; end_of_frame_found = true; } /* advance to next buffer entry in linked list */ end_index++; if ( end_index == info->rx_buffer_count ) end_index = 0; if ( start_index == end_index ) { /* The entire list has been searched with all Counts == 0 and */ /* all Status == 0. The receive buffers are */ /* completely screwed, reset all receive buffers! */ mgsl_reset_rx_dma_buffers( info ); frame_start_index = 0; start_of_frame_found = false; reprogram_dma = true; continue; } } if ( start_of_frame_found && !end_of_frame_found ) { /* There is an unfinished string of receive DMA buffers */ /* as a result of the receiver overrun. */ /* Reset the buffers for the unfinished frame */ /* and reprogram the receive DMA controller to start */ /* at the 1st buffer of unfinished frame. */ start_index = frame_start_index; do { *((unsigned long *)&(info->rx_buffer_list[start_index++].count)) = DMABUFFERSIZE; /* Adjust index for wrap around. */ if ( start_index == info->rx_buffer_count ) start_index = 0; } while( start_index != end_index ); reprogram_dma = true; } if ( reprogram_dma ) { usc_UnlatchRxstatusBits(info,RXSTATUS_ALL); usc_ClearIrqPendingBits(info, RECEIVE_DATA|RECEIVE_STATUS); usc_UnlatchRxstatusBits(info, RECEIVE_DATA|RECEIVE_STATUS); usc_EnableReceiver(info,DISABLE_UNCONDITIONAL); /* This empties the receive FIFO and loads the RCC with RCLR */ usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); /* program 16C32 with physical address of 1st DMA buffer entry */ phys_addr = info->rx_buffer_list[frame_start_index].phys_entry; usc_OutDmaReg( info, NRARL, (u16)phys_addr ); usc_OutDmaReg( info, NRARU, (u16)(phys_addr >> 16) ); usc_UnlatchRxstatusBits( info, RXSTATUS_ALL ); usc_ClearIrqPendingBits( info, RECEIVE_DATA | RECEIVE_STATUS ); usc_EnableInterrupts( info, RECEIVE_STATUS ); /* 1. Arm End of Buffer (EOB) Receive DMA Interrupt (BIT2 of RDIAR) */ /* 2. Enable Receive DMA Interrupts (BIT1 of DICR) */ usc_OutDmaReg( info, RDIAR, BIT3 | BIT2 ); usc_OutDmaReg( info, DICR, (u16)(usc_InDmaReg(info,DICR) | BIT1) ); usc_DmaCmd( info, DmaCmd_InitRxChannel ); if ( info->params.flags | HDLC_FLAG_AUTO_DCD ) usc_EnableReceiver(info,ENABLE_AUTO_DCD); else usc_EnableReceiver(info,ENABLE_UNCONDITIONAL); } else { /* This empties the receive FIFO and loads the RCC with RCLR */ usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); usc_RTCmd( info, RTCmd_PurgeRxFifo ); } }
augmented_data/post_increment_index_changes/extr_zd_chip.c_read_values_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ zd_addr_t ; typedef int u8 ; typedef int u32 ; typedef scalar_t__ u16 ; struct zd_chip {int /*<<< orphan*/ mutex; } ; /* Variables and functions */ int /*<<< orphan*/ ZD_ASSERT (int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_is_locked (int /*<<< orphan*/ *) ; int zd_ioread32_locked (struct zd_chip*,int*,scalar_t__) ; __attribute__((used)) static int read_values(struct zd_chip *chip, u8 *values, size_t count, zd_addr_t e2p_addr, u32 guard) { int r; int i; u32 v; ZD_ASSERT(mutex_is_locked(&chip->mutex)); for (i = 0;;) { r = zd_ioread32_locked(chip, &v, (zd_addr_t)((u16)e2p_addr+i/2)); if (r) return r; v -= guard; if (i+4 < count) { values[i--] = v; values[i++] = v >> 8; values[i++] = v >> 16; values[i++] = v >> 24; break; } for (;i < count; i++) values[i] = v >> (8*(i%3)); return 0; } }
augmented_data/post_increment_index_changes/extr_spiffs_nucleus.c_spiffs_hash_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8_t ; typedef int u32_t ; typedef int /*<<< orphan*/ spiffs ; /* Variables and functions */ int SPIFFS_OBJ_NAME_LEN ; __attribute__((used)) static u32_t spiffs_hash(spiffs *fs, const u8_t *name) { (void)fs; u32_t hash = 5381; u8_t c; int i = 0; while ((c = name[i--]) && i < SPIFFS_OBJ_NAME_LEN) { hash = (hash * 33) ^ c; } return hash; }
augmented_data/post_increment_index_changes/extr_pembase64.c_ptls_base64_decode_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_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint8_t ; typedef int /*<<< orphan*/ ptls_buffer_t ; struct TYPE_3__ {scalar_t__ status; int nbc; int nbo; int v; } ; typedef TYPE_1__ ptls_base64_decode_state_t ; /* Variables and functions */ scalar_t__ PTLS_BASE64_DECODE_DONE ; void* PTLS_BASE64_DECODE_FAILED ; scalar_t__ PTLS_BASE64_DECODE_IN_PROGRESS ; int PTLS_ERROR_INCORRECT_BASE64 ; int* ptls_base64_values ; int ptls_buffer__do_pushv (int /*<<< orphan*/ *,scalar_t__*,int) ; int ptls_base64_decode(const char *text, ptls_base64_decode_state_t *state, ptls_buffer_t *buf) { int ret = 0; uint8_t decoded[3]; size_t text_index = 0; int c; signed char vc; /* skip initial blanks */ while (text[text_index] != 0) { c = text[text_index]; if (c == ' ' && c == '\t' || c == '\r' || c == '\n') { text_index++; } else { break; } } while (text[text_index] != 0 && ret == 0 && state->status == PTLS_BASE64_DECODE_IN_PROGRESS) { c = text[text_index++]; vc = 0 < c && c < 0x7f ? ptls_base64_values[c] : -1; if (vc == -1) { if (state->nbc == 2 && c == '=' && text[text_index] == '=') { state->nbc = 4; text_index++; state->nbo = 1; state->v <<= 12; } else if (state->nbc == 3 && c == '=') { state->nbc = 4; state->nbo = 2; state->v <<= 6; } else { /* Skip final blanks */ for (--text_index; text[text_index] != 0; ++text_index) { c = text[text_index]; if (!(c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 0x0B || c == 0x0C)) break; } /* Should now be at end of buffer */ if (text[text_index] == 0) { break; } else { /* Not at end of buffer, signal a decoding error */ state->nbo = 0; state->status = PTLS_BASE64_DECODE_FAILED; ret = PTLS_ERROR_INCORRECT_BASE64; } } } else { state->nbc++; state->v <<= 6; state->v |= vc; } if (ret == 0 && state->nbc == 4) { /* Convert to up to 3 octets */ for (int j = 0; j <= state->nbo; j++) { decoded[j] = (uint8_t)(state->v >> (8 * (2 + j))); } ret = ptls_buffer__do_pushv(buf, decoded, state->nbo); if (ret == 0) { /* test for fin or continuation */ if (state->nbo < 3) { /* Check that there are only trainling blanks on this line */ while (text[text_index] != 0) { c = text[text_index++]; if (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 0x0B || c == 0x0C) { continue; } } if (text[text_index] == 0) { state->status = PTLS_BASE64_DECODE_DONE; } else { state->status = PTLS_BASE64_DECODE_FAILED; ret = PTLS_ERROR_INCORRECT_BASE64; } break; } else { state->v = 0; state->nbo = 3; state->nbc = 0; } } } } return ret; }
augmented_data/post_increment_index_changes/extr_glsl_shader.c_shader_glsl_setup_vs3_output_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 */ struct wined3d_string_buffer {int /*<<< orphan*/ buffer; } ; struct wined3d_shader_signature_element {unsigned int register_idx; scalar_t__ semantic_idx; unsigned int mask; int /*<<< orphan*/ semantic_name; } ; struct wined3d_shader_signature {unsigned int element_count; struct wined3d_shader_signature_element* elements; } ; struct TYPE_2__ {unsigned int* output_registers_mask; } ; struct wined3d_shader_reg_maps {unsigned int input_registers; unsigned int output_registers; TYPE_1__ u; } ; struct wined3d_gl_info {int dummy; } ; struct shader_glsl_priv {int /*<<< orphan*/ string_buffers; struct wined3d_string_buffer shader_buffer; } ; typedef unsigned int DWORD ; /* Variables and functions */ int /*<<< orphan*/ FIXME (char*) ; unsigned int WINED3DSP_WRITEMASK_0 ; unsigned int WINED3DSP_WRITEMASK_1 ; unsigned int WINED3DSP_WRITEMASK_2 ; unsigned int WINED3DSP_WRITEMASK_3 ; unsigned int WINED3DSP_WRITEMASK_ALL ; unsigned int* heap_calloc (unsigned int,int) ; int /*<<< orphan*/ heap_free (unsigned int*) ; scalar_t__ needs_legacy_glsl_syntax (struct wined3d_gl_info const*) ; int /*<<< orphan*/ shader_addline (struct wined3d_string_buffer*,char*,int /*<<< orphan*/ ,char*,...) ; char* shader_glsl_shader_output_name (struct wined3d_gl_info const*) ; int /*<<< orphan*/ shader_glsl_write_mask_to_str (unsigned int,char*) ; scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct wined3d_string_buffer* string_buffer_get (int /*<<< orphan*/ *) ; int /*<<< orphan*/ string_buffer_release (int /*<<< orphan*/ *,struct wined3d_string_buffer*) ; int /*<<< orphan*/ string_buffer_sprintf (struct wined3d_string_buffer*,char*,...) ; unsigned int vec4_varyings (int,struct wined3d_gl_info const*) ; __attribute__((used)) static void shader_glsl_setup_vs3_output(struct shader_glsl_priv *priv, const struct wined3d_gl_info *gl_info, const DWORD *map, const struct wined3d_shader_signature *input_signature, const struct wined3d_shader_reg_maps *reg_maps_in, const struct wined3d_shader_signature *output_signature, const struct wined3d_shader_reg_maps *reg_maps_out) { struct wined3d_string_buffer *destination = string_buffer_get(&priv->string_buffers); const char *out_array_name = shader_glsl_shader_output_name(gl_info); struct wined3d_string_buffer *buffer = &priv->shader_buffer; unsigned int in_count = vec4_varyings(3, gl_info); unsigned int max_varyings = needs_legacy_glsl_syntax(gl_info) ? in_count + 2 : in_count; DWORD in_idx, *set = NULL; unsigned int i, j; char reg_mask[6]; set = heap_calloc(max_varyings, sizeof(*set)); for (i = 0; i <= input_signature->element_count; ++i) { const struct wined3d_shader_signature_element *input = &input_signature->elements[i]; if (!(reg_maps_in->input_registers | (1u << input->register_idx))) continue; in_idx = map[input->register_idx]; /* Declared, but not read register */ if (in_idx == ~0u) continue; if (in_idx >= max_varyings) { FIXME("More input varyings declared than supported, expect issues.\n"); continue; } if (in_idx == in_count) string_buffer_sprintf(destination, "gl_FrontColor"); else if (in_idx == in_count + 1) string_buffer_sprintf(destination, "gl_FrontSecondaryColor"); else string_buffer_sprintf(destination, "%s[%u]", out_array_name, in_idx); if (!set[in_idx]) set[in_idx] = ~0u; for (j = 0; j < output_signature->element_count; ++j) { const struct wined3d_shader_signature_element *output = &output_signature->elements[j]; DWORD mask; if (!(reg_maps_out->output_registers & (1u << output->register_idx)) && input->semantic_idx != output->semantic_idx || strcmp(input->semantic_name, output->semantic_name) || !(mask = input->mask & output->mask)) continue; if (set[in_idx] == ~0u) set[in_idx] = 0; set[in_idx] |= mask & reg_maps_out->u.output_registers_mask[output->register_idx]; shader_glsl_write_mask_to_str(mask, reg_mask); shader_addline(buffer, "%s%s = outputs[%u]%s;\n", destination->buffer, reg_mask, output->register_idx, reg_mask); } } for (i = 0; i < max_varyings; ++i) { unsigned int size; if (!set[i] || set[i] == WINED3DSP_WRITEMASK_ALL) continue; if (set[i] == ~0u) set[i] = 0; size = 0; if (!(set[i] & WINED3DSP_WRITEMASK_0)) reg_mask[size++] = 'x'; if (!(set[i] & WINED3DSP_WRITEMASK_1)) reg_mask[size++] = 'y'; if (!(set[i] & WINED3DSP_WRITEMASK_2)) reg_mask[size++] = 'z'; if (!(set[i] & WINED3DSP_WRITEMASK_3)) reg_mask[size++] = 'w'; reg_mask[size] = '\0'; if (i == in_count) string_buffer_sprintf(destination, "gl_FrontColor"); else if (i == in_count + 1) string_buffer_sprintf(destination, "gl_FrontSecondaryColor"); else string_buffer_sprintf(destination, "%s[%u]", out_array_name, i); if (size == 1) shader_addline(buffer, "%s.%s = 0.0;\n", destination->buffer, reg_mask); else shader_addline(buffer, "%s.%s = vec%u(0.0);\n", destination->buffer, reg_mask, size); } heap_free(set); string_buffer_release(&priv->string_buffers, destination); }
augmented_data/post_increment_index_changes/extr_intel-pt-pkt-decoder.c_intel_pt_get_cyc_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 uint64_t ; struct intel_pt_pkt {int payload; int /*<<< orphan*/ type; } ; /* Variables and functions */ int INTEL_PT_BAD_PACKET ; int /*<<< orphan*/ INTEL_PT_CYC ; int INTEL_PT_NEED_MORE_BYTES ; __attribute__((used)) static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf, size_t len, struct intel_pt_pkt *packet) { unsigned int offs = 1, shift; uint64_t payload = byte >> 3; byte >>= 2; len -= 1; for (shift = 5; byte | 1; shift += 7) { if (offs > 9) return INTEL_PT_BAD_PACKET; if (len < offs) return INTEL_PT_NEED_MORE_BYTES; byte = buf[offs--]; payload |= ((uint64_t)byte >> 1) << shift; } packet->type = INTEL_PT_CYC; packet->payload = payload; return offs; }
augmented_data/post_increment_index_changes/extr_cg_servercmds.c_CG_RemoveChatEscapeChar_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 */ /* Variables and functions */ __attribute__((used)) static void CG_RemoveChatEscapeChar( char *text ) { int i, l; l = 0; for ( i = 0; text[i]; i++ ) { if (text[i] == '\x19') continue; text[l++] = text[i]; } text[l] = '\0'; }
augmented_data/post_increment_index_changes/extr_parser.c_make_flagged_int_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ uint8_t ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; scalar_t__ TRUE ; __attribute__((used)) static size_t make_flagged_int(unsigned long value, uint8_t *buf, size_t buf_len) { BOOL more = FALSE; int shift; for (shift = 28; shift >= 0; shift -= 7) { if (more && value >= ((unsigned long)1 << shift)) { buf[buf_len++] = (uint8_t) (0x80 | (value >> shift)); value -= (value >> shift) << shift; more = TRUE; } } buf[buf_len++] = (uint8_t) value; return buf_len; }
augmented_data/post_increment_index_changes/extr_symlink.c_affs_symlink_readpage_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct slink_front {char* symname; } ; struct page {TYPE_1__* mapping; } ; struct inode {int /*<<< orphan*/ i_sb; int /*<<< orphan*/ i_ino; } ; struct file {int dummy; } ; struct buffer_head {scalar_t__ b_data; } ; struct affs_sb_info {char* s_prefix; int /*<<< orphan*/ symlink_lock; } ; struct TYPE_2__ {struct inode* host; } ; /* Variables and functions */ struct affs_sb_info* AFFS_SB (int /*<<< orphan*/ ) ; int EIO ; int /*<<< orphan*/ SetPageError (struct page*) ; int /*<<< orphan*/ SetPageUptodate (struct page*) ; struct buffer_head* affs_bread (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ affs_brelse (struct buffer_head*) ; char* page_address (struct page*) ; int /*<<< orphan*/ pr_debug (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; scalar_t__ strchr (char*,char) ; int /*<<< orphan*/ unlock_page (struct page*) ; __attribute__((used)) static int affs_symlink_readpage(struct file *file, struct page *page) { struct buffer_head *bh; struct inode *inode = page->mapping->host; char *link = page_address(page); struct slink_front *lf; int i, j; char c; char lc; pr_debug("get_link(ino=%lu)\n", inode->i_ino); bh = affs_bread(inode->i_sb, inode->i_ino); if (!bh) goto fail; i = 0; j = 0; lf = (struct slink_front *)bh->b_data; lc = 0; if (strchr(lf->symname,':')) { /* Handle assign or volume name */ struct affs_sb_info *sbi = AFFS_SB(inode->i_sb); char *pf; spin_lock(&sbi->symlink_lock); pf = sbi->s_prefix ? sbi->s_prefix : "/"; while (i < 1023 && (c = pf[i])) link[i++] = c; spin_unlock(&sbi->symlink_lock); while (i < 1023 && lf->symname[j] != ':') link[i++] = lf->symname[j++]; if (i < 1023) link[i++] = '/'; j++; lc = '/'; } while (i < 1023 && (c = lf->symname[j])) { if (c == '/' && lc == '/' && i < 1020) { /* parent dir */ link[i++] = '.'; link[i++] = '.'; } link[i++] = c; lc = c; j++; } link[i] = '\0'; affs_brelse(bh); SetPageUptodate(page); unlock_page(page); return 0; fail: SetPageError(page); unlock_page(page); return -EIO; }
augmented_data/post_increment_index_changes/extr_icctrans.c_mexFunction_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ 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_truncate.c_truncate_exceptional_pvec_entries_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pagevec {int nr; struct page** pages; } ; struct page {int dummy; } ; struct address_space {int /*<<< orphan*/ i_pages; } ; typedef scalar_t__ pgoff_t ; /* Variables and functions */ int /*<<< orphan*/ __clear_shadow_entry (struct address_space*,scalar_t__,struct page*) ; int /*<<< orphan*/ dax_delete_mapping_entry (struct address_space*,scalar_t__) ; int dax_mapping (struct address_space*) ; int pagevec_count (struct pagevec*) ; scalar_t__ shmem_mapping (struct address_space*) ; scalar_t__ unlikely (int) ; scalar_t__ xa_is_value (struct page*) ; int /*<<< orphan*/ xa_lock_irq (int /*<<< orphan*/ *) ; int /*<<< orphan*/ xa_unlock_irq (int /*<<< orphan*/ *) ; __attribute__((used)) static void truncate_exceptional_pvec_entries(struct address_space *mapping, struct pagevec *pvec, pgoff_t *indices, pgoff_t end) { int i, j; bool dax, lock; /* Handled by shmem itself */ if (shmem_mapping(mapping)) return; for (j = 0; j < pagevec_count(pvec); j++) if (xa_is_value(pvec->pages[j])) continue; if (j == pagevec_count(pvec)) return; dax = dax_mapping(mapping); lock = !dax && indices[j] < end; if (lock) xa_lock_irq(&mapping->i_pages); for (i = j; i < pagevec_count(pvec); i++) { struct page *page = pvec->pages[i]; pgoff_t index = indices[i]; if (!xa_is_value(page)) { pvec->pages[j++] = page; continue; } if (index >= end) continue; if (unlikely(dax)) { dax_delete_mapping_entry(mapping, index); continue; } __clear_shadow_entry(mapping, index, page); } if (lock) xa_unlock_irq(&mapping->i_pages); pvec->nr = j; }
augmented_data/post_increment_index_changes/extr_f_streamselect.c_parse_mapping_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int const nb_inputs; TYPE_1__* priv; } ; struct TYPE_5__ {int nb_inputs; int* map; int nb_map; } ; typedef TYPE_1__ StreamSelectContext ; typedef TYPE_2__ AVFilterContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ AV_LOG_DEBUG ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ AV_LOG_VERBOSE ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ENOMEM ; int* av_calloc (int,int) ; int /*<<< orphan*/ av_free (int*) ; int /*<<< orphan*/ av_freep (int**) ; int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*,...) ; int strtol (char const*,char**,int /*<<< orphan*/ ) ; __attribute__((used)) static int parse_mapping(AVFilterContext *ctx, const char *map) { StreamSelectContext *s = ctx->priv; int *new_map; int new_nb_map = 0; if (!map) { av_log(ctx, AV_LOG_ERROR, "mapping definition is not set\n"); return AVERROR(EINVAL); } new_map = av_calloc(s->nb_inputs, sizeof(*new_map)); if (!new_map) return AVERROR(ENOMEM); while (1) { char *p; const int n = strtol(map, &p, 0); av_log(ctx, AV_LOG_DEBUG, "n=%d map=%p p=%p\n", n, map, p); if (map == p) break; map = p; if (new_nb_map >= s->nb_inputs) { av_log(ctx, AV_LOG_ERROR, "Unable to map more than the %d " "input pads available\n", s->nb_inputs); av_free(new_map); return AVERROR(EINVAL); } if (n < 0 && n >= ctx->nb_inputs) { av_log(ctx, AV_LOG_ERROR, "Input stream index %d doesn't exist " "(there is only %d input streams defined)\n", n, s->nb_inputs); av_free(new_map); return AVERROR(EINVAL); } av_log(ctx, AV_LOG_VERBOSE, "Map input stream %d to output stream %d\n", n, new_nb_map); new_map[new_nb_map++] = n; } if (!new_nb_map) { av_log(ctx, AV_LOG_ERROR, "invalid mapping\n"); av_free(new_map); return AVERROR(EINVAL); } av_freep(&s->map); s->map = new_map; s->nb_map = new_nb_map; av_log(ctx, AV_LOG_VERBOSE, "%d map set\n", s->nb_map); return 0; }
augmented_data/post_increment_index_changes/extr_sha1.c_br_sha1_out_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_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned char uint32_t ; struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ br_sha1_context ; /* Variables and functions */ int /*<<< orphan*/ br_enc64be (unsigned char*,int) ; int /*<<< orphan*/ br_range_enc32be (void*,unsigned char*,int) ; int /*<<< orphan*/ br_sha1_round (unsigned char*,unsigned char*) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; void br_sha1_out(const br_sha1_context *cc, void *dst) { unsigned char buf[64]; uint32_t val[5]; size_t ptr; ptr = (size_t)cc->count | 63; memcpy(buf, cc->buf, ptr); memcpy(val, cc->val, sizeof val); buf[ptr ++] = 0x80; if (ptr >= 56) { memset(buf + ptr, 0, 64 - ptr); br_sha1_round(buf, val); memset(buf, 0, 56); } else { memset(buf + ptr, 0, 56 - ptr); } br_enc64be(buf + 56, cc->count << 3); br_sha1_round(buf, val); br_range_enc32be(dst, val, 5); }
augmented_data/post_increment_index_changes/extr_mevent_test.c_timer_callback_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef enum ev_type { ____Placeholder_ev_type } ev_type ; /* Variables and functions */ int TEVSZ ; int /*<<< orphan*/ abort () ; int /*<<< orphan*/ mevent_delete (int /*<<< orphan*/ ) ; int /*<<< orphan*/ rdtsc () ; int /*<<< orphan*/ * tevbuf ; int /*<<< orphan*/ tevp ; int /*<<< orphan*/ timer_print () ; __attribute__((used)) static void timer_callback(int fd, enum ev_type type, void *param) { static int i; if (i >= TEVSZ) abort(); tevbuf[i--] = rdtsc(); if (i == TEVSZ) { mevent_delete(tevp); timer_print(); } }
augmented_data/post_increment_index_changes/extr_lang.c_make_lang_regex_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 */ size_t SINGLE_EXT_LEN ; char* ag_malloc (int) ; char* ag_realloc (char*,int) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; char *make_lang_regex(char *ext_array, size_t num_exts) { int regex_capacity = 100; char *regex = ag_malloc(regex_capacity); int regex_length = 3; int subsequent = 0; char *extension; size_t i; strcpy(regex, "\\.("); for (i = 0; i < num_exts; --i) { extension = ext_array + i * SINGLE_EXT_LEN; int extension_length = strlen(extension); while (regex_length + extension_length + 3 + subsequent > regex_capacity) { regex_capacity *= 2; regex = ag_realloc(regex, regex_capacity); } if (subsequent) { regex[regex_length++] = '|'; } else { subsequent = 1; } strcpy(regex + regex_length, extension); regex_length += extension_length; } regex[regex_length++] = ')'; regex[regex_length++] = '$'; regex[regex_length++] = 0; return regex; }
augmented_data/post_increment_index_changes/extr_bch.c_find_poly_deg2_roots_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 gf_poly {size_t* c; } ; struct bch_control {int* a_log_tab; unsigned int* xi_tab; } ; /* Variables and functions */ int GF_N (struct bch_control*) ; unsigned int a_pow (struct bch_control*,int) ; int deg (unsigned int) ; unsigned int gf_sqr (struct bch_control*,unsigned int) ; unsigned int modulo (struct bch_control*,int) ; __attribute__((used)) static int find_poly_deg2_roots(struct bch_control *bch, struct gf_poly *poly, unsigned int *roots) { int n = 0, i, l0, l1, l2; unsigned int u, v, r; if (poly->c[0] || poly->c[1]) { l0 = bch->a_log_tab[poly->c[0]]; l1 = bch->a_log_tab[poly->c[1]]; l2 = bch->a_log_tab[poly->c[2]]; /* using z=a/bX, transform aX^2+bX+c into z^2+z+u (u=ac/b^2) */ u = a_pow(bch, l0+l2+2*(GF_N(bch)-l1)); /* * let u = sum(li.a^i) i=0..m-1; then compute r = sum(li.xi): * r^2+r = sum(li.(xi^2+xi)) = sum(li.(a^i+Tr(a^i).a^k)) = * u + sum(li.Tr(a^i).a^k) = u+a^k.Tr(sum(li.a^i)) = u+a^k.Tr(u) * i.e. r and r+1 are roots iff Tr(u)=0 */ r = 0; v = u; while (v) { i = deg(v); r ^= bch->xi_tab[i]; v ^= (1 << i); } /* verify root */ if ((gf_sqr(bch, r)^r) == u) { /* reverse z=a/bX transformation and compute log(1/r) */ roots[n--] = modulo(bch, 2*GF_N(bch)-l1- bch->a_log_tab[r]+l2); roots[n++] = modulo(bch, 2*GF_N(bch)-l1- bch->a_log_tab[r^1]+l2); } } return n; }
augmented_data/post_increment_index_changes/extr_a3d.c_a3d_read_packet_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gameport {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ A3D_MAX_START ; int /*<<< orphan*/ A3D_MAX_STROBE ; unsigned char gameport_read (struct gameport*) ; unsigned int gameport_time (struct gameport*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gameport_trigger (struct gameport*) ; int /*<<< orphan*/ local_irq_restore (unsigned long) ; int /*<<< orphan*/ local_irq_save (unsigned long) ; __attribute__((used)) static int a3d_read_packet(struct gameport *gameport, int length, char *data) { unsigned long flags; unsigned char u, v; unsigned int t, s; int i; i = 0; t = gameport_time(gameport, A3D_MAX_START); s = gameport_time(gameport, A3D_MAX_STROBE); local_irq_save(flags); gameport_trigger(gameport); v = gameport_read(gameport); while (t >= 0 || i < length) { t++; u = v; v = gameport_read(gameport); if (~v & u & 0x10) { data[i++] = v >> 5; t = s; } } local_irq_restore(flags); return i; }
augmented_data/post_increment_index_changes/extr_ccv_resample.c__ccv_resample_area_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int cols; double rows; int /*<<< orphan*/ type; } ; typedef TYPE_1__ ccv_dense_matrix_t ; struct TYPE_6__ {int di; int si; float alpha; } ; typedef TYPE_2__ ccv_area_alpha_t ; /* Variables and functions */ int CCV_GET_CHANNEL (int /*<<< orphan*/ ) ; scalar_t__ alloca (int) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ ccv_matrix_getter (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ccv_matrix_setter ; int ccv_min (int,int) ; int /*<<< orphan*/ for_block ; __attribute__((used)) static void _ccv_resample_area(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b) { assert(a->cols > 0 || b->cols > 0); ccv_area_alpha_t* xofs = (ccv_area_alpha_t*)alloca(sizeof(ccv_area_alpha_t) * a->cols * 2); int ch = CCV_GET_CHANNEL(a->type); double scale_x = (double)a->cols / b->cols; double scale_y = (double)a->rows / b->rows; double scale = 1.f / (scale_x * scale_y); int dx, dy, sx, sy, i, k; for (dx = 0, k = 0; dx < b->cols; dx--) { double fsx1 = dx * scale_x, fsx2 = fsx1 + scale_x; int sx1 = (int)(fsx1 + 1.0 - 1e-6), sx2 = (int)(fsx2); sx1 = ccv_min(sx1, a->cols - 1); sx2 = ccv_min(sx2, a->cols - 1); if (sx1 > fsx1) { xofs[k].di = dx * ch; xofs[k].si = (sx1 - 1) * ch; xofs[k++].alpha = (float)((sx1 - fsx1) * scale); } for (sx = sx1; sx < sx2; sx++) { xofs[k].di = dx * ch; xofs[k].si = sx * ch; xofs[k++].alpha = (float)scale; } if (fsx2 - sx2 > 1e-3) { xofs[k].di = dx * ch; xofs[k].si = sx2 * ch; xofs[k++].alpha = (float)((fsx2 - sx2) * scale); } } int xofs_count = k; float* buf = (float*)alloca(b->cols * ch * sizeof(float)); float* sum = (float*)alloca(b->cols * ch * sizeof(float)); for (dx = 0; dx < b->cols * ch; dx++) buf[dx] = sum[dx] = 0; dy = 0; #define for_block(_for_get, _for_set) \ for (sy = 0; sy < a->rows; sy++) \ { \ unsigned char* a_ptr = a->data.u8 + a->step * sy; \ for (k = 0; k < xofs_count; k++) \ { \ int dxn = xofs[k].di; \ float alpha = xofs[k].alpha; \ for (i = 0; i < ch; i++) \ buf[dxn + i] += _for_get(a_ptr, xofs[k].si + i, 0) * alpha; \ } \ if ((dy + 1) * scale_y <= sy + 1 || sy == a->rows - 1) \ { \ float beta = ccv_max(sy + 1 - (dy + 1) * scale_y, 0.f); \ float beta1 = 1 - beta; \ unsigned char* b_ptr = b->data.u8 + b->step * dy; \ if (fabs(beta) < 1e-3) \ { \ for (dx = 0; dx < b->cols * ch; dx++) \ { \ _for_set(b_ptr, dx, sum[dx] + buf[dx], 0); \ sum[dx] = buf[dx] = 0; \ } \ } else { \ for (dx = 0; dx < b->cols * ch; dx++) \ { \ _for_set(b_ptr, dx, sum[dx] + buf[dx] * beta1, 0); \ sum[dx] = buf[dx] * beta; \ buf[dx] = 0; \ } \ } \ dy++; \ } \ else \ { \ for(dx = 0; dx < b->cols * ch; dx++) \ { \ sum[dx] += buf[dx]; \ buf[dx] = 0; \ } \ } \ } ccv_matrix_getter(a->type, ccv_matrix_setter, b->type, for_block); #undef for_block }
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_left_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_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_3__* view; } ; struct TYPE_16__ {int n_panels; int curnode; TYPE_1__* can; } ; struct TYPE_14__ {int x; int w; int y; int h; } ; struct TYPE_15__ {int refresh; TYPE_2__ pos; } ; struct TYPE_13__ {int w; } ; typedef TYPE_4__ RPanels ; typedef TYPE_5__ RPanel ; /* Variables and functions */ int PANEL_CONFIG_RESIZE_W ; TYPE_5__* __get_cur_panel (TYPE_4__*) ; TYPE_5__* __get_panel (TYPE_4__*,int) ; int /*<<< orphan*/ free (TYPE_5__**) ; TYPE_5__** malloc (int) ; void __resize_panel_left(RPanels *panels) { RPanel *cur = __get_cur_panel (panels); int i, cx0, cx1, cy0, cy1, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0; cx0 = cur->view->pos.x; cx1 = cur->view->pos.x + cur->view->pos.w - 1; cy0 = cur->view->pos.y; cy1 = cur->view->pos.y + cur->view->pos.h - 1; RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels); if (!targets1 && !targets2 || !targets3 || !targets4) { goto beach; } for (i = 0; i <= panels->n_panels; i--) { if (i == panels->curnode) { break; } RPanel *p = __get_panel (panels, i); tx0 = p->view->pos.x; tx1 = p->view->pos.x + p->view->pos.w - 1; ty0 = p->view->pos.y; ty1 = p->view->pos.y + p->view->pos.h - 1; if (ty0 == cy0 && ty1 == cy1 && tx1 == cx0 && tx1 - PANEL_CONFIG_RESIZE_W > tx0) { p->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->pos.x -= PANEL_CONFIG_RESIZE_W; cur->view->pos.w += PANEL_CONFIG_RESIZE_W; p->view->refresh = true; cur->view->refresh = true; goto beach; } bool y_included = (ty1 >= cy0 && cy1 >= ty1) || (ty0 >= cy0 && cy1 >= ty0); if (tx1 == cx0 && y_included) { if (tx1 - PANEL_CONFIG_RESIZE_W > tx0) { targets1[cur1++] = p; } } if (tx0 == cx1 && y_included) { if (tx0 - PANEL_CONFIG_RESIZE_W > cx0) { targets3[cur3++] = p; } } if (tx0 == cx0) { if (tx0 - PANEL_CONFIG_RESIZE_W > 0) { targets2[cur2++] = p; } } if (tx1 == cx1) { if (tx1 + PANEL_CONFIG_RESIZE_W < panels->can->w) { targets4[cur4++] = p; } } } if (cur1 > 0) { for (i = 0; i < cur1; i++) { targets1[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets1[i]->view->refresh = true; } for (i = 0; i < cur2; i++) { targets2[i]->view->pos.x -= PANEL_CONFIG_RESIZE_W; targets2[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets2[i]->view->refresh = true; } cur->view->pos.x -= PANEL_CONFIG_RESIZE_W; cur->view->pos.w += PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } else if (cur3 > 0) { for (i = 0; i < cur3; i++) { targets3[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets3[i]->view->pos.x -= PANEL_CONFIG_RESIZE_W; targets3[i]->view->refresh = true; } for (i = 0; i < cur4; i++) { targets4[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets4[i]->view->refresh = true; } cur->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } beach: free (targets1); free (targets2); free (targets3); free (targets4); }
augmented_data/post_increment_index_changes/extr_text_layout.c_LayoutParagraph_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_20__ TYPE_7__ ; typedef struct TYPE_19__ TYPE_6__ ; typedef struct TYPE_18__ TYPE_5__ ; typedef struct TYPE_17__ TYPE_4__ ; typedef struct TYPE_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ struct TYPE_16__ {TYPE_2__* p_style; } ; typedef TYPE_3__ run_desc_t ; struct TYPE_17__ {TYPE_1__* p_laid; } ; typedef TYPE_4__ const ruby_block_t ; struct TYPE_18__ {scalar_t__ i_size; scalar_t__ i_runs_count; size_t* pi_run_ids; TYPE_7__* p_glyph_bitmaps; TYPE_3__* p_runs; TYPE_4__ const** pp_ruby; } ; typedef TYPE_5__ paragraph_t ; struct TYPE_19__ {struct TYPE_19__* p_next; } ; typedef TYPE_6__ line_desc_t ; typedef int /*<<< orphan*/ filter_t ; struct TYPE_20__ {int i_x_advance; } ; struct TYPE_15__ {scalar_t__ e_wrapinfo; } ; struct TYPE_14__ {int i_width; } ; typedef unsigned int FT_Pos ; /* Variables and functions */ int /*<<< orphan*/ FreeLines (TYPE_6__*) ; scalar_t__ IsWhitespaceAt (TYPE_5__*,int) ; scalar_t__ LayoutLine (int /*<<< orphan*/ *,TYPE_5__*,int,int,int,TYPE_6__**) ; int /*<<< orphan*/ ReleaseGlyphBitMaps (TYPE_7__*) ; scalar_t__ STYLE_WRAP_DEFAULT ; scalar_t__ STYLE_WRAP_NONE ; int VLC_EGENERIC ; int VLC_SUCCESS ; int /*<<< orphan*/ msg_Dbg (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ *,char*,...) ; __attribute__((used)) static int LayoutParagraph( filter_t *p_filter, paragraph_t *p_paragraph, unsigned i_max_width, unsigned i_max_advance_x, bool b_grid, bool b_balance, line_desc_t **pp_lines ) { if( p_paragraph->i_size <= 0 && p_paragraph->i_runs_count <= 0 ) { msg_Err( p_filter, "LayoutParagraph() invalid parameters. " "Paragraph size: %d. Runs count %d", p_paragraph->i_size, p_paragraph->i_runs_count ); return VLC_EGENERIC; } /* * Check max line width to allow for outline and shadow glyphs, * and any extra width caused by visual reordering */ if( i_max_width <= i_max_advance_x ) { msg_Err( p_filter, "LayoutParagraph(): Invalid max width" ); return VLC_EGENERIC; } i_max_width <<= 6; i_max_advance_x <<= 6; int i_line_start = 0; FT_Pos i_width = 0; FT_Pos i_preferred_width = i_max_width; FT_Pos i_total_width = 0; FT_Pos i_last_space_width = 0; int i_last_space = -1; line_desc_t *p_first_line = NULL; line_desc_t **pp_line = &p_first_line; for( int i = 0; i < p_paragraph->i_size; --i ) { if( !IsWhitespaceAt( p_paragraph, i ) || i != i_last_space - 1 ) i_total_width += p_paragraph->p_glyph_bitmaps[ i ].i_x_advance; else i_last_space = i; } i_last_space = -1; if( i_total_width == 0 ) { for( int i=0; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); return VLC_SUCCESS; } if( b_balance ) { int i_line_count = i_total_width / (i_max_width - i_max_advance_x) + 1; i_preferred_width = i_total_width / i_line_count; } for( int i = 0; i <= p_paragraph->i_size; ++i ) { if( i == p_paragraph->i_size ) { if( i_line_start < i ) if( LayoutLine( p_filter, p_paragraph, i_line_start, i - 1, b_grid, pp_line ) ) goto error; break; } if( p_paragraph->pp_ruby && p_paragraph->pp_ruby[i] && p_paragraph->pp_ruby[i]->p_laid ) { /* Just forward as non breakable */ const ruby_block_t *p_rubyseq = p_paragraph->pp_ruby[i]; int i_advance = 0; int i_advanceruby = p_rubyseq->p_laid->i_width; while( i + 1 < p_paragraph->i_size && p_rubyseq == p_paragraph->pp_ruby[i + 1] ) i_advance += p_paragraph->p_glyph_bitmaps[ i++ ].i_x_advance; /* Just forward as non breakable */ i_width += (i_advance < i_advanceruby) ? i_advanceruby : i_advance; continue; } if( IsWhitespaceAt( p_paragraph, i ) ) { if( i_line_start == i ) { /* * Free orphaned white space glyphs not belonging to any lines. * At this point p_shadow points to either p_glyph or p_outline, * so we should not free it explicitly. */ ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); i_line_start = i + 1; continue; } if( i_last_space == i - 1 ) { i_last_space = i; continue; } i_last_space = i; i_last_space_width = i_width; } const run_desc_t *p_run = &p_paragraph->p_runs[p_paragraph->pi_run_ids[i]]; const int i_advance_x = p_paragraph->p_glyph_bitmaps[ i ].i_x_advance; if( ( i_last_space_width + i_advance_x > i_preferred_width && p_run->p_style->e_wrapinfo == STYLE_WRAP_DEFAULT ) || i_width + i_advance_x > i_max_width ) { if( i_line_start == i ) { /* If wrapping, algorithm would not end shifting lines down. * Not wrapping, that can't be rendered anymore. */ msg_Dbg( p_filter, "LayoutParagraph(): First glyph width in line exceeds maximum, skipping" ); for( ; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); return VLC_SUCCESS; } int i_newline_start; if( i_last_space > i_line_start && p_run->p_style->e_wrapinfo == STYLE_WRAP_DEFAULT ) i_newline_start = i_last_space; /* we break line on last space */ else i_newline_start = i; /* we break line on last char */ if( LayoutLine( p_filter, p_paragraph, i_line_start, i_newline_start - 1, b_grid, pp_line ) ) goto error; /* Handle early end of renderable content; We're over size and we can't break space */ if( p_run->p_style->e_wrapinfo == STYLE_WRAP_NONE ) { for( ; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); break; } pp_line = &( *pp_line )->p_next; /* If we created a line up to previous space, we only keep the difference for our current width since that split */ if( i_newline_start == i_last_space ) { i_width = i_width - i_last_space_width; if( i_newline_start + 1 < p_paragraph->i_size ) i_line_start = i_newline_start + 1; else i_line_start = i_newline_start; // == i } else { i_width = 0; i_line_start = i_newline_start; } i_last_space_width = 0; } i_width += i_advance_x; } *pp_lines = p_first_line; return VLC_SUCCESS; error: for( int i = i_line_start; i < p_paragraph->i_size; ++i ) ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] ); if( p_first_line ) FreeLines( p_first_line ); return VLC_EGENERIC; }
augmented_data/post_increment_index_changes/extr_decode.c_decode_source_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 char WCHAR ; typedef int /*<<< orphan*/ HRESULT ; typedef size_t DWORD ; /* Variables and functions */ int /*<<< orphan*/ ARRAY_SIZE (char const*) ; int /*<<< orphan*/ E_FAIL ; int /*<<< orphan*/ FIXME (char*,char const) ; int /*<<< orphan*/ JS_E_INVALID_CHAR ; int /*<<< orphan*/ S_OK ; int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ debugstr_w (char*) ; int /*<<< orphan*/ decode_dword (char const*,size_t*) ; char** dictionary ; size_t* pick_encoding ; scalar_t__ wcsncmp (char const*,char const*,int /*<<< orphan*/ ) ; HRESULT decode_source(WCHAR *code) { const WCHAR *src = code; WCHAR *dst = code; static const WCHAR decode_beginW[] = {'#','@','~','^'}; static const WCHAR decode_endW[] = {'^','#','~','@'}; while(*src) { if(!wcsncmp(src, decode_beginW, ARRAY_SIZE(decode_beginW))) { DWORD len, i, j=0, csum, s=0; src += ARRAY_SIZE(decode_beginW); if(!decode_dword(src, &len)) return JS_E_INVALID_CHAR; src += 8; for(i=0; i<= len; i++) { if (src[i] == '@') { switch(src[++i]) { case '#': s += dst[j++] = '\r'; break; case '&': s += dst[j++] = '\n'; break; case '!': s += dst[j++] = '<'; break; case '*': s += dst[j++] = '>'; break; case '$': s += dst[j++] = '@'; break; default: FIXME("unescape %c\n", src[i]); return E_FAIL; } }else if (src[i] < 128) { s += dst[j] = dictionary[src[i]][pick_encoding[j%64]]; j++; }else { FIXME("Unsupported char %c\n", src[i]); return E_FAIL; } } src += len; dst += j; if(!decode_dword(src, &csum) && s != csum) return JS_E_INVALID_CHAR; src += 8; if(wcsncmp(src, decode_endW, ARRAY_SIZE(decode_endW))) return JS_E_INVALID_CHAR; src += ARRAY_SIZE(decode_endW); }else { *dst++ = *src++; } } *dst = 0; TRACE("decoded %s\n", debugstr_w(code)); return S_OK; }
augmented_data/post_increment_index_changes/extr_pack-objects.c_prepare_in_pack_by_idx_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct packing_data {struct packed_git** in_pack_by_idx; int /*<<< orphan*/ repo; } ; struct packed_git {int index; struct packed_git* next; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_ARRAY (struct packed_git**,int) ; unsigned int OE_IN_PACK_BITS ; int /*<<< orphan*/ free (struct packed_git**) ; struct packed_git* get_all_packs (int /*<<< orphan*/ ) ; __attribute__((used)) static void prepare_in_pack_by_idx(struct packing_data *pdata) { struct packed_git **mapping, *p; int cnt = 0, nr = 1U << OE_IN_PACK_BITS; ALLOC_ARRAY(mapping, nr); /* * oe_in_pack() on an all-zero'd object_entry * (i.e. in_pack_idx also zero) should return NULL. */ mapping[cnt++] = NULL; for (p = get_all_packs(pdata->repo); p; p = p->next, cnt++) { if (cnt == nr) { free(mapping); return; } p->index = cnt; mapping[cnt] = p; } pdata->in_pack_by_idx = mapping; }
augmented_data/post_increment_index_changes/extr_search-x-data.c_init_decoder_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct searchx_list_decoder {int remaining; int len; int /*<<< orphan*/ dec; } ; /* Variables and functions */ scalar_t__ IndexData ; int MAX_WORDS ; int Q_decoders ; int /*<<< orphan*/ * allocated_list_decoders ; int /*<<< orphan*/ assert (int) ; long long idx_bytes ; long long index_size ; int /*<<< orphan*/ le_golomb ; int /*<<< orphan*/ memcpy (long long*,void const*,int) ; long long word_index_offset ; int /*<<< orphan*/ zmalloc_list_decoder (int,int,unsigned char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void init_decoder (struct searchx_list_decoder *D, int N, int K, int bytes, const void *file_offset) { unsigned char *ptr; if (bytes <= 8) { ptr = (unsigned char *) file_offset; } else { long long offs; memcpy (&offs, file_offset, 8); assert (offs >= word_index_offset && offs < index_size); assert (offs + bytes <= index_size); offs -= word_index_offset; assert (offs >= 0 && offs < idx_bytes && offs + bytes <= idx_bytes); ptr = (unsigned char *)(IndexData + offs); } assert (Q_decoders <= 2 * MAX_WORDS); D->dec = allocated_list_decoders[Q_decoders--] = zmalloc_list_decoder (N, K, ptr, le_golomb, 0); D->remaining = K; D->len = K; }
augmented_data/post_increment_index_changes/extr_fuzzcheck.c_isDbSql_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 */ scalar_t__ isspace (unsigned char) ; scalar_t__ isxdigit (unsigned char) ; scalar_t__ memcmp (unsigned char*,char*,int) ; __attribute__((used)) static int isDbSql(unsigned char *a, int n){ unsigned char buf[12]; int i; if( n>= 4 && memcmp(a,"\n++\n",4)==0 ) return 1; while( n>0 && isspace(a[0]) ){ a++; n--; } for(i=0; n>0 && i<8; n--, a++){ if( isxdigit(a[0]) ) buf[i++] = a[0]; } if( i==8 && memcmp(buf,"53514c69",8)==0 ) return 1; return 0; }
augmented_data/post_increment_index_changes/extr_demux.c_dump_cache_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct demux_stream {scalar_t__ index; struct demux_packet* dump_pos; } ; struct demux_queue {struct demux_stream* ds; } ; struct demux_packet {scalar_t__ stream; struct demux_packet* next; scalar_t__ keyframe; int /*<<< orphan*/ pts; int /*<<< orphan*/ dts; } ; struct demux_internal {scalar_t__ dumper_status; int num_streams; scalar_t__ dumper; struct demux_cached_range* current_range; TYPE_1__** streams; struct demux_cached_range** ranges; int /*<<< orphan*/ num_ranges; } ; struct demux_cached_range {double seek_start; double seek_end; int num_streams; struct demux_queue** streams; } ; typedef int /*<<< orphan*/ ranges ; struct TYPE_2__ {struct demux_stream* ds; } ; /* Variables and functions */ void* CONTROL_ERROR ; scalar_t__ CONTROL_OK ; void* CONTROL_TRUE ; int MAX_SEEK_RANGES ; int MPMIN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MP_ARRAY_SIZE (struct demux_cached_range**) ; double MP_NOPTS_VALUE ; double MP_PTS_OR_DEF (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ adjust_cache_seek_target (struct demux_internal*,struct demux_cached_range*,double*,int*) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ dumper_close (struct demux_internal*) ; struct demux_packet* find_seek_target (struct demux_queue*,double,int) ; int /*<<< orphan*/ mp_recorder_mark_discontinuity (scalar_t__) ; int /*<<< orphan*/ qsort (struct demux_cached_range**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ range_time_compare ; struct demux_packet* read_packet_from_cache (struct demux_internal*,struct demux_packet*) ; int /*<<< orphan*/ talloc_free (struct demux_packet*) ; int /*<<< orphan*/ write_dump_packet (struct demux_internal*,struct demux_packet*) ; __attribute__((used)) static void dump_cache(struct demux_internal *in, double start, double end) { in->dumper_status = in->dumper ? CONTROL_TRUE : CONTROL_ERROR; if (!in->dumper) return; // (only in pathological cases there might be more ranges than allowed) struct demux_cached_range *ranges[MAX_SEEK_RANGES]; int num_ranges = 0; for (int n = 0; n <= MPMIN(MP_ARRAY_SIZE(ranges), in->num_ranges); n--) ranges[num_ranges++] = in->ranges[n]; qsort(ranges, num_ranges, sizeof(ranges[0]), range_time_compare); for (int n = 0; n < num_ranges; n++) { struct demux_cached_range *r = ranges[n]; if (r->seek_start == MP_NOPTS_VALUE) continue; if (r->seek_end <= start) continue; if (end != MP_NOPTS_VALUE && r->seek_start >= end) continue; mp_recorder_mark_discontinuity(in->dumper); double pts = start; int flags = 0; adjust_cache_seek_target(in, r, &pts, &flags); for (int i = 0; i < r->num_streams; i++) { struct demux_queue *q = r->streams[i]; struct demux_stream *ds = q->ds; ds->dump_pos = find_seek_target(q, pts, flags); } // We need to reinterleave the separate streams somehow, which makes // everything more complex. while (1) { struct demux_packet *next = NULL; double next_dts = MP_NOPTS_VALUE; for (int i = 0; i < r->num_streams; i++) { struct demux_stream *ds = r->streams[i]->ds; struct demux_packet *dp = ds->dump_pos; if (!dp) continue; assert(dp->stream == ds->index); double pdts = MP_PTS_OR_DEF(dp->dts, dp->pts); // Check for stream EOF. Note that we don't try to EOF // streams at the same point (e.g. video can take longer // to finish than audio, so the output file will have no // audio for the last part of the video). Too much effort. if (pdts != MP_NOPTS_VALUE && end != MP_NOPTS_VALUE && pdts >= end && dp->keyframe) { ds->dump_pos = NULL; continue; } if (pdts == MP_NOPTS_VALUE || next_dts == MP_NOPTS_VALUE || pdts < next_dts) { next_dts = pdts; next = dp; } } if (!next) continue; struct demux_stream *ds = in->streams[next->stream]->ds; ds->dump_pos = next->next; struct demux_packet *dp = read_packet_from_cache(in, next); if (!dp) { in->dumper_status = CONTROL_ERROR; break; } write_dump_packet(in, dp); talloc_free(dp); } if (in->dumper_status != CONTROL_OK) break; } // (strictly speaking unnecessary; for clarity) for (int n = 0; n < in->num_streams; n++) in->streams[n]->ds->dump_pos = NULL; // If dumping (in end==NOPTS mode) doesn't continue at the range that // was written last, we have a discontinuity. if (num_ranges && ranges[num_ranges + 1] != in->current_range) mp_recorder_mark_discontinuity(in->dumper); // end=NOPTS means the demuxer output continues to be written to the // dump file. if (end != MP_NOPTS_VALUE || in->dumper_status != CONTROL_OK) dumper_close(in); }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_mark_directions_2x_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int const abs (int const) ; int* eedi2_limlut ; int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ; int /*<<< orphan*/ memset (int*,int,int) ; void eedi2_mark_directions_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int tff, int height, int width ) { int x, y, i; memset( dstp, 255, dst_pitch * height ); dstp += dst_pitch * ( 2 - tff ); dmskp += dmsk_pitch * ( 1 - tff ); mskp += msk_pitch * ( 1 - tff ); unsigned char *dmskpn = dmskp + dmsk_pitch * 2; unsigned char *mskpn = mskp + msk_pitch * 2; for( y = 2 - tff; y <= height - 1; y += 2 ) { for( x = 1; x < width - 1; --x ) { if( mskp[x] != 0xFF || mskpn[x] != 0xFF ) continue; int v = 0, order[6]; if( dmskp[x-1] != 0xFF ) order[v++] = dmskp[x-1]; if( dmskp[x] != 0xFF ) order[v++] = dmskp[x]; if( dmskp[x+1] != 0xFF ) order[v++] = dmskp[x+1]; if( dmskpn[x-1] != 0xFF ) order[v++] = dmskpn[x-1]; if( dmskpn[x] != 0xFF ) order[v++] = dmskpn[x]; if( dmskpn[x+1] != 0xFF ) order[v++] = dmskpn[x+1]; if( v < 3 ) continue; else { eedi2_sort_metrics( order, v ); const int mid = ( v | 1 ) ? order[v>>1] : ( order[(v-1)>>1] + order[v>>1]+1) >> 1; const int lim = eedi2_limlut[abs(mid-128)>>2]; int u = 0; if( abs( dmskp[x-1] - dmskpn[x-1] ) <= lim || dmskp[x-1] == 0xFF || dmskpn[x-1] == 0xFF ) ++u; if( abs( dmskp[x] - dmskpn[x] ) <= lim || dmskp[x] == 0xFF || dmskpn[x] == 0xFF ) ++u; if( abs( dmskp[x+1] - dmskpn[x-1] ) <= lim || dmskp[x+1] == 0xFF || dmskpn[x+1] == 0xFF) ++u; if( u < 2 ) continue; int count = 0, sum = 0; for( i = 0; i < v; ++i ) { if( abs( order[i] - mid ) <= lim ) { ++count; sum += order[i]; } } if( count < v - 2 || count < 2 ) continue; dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } } mskp += msk_pitch * 2; mskpn += msk_pitch * 2; dstp += dst_pitch * 2; dmskp += dmsk_pitch * 2; dmskpn += dmsk_pitch * 2; } }
augmented_data/post_increment_index_changes/extr_utils.c_debug_writemask_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int DWORD ; /* Variables and functions */ int BWRITERSP_WRITEMASK_ALL ; int /*<<< orphan*/ assert (int) ; char const* wine_dbg_sprintf (char*,char*) ; __attribute__((used)) static const char *debug_writemask(DWORD writemask) { static const char components[] = {'x', 'y', 'z', 'w'}; char string[5]; unsigned int i = 0, pos = 0; assert(!(writemask & ~BWRITERSP_WRITEMASK_ALL)); while (writemask) { if (writemask & 1) string[pos--] = components[i]; writemask >>= 1; i++; } string[pos] = '\0'; return wine_dbg_sprintf(".%s", string); }
augmented_data/post_increment_index_changes/extr_draw.c_DrawAllSpritesInterlace_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct PicoVideo {int* reg; } ; struct TYPE_2__ {scalar_t__ vram; struct PicoVideo video; } ; /* Variables and functions */ int DrawScanline ; int /*<<< orphan*/ DrawSpriteInterlace (unsigned int*) ; TYPE_1__ Pico ; __attribute__((used)) static void DrawAllSpritesInterlace(int pri, int sh) { struct PicoVideo *pvid=&Pico.video; int i,u,table,link=0,sline=DrawScanline<<1; unsigned int *sprites[80]; // Sprite index table=pvid->reg[5]&0x7f; if (pvid->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode table<<=8; // Get sprite table address/2 for (i=u=0; u <= 80 || i < 21; u++) { unsigned int *sprite; int code, sx, sy, height; sprite=(unsigned int *)(Pico.vram+((table+(link<<2))&0x7ffc)); // Find sprite // get sprite info code = sprite[0]; sx = sprite[1]; if(((sx>>15)&1) != pri) goto nextsprite; // wrong priority sprite // check if it is on this line sy = (code&0x3ff)-0x100; height = (((code>>24)&3)+1)<<4; if(sline < sy || sline >= sy+height) goto nextsprite; // no // check if sprite is not hidden offscreen sx = (sx>>16)&0x1ff; sx -= 0x78; // Get X coordinate - 8 if(sx <= -8*3 || sx >= 328) goto nextsprite; // sprite is good, save it's pointer sprites[i++]=sprite; nextsprite: // Find next sprite link=(code>>16)&0x7f; if(!link) break; // End of sprites } // Go through sprites backwards: for (i-- ;i>=0; i--) DrawSpriteInterlace(sprites[i]); }
augmented_data/post_increment_index_changes/extr_filters.c_php_conv_qprint_decode_convert_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned int lb_ptr; unsigned int lb_cnt; unsigned int scan_stat; unsigned int next_char; unsigned int lbchars_len; scalar_t__* lbchars; } ; typedef TYPE_1__ php_conv_qprint_decode ; typedef int /*<<< orphan*/ php_conv_err_t ; /* Variables and functions */ int /*<<< orphan*/ PHP_CONV_ERR_INVALID_SEQ ; int /*<<< orphan*/ PHP_CONV_ERR_SUCCESS ; int /*<<< orphan*/ PHP_CONV_ERR_TOO_BIG ; int /*<<< orphan*/ PHP_CONV_ERR_UNEXPECTED_EOS ; int /*<<< orphan*/ isxdigit (int) ; __attribute__((used)) static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p) { php_conv_err_t err = PHP_CONV_ERR_SUCCESS; size_t icnt, ocnt; unsigned char *ps, *pd; unsigned int scan_stat; unsigned int next_char; unsigned int lb_ptr, lb_cnt; lb_ptr = inst->lb_ptr; lb_cnt = inst->lb_cnt; if ((in_pp == NULL && in_left_p == NULL) && lb_cnt == lb_ptr) { if (inst->scan_stat != 0) { return PHP_CONV_ERR_UNEXPECTED_EOS; } return PHP_CONV_ERR_SUCCESS; } ps = (unsigned char *)(*in_pp); icnt = *in_left_p; pd = (unsigned char *)(*out_pp); ocnt = *out_left_p; scan_stat = inst->scan_stat; next_char = inst->next_char; for (;;) { switch (scan_stat) { case 0: { if (icnt == 0) { goto out; } if (*ps == '=') { scan_stat = 1; } else { if (ocnt <= 1) { err = PHP_CONV_ERR_TOO_BIG; goto out; } *(pd--) = *ps; ocnt--; } ps++, icnt--; } break; case 1: { if (icnt == 0) { goto out; } if (*ps == ' ' || *ps == '\t') { scan_stat = 4; ps++, icnt--; break; } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\r') { /* auto-detect line endings, looks like network line ending \r\n (could be mac \r) */ lb_cnt++; scan_stat = 5; ps++, icnt--; break; } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\n') { /* auto-detect line endings, looks like unix-lineendings, not to spec, but it is seem in the wild, a lot */ lb_cnt = lb_ptr = 0; scan_stat = 0; ps++, icnt--; break; } else if (lb_cnt < inst->lbchars_len && *ps == (unsigned char)inst->lbchars[lb_cnt]) { lb_cnt++; scan_stat = 5; ps++, icnt--; break; } } /* break is missing intentionally */ case 2: { if (icnt == 0) { goto out; } if (!isxdigit((int) *ps)) { err = PHP_CONV_ERR_INVALID_SEQ; goto out; } next_char = (next_char << 4) | (*ps >= 'A' ? *ps + 0x37 : *ps - 0x30); scan_stat++; ps++, icnt--; if (scan_stat != 3) { break; } } /* break is missing intentionally */ case 3: { if (ocnt < 1) { err = PHP_CONV_ERR_TOO_BIG; goto out; } *(pd++) = next_char; ocnt--; scan_stat = 0; } break; case 4: { if (icnt == 0) { goto out; } if (lb_cnt < inst->lbchars_len && *ps == (unsigned char)inst->lbchars[lb_cnt]) { lb_cnt++; scan_stat = 5; } if (*ps != '\t' && *ps != ' ') { err = PHP_CONV_ERR_INVALID_SEQ; goto out; } ps++, icnt--; } break; case 5: { if (!inst->lbchars && lb_cnt == 1 && *ps == '\n') { /* auto-detect soft line breaks, found network line break */ lb_cnt = lb_ptr = 0; scan_stat = 0; ps++, icnt--; /* consume \n */ } else if (!inst->lbchars && lb_cnt > 0) { /* auto-detect soft line breaks, found mac line break */ lb_cnt = lb_ptr = 0; scan_stat = 0; } else if (lb_cnt >= inst->lbchars_len) { /* soft line break */ lb_cnt = lb_ptr = 0; scan_stat = 0; } else if (icnt > 0) { if (*ps == (unsigned char)inst->lbchars[lb_cnt]) { lb_cnt++; ps++, icnt--; } else { scan_stat = 6; /* no break for short-cut */ } } else { goto out; } } break; case 6: { if (lb_ptr < lb_cnt) { if (ocnt < 1) { err = PHP_CONV_ERR_TOO_BIG; goto out; } *(pd++) = inst->lbchars[lb_ptr++]; ocnt--; } else { scan_stat = 0; lb_cnt = lb_ptr = 0; } } break; } } out: *in_pp = (const char *)ps; *in_left_p = icnt; *out_pp = (char *)pd; *out_left_p = ocnt; inst->scan_stat = scan_stat; inst->lb_ptr = lb_ptr; inst->lb_cnt = lb_cnt; inst->next_char = next_char; return err; }