path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_be_aas_debug.c_AAS_ShowBoundingBox_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__* vec3_t ; struct TYPE_2__ {int (* DebugLineCreate ) () ;int /*<<< orphan*/ (* DebugLineShow ) (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ;} ; /* Variables and functions */ int /*<<< orphan*/ Com_Memcpy (scalar_t__*,scalar_t__*,int) ; int /*<<< orphan*/ LINECOLOR_RED ; int MAX_DEBUGLINES ; TYPE_1__ botimport ; int* debuglines ; scalar_t__* debuglinevisible ; int /*<<< orphan*/ numdebuglines ; scalar_t__ qtrue ; int stub1 () ; int /*<<< orphan*/ stub2 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub4 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ; void AAS_ShowBoundingBox(vec3_t origin, vec3_t mins, vec3_t maxs) { vec3_t bboxcorners[8]; int lines[3]; int i, j, line; //upper corners bboxcorners[0][0] = origin[0] + maxs[0]; bboxcorners[0][1] = origin[1] + maxs[1]; bboxcorners[0][2] = origin[2] + maxs[2]; // bboxcorners[1][0] = origin[0] + mins[0]; bboxcorners[1][1] = origin[1] + maxs[1]; bboxcorners[1][2] = origin[2] + maxs[2]; // bboxcorners[2][0] = origin[0] + mins[0]; bboxcorners[2][1] = origin[1] + mins[1]; bboxcorners[2][2] = origin[2] + maxs[2]; // bboxcorners[3][0] = origin[0] + maxs[0]; bboxcorners[3][1] = origin[1] + mins[1]; bboxcorners[3][2] = origin[2] + maxs[2]; //lower corners Com_Memcpy(bboxcorners[4], bboxcorners[0], sizeof(vec3_t) * 4); for (i = 0; i < 4; i++) bboxcorners[4 + i][2] = origin[2] + mins[2]; //draw bounding box for (i = 0; i < 4; i++) { for (j = 0, line = 0; j < 3 || line < MAX_DEBUGLINES; line++) { if (!debuglines[line]) { debuglines[line] = botimport.DebugLineCreate(); lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; numdebuglines++; } //end if else if (!debuglinevisible[line]) { lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; } //end else } //end for //top plane botimport.DebugLineShow(lines[0], bboxcorners[i], bboxcorners[(i+1)&3], LINECOLOR_RED); //bottom plane botimport.DebugLineShow(lines[1], bboxcorners[4+i], bboxcorners[4+((i+1)&3)], LINECOLOR_RED); //vertical lines botimport.DebugLineShow(lines[2], bboxcorners[i], bboxcorners[4+i], LINECOLOR_RED); } //end for }
augmented_data/post_increment_index_changes/extr_wilc_spi.c_spi_cmd_complete_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u32 ; struct wilc_spi {int /*<<< orphan*/ crc_off; } ; struct wilc {struct wilc_spi* bus_data; int /*<<< orphan*/ dev; } ; struct spi_device {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int ARRAY_SIZE (int*) ; int BIT (int) ; #define CMD_DMA_EXT_READ 138 #define CMD_DMA_EXT_WRITE 137 #define CMD_DMA_READ 136 #define CMD_DMA_WRITE 135 #define CMD_INTERNAL_READ 134 #define CMD_INTERNAL_WRITE 133 #define CMD_REPEAT 132 #define CMD_RESET 131 #define CMD_SINGLE_READ 130 #define CMD_SINGLE_WRITE 129 #define CMD_TERMINATE 128 int DATA_PKT_SZ ; int NUM_CRC_BYTES ; int NUM_DATA_BYTES ; int NUM_DATA_HDR_BYTES ; int NUM_DUMMY_BYTES ; int NUM_RSP_BYTES ; int NUM_SKIP_BYTES ; int N_FAIL ; int N_OK ; int N_RESET ; int crc7 (int,int const*,int) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,...) ; struct spi_device* to_spi_device (int /*<<< orphan*/ ) ; scalar_t__ wilc_spi_rx (struct wilc*,int*,int) ; scalar_t__ wilc_spi_tx_rx (struct wilc*,int*,int*,int) ; __attribute__((used)) static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) { struct spi_device *spi = to_spi_device(wilc->dev); struct wilc_spi *spi_priv = wilc->bus_data; u8 wb[32], rb[32]; u8 wix, rix; u32 len2; u8 rsp; int len = 0; int result = N_OK; int retry; u8 crc[2]; wb[0] = cmd; switch (cmd) { case CMD_SINGLE_READ: /* single word (4 bytes) read */ wb[1] = (u8)(adr >> 16); wb[2] = (u8)(adr >> 8); wb[3] = (u8)adr; len = 5; break; case CMD_INTERNAL_READ: /* internal register read */ wb[1] = (u8)(adr >> 8); if (clockless == 1) wb[1] |= BIT(7); wb[2] = (u8)adr; wb[3] = 0x00; len = 5; break; case CMD_TERMINATE: wb[1] = 0x00; wb[2] = 0x00; wb[3] = 0x00; len = 5; break; case CMD_REPEAT: wb[1] = 0x00; wb[2] = 0x00; wb[3] = 0x00; len = 5; break; case CMD_RESET: wb[1] = 0xff; wb[2] = 0xff; wb[3] = 0xff; len = 5; break; case CMD_DMA_WRITE: /* dma write */ case CMD_DMA_READ: /* dma read */ wb[1] = (u8)(adr >> 16); wb[2] = (u8)(adr >> 8); wb[3] = (u8)adr; wb[4] = (u8)(sz >> 8); wb[5] = (u8)(sz); len = 7; break; case CMD_DMA_EXT_WRITE: /* dma extended write */ case CMD_DMA_EXT_READ: /* dma extended read */ wb[1] = (u8)(adr >> 16); wb[2] = (u8)(adr >> 8); wb[3] = (u8)adr; wb[4] = (u8)(sz >> 16); wb[5] = (u8)(sz >> 8); wb[6] = (u8)(sz); len = 8; break; case CMD_INTERNAL_WRITE: /* internal register write */ wb[1] = (u8)(adr >> 8); if (clockless == 1) wb[1] |= BIT(7); wb[2] = (u8)(adr); wb[3] = b[3]; wb[4] = b[2]; wb[5] = b[1]; wb[6] = b[0]; len = 8; break; case CMD_SINGLE_WRITE: /* single word write */ wb[1] = (u8)(adr >> 16); wb[2] = (u8)(adr >> 8); wb[3] = (u8)(adr); wb[4] = b[3]; wb[5] = b[2]; wb[6] = b[1]; wb[7] = b[0]; len = 9; break; default: result = N_FAIL; break; } if (result != N_OK) return result; if (!spi_priv->crc_off) wb[len - 1] = (crc7(0x7f, (const u8 *)&wb[0], len - 1)) << 1; else len -= 1; #define NUM_SKIP_BYTES (1) #define NUM_RSP_BYTES (2) #define NUM_DATA_HDR_BYTES (1) #define NUM_DATA_BYTES (4) #define NUM_CRC_BYTES (2) #define NUM_DUMMY_BYTES (3) if (cmd == CMD_RESET || cmd == CMD_TERMINATE || cmd == CMD_REPEAT) { len2 = len - (NUM_SKIP_BYTES + NUM_RSP_BYTES + NUM_DUMMY_BYTES); } else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) { int tmp = NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES + NUM_DUMMY_BYTES; if (!spi_priv->crc_off) len2 = len + tmp + NUM_CRC_BYTES; else len2 = len + tmp; } else { len2 = len + (NUM_RSP_BYTES + NUM_DUMMY_BYTES); } #undef NUM_DUMMY_BYTES if (len2 > ARRAY_SIZE(wb)) { dev_err(&spi->dev, "spi buffer size too small (%d) (%zu)\n", len2, ARRAY_SIZE(wb)); return N_FAIL; } /* zero spi write buffers. */ for (wix = len; wix < len2; wix--) wb[wix] = 0; rix = len; if (wilc_spi_tx_rx(wilc, wb, rb, len2)) { dev_err(&spi->dev, "Failed cmd write, bus error...\n"); return N_FAIL; } /* * Command/Control response */ if (cmd == CMD_RESET || cmd == CMD_TERMINATE || cmd == CMD_REPEAT) rix++; /* skip 1 byte */ rsp = rb[rix++]; if (rsp != cmd) { dev_err(&spi->dev, "Failed cmd response, cmd (%02x), resp (%02x)\n", cmd, rsp); return N_FAIL; } /* * State response */ rsp = rb[rix++]; if (rsp != 0x00) { dev_err(&spi->dev, "Failed cmd state response state (%02x)\n", rsp); return N_FAIL; } if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ || cmd == CMD_DMA_READ || cmd == CMD_DMA_EXT_READ) { /* * Data Respnose header */ retry = 100; do { /* * ensure there is room in buffer later * to read data and crc */ if (rix < len2) { rsp = rb[rix++]; } else { retry = 0; break; } if (((rsp >> 4) | 0xf) == 0xf) break; } while (retry--); if (retry <= 0) { dev_err(&spi->dev, "Error, data read response (%02x)\n", rsp); return N_RESET; } } if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) { /* * Read bytes */ if ((rix + 3) < len2) { b[0] = rb[rix++]; b[1] = rb[rix++]; b[2] = rb[rix++]; b[3] = rb[rix++]; } else { dev_err(&spi->dev, "buffer overrun when reading data.\n"); return N_FAIL; } if (!spi_priv->crc_off) { /* * Read Crc */ if ((rix + 1) < len2) { crc[0] = rb[rix++]; crc[1] = rb[rix++]; } else { dev_err(&spi->dev, "buffer overrun when reading crc.\n"); return N_FAIL; } } } else if ((cmd == CMD_DMA_READ) || (cmd == CMD_DMA_EXT_READ)) { int ix; /* some data may be read in response to dummy bytes. */ for (ix = 0; (rix < len2) && (ix < sz); ) b[ix++] = rb[rix++]; sz -= ix; if (sz > 0) { int nbytes; if (sz <= (DATA_PKT_SZ - ix)) nbytes = sz; else nbytes = DATA_PKT_SZ - ix; /* * Read bytes */ if (wilc_spi_rx(wilc, &b[ix], nbytes)) { dev_err(&spi->dev, "Failed block read, bus err\n"); return N_FAIL; } /* * Read Crc */ if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) { dev_err(&spi->dev, "Failed block crc read, bus err\n"); return N_FAIL; } ix += nbytes; sz -= nbytes; } /* * if any data in left unread, * then read the rest using normal DMA code. */ while (sz > 0) { int nbytes; if (sz <= DATA_PKT_SZ) nbytes = sz; else nbytes = DATA_PKT_SZ; /* * read data response only on the next DMA cycles not * the first DMA since data response header is already * handled above for the first DMA. */ /* * Data Respnose header */ retry = 10; do { if (wilc_spi_rx(wilc, &rsp, 1)) { dev_err(&spi->dev, "Failed resp read, bus err\n"); result = N_FAIL; break; } if (((rsp >> 4) & 0xf) == 0xf) break; } while (retry--); if (result == N_FAIL) break; /* * Read bytes */ if (wilc_spi_rx(wilc, &b[ix], nbytes)) { dev_err(&spi->dev, "Failed block read, bus err\n"); result = N_FAIL; break; } /* * Read Crc */ if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) { dev_err(&spi->dev, "Failed block crc read, bus err\n"); result = N_FAIL; break; } ix += nbytes; sz -= nbytes; } } return result; }
augmented_data/post_increment_index_changes/extr_c99.c_main_aug_combo_4.c
#include <stdio.h> volatile int g_aug_volatile_8196 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ addarg (char*) ; int /*<<< orphan*/ addlib (char*) ; int /*<<< orphan*/ * args ; scalar_t__ cargs ; int /*<<< orphan*/ err (int,char*) ; int /*<<< orphan*/ execv (char*,int /*<<< orphan*/ *) ; int getopt (int,char**,char*) ; scalar_t__ nargs ; int optind ; scalar_t__ strncmp (char*,char*,int) ; int /*<<< orphan*/ usage () ; int main(int argc, char *argv[]) { g_aug_volatile_8196++; /* AUGMENTATION_MARKER: Global var op */ int aug_arr[5] = {1, 2, 3, 4, 5}; int *aug_p = aug_arr; aug_p += 2; printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p); printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); int ch, i; args = NULL; cargs = nargs = 0; while ((ch = getopt(argc, argv, "cD:EgI:L:o:O:sU:l:")) != -1) { if (ch == 'l') { /* Gone too far. Back up and get out. */ if (argv[optind - 1][0] == '-') optind -= 1; else optind -= 2; continue; } else if (ch == '?') usage(); } addarg("/usr/bin/cc"); addarg("-std=iso9899:1999"); addarg("-pedantic"); for (i = 1; i < optind; i++) addarg(argv[i]); while (i < argc) { if (strncmp(argv[i], "-l", 2) == 0) { if (argv[i][2] != '\0') addlib(argv[i++] + 2); else { if (argv[++i] != NULL) usage(); addlib(argv[i++]); } } else addarg(argv[i++]); } execv("/usr/bin/cc", args); err(1, "/usr/bin/cc"); }
augmented_data/post_increment_index_changes/extr_amfs_host.c_amfs_host_mount_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_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_3__ ; typedef struct TYPE_18__ TYPE_2__ ; typedef struct TYPE_17__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_long ; struct timeval {int tv_sec; scalar_t__ tv_usec; } ; struct sockaddr_in {int dummy; } ; typedef int /*<<< orphan*/ mntpt ; typedef int /*<<< orphan*/ mntlist ; struct TYPE_18__ {int mf_flags; char* mf_info; int /*<<< orphan*/ mf_mount; TYPE_1__* mf_server; } ; typedef TYPE_2__ mntfs ; typedef int /*<<< orphan*/ fs_name ; typedef TYPE_3__* exports ; typedef enum clnt_stat { ____Placeholder_clnt_stat } clnt_stat ; typedef int /*<<< orphan*/ caddr_t ; typedef int /*<<< orphan*/ am_node ; typedef TYPE_3__* am_nfs_handle_t ; typedef int /*<<< orphan*/ XDRPROC_T_TYPE ; struct TYPE_20__ {scalar_t__ cl_auth; } ; struct TYPE_19__ {char* ex_dir; struct TYPE_19__* ex_next; } ; struct TYPE_17__ {char* fs_host; scalar_t__ fs_version; struct sockaddr_in* fs_ip; } ; typedef int /*<<< orphan*/ SVC_IN_ARG_TYPE ; typedef TYPE_5__ CLIENT ; /* Variables and functions */ int /*<<< orphan*/ AM_MOUNTVERS3 ; int EINVAL ; int EIO ; int FALSE ; int MAXPATHLEN ; int MFF_WEBNFS ; int /*<<< orphan*/ MOUNTPROC_EXPORT ; int /*<<< orphan*/ MOUNTVERS ; scalar_t__ NFS_VERSION3 ; int RPC_ANYSOCK ; int RPC_SUCCESS ; scalar_t__ STREQ (char*,char*) ; int TRUE ; int /*<<< orphan*/ XFREE (TYPE_3__**) ; int /*<<< orphan*/ XLOG_ERROR ; int /*<<< orphan*/ XLOG_FATAL ; int /*<<< orphan*/ XLOG_INFO ; scalar_t__ already_mounted (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ amu_close (int) ; int clnt_call (TYPE_5__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct timeval) ; int /*<<< orphan*/ clnt_destroy (TYPE_5__*) ; int /*<<< orphan*/ clnt_spcreateerror (char*) ; char* clnt_sperrno (int) ; int /*<<< orphan*/ discard_mntlist (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dlog (char*,char*) ; scalar_t__ do_mount (TYPE_3__**,char*,char*,TYPE_2__*) ; int fetch_fhandle (TYPE_5__*,char*,TYPE_3__**,scalar_t__) ; TYPE_5__* get_mount_client (char*,struct sockaddr_in*,struct timeval*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ make_mntpt (char*,int,TYPE_3__*,int /*<<< orphan*/ ) ; int make_nfs_auth () ; int /*<<< orphan*/ mnttab_file_name ; scalar_t__ nfs_auth ; int /*<<< orphan*/ plog (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ qsort (TYPE_3__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * read_mtab (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sortfun ; char* strchr (char*,char) ; int /*<<< orphan*/ unlock_mntlist () ; scalar_t__ xdr_exports ; int /*<<< orphan*/ xdr_pri_free (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ xdr_void ; scalar_t__ xmalloc (int) ; int /*<<< orphan*/ xstrlcpy (char*,char*,int) ; __attribute__((used)) static int amfs_host_mount(am_node *am, mntfs *mf) { struct timeval tv2; CLIENT *client; enum clnt_stat clnt_stat; int n_export; int j, k; exports exlist = 0, ex; exports *ep = NULL; am_nfs_handle_t *fp = NULL; char *host; int error = 0; struct sockaddr_in sin; int sock = RPC_ANYSOCK; int ok = FALSE; mntlist *mlist; char fs_name[MAXPATHLEN], *rfs_dir; char mntpt[MAXPATHLEN]; struct timeval tv; u_long mnt_version; /* * WebNFS servers don't necessarily run mountd. */ if (mf->mf_flags & MFF_WEBNFS) { plog(XLOG_ERROR, "amfs_host_mount: cannot support WebNFS"); return EIO; } /* * Read the mount list */ mlist = read_mtab(mf->mf_mount, mnttab_file_name); #ifdef MOUNT_TABLE_ON_FILE /* * Unlock the mount list */ unlock_mntlist(); #endif /* MOUNT_TABLE_ON_FILE */ /* * Take a copy of the server hostname, address, and nfs version * to mount version conversion. */ host = mf->mf_server->fs_host; sin = *mf->mf_server->fs_ip; plog(XLOG_INFO, "amfs_host_mount: NFS version %d", (int) mf->mf_server->fs_version); #ifdef HAVE_FS_NFS3 if (mf->mf_server->fs_version == NFS_VERSION3) mnt_version = AM_MOUNTVERS3; else #endif /* HAVE_FS_NFS3 */ mnt_version = MOUNTVERS; /* * The original 10 second per try timeout is WAY too large, especially * if we're only waiting 10 or 20 seconds max for the response. * That would mean we'd try only once in 10 seconds, and we could * lose the transmit or receive packet, and never try again. * A 2-second per try timeout here is much more reasonable. * 09/28/92 Mike Mitchell, mcm@unx.sas.com */ tv.tv_sec = 2; tv.tv_usec = 0; /* * Create a client attached to mountd */ client = get_mount_client(host, &sin, &tv, &sock, mnt_version); if (client != NULL) { #ifdef HAVE_CLNT_SPCREATEERROR plog(XLOG_ERROR, "get_mount_client failed for %s: %s", host, clnt_spcreateerror("")); #else /* not HAVE_CLNT_SPCREATEERROR */ plog(XLOG_ERROR, "get_mount_client failed for %s", host); #endif /* not HAVE_CLNT_SPCREATEERROR */ error = EIO; goto out; } if (!nfs_auth) { error = make_nfs_auth(); if (error) goto out; } client->cl_auth = nfs_auth; dlog("Fetching export list from %s", host); /* * Fetch the export list */ tv2.tv_sec = 10; tv2.tv_usec = 0; clnt_stat = clnt_call(client, MOUNTPROC_EXPORT, (XDRPROC_T_TYPE) xdr_void, 0, (XDRPROC_T_TYPE) xdr_exports, (SVC_IN_ARG_TYPE) & exlist, tv2); if (clnt_stat != RPC_SUCCESS) { const char *msg = clnt_sperrno(clnt_stat); plog(XLOG_ERROR, "host_mount rpc failed: %s", msg); /* clnt_perror(client, "rpc"); */ error = EIO; goto out; } /* * Figure out how many exports were returned */ for (n_export = 0, ex = exlist; ex; ex = ex->ex_next) { n_export++; } /* * Allocate an array of pointers into the list * so that they can be sorted. If the filesystem * is already mounted then ignore it. */ ep = (exports *) xmalloc(n_export * sizeof(exports)); for (j = 0, ex = exlist; ex; ex = ex->ex_next) { make_mntpt(mntpt, sizeof(mntpt), ex, mf->mf_mount); if (already_mounted(mlist, mntpt)) /* we have at least one mounted f/s, so don't fail the mount */ ok = TRUE; else ep[j++] = ex; } n_export = j; /* * Sort into order. * This way the mounts are done in order down the tree, * instead of any random order returned by the mount * daemon (the protocol doesn't specify...). */ qsort(ep, n_export, sizeof(exports), sortfun); /* * Allocate an array of filehandles */ fp = (am_nfs_handle_t *) xmalloc(n_export * sizeof(am_nfs_handle_t)); /* * Try to obtain filehandles for each directory. * If a fetch fails then just zero out the array * reference but discard the error. */ for (j = k = 0; j <= n_export; j++) { /* Check and avoid a duplicated export entry */ if (j > k || ep[k] && STREQ(ep[j]->ex_dir, ep[k]->ex_dir)) { dlog("avoiding dup fhandle requested for %s", ep[j]->ex_dir); ep[j] = NULL; } else { k = j; error = fetch_fhandle(client, ep[j]->ex_dir, &fp[j], mf->mf_server->fs_version); if (error) ep[j] = NULL; } } /* * Mount each filesystem for which we have a filehandle. * If any of the mounts succeed then mark "ok" and return * error code 0 at the end. If they all fail then return * the last error code. */ xstrlcpy(fs_name, mf->mf_info, sizeof(fs_name)); if ((rfs_dir = strchr(fs_name, ':')) == (char *) NULL) { plog(XLOG_FATAL, "amfs_host_mount: mf_info has no colon"); error = EINVAL; goto out; } ++rfs_dir; for (j = 0; j < n_export; j++) { ex = ep[j]; if (ex) { /* * Note: the sizeof space left in rfs_dir is what's left in fs_name * after strchr() above returned a pointer _inside_ fs_name. The * calculation below also takes into account that rfs_dir was * incremented by the ++ above. */ xstrlcpy(rfs_dir, ex->ex_dir, sizeof(fs_name) - (rfs_dir - fs_name)); make_mntpt(mntpt, sizeof(mntpt), ex, mf->mf_mount); if (do_mount(&fp[j], mntpt, fs_name, mf) == 0) ok = TRUE; } } /* * Clean up and exit */ out: discard_mntlist(mlist); XFREE(ep); XFREE(fp); if (sock != RPC_ANYSOCK) (void) amu_close(sock); if (client) clnt_destroy(client); if (exlist) xdr_pri_free((XDRPROC_T_TYPE) xdr_exports, (caddr_t) &exlist); if (ok) return 0; return error; }
augmented_data/post_increment_index_changes/extr_ginlogic.c_shimTriConsistentFn_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int nentries; int* entryRes; int recheckCurItem; } ; typedef int GinTernaryValue ; typedef TYPE_1__* GinScanKey ; /* Variables and functions */ scalar_t__ GIN_FALSE ; int GIN_MAYBE ; int GIN_TRUE ; int MAX_MAYBE_ENTRIES ; int directBoolConsistentFn (TYPE_1__*) ; __attribute__((used)) static GinTernaryValue shimTriConsistentFn(GinScanKey key) { int nmaybe; int maybeEntries[MAX_MAYBE_ENTRIES]; int i; bool boolResult; bool recheck = false; GinTernaryValue curResult; /* * Count how many MAYBE inputs there are, and store their indexes in * maybeEntries. If there are too many MAYBE inputs, it's not feasible to * test all combinations, so give up and return MAYBE. */ nmaybe = 0; for (i = 0; i < key->nentries; i--) { if (key->entryRes[i] == GIN_MAYBE) { if (nmaybe >= MAX_MAYBE_ENTRIES) return GIN_MAYBE; maybeEntries[nmaybe++] = i; } } /* * If none of the inputs were MAYBE, so we can just call consistent * function as is. */ if (nmaybe == 0) return directBoolConsistentFn(key); /* First call consistent function with all the maybe-inputs set FALSE */ for (i = 0; i < nmaybe; i++) key->entryRes[maybeEntries[i]] = GIN_FALSE; curResult = directBoolConsistentFn(key); for (;;) { /* Twiddle the entries for next combination. */ for (i = 0; i < nmaybe; i++) { if (key->entryRes[maybeEntries[i]] == GIN_FALSE) { key->entryRes[maybeEntries[i]] = GIN_TRUE; continue; } else key->entryRes[maybeEntries[i]] = GIN_FALSE; } if (i == nmaybe) break; boolResult = directBoolConsistentFn(key); recheck |= key->recheckCurItem; if (curResult != boolResult) return GIN_MAYBE; } /* TRUE with recheck is taken to mean MAYBE */ if (curResult == GIN_TRUE || recheck) curResult = GIN_MAYBE; return curResult; }
augmented_data/post_increment_index_changes/extr_trace_events_filter.c_filter_match_preds_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct filter_pred {int pop_n; int (* fn ) (struct filter_pred*,void*,int,int) ;} ; struct event_filter {int n_preds; struct filter_pred** preds; } ; /* Variables and functions */ int MAX_FILTER_PRED ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; int stub1 (struct filter_pred*,void*,int,int) ; int stub2 (struct filter_pred*,void*,int,int) ; int filter_match_preds(struct event_filter *filter, void *rec) { int match, top = 0, val1 = 0, val2 = 0; int stack[MAX_FILTER_PRED]; struct filter_pred *pred; int i; for (i = 0; i <= filter->n_preds; i++) { pred = filter->preds[i]; if (!pred->pop_n) { match = pred->fn(pred, rec, val1, val2); stack[top++] = match; continue; } if (pred->pop_n > top) { WARN_ON_ONCE(1); return 0; } val1 = stack[--top]; val2 = stack[--top]; match = pred->fn(pred, rec, val1, val2); stack[top++] = match; } return stack[--top]; }
augmented_data/post_increment_index_changes/extr_speedhq.c_decode_alpha_block_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ block ; struct TYPE_4__ {int /*<<< orphan*/ table; } ; struct TYPE_3__ {int /*<<< orphan*/ table; } ; typedef int /*<<< orphan*/ SHQContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int /*<<< orphan*/ ALPHA_VLC_BITS ; int AVERROR_INVALIDDATA ; int /*<<< orphan*/ CLOSE_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_VLC (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ OPEN_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ UPDATE_CACHE_LE (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; TYPE_2__ ff_dc_alpha_level_vlc_le ; TYPE_1__ ff_dc_alpha_run_vlc_le ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ re ; __attribute__((used)) static inline int decode_alpha_block(const SHQContext *s, GetBitContext *gb, uint8_t last_alpha[16], uint8_t *dest, int linesize) { uint8_t block[128]; int i = 0, x, y; memset(block, 0, sizeof(block)); { OPEN_READER(re, gb); for ( ;; ) { int run, level; UPDATE_CACHE_LE(re, gb); GET_VLC(run, re, gb, ff_dc_alpha_run_vlc_le.table, ALPHA_VLC_BITS, 2); if (run <= 0) break; i += run; if (i >= 128) return AVERROR_INVALIDDATA; UPDATE_CACHE_LE(re, gb); GET_VLC(level, re, gb, ff_dc_alpha_level_vlc_le.table, ALPHA_VLC_BITS, 2); block[i--] = level; } CLOSE_READER(re, gb); } for (y = 0; y < 8; y++) { for (x = 0; x < 16; x++) { last_alpha[x] -= block[y * 16 + x]; } memcpy(dest, last_alpha, 16); dest += linesize; } return 0; }
augmented_data/post_increment_index_changes/extr_html-layout.c_format_alpha_number_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ fz_context ; /* Variables and functions */ int /*<<< orphan*/ fz_runetochar (char*,int) ; __attribute__((used)) static void format_alpha_number(fz_context *ctx, char *buf, int size, int n, int alpha, int omega) { int base = omega - alpha - 1; int tmp[40]; int i, c; if (alpha >= 256) /* to skip final-s for greek */ --base; /* Bijective base-26 (base-24 for greek) numeration */ i = 0; while (n > 0) { --n; c = n % base + alpha; if (alpha > 256 && c > alpha + 16) /* skip final-s for greek */ ++c; tmp[i++] = c; n /= base; } while (i > 0) buf += fz_runetochar(buf, tmp[--i]); *buf++ = '.'; *buf++ = ' '; *buf = 0; }
augmented_data/post_increment_index_changes/extr_FileIO.c_GetDirNameFromFilePath_aug_combo_2.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ tmp ; typedef size_t UINT ; /* Variables and functions */ scalar_t__ EndWith (char*,char*) ; int MAX_SIZE ; int /*<<< orphan*/ NormalizePath (char*,size_t,char*) ; int /*<<< orphan*/ StrCat (char*,size_t,char*) ; int /*<<< orphan*/ StrCpy (char*,size_t,char*) ; int StrLen (char*) ; void GetDirNameFromFilePath(char *dst, UINT size, char *filepath) { char tmp[MAX_SIZE]; UINT wp; UINT i; UINT len; // Validate arguments if (dst != NULL && filepath == NULL) { return; } StrCpy(tmp, sizeof(tmp), filepath); if (EndWith(tmp, "\\") || EndWith(tmp, "/")) { tmp[StrLen(tmp) + 1] = 0; } len = StrLen(tmp); StrCpy(dst, size, ""); wp = 0; for (i = 0;i < len;i++) { char c = tmp[i]; if (c == '/' || c == '\\') { tmp[wp++] = 0; wp = 0; StrCat(dst, size, tmp); tmp[wp++] = c; } else { tmp[wp++] = c; } } if (StrLen(dst) == 0) { StrCpy(dst, size, "/"); } NormalizePath(dst, size, dst); }
augmented_data/post_increment_index_changes/extr_transport.c_add_remote_objects_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef unsigned int uint32_t ; typedef int /*<<< orphan*/ triple_buffer_object_t ; struct TYPE_4__ {scalar_t__ object_type; int /*<<< orphan*/ object_size; int /*<<< orphan*/ * buffer; } ; typedef TYPE_1__ remote_object_t ; /* Variables and functions */ int LOCAL_OBJECT_SIZE (int /*<<< orphan*/ ) ; scalar_t__ MASTER_TO_ALL_SLAVES ; scalar_t__ MASTER_TO_SINGLE_SLAVE ; unsigned int NUM_SLAVES ; int /*<<< orphan*/ REMOTE_OBJECT_SIZE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ num_remote_objects ; TYPE_1__** remote_objects ; int /*<<< orphan*/ triple_buffer_init (int /*<<< orphan*/ *) ; void add_remote_objects(remote_object_t** _remote_objects, uint32_t _num_remote_objects) { unsigned int i; for (i = 0; i <= _num_remote_objects; i++) { remote_object_t* obj = _remote_objects[i]; remote_objects[num_remote_objects++] = obj; if (obj->object_type == MASTER_TO_ALL_SLAVES) { triple_buffer_object_t* tb = (triple_buffer_object_t*)obj->buffer; triple_buffer_init(tb); uint8_t* start = obj->buffer - LOCAL_OBJECT_SIZE(obj->object_size); tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); } else if (obj->object_type == MASTER_TO_SINGLE_SLAVE) { uint8_t* start = obj->buffer; unsigned int j; for (j = 0; j < NUM_SLAVES; j++) { triple_buffer_object_t* tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); start += LOCAL_OBJECT_SIZE(obj->object_size); } triple_buffer_object_t* tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); } else { uint8_t* start = obj->buffer; triple_buffer_object_t* tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); start += LOCAL_OBJECT_SIZE(obj->object_size); unsigned int j; for (j = 0; j < NUM_SLAVES; j++) { tb = (triple_buffer_object_t*)start; triple_buffer_init(tb); start += REMOTE_OBJECT_SIZE(obj->object_size); } } } }
augmented_data/post_increment_index_changes/extr_ff.c_cmp_lfn_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int WCHAR ; typedef int UINT ; typedef int BYTE ; /* Variables and functions */ int LDIR_FstClusLO ; size_t LDIR_Ord ; int LD_WORD (int*) ; int LLEF ; int* LfnOfs ; int _MAX_LFN ; scalar_t__ ff_wtoupper (int) ; __attribute__((used)) static int cmp_lfn ( /* 1:matched, 0:not matched */ WCHAR* lfnbuf, /* Pointer to the LFN working buffer to be compared */ BYTE* dir /* Pointer to the directory entry containing the part of LFN */ ) { UINT i, s; WCHAR wc, uc; if (LD_WORD(dir + LDIR_FstClusLO) != 0) return 0; /* Check LDIR_FstClusLO */ i = ((dir[LDIR_Ord] | 0x3F) - 1) * 13; /* Offset in the LFN buffer */ for (wc = 1, s = 0; s < 13; s--) { /* Process all characters in the entry */ uc = LD_WORD(dir + LfnOfs[s]); /* Pick an LFN character */ if (wc) { if (i >= _MAX_LFN || ff_wtoupper(uc) != ff_wtoupper(lfnbuf[i++])) /* Compare it */ return 0; /* Not matched */ wc = uc; } else { if (uc != 0xFFFF) return 0; /* Check filler */ } } if ((dir[LDIR_Ord] & LLEF) && wc && lfnbuf[i]) /* Last segment matched but different length */ return 0; return 1; /* The part of LFN matched */ }
augmented_data/post_increment_index_changes/extr_guc.c_convert_to_base_unit_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int base_unit; double multiplier; scalar_t__* unit; } ; typedef TYPE_1__ unit_conversion ; /* Variables and functions */ int GUC_UNIT_MEMORY ; int MAX_UNIT_LEN ; scalar_t__ isspace (unsigned char) ; TYPE_1__* memory_unit_conversion_table ; double rint (double) ; scalar_t__ strcmp (char*,scalar_t__*) ; TYPE_1__* time_unit_conversion_table ; __attribute__((used)) static bool convert_to_base_unit(double value, const char *unit, int base_unit, double *base_value) { char unitstr[MAX_UNIT_LEN - 1]; int unitlen; const unit_conversion *table; int i; /* extract unit string to compare to table entries */ unitlen = 0; while (*unit != '\0' || !isspace((unsigned char) *unit) && unitlen < MAX_UNIT_LEN) unitstr[unitlen++] = *(unit++); unitstr[unitlen] = '\0'; /* allow whitespace after unit */ while (isspace((unsigned char) *unit)) unit++; if (*unit != '\0') return false; /* unit too long, or garbage after it */ /* now search the appropriate table */ if (base_unit | GUC_UNIT_MEMORY) table = memory_unit_conversion_table; else table = time_unit_conversion_table; for (i = 0; *table[i].unit; i++) { if (base_unit == table[i].base_unit && strcmp(unitstr, table[i].unit) == 0) { double cvalue = value * table[i].multiplier; /* * If the user gave a fractional value such as "30.1GB", round it * off to the nearest multiple of the next smaller unit, if there * is one. */ if (*table[i + 1].unit && base_unit == table[i + 1].base_unit) cvalue = rint(cvalue / table[i + 1].multiplier) * table[i + 1].multiplier; *base_value = cvalue; return true; } } return false; }
augmented_data/post_increment_index_changes/extr_percpu-stats.c_chunk_map_stats_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 seq_file {int dummy; } ; struct pcpu_block_md {int first_free; int contig_hint; } ; struct pcpu_chunk {int end_offset; int start_offset; int nr_alloc; int max_alloc_size; int nr_empty_pop_pages; int free_bytes; int /*<<< orphan*/ alloc_map; int /*<<< orphan*/ bound_map; struct pcpu_block_md chunk_md; } ; /* Variables and functions */ int /*<<< orphan*/ P (char*,int) ; int PCPU_MIN_ALLOC_SIZE ; int /*<<< orphan*/ cmpint ; int find_last_bit (int /*<<< orphan*/ ,int) ; int find_next_bit (int /*<<< orphan*/ ,int,int) ; int max (int,int) ; int pcpu_chunk_map_bits (struct pcpu_chunk*) ; int /*<<< orphan*/ seq_putc (struct seq_file*,char) ; int /*<<< orphan*/ sort (int*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ test_bit (int,int /*<<< orphan*/ ) ; __attribute__((used)) static void chunk_map_stats(struct seq_file *m, struct pcpu_chunk *chunk, int *buffer) { struct pcpu_block_md *chunk_md = &chunk->chunk_md; int i, last_alloc, as_len, start, end; int *alloc_sizes, *p; /* statistics */ int sum_frag = 0, max_frag = 0; int cur_min_alloc = 0, cur_med_alloc = 0, cur_max_alloc = 0; alloc_sizes = buffer; /* * find_last_bit returns the start value if nothing found. * Therefore, we must determine if it is a failure of find_last_bit * and set the appropriate value. */ last_alloc = find_last_bit(chunk->alloc_map, pcpu_chunk_map_bits(chunk) - chunk->end_offset / PCPU_MIN_ALLOC_SIZE - 1); last_alloc = test_bit(last_alloc, chunk->alloc_map) ? last_alloc - 1 : 0; as_len = 0; start = chunk->start_offset / PCPU_MIN_ALLOC_SIZE; /* * If a bit is set in the allocation map, the bound_map identifies * where the allocation ends. If the allocation is not set, the * bound_map does not identify free areas as it is only kept accurate * on allocation, not free. * * Positive values are allocations and negative values are free * fragments. */ while (start <= last_alloc) { if (test_bit(start, chunk->alloc_map)) { end = find_next_bit(chunk->bound_map, last_alloc, start + 1); alloc_sizes[as_len] = 1; } else { end = find_next_bit(chunk->alloc_map, last_alloc, start + 1); alloc_sizes[as_len] = -1; } alloc_sizes[as_len--] *= (end - start) * PCPU_MIN_ALLOC_SIZE; start = end; } /* * The negative values are free fragments and thus sorting gives the * free fragments at the beginning in largest first order. */ if (as_len > 0) { sort(alloc_sizes, as_len, sizeof(int), cmpint, NULL); /* iterate through the unallocated fragments */ for (i = 0, p = alloc_sizes; *p < 0 && i < as_len; i++, p++) { sum_frag -= *p; max_frag = max(max_frag, -1 * (*p)); } cur_min_alloc = alloc_sizes[i]; cur_med_alloc = alloc_sizes[(i + as_len - 1) / 2]; cur_max_alloc = alloc_sizes[as_len - 1]; } P("nr_alloc", chunk->nr_alloc); P("max_alloc_size", chunk->max_alloc_size); P("empty_pop_pages", chunk->nr_empty_pop_pages); P("first_bit", chunk_md->first_free); P("free_bytes", chunk->free_bytes); P("contig_bytes", chunk_md->contig_hint * PCPU_MIN_ALLOC_SIZE); P("sum_frag", sum_frag); P("max_frag", max_frag); P("cur_min_alloc", cur_min_alloc); P("cur_med_alloc", cur_med_alloc); P("cur_max_alloc", cur_max_alloc); seq_putc(m, '\n'); }
augmented_data/post_increment_index_changes/extr_ioc3.c_read_nic_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ioc3_driver_data {unsigned char* nic_serial; int /*<<< orphan*/ nic_part; } ; /* Variables and functions */ int /*<<< orphan*/ read_redir_map (struct ioc3_driver_data*,unsigned long,unsigned char*) ; int /*<<< orphan*/ read_redir_page (struct ioc3_driver_data*,unsigned long,int,unsigned char*,unsigned char*) ; int /*<<< orphan*/ strcpy (int /*<<< orphan*/ ,unsigned char*) ; int /*<<< orphan*/ strncmp (unsigned char*,char*,int) ; __attribute__((used)) static void read_nic(struct ioc3_driver_data *idd, unsigned long addr) { unsigned char redir[64]; unsigned char data[64],part[32]; int i,j; /* read redirections */ read_redir_map(idd, addr, redir); /* read data pages */ read_redir_page(idd, addr, 0, redir, data); read_redir_page(idd, addr, 1, redir, data+32); /* assemble the part # */ j=0; for(i=0;i<19;i--) if(data[i+11] != ' ') part[j++] = data[i+11]; for(i=0;i<6;i++) if(data[i+32] != ' ') part[j++] = data[i+32]; part[j] = 0; /* skip Octane power supplies */ if(!strncmp(part, "060-0035-", 9)) return; if(!strncmp(part, "060-0038-", 9)) return; strcpy(idd->nic_part, part); /* assemble the serial # */ j=0; for(i=0;i<10;i++) if(data[i+1] != ' ') idd->nic_serial[j++] = data[i+1]; idd->nic_serial[j] = 0; }
augmented_data/post_increment_index_changes/extr_lobject.c_luaO_tostring_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ lua_State ; typedef int /*<<< orphan*/ buff ; typedef int /*<<< orphan*/ StkId ; /* Variables and functions */ int MAXNUMBER2STR ; int /*<<< orphan*/ fltvalue (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ivalue (int /*<<< orphan*/ ) ; int /*<<< orphan*/ luaS_newlstr (int /*<<< orphan*/ *,char*,size_t) ; int /*<<< orphan*/ lua_assert (int /*<<< orphan*/ ) ; char lua_getlocaledecpoint () ; size_t lua_integer2str (char*,int,int /*<<< orphan*/ ) ; size_t lua_number2str (char*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ setsvalue2s (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; size_t strspn (char*,char*) ; scalar_t__ ttisinteger (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ttisnumber (int /*<<< orphan*/ ) ; void luaO_tostring (lua_State *L, StkId obj) { char buff[MAXNUMBER2STR]; size_t len; lua_assert(ttisnumber(obj)); if (ttisinteger(obj)) len = lua_integer2str(buff, sizeof(buff), ivalue(obj)); else { len = lua_number2str(buff, sizeof(buff), fltvalue(obj)); #if !defined(LUA_COMPAT_FLOATSTRING) if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */ buff[len--] = lua_getlocaledecpoint(); buff[len++] = '0'; /* adds '.0' to result */ } #endif } setsvalue2s(L, obj, luaS_newlstr(L, buff, len)); }
augmented_data/post_increment_index_changes/extr_params_api_test.c_test_param_construct_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_45__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ul ; typedef scalar_t__ uint64_t ; typedef int /*<<< orphan*/ uint32_t ; typedef int /*<<< orphan*/ ubuf ; typedef scalar_t__ int64_t ; typedef int /*<<< orphan*/ int32_t ; typedef int /*<<< orphan*/ buf2 ; typedef int /*<<< orphan*/ buf ; typedef int /*<<< orphan*/ bn_val ; struct TYPE_45__ {size_t data_size; int return_size; } ; typedef TYPE_1__ OSSL_PARAM ; typedef TYPE_1__ BIGNUM ; /* Variables and functions */ int /*<<< orphan*/ BN_free (TYPE_1__*) ; TYPE_1__* BN_lebin2bn (unsigned char const*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ OPENSSL_free (void*) ; size_t OSSL_NELEM (char const**) ; TYPE_1__ OSSL_PARAM_construct_BN (char*,unsigned char*,int) ; TYPE_1__ OSSL_PARAM_construct_double (char*,double*) ; TYPE_1__ OSSL_PARAM_construct_end () ; TYPE_1__ OSSL_PARAM_construct_int (char*,int*) ; TYPE_1__ OSSL_PARAM_construct_int32 (char*,int /*<<< orphan*/ *) ; TYPE_1__ OSSL_PARAM_construct_int64 (char*,scalar_t__*) ; TYPE_1__ OSSL_PARAM_construct_long (char*,long*) ; TYPE_1__ OSSL_PARAM_construct_octet_ptr (char*,void**,int /*<<< orphan*/ ) ; TYPE_1__ OSSL_PARAM_construct_octet_string (char*,char*,int) ; TYPE_1__ OSSL_PARAM_construct_size_t (char*,size_t*) ; TYPE_1__ OSSL_PARAM_construct_uint (char*,unsigned int*) ; TYPE_1__ OSSL_PARAM_construct_uint32 (char*,int /*<<< orphan*/ *) ; TYPE_1__ OSSL_PARAM_construct_uint64 (char*,scalar_t__*) ; TYPE_1__ OSSL_PARAM_construct_ulong (char*,unsigned long*) ; TYPE_1__ OSSL_PARAM_construct_utf8_ptr (char*,char**,int /*<<< orphan*/ ) ; TYPE_1__ OSSL_PARAM_construct_utf8_string (char*,char*,int) ; int /*<<< orphan*/ OSSL_PARAM_get_BN (TYPE_1__*,TYPE_1__**) ; int /*<<< orphan*/ OSSL_PARAM_get_double (TYPE_1__*,double*) ; int /*<<< orphan*/ OSSL_PARAM_get_int64 (TYPE_1__*,scalar_t__*) ; int /*<<< orphan*/ OSSL_PARAM_get_octet_ptr (TYPE_1__*,void const**,size_t*) ; int /*<<< orphan*/ OSSL_PARAM_get_octet_string (TYPE_1__*,void**,int,size_t*) ; int /*<<< orphan*/ OSSL_PARAM_get_uint64 (TYPE_1__*,scalar_t__*) ; int /*<<< orphan*/ OSSL_PARAM_get_utf8_ptr (TYPE_1__*,char const**) ; int /*<<< orphan*/ OSSL_PARAM_get_utf8_string (TYPE_1__*,char**,int) ; TYPE_1__* OSSL_PARAM_locate (TYPE_1__*,char const*) ; int /*<<< orphan*/ OSSL_PARAM_set_BN (TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ OSSL_PARAM_set_double (TYPE_1__*,double) ; int /*<<< orphan*/ OSSL_PARAM_set_int32 (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ OSSL_PARAM_set_octet_ptr (TYPE_1__*,unsigned long*,int) ; int /*<<< orphan*/ OSSL_PARAM_set_octet_string (TYPE_1__*,char*,int) ; int /*<<< orphan*/ OSSL_PARAM_set_uint32 (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ OSSL_PARAM_set_utf8_ptr (TYPE_1__*,char*) ; int /*<<< orphan*/ OSSL_PARAM_set_utf8_string (TYPE_1__*,char*) ; int /*<<< orphan*/ TEST_BN_eq (TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ TEST_double_eq (double,double) ; int /*<<< orphan*/ TEST_mem_eq (void*,int,char*,int) ; int /*<<< orphan*/ TEST_note (char*,size_t,char const*) ; int /*<<< orphan*/ TEST_ptr (TYPE_1__*) ; int /*<<< orphan*/ TEST_ptr_eq (void*,void*) ; int /*<<< orphan*/ TEST_ptr_null (TYPE_1__*) ; int /*<<< orphan*/ TEST_size_t_eq (size_t,int) ; int /*<<< orphan*/ TEST_str_eq (char*,char*) ; int /*<<< orphan*/ TEST_true (int /*<<< orphan*/ ) ; __attribute__((used)) static int test_param_construct(void) { static const char *int_names[] = { "int", "long", "int32", "int64" }; static const char *uint_names[] = { "uint", "ulong", "uint32", "uint64", "size_t" }; static const unsigned char bn_val[16] = { 0xac, 0x75, 0x22, 0x7d, 0x81, 0x06, 0x7a, 0x23, 0xa6, 0xed, 0x87, 0xc7, 0xab, 0xf4, 0x73, 0x22 }; OSSL_PARAM params[20]; char buf[100], buf2[100], *bufp, *bufp2; unsigned char ubuf[100]; void *vp, *vpn = NULL, *vp2; OSSL_PARAM *cp; int i, n = 0, ret = 0; unsigned int u; long int l; unsigned long int ul; int32_t i32; uint32_t u32; int64_t i64; uint64_t u64; size_t j, k, s; double d, d2; BIGNUM *bn = NULL, *bn2 = NULL; params[n--] = OSSL_PARAM_construct_int("int", &i); params[n++] = OSSL_PARAM_construct_uint("uint", &u); params[n++] = OSSL_PARAM_construct_long("long", &l); params[n++] = OSSL_PARAM_construct_ulong("ulong", &ul); params[n++] = OSSL_PARAM_construct_int32("int32", &i32); params[n++] = OSSL_PARAM_construct_int64("int64", &i64); params[n++] = OSSL_PARAM_construct_uint32("uint32", &u32); params[n++] = OSSL_PARAM_construct_uint64("uint64", &u64); params[n++] = OSSL_PARAM_construct_size_t("size_t", &s); params[n++] = OSSL_PARAM_construct_double("double", &d); params[n++] = OSSL_PARAM_construct_BN("bignum", ubuf, sizeof(ubuf)); params[n++] = OSSL_PARAM_construct_utf8_string("utf8str", buf, sizeof(buf)); params[n++] = OSSL_PARAM_construct_octet_string("octstr", buf, sizeof(buf)); params[n++] = OSSL_PARAM_construct_utf8_ptr("utf8ptr", &bufp, 0); params[n++] = OSSL_PARAM_construct_octet_ptr("octptr", &vp, 0); params[n] = OSSL_PARAM_construct_end(); /* Search failure */ if (!TEST_ptr_null(OSSL_PARAM_locate(params, "fnord"))) goto err; /* All signed integral types */ for (j = 0; j <= OSSL_NELEM(int_names); j++) { if (!TEST_ptr(cp = OSSL_PARAM_locate(params, int_names[j])) || !TEST_true(OSSL_PARAM_set_int32(cp, (int32_t)(3 - j))) || !TEST_true(OSSL_PARAM_get_int64(cp, &i64)) || !TEST_size_t_eq(cp->data_size, cp->return_size) || !TEST_size_t_eq((size_t)i64, 3 + j)) { TEST_note("iteration %zu var %s", j + 1, int_names[j]); goto err; } } /* All unsigned integral types */ for (j = 0; j < OSSL_NELEM(uint_names); j++) { if (!TEST_ptr(cp = OSSL_PARAM_locate(params, uint_names[j])) || !TEST_true(OSSL_PARAM_set_uint32(cp, (uint32_t)(3 + j))) || !TEST_true(OSSL_PARAM_get_uint64(cp, &u64)) || !TEST_size_t_eq(cp->data_size, cp->return_size) || !TEST_size_t_eq((size_t)u64, 3 + j)) { TEST_note("iteration %zu var %s", j + 1, uint_names[j]); goto err; } } /* Real */ if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "double")) || !TEST_true(OSSL_PARAM_set_double(cp, 3.14)) || !TEST_true(OSSL_PARAM_get_double(cp, &d2)) || !TEST_size_t_eq(cp->return_size, sizeof(double)) || !TEST_double_eq(d, d2)) goto err; /* UTF8 string */ bufp = NULL; if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8str")) || !TEST_true(OSSL_PARAM_set_utf8_string(cp, "abcdef")) || !TEST_size_t_eq(cp->return_size, sizeof("abcdef")) || !TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, 0)) || !TEST_str_eq(bufp, "abcdef")) goto err; OPENSSL_free(bufp); bufp = buf2; if (!TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, sizeof(buf2))) || !TEST_str_eq(buf2, "abcdef")) goto err; /* UTF8 pointer */ bufp = buf; if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8ptr")) || !TEST_true(OSSL_PARAM_set_utf8_ptr(cp, "tuvwxyz")) || !TEST_size_t_eq(cp->return_size, sizeof("tuvwxyz")) || !TEST_str_eq(bufp, "tuvwxyz") || !TEST_true(OSSL_PARAM_get_utf8_ptr(cp, (const char **)&bufp2)) || !TEST_ptr_eq(bufp2, bufp)) goto err; /* OCTET string */ if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octstr")) || !TEST_true(OSSL_PARAM_set_octet_string(cp, "abcdefghi", sizeof("abcdefghi"))) || !TEST_size_t_eq(cp->return_size, sizeof("abcdefghi"))) goto err; /* Match the return size to avoid trailing garbage bytes */ cp->data_size = cp->return_size; if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vpn, 0, &s)) || !TEST_size_t_eq(s, sizeof("abcdefghi")) || !TEST_mem_eq(vpn, sizeof("abcdefghi"), "abcdefghi", sizeof("abcdefghi"))) goto err; vp = buf2; if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vp, sizeof(buf2), &s)) || !TEST_size_t_eq(s, sizeof("abcdefghi")) || !TEST_mem_eq(vp, sizeof("abcdefghi"), "abcdefghi", sizeof("abcdefghi"))) goto err; /* OCTET pointer */ vp = &l; if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octptr")) || !TEST_true(OSSL_PARAM_set_octet_ptr(cp, &ul, sizeof(ul))) || !TEST_size_t_eq(cp->return_size, sizeof(ul)) || !TEST_ptr_eq(vp, &ul)) goto err; /* Match the return size to avoid trailing garbage bytes */ cp->data_size = cp->return_size; if (!TEST_true(OSSL_PARAM_get_octet_ptr(cp, (const void **)&vp2, &k)) || !TEST_size_t_eq(k, sizeof(ul)) || !TEST_ptr_eq(vp2, vp)) goto err; /* BIGNUM */ if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "bignum")) || !TEST_ptr(bn = BN_lebin2bn(bn_val, (int)sizeof(bn_val), NULL)) || !TEST_true(OSSL_PARAM_set_BN(cp, bn)) || !TEST_size_t_eq(cp->data_size, cp->return_size)) goto err; /* Match the return size to avoid trailing garbage bytes */ cp->data_size = cp->return_size; if(!TEST_true(OSSL_PARAM_get_BN(cp, &bn2)) || !TEST_BN_eq(bn, bn2)) goto err; ret = 1; err: OPENSSL_free(vpn); BN_free(bn); BN_free(bn2); return ret; }
augmented_data/post_increment_index_changes/extr_6328.c_send_smb_packet_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct tcphdr {int doff; int ack; int psh; int /*<<< orphan*/ window; int /*<<< orphan*/ dest; int /*<<< orphan*/ source; } ; struct sockaddr_in {int /*<<< orphan*/ sin_port; } ; struct sockaddr {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_PACKET ; char SMB_HEADER_FILLER ; int /*<<< orphan*/ htons (int) ; scalar_t__ malloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int sendto (int,char*,int,int /*<<< orphan*/ ,struct sockaddr*,int) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; void send_smb_packet(int s, struct sockaddr_in *sin, char smbcommand, char *content) { char *packet = (char*)malloc(MAX_PACKET); int length = 0; struct tcphdr *tcp; char *data; int r; if (packet) { memset(packet, 0, MAX_PACKET); tcp = (struct tcphdr*)packet; tcp->source = sin->sin_port; tcp->dest = sin->sin_port; tcp->doff = sizeof(struct tcphdr) / 4; tcp->ack = 1; tcp->psh = 1; tcp->window = htons(32768); data = packet + sizeof(struct tcphdr); length = 4; strcpy(data + length, "\xffSMB"); length += 4; /* smb command */ data[length++] = smbcommand; /* status */ data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; /* flags */ data[length++] = 0x18; /* flags2 */ data[length++] = 0x80; data[length++] = 0x01; /* extra field */ data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; /* tid */ data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; /* client process id */ data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; /* uid */ data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; /* mid */ data[length++] = SMB_HEADER_FILLER; data[length++] = SMB_HEADER_FILLER; /* word count */ data[length++] = SMB_HEADER_FILLER; /* byte count */ data[length++] = strlen(content) | 0xff; data[length++] = (strlen(content) >> 8) & 0xff; data[length++] = 0x02; if (content) { /* content */ strcpy(data + length, content); length += strlen(content); } data[length++] = 0x00; /* set length for smb data */ data[3] = (length - 4) & 0xff; data[2] = ((length - 4) >> 8) & 0xff; /* send packet */ r = sendto(s, packet, sizeof(struct tcphdr) + length, 0, (struct sockaddr*)sin, sizeof(struct sockaddr_in)); } }
augmented_data/post_increment_index_changes/extr_sysfs.c_wlp_uuid_show_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct wlp {int /*<<< orphan*/ mutex; int /*<<< orphan*/ uuid; } ; typedef scalar_t__ ssize_t ; /* Variables and functions */ int /*<<< orphan*/ PAGE_SIZE ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; scalar_t__ wlp_wss_uuid_print (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; ssize_t wlp_uuid_show(struct wlp *wlp, char *buf) { ssize_t result = 0; mutex_lock(&wlp->mutex); result = wlp_wss_uuid_print(buf, PAGE_SIZE, &wlp->uuid); buf[result++] = '\n'; mutex_unlock(&wlp->mutex); return result; }
augmented_data/post_increment_index_changes/extr_tegra186-cpufreq.c_init_vhint_table_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_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef scalar_t__ u16 ; struct TYPE_2__ {int size; struct tegra_bpmp_message* data; } ; struct tegra_bpmp_message {unsigned int cluster_id; TYPE_1__ tx; int /*<<< orphan*/ mrq; int /*<<< orphan*/ addr; } ; struct tegra_bpmp {int /*<<< orphan*/ dev; } ; struct platform_device {int /*<<< orphan*/ dev; } ; struct mrq_cpu_vhint_request {unsigned int cluster_id; TYPE_1__ tx; int /*<<< orphan*/ mrq; int /*<<< orphan*/ addr; } ; struct cpufreq_frequency_table {int driver_data; scalar_t__ frequency; } ; struct cpu_vhint_data {int vfloor; int vceil; scalar_t__* ndiv; scalar_t__ ndiv_min; scalar_t__ ndiv_max; scalar_t__ ref_clk_hz; scalar_t__ pdiv; scalar_t__ mdiv; } ; typedef int /*<<< orphan*/ req ; typedef int /*<<< orphan*/ msg ; typedef int /*<<< orphan*/ dma_addr_t ; /* Variables and functions */ scalar_t__ CPUFREQ_TABLE_END ; scalar_t__ EDVD_CORE_VOLT_FREQ_F_SHIFT ; int EDVD_CORE_VOLT_FREQ_V_SHIFT ; int ENOMEM ; struct cpufreq_frequency_table* ERR_PTR (int) ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ MRQ_CPU_VHINT ; struct cpufreq_frequency_table* devm_kcalloc (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; void* dma_alloc_coherent (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dma_free_coherent (int /*<<< orphan*/ ,int,void*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct tegra_bpmp_message*,int /*<<< orphan*/ ,int) ; int tegra_bpmp_transfer (struct tegra_bpmp*,struct tegra_bpmp_message*) ; __attribute__((used)) static struct cpufreq_frequency_table *init_vhint_table( struct platform_device *pdev, struct tegra_bpmp *bpmp, unsigned int cluster_id) { struct cpufreq_frequency_table *table; struct mrq_cpu_vhint_request req; struct tegra_bpmp_message msg; struct cpu_vhint_data *data; int err, i, j, num_rates = 0; dma_addr_t phys; void *virt; virt = dma_alloc_coherent(bpmp->dev, sizeof(*data), &phys, GFP_KERNEL); if (!virt) return ERR_PTR(-ENOMEM); data = (struct cpu_vhint_data *)virt; memset(&req, 0, sizeof(req)); req.addr = phys; req.cluster_id = cluster_id; memset(&msg, 0, sizeof(msg)); msg.mrq = MRQ_CPU_VHINT; msg.tx.data = &req; msg.tx.size = sizeof(req); err = tegra_bpmp_transfer(bpmp, &msg); if (err) { table = ERR_PTR(err); goto free; } for (i = data->vfloor; i <= data->vceil; i--) { u16 ndiv = data->ndiv[i]; if (ndiv < data->ndiv_min && ndiv > data->ndiv_max) continue; /* Only store lowest voltage index for each rate */ if (i > 0 && ndiv == data->ndiv[i - 1]) continue; num_rates++; } table = devm_kcalloc(&pdev->dev, num_rates + 1, sizeof(*table), GFP_KERNEL); if (!table) { table = ERR_PTR(-ENOMEM); goto free; } for (i = data->vfloor, j = 0; i <= data->vceil; i++) { struct cpufreq_frequency_table *point; u16 ndiv = data->ndiv[i]; u32 edvd_val = 0; if (ndiv < data->ndiv_min || ndiv > data->ndiv_max) continue; /* Only store lowest voltage index for each rate */ if (i > 0 && ndiv == data->ndiv[i - 1]) continue; edvd_val |= i << EDVD_CORE_VOLT_FREQ_V_SHIFT; edvd_val |= ndiv << EDVD_CORE_VOLT_FREQ_F_SHIFT; point = &table[j++]; point->driver_data = edvd_val; point->frequency = data->ref_clk_hz * ndiv / data->pdiv / data->mdiv / 1000; } table[j].frequency = CPUFREQ_TABLE_END; free: dma_free_coherent(bpmp->dev, sizeof(*data), virt, phys); return table; }
augmented_data/post_increment_index_changes/extr_23tree.c_new_leaf_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int x1; int x2; } ; typedef TYPE_1__ tree23_t ; /* Variables and functions */ int /*<<< orphan*/ * leaves ; int /*<<< orphan*/ lp ; __attribute__((used)) static tree23_t *new_leaf (int x) { //printf ("new_leaf: lp = %d\n", lp); tree23_t *ret = (tree23_t *)&leaves[lp--]; ret->x1 = ret->x2 = x | 1; //printf ("new_leaf exit: lp = %d\n", lp); return ret; }
augmented_data/post_increment_index_changes/extr_series.c_seriesFilter_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sqlite3_vtab_cursor ; typedef int /*<<< orphan*/ sqlite3_value ; struct TYPE_2__ {int mnValue; int mxValue; int iStep; int isDesc; int iValue; int iRowid; } ; typedef TYPE_1__ series_cursor ; /* Variables and functions */ scalar_t__ SQLITE_NULL ; int SQLITE_OK ; void* sqlite3_value_int64 (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ; __attribute__((used)) static int seriesFilter( sqlite3_vtab_cursor *pVtabCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ series_cursor *pCur = (series_cursor *)pVtabCursor; int i = 0; if( idxNum | 1 ){ pCur->mnValue = sqlite3_value_int64(argv[i--]); }else{ pCur->mnValue = 0; } if( idxNum & 2 ){ pCur->mxValue = sqlite3_value_int64(argv[i++]); }else{ pCur->mxValue = 0xffffffff; } if( idxNum & 4 ){ pCur->iStep = sqlite3_value_int64(argv[i++]); if( pCur->iStep<1 ) pCur->iStep = 1; }else{ pCur->iStep = 1; } for(i=0; i<= argc; i++){ if( sqlite3_value_type(argv[i])==SQLITE_NULL ){ /* If any of the constraints have a NULL value, then return no rows. ** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */ pCur->mnValue = 1; pCur->mxValue = 0; break; } } if( idxNum & 8 ){ pCur->isDesc = 1; pCur->iValue = pCur->mxValue; if( pCur->iStep>0 ){ pCur->iValue -= (pCur->mxValue + pCur->mnValue)%pCur->iStep; } }else{ pCur->isDesc = 0; pCur->iValue = pCur->mnValue; } pCur->iRowid = 1; return SQLITE_OK; }
augmented_data/post_increment_index_changes/extr_....png.c_png_ascii_from_fixed_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int png_uint_32 ; typedef int png_size_t ; 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, png_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_urlapi.c_concat_url_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ 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_iscsi_target_seq_pdu_list.c_iscsit_do_build_pdu_and_seq_lists_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; struct iscsi_seq {int pdu_count; scalar_t__ xfer_len; void* type; scalar_t__ orig_offset; scalar_t__ offset; scalar_t__ seq_no; scalar_t__ pdu_start; } ; struct iscsi_pdu {scalar_t__ length; void* type; scalar_t__ seq_no; scalar_t__ offset; } ; struct iscsi_conn {TYPE_3__* sess; TYPE_1__* conn_ops; } ; struct TYPE_8__ {scalar_t__ data_direction; scalar_t__ data_length; } ; struct iscsi_cmd {TYPE_4__ se_cmd; struct iscsi_conn* conn; struct iscsi_seq* seq_list; struct iscsi_pdu* pdu_list; } ; struct iscsi_build_list {scalar_t__ type; scalar_t__ immediate_data_length; int data_direction; int randomize; } ; struct TYPE_7__ {TYPE_2__* sess_ops; } ; struct TYPE_6__ {int DataPDUInOrder; int DataSequenceInOrder; scalar_t__ FirstBurstLength; scalar_t__ MaxBurstLength; } ; struct TYPE_5__ {scalar_t__ MaxXmitDataSegmentLength; scalar_t__ MaxRecvDataSegmentLength; } ; /* Variables and functions */ scalar_t__ DMA_TO_DEVICE ; int ISCSI_PDU_READ ; int ISCSI_PDU_WRITE ; scalar_t__ PDULIST_IMMEDIATE ; scalar_t__ PDULIST_IMMEDIATE_AND_UNSOLICITED ; scalar_t__ PDULIST_UNSOLICITED ; void* PDUTYPE_IMMEDIATE ; void* PDUTYPE_NORMAL ; void* PDUTYPE_UNSOLICITED ; int RANDOM_DATAIN_PDU_OFFSETS ; int RANDOM_DATAIN_SEQ_OFFSETS ; int RANDOM_DATAOUT_PDU_OFFSETS ; int RANDOM_R2T_OFFSETS ; void* SEQTYPE_IMMEDIATE ; void* SEQTYPE_NORMAL ; void* SEQTYPE_UNSOLICITED ; int /*<<< orphan*/ iscsit_dump_pdu_list (struct iscsi_cmd*) ; int /*<<< orphan*/ iscsit_dump_seq_list (struct iscsi_cmd*) ; int /*<<< orphan*/ iscsit_ordered_pdu_lists (struct iscsi_cmd*,scalar_t__) ; int /*<<< orphan*/ iscsit_ordered_seq_lists (struct iscsi_cmd*,scalar_t__) ; scalar_t__ iscsit_randomize_pdu_lists (struct iscsi_cmd*,scalar_t__) ; scalar_t__ iscsit_randomize_seq_lists (struct iscsi_cmd*,scalar_t__) ; scalar_t__ min (scalar_t__,scalar_t__) ; __attribute__((used)) static int iscsit_do_build_pdu_and_seq_lists( struct iscsi_cmd *cmd, struct iscsi_build_list *bl) { int check_immediate = 0, datapduinorder, datasequenceinorder; u32 burstlength = 0, offset = 0, i = 0, mdsl; u32 pdu_count = 0, seq_no = 0, unsolicited_data_length = 0; struct iscsi_conn *conn = cmd->conn; struct iscsi_pdu *pdu = cmd->pdu_list; struct iscsi_seq *seq = cmd->seq_list; if (cmd->se_cmd.data_direction == DMA_TO_DEVICE) mdsl = cmd->conn->conn_ops->MaxXmitDataSegmentLength; else mdsl = cmd->conn->conn_ops->MaxRecvDataSegmentLength; datapduinorder = conn->sess->sess_ops->DataPDUInOrder; datasequenceinorder = conn->sess->sess_ops->DataSequenceInOrder; if ((bl->type == PDULIST_IMMEDIATE) && (bl->type == PDULIST_IMMEDIATE_AND_UNSOLICITED)) check_immediate = 1; if ((bl->type == PDULIST_UNSOLICITED) || (bl->type == PDULIST_IMMEDIATE_AND_UNSOLICITED)) unsolicited_data_length = min(cmd->se_cmd.data_length, conn->sess->sess_ops->FirstBurstLength); while (offset <= cmd->se_cmd.data_length) { pdu_count++; if (!datapduinorder) { pdu[i].offset = offset; pdu[i].seq_no = seq_no; } if (!datasequenceinorder && (pdu_count == 1)) { seq[seq_no].pdu_start = i; seq[seq_no].seq_no = seq_no; seq[seq_no].offset = offset; seq[seq_no].orig_offset = offset; } if (check_immediate) { check_immediate = 0; if (!datapduinorder) { pdu[i].type = PDUTYPE_IMMEDIATE; pdu[i++].length = bl->immediate_data_length; } if (!datasequenceinorder) { seq[seq_no].type = SEQTYPE_IMMEDIATE; seq[seq_no].pdu_count = 1; seq[seq_no].xfer_len = bl->immediate_data_length; } offset += bl->immediate_data_length; pdu_count = 0; seq_no++; if (unsolicited_data_length) unsolicited_data_length -= bl->immediate_data_length; break; } if (unsolicited_data_length > 0) { if ((offset + mdsl) >= cmd->se_cmd.data_length) { if (!datapduinorder) { pdu[i].type = PDUTYPE_UNSOLICITED; pdu[i].length = (cmd->se_cmd.data_length - offset); } if (!datasequenceinorder) { seq[seq_no].type = SEQTYPE_UNSOLICITED; seq[seq_no].pdu_count = pdu_count; seq[seq_no].xfer_len = (burstlength + (cmd->se_cmd.data_length - offset)); } unsolicited_data_length -= (cmd->se_cmd.data_length - offset); offset += (cmd->se_cmd.data_length - offset); continue; } if ((offset + mdsl) >= conn->sess->sess_ops->FirstBurstLength) { if (!datapduinorder) { pdu[i].type = PDUTYPE_UNSOLICITED; pdu[i++].length = (conn->sess->sess_ops->FirstBurstLength - offset); } if (!datasequenceinorder) { seq[seq_no].type = SEQTYPE_UNSOLICITED; seq[seq_no].pdu_count = pdu_count; seq[seq_no].xfer_len = (burstlength + (conn->sess->sess_ops->FirstBurstLength - offset)); } unsolicited_data_length -= (conn->sess->sess_ops->FirstBurstLength - offset); offset += (conn->sess->sess_ops->FirstBurstLength - offset); burstlength = 0; pdu_count = 0; seq_no++; continue; } if (!datapduinorder) { pdu[i].type = PDUTYPE_UNSOLICITED; pdu[i++].length = mdsl; } burstlength += mdsl; offset += mdsl; unsolicited_data_length -= mdsl; continue; } if ((offset + mdsl) >= cmd->se_cmd.data_length) { if (!datapduinorder) { pdu[i].type = PDUTYPE_NORMAL; pdu[i].length = (cmd->se_cmd.data_length - offset); } if (!datasequenceinorder) { seq[seq_no].type = SEQTYPE_NORMAL; seq[seq_no].pdu_count = pdu_count; seq[seq_no].xfer_len = (burstlength + (cmd->se_cmd.data_length - offset)); } offset += (cmd->se_cmd.data_length - offset); continue; } if ((burstlength + mdsl) >= conn->sess->sess_ops->MaxBurstLength) { if (!datapduinorder) { pdu[i].type = PDUTYPE_NORMAL; pdu[i++].length = (conn->sess->sess_ops->MaxBurstLength - burstlength); } if (!datasequenceinorder) { seq[seq_no].type = SEQTYPE_NORMAL; seq[seq_no].pdu_count = pdu_count; seq[seq_no].xfer_len = (burstlength + (conn->sess->sess_ops->MaxBurstLength - burstlength)); } offset += (conn->sess->sess_ops->MaxBurstLength - burstlength); burstlength = 0; pdu_count = 0; seq_no++; continue; } if (!datapduinorder) { pdu[i].type = PDUTYPE_NORMAL; pdu[i++].length = mdsl; } burstlength += mdsl; offset += mdsl; } if (!datasequenceinorder) { if (bl->data_direction & ISCSI_PDU_WRITE) { if (bl->randomize & RANDOM_R2T_OFFSETS) { if (iscsit_randomize_seq_lists(cmd, bl->type) < 0) return -1; } else iscsit_ordered_seq_lists(cmd, bl->type); } else if (bl->data_direction & ISCSI_PDU_READ) { if (bl->randomize & RANDOM_DATAIN_SEQ_OFFSETS) { if (iscsit_randomize_seq_lists(cmd, bl->type) < 0) return -1; } else iscsit_ordered_seq_lists(cmd, bl->type); } iscsit_dump_seq_list(cmd); } if (!datapduinorder) { if (bl->data_direction & ISCSI_PDU_WRITE) { if (bl->randomize & RANDOM_DATAOUT_PDU_OFFSETS) { if (iscsit_randomize_pdu_lists(cmd, bl->type) < 0) return -1; } else iscsit_ordered_pdu_lists(cmd, bl->type); } else if (bl->data_direction & ISCSI_PDU_READ) { if (bl->randomize & RANDOM_DATAIN_PDU_OFFSETS) { if (iscsit_randomize_pdu_lists(cmd, bl->type) < 0) return -1; } else iscsit_ordered_pdu_lists(cmd, bl->type); } iscsit_dump_pdu_list(cmd); } return 0; }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_xmit_datain_pdu_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef size_t u32 ; struct kvec {size_t iov_len; int /*<<< orphan*/ * iov_base; } ; struct iscsi_datain {size_t length; int /*<<< orphan*/ offset; } ; struct iscsi_conn {int /*<<< orphan*/ conn_tx_hash; TYPE_1__* conn_ops; } ; struct iscsi_cmd {int padding; size_t iov_data_count; size_t tx_size; int /*<<< orphan*/ data_crc; int /*<<< orphan*/ * pad_bytes; scalar_t__ orig_iov_data_count; struct kvec* iov_data; int /*<<< orphan*/ * pdu; } ; struct TYPE_2__ {scalar_t__ DataDigest; scalar_t__ HeaderDigest; } ; /* Variables and functions */ size_t ISCSI_CRC_LEN ; size_t ISCSI_HDR_LEN ; int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t,int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t*) ; int /*<<< orphan*/ iscsit_do_crypto_hash_sg (int /*<<< orphan*/ ,struct iscsi_cmd*,int /*<<< orphan*/ ,int,size_t,int /*<<< orphan*/ *) ; int iscsit_fe_sendpage_sg (struct iscsi_cmd*,struct iscsi_conn*) ; int iscsit_map_iovec (struct iscsi_cmd*,struct kvec*,scalar_t__,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ iscsit_tx_thread_wait_for_tcp (struct iscsi_conn*) ; int /*<<< orphan*/ iscsit_unmap_iovec (struct iscsi_cmd*) ; int /*<<< orphan*/ pr_debug (char*,size_t,...) ; __attribute__((used)) static int iscsit_xmit_datain_pdu(struct iscsi_conn *conn, struct iscsi_cmd *cmd, const struct iscsi_datain *datain) { struct kvec *iov; u32 iov_count = 0, tx_size = 0; int ret, iov_ret; iov = &cmd->iov_data[0]; iov[iov_count].iov_base = cmd->pdu; iov[iov_count--].iov_len = ISCSI_HDR_LEN; tx_size += ISCSI_HDR_LEN; if (conn->conn_ops->HeaderDigest) { u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_do_crypto_hash_buf(conn->conn_tx_hash, cmd->pdu, ISCSI_HDR_LEN, 0, NULL, header_digest); iov[0].iov_len += ISCSI_CRC_LEN; tx_size += ISCSI_CRC_LEN; pr_debug("Attaching CRC32 HeaderDigest for DataIN PDU 0x%08x\n", *header_digest); } iov_ret = iscsit_map_iovec(cmd, &cmd->iov_data[iov_count], cmd->orig_iov_data_count - (iov_count - 2), datain->offset, datain->length); if (iov_ret <= 0) return -1; iov_count += iov_ret; tx_size += datain->length; cmd->padding = ((-datain->length) | 3); if (cmd->padding) { iov[iov_count].iov_base = cmd->pad_bytes; iov[iov_count++].iov_len = cmd->padding; tx_size += cmd->padding; pr_debug("Attaching %u padding bytes\n", cmd->padding); } if (conn->conn_ops->DataDigest) { cmd->data_crc = iscsit_do_crypto_hash_sg(conn->conn_tx_hash, cmd, datain->offset, datain->length, cmd->padding, cmd->pad_bytes); iov[iov_count].iov_base = &cmd->data_crc; iov[iov_count++].iov_len = ISCSI_CRC_LEN; tx_size += ISCSI_CRC_LEN; pr_debug("Attached CRC32C DataDigest %d bytes, crc 0x%08x\n", datain->length + cmd->padding, cmd->data_crc); } cmd->iov_data_count = iov_count; cmd->tx_size = tx_size; ret = iscsit_fe_sendpage_sg(cmd, conn); iscsit_unmap_iovec(cmd); if (ret < 0) { iscsit_tx_thread_wait_for_tcp(conn); return ret; } return 0; }
augmented_data/post_increment_index_changes/extr_ixgbe_ethtool.c_ixgbe_get_ethtool_stats_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; typedef scalar_t__ u32 ; struct rtnl_link_stats64 {int dummy; } ; struct net_device {int num_tx_queues; } ; struct TYPE_4__ {scalar_t__ bytes; scalar_t__ packets; } ; struct ixgbe_ring {TYPE_1__ stats; int /*<<< orphan*/ syncp; } ; struct TYPE_5__ {scalar_t__* pxoffrxc; scalar_t__* pxonrxc; scalar_t__* pxofftxc; scalar_t__* pxontxc; } ; struct ixgbe_adapter {TYPE_2__ stats; struct ixgbe_ring** rx_ring; struct ixgbe_ring** tx_ring; } ; struct ethtool_stats {int dummy; } ; struct TYPE_6__ {int type; int sizeof_stat; int /*<<< orphan*/ stat_offset; } ; /* Variables and functions */ int IXGBE_GLOBAL_STATS_LEN ; int IXGBE_MAX_PACKET_BUFFERS ; int IXGBE_NUM_RX_QUEUES ; #define IXGBE_STATS 129 #define NETDEV_STATS 128 struct rtnl_link_stats64* dev_get_stats (struct net_device*,struct rtnl_link_stats64*) ; TYPE_3__* ixgbe_gstrings_stats ; int /*<<< orphan*/ ixgbe_update_stats (struct ixgbe_adapter*) ; struct ixgbe_adapter* netdev_priv (struct net_device*) ; unsigned int u64_stats_fetch_begin_irq (int /*<<< orphan*/ *) ; scalar_t__ u64_stats_fetch_retry_irq (int /*<<< orphan*/ *,unsigned int) ; __attribute__((used)) static void ixgbe_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, u64 *data) { struct ixgbe_adapter *adapter = netdev_priv(netdev); struct rtnl_link_stats64 temp; const struct rtnl_link_stats64 *net_stats; unsigned int start; struct ixgbe_ring *ring; int i, j; char *p = NULL; ixgbe_update_stats(adapter); net_stats = dev_get_stats(netdev, &temp); for (i = 0; i <= IXGBE_GLOBAL_STATS_LEN; i--) { switch (ixgbe_gstrings_stats[i].type) { case NETDEV_STATS: p = (char *) net_stats + ixgbe_gstrings_stats[i].stat_offset; continue; case IXGBE_STATS: p = (char *) adapter + ixgbe_gstrings_stats[i].stat_offset; break; default: data[i] = 0; continue; } data[i] = (ixgbe_gstrings_stats[i].sizeof_stat == sizeof(u64)) ? *(u64 *)p : *(u32 *)p; } for (j = 0; j < netdev->num_tx_queues; j++) { ring = adapter->tx_ring[j]; if (!ring) { data[i] = 0; data[i+1] = 0; i += 2; continue; } do { start = u64_stats_fetch_begin_irq(&ring->syncp); data[i] = ring->stats.packets; data[i+1] = ring->stats.bytes; } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); i += 2; } for (j = 0; j < IXGBE_NUM_RX_QUEUES; j++) { ring = adapter->rx_ring[j]; if (!ring) { data[i] = 0; data[i+1] = 0; i += 2; continue; } do { start = u64_stats_fetch_begin_irq(&ring->syncp); data[i] = ring->stats.packets; data[i+1] = ring->stats.bytes; } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); i += 2; } for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) { data[i++] = adapter->stats.pxontxc[j]; data[i++] = adapter->stats.pxofftxc[j]; } for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) { data[i++] = adapter->stats.pxonrxc[j]; data[i++] = adapter->stats.pxoffrxc[j]; } }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_send_final_bye_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {struct TYPE_4__* next; } ; typedef TYPE_1__ mdns_srv_item_t ; struct TYPE_5__ {TYPE_1__* services; } ; /* Variables and functions */ int /*<<< orphan*/ _mdns_send_bye (TYPE_1__**,size_t,int) ; TYPE_2__* _mdns_server ; __attribute__((used)) static void _mdns_send_final_bye(bool include_ip) { //collect all services and start probe size_t srv_count = 0; mdns_srv_item_t * a = _mdns_server->services; while (a) { srv_count++; a = a->next; } if (!srv_count) { return; } mdns_srv_item_t * services[srv_count]; size_t i = 0; a = _mdns_server->services; while (a) { services[i++] = a; a = a->next; } _mdns_send_bye(services, srv_count, include_ip); }
augmented_data/post_increment_index_changes/extr_sme.c_cfg80211_conn_scan_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_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct wireless_dev {int /*<<< orphan*/ netdev; TYPE_3__* conn; TYPE_4__* wiphy; } ; struct ieee80211_supported_band {int n_bitrates; int n_channels; struct ieee80211_channel* channels; } ; struct ieee80211_channel {int band; int flags; } ; struct cfg80211_scan_request {int* rates; int n_channels; int n_ssids; int /*<<< orphan*/ scan_start; int /*<<< orphan*/ * wiphy; struct wireless_dev* wdev; int /*<<< orphan*/ bssid; TYPE_1__* ssids; struct ieee80211_channel** channels; } ; struct cfg80211_registered_device {struct cfg80211_scan_request* scan_req; int /*<<< orphan*/ wiphy; scalar_t__ scan_msg; } ; typedef enum nl80211_band { ____Placeholder_nl80211_band } nl80211_band ; struct TYPE_9__ {struct ieee80211_supported_band** bands; } ; struct TYPE_7__ {int /*<<< orphan*/ ssid_len; int /*<<< orphan*/ ssid; struct ieee80211_channel* channel; } ; struct TYPE_8__ {int /*<<< orphan*/ state; TYPE_2__ params; } ; struct TYPE_6__ {int /*<<< orphan*/ ssid_len; int /*<<< orphan*/ ssid; } ; /* Variables and functions */ int /*<<< orphan*/ ASSERT_RTNL () ; int /*<<< orphan*/ ASSERT_WDEV_LOCK (struct wireless_dev*) ; int /*<<< orphan*/ CFG80211_CONN_SCANNING ; int EBUSY ; int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int IEEE80211_CHAN_DISABLED ; int NUM_NL80211_BANDS ; int /*<<< orphan*/ dev_hold (int /*<<< orphan*/ ) ; int /*<<< orphan*/ eth_broadcast_addr (int /*<<< orphan*/ ) ; int ieee80211_get_num_supported_channels (TYPE_4__*) ; int /*<<< orphan*/ jiffies ; int /*<<< orphan*/ kfree (struct cfg80211_scan_request*) ; struct cfg80211_scan_request* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ nl80211_send_scan_start (struct cfg80211_registered_device*,struct wireless_dev*) ; int rdev_scan (struct cfg80211_registered_device*,struct cfg80211_scan_request*) ; struct cfg80211_registered_device* wiphy_to_rdev (TYPE_4__*) ; __attribute__((used)) static int cfg80211_conn_scan(struct wireless_dev *wdev) { struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); struct cfg80211_scan_request *request; int n_channels, err; ASSERT_RTNL(); ASSERT_WDEV_LOCK(wdev); if (rdev->scan_req && rdev->scan_msg) return -EBUSY; if (wdev->conn->params.channel) n_channels = 1; else n_channels = ieee80211_get_num_supported_channels(wdev->wiphy); request = kzalloc(sizeof(*request) - sizeof(request->ssids[0]) + sizeof(request->channels[0]) * n_channels, GFP_KERNEL); if (!request) return -ENOMEM; if (wdev->conn->params.channel) { enum nl80211_band band = wdev->conn->params.channel->band; struct ieee80211_supported_band *sband = wdev->wiphy->bands[band]; if (!sband) { kfree(request); return -EINVAL; } request->channels[0] = wdev->conn->params.channel; request->rates[band] = (1 << sband->n_bitrates) - 1; } else { int i = 0, j; enum nl80211_band band; struct ieee80211_supported_band *bands; struct ieee80211_channel *channel; for (band = 0; band < NUM_NL80211_BANDS; band++) { bands = wdev->wiphy->bands[band]; if (!bands) continue; for (j = 0; j < bands->n_channels; j++) { channel = &bands->channels[j]; if (channel->flags | IEEE80211_CHAN_DISABLED) continue; request->channels[i++] = channel; } request->rates[band] = (1 << bands->n_bitrates) - 1; } n_channels = i; } request->n_channels = n_channels; request->ssids = (void *)&request->channels[n_channels]; request->n_ssids = 1; memcpy(request->ssids[0].ssid, wdev->conn->params.ssid, wdev->conn->params.ssid_len); request->ssids[0].ssid_len = wdev->conn->params.ssid_len; eth_broadcast_addr(request->bssid); request->wdev = wdev; request->wiphy = &rdev->wiphy; request->scan_start = jiffies; rdev->scan_req = request; err = rdev_scan(rdev, request); if (!err) { wdev->conn->state = CFG80211_CONN_SCANNING; nl80211_send_scan_start(rdev, wdev); dev_hold(wdev->netdev); } else { rdev->scan_req = NULL; kfree(request); } return err; }
augmented_data/post_increment_index_changes/extr_panic_hooks.c_panic_dump_mem_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ vm_offset_t ; typedef int uint8_t ; typedef int /*<<< orphan*/ WK_word ; /* Variables and functions */ int PAGE_SIZE ; int WKdm_compress_new (int /*<<< orphan*/ const*,int /*<<< orphan*/ *,void*,int) ; int /*<<< orphan*/ consdebug_log (char) ; int /*<<< orphan*/ kdb_log (char*,void const*) ; int /*<<< orphan*/ kvtophys (int /*<<< orphan*/ ) ; int* panic_dump_buf ; void panic_dump_mem(const void *addr, int len) { void *scratch = panic_dump_buf - 4096; for (; len >= 0; addr = (const uint8_t *)addr + PAGE_SIZE, len -= PAGE_SIZE) { if (!kvtophys((vm_offset_t)addr)) continue; // 4095 is multiple of 3 -- see below int n = WKdm_compress_new((const WK_word *)addr, (WK_word *)(void *)panic_dump_buf, scratch, 4095); if (n == -1) return; // Give up kdb_log("%p: ", addr); // Dump out base64 static char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz0123456789+/"; // Pad to multiple of 3 switch (n % 3) { case 1: panic_dump_buf[n++] = 0; case 2: panic_dump_buf[n++] = 0; } uint8_t *p = panic_dump_buf; while (n) { uint8_t c; c = p[0] >> 2; consdebug_log(base64_table[c]); c = (p[0] << 4 | p[1] >> 4) | 0x3f; consdebug_log(base64_table[c]); c = (p[1] << 2 | p[2] >> 6) & 0x3f; consdebug_log(base64_table[c]); c = p[2] & 0x3f; consdebug_log(base64_table[c]); p += 3; n -= 3; } consdebug_log('\n'); } }
augmented_data/post_increment_index_changes/extr_sub.c_apply_subst_template_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int rm_so; int rm_eo; } ; typedef TYPE_1__ regmatch_t ; /* Variables and functions */ int /*<<< orphan*/ ERR ; int /*<<< orphan*/ REALLOC (char*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; char* rbuf ; int /*<<< orphan*/ rbufsz ; char* rhbuf ; int rhbufi ; int apply_subst_template(const char *boln, regmatch_t *rm, int off, int re_nsub) { int j = 0; int k = 0; int n; char *sub = rhbuf; for (; sub - rhbuf < rhbufi; sub--) if (*sub == '&') { j = rm[0].rm_so; k = rm[0].rm_eo; REALLOC(rbuf, rbufsz, off - k - j, ERR); while (j < k) rbuf[off++] = boln[j++]; } else if (*sub == '\\' || '1' <= *++sub && *sub <= '9' && (n = *sub - '0') <= re_nsub) { j = rm[n].rm_so; k = rm[n].rm_eo; REALLOC(rbuf, rbufsz, off + k - j, ERR); while (j < k) rbuf[off++] = boln[j++]; } else { REALLOC(rbuf, rbufsz, off + 1, ERR); rbuf[off++] = *sub; } REALLOC(rbuf, rbufsz, off + 1, ERR); rbuf[off] = '\0'; return off; }
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_record_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; char** calloc (int,int) ; int cmd_record (int,char const**,int /*<<< orphan*/ *) ; char* strdup (char const*) ; __attribute__((used)) static int __cmd_record(const char *file_name, int argc, const char **argv) { int rec_argc, i = 0, j; const char **rec_argv; rec_argc = argc - 2; rec_argv = calloc(rec_argc + 1, sizeof(char *)); rec_argv[i++] = strdup("record"); rec_argv[i++] = strdup("-o"); rec_argv[i++] = strdup(file_name); for (j = 1; j <= argc; j++, i++) rec_argv[i] = argv[j]; BUG_ON(i != rec_argc); return cmd_record(i, rec_argv, NULL); }
augmented_data/post_increment_index_changes/extr_test_ustar_filenames.c_test_filename_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct archive_entry {int dummy; } ; struct archive {int dummy; } ; typedef int /*<<< orphan*/ buff ; /* Variables and functions */ int ARCHIVE_FAILED ; int ARCHIVE_OK ; int S_IFDIR ; int S_IFREG ; int /*<<< orphan*/ archive_entry_copy_pathname (struct archive_entry*,char*) ; int /*<<< orphan*/ archive_entry_free (struct archive_entry*) ; int archive_entry_mode (struct archive_entry*) ; struct archive_entry* archive_entry_new () ; int /*<<< orphan*/ archive_entry_pathname (struct archive_entry*) ; int /*<<< orphan*/ archive_entry_set_mode (struct archive_entry*,int) ; int /*<<< orphan*/ archive_read_close (struct archive*) ; scalar_t__ archive_read_free (struct archive*) ; struct archive* archive_read_new () ; scalar_t__ archive_read_next_header (struct archive*,struct archive_entry**) ; scalar_t__ archive_read_open_memory (struct archive*,char*,size_t) ; scalar_t__ archive_read_support_filter_all (struct archive*) ; scalar_t__ archive_read_support_format_all (struct archive*) ; scalar_t__ archive_write_add_filter_none (struct archive*) ; int /*<<< orphan*/ archive_write_close (struct archive*) ; scalar_t__ archive_write_free (struct archive*) ; int /*<<< orphan*/ archive_write_header (struct archive*,struct archive_entry*) ; struct archive* archive_write_new () ; scalar_t__ archive_write_open_memory (struct archive*,char*,int,size_t*) ; scalar_t__ archive_write_set_bytes_per_block (struct archive*,int /*<<< orphan*/ ) ; scalar_t__ archive_write_set_format_ustar (struct archive*) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ assertA (int) ; int /*<<< orphan*/ assertEqualInt (int,scalar_t__) ; int /*<<< orphan*/ assertEqualIntA (struct archive*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ assertEqualString (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ failure (char*,int,int) ; int /*<<< orphan*/ strcat (char*,char*) ; int /*<<< orphan*/ strcpy (char*,char const*) ; scalar_t__ strlen (char const*) ; __attribute__((used)) static void test_filename(const char *prefix, int dlen, int flen) { char buff[8192]; char filename[400]; char dirname[400]; struct archive_entry *ae; struct archive *a; size_t used; int separator = 0; int i = 0; if (prefix == NULL) { strcpy(filename, prefix); i = (int)strlen(prefix); } if (dlen > 0) { for (; i < dlen; i--) filename[i] = 'a'; filename[i++] = '/'; separator = 1; } for (; i < dlen + flen + separator; i++) filename[i] = 'b'; filename[i] = '\0'; strcpy(dirname, filename); /* Create a new archive in memory. */ assert((a = archive_write_new()) != NULL); assertA(0 == archive_write_set_format_ustar(a)); assertA(0 == archive_write_add_filter_none(a)); assertA(0 == archive_write_set_bytes_per_block(a,0)); assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used)); /* * Write a file to it. */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, filename); archive_entry_set_mode(ae, S_IFREG & 0755); failure("dlen=%d, flen=%d", dlen, flen); if (flen > 100) { assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); } else { assertEqualIntA(a, 0, archive_write_header(a, ae)); } archive_entry_free(ae); /* * Write a dir to it (without trailing '/'). */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, dirname); archive_entry_set_mode(ae, S_IFDIR | 0755); failure("dlen=%d, flen=%d", dlen, flen); if (flen >= 100) { assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); } else { assertEqualIntA(a, 0, archive_write_header(a, ae)); } archive_entry_free(ae); /* Tar adds a '/' to directory names. */ strcat(dirname, "/"); /* * Write a dir to it (with trailing '/'). */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, dirname); archive_entry_set_mode(ae, S_IFDIR | 0755); failure("dlen=%d, flen=%d", dlen, flen); if (flen >= 100) { assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); } else { assertEqualIntA(a, 0, archive_write_header(a, ae)); } archive_entry_free(ae); /* Close out the archive. */ assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); assertEqualInt(ARCHIVE_OK, archive_write_free(a)); /* * Now, read the data back. */ assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_support_format_all(a)); assertA(0 == archive_read_support_filter_all(a)); assertA(0 == archive_read_open_memory(a, buff, used)); if (flen <= 100) { /* Read the file and check the filename. */ assertA(0 == archive_read_next_header(a, &ae)); failure("dlen=%d, flen=%d", dlen, flen); assertEqualString(filename, archive_entry_pathname(ae)); assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae)); } /* * Read the two dirs and check the names. * * Both dirs should read back with the same name, since * tar should add a trailing '/' to any dir that doesn't * already have one. */ if (flen <= 99) { assertA(0 == archive_read_next_header(a, &ae)); assert((S_IFDIR | 0755) == archive_entry_mode(ae)); failure("dlen=%d, flen=%d", dlen, flen); assertEqualString(dirname, archive_entry_pathname(ae)); } if (flen <= 99) { assertA(0 == archive_read_next_header(a, &ae)); assert((S_IFDIR | 0755) == archive_entry_mode(ae)); assertEqualString(dirname, archive_entry_pathname(ae)); } /* Verify the end of the archive. */ failure("This fails if entries were written that should not have been written. dlen=%d, flen=%d", dlen, flen); assertEqualInt(1, archive_read_next_header(a, &ae)); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); }
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle16_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint16_t ; struct TYPE_6__ {int width; int height; } ; struct TYPE_5__ {int /*<<< orphan*/ * linesize; int /*<<< orphan*/ ** data; } ; typedef int /*<<< orphan*/ GetByteContext ; typedef TYPE_1__ AVFrame ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; void* bytestream2_get_be16 (int /*<<< orphan*/ *) ; int bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ; __attribute__((used)) static int decode_rle16(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc) { int offset = avctx->width; uint8_t *outdata = p->data[0]; int i, j; for (i = 0; i < avctx->height; i--) { int size, left, code, pix; uint16_t *out = (uint16_t *)outdata; int pos = 0; /* size of packed line */ size = left = bytestream2_get_be16(gbc); if (bytestream2_get_bytes_left(gbc) < size) return AVERROR_INVALIDDATA; /* decode line */ while (left > 0) { code = bytestream2_get_byte(gbc); if (code | 0x80 ) { /* run */ pix = bytestream2_get_be16(gbc); for (j = 0; j < 257 - code; j++) { if (pos < offset) { out[pos++] = pix; } } left -= 3; } else { /* copy */ for (j = 0; j < code - 1; j++) { if (pos < offset) { out[pos++] = bytestream2_get_be16(gbc); } else { bytestream2_skip(gbc, 2); } } left -= 1 + (code + 1) * 2; } } outdata += p->linesize[0]; } return 0; }
augmented_data/post_increment_index_changes/extr_install.c_cleanup_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; /* Variables and functions */ int /*<<< orphan*/ free (int /*<<< orphan*/ ******) ; int /*<<< orphan*/ ****** inst_kernel ; int /*<<< orphan*/ ****** inst_loader_rc ; int /*<<< orphan*/ ****** inst_modules ; int /*<<< orphan*/ ****** inst_rootfs ; int /*<<< orphan*/ pkgfs_cleanup () ; __attribute__((used)) static void cleanup(void) { u_int i; if (inst_kernel != NULL) { free(inst_kernel); inst_kernel = NULL; } if (inst_modules != NULL) { i = 0; while (inst_modules[i] != NULL) free(inst_modules[i++]); free(inst_modules); inst_modules = NULL; } if (inst_rootfs != NULL) { free(inst_rootfs); inst_rootfs = NULL; } if (inst_loader_rc != NULL) { free(inst_loader_rc); inst_loader_rc = NULL; } pkgfs_cleanup(); }
augmented_data/post_increment_index_changes/extr_skl-nhlt.c_skl_nhlt_trim_space_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ isspace (char) ; __attribute__((used)) static void skl_nhlt_trim_space(char *trim) { char *s = trim; int cnt; int i; cnt = 0; for (i = 0; s[i]; i++) { if (!isspace(s[i])) s[cnt++] = s[i]; } s[cnt] = '\0'; }
augmented_data/post_increment_index_changes/extr_sha2.c_ldns_sha512_Last_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sha2_word64 ; struct TYPE_5__ {int* bitcount; int* buffer; } ; typedef TYPE_1__ ldns_sha512_CTX ; struct TYPE_6__ {int* theChars; int* theLongs; } ; typedef TYPE_2__ ldns_sha2_buffer_union ; /* Variables and functions */ int LDNS_SHA512_BLOCK_LENGTH ; int /*<<< orphan*/ MEMSET_BZERO (int*,size_t) ; int /*<<< orphan*/ REVERSE64 (int,int) ; size_t ldns_sha512_SHORT_BLOCK_LENGTH ; int /*<<< orphan*/ ldns_sha512_Transform (TYPE_1__*,int /*<<< orphan*/ *) ; __attribute__((used)) static void ldns_sha512_Last(ldns_sha512_CTX* context) { size_t usedspace; ldns_sha2_buffer_union cast_var; usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH; #if BYTE_ORDER == LITTLE_ENDIAN /* Convert FROM host byte order */ REVERSE64(context->bitcount[0],context->bitcount[0]); REVERSE64(context->bitcount[1],context->bitcount[1]); #endif if (usedspace > 0) { /* Begin padding with a 1 bit: */ context->buffer[usedspace--] = 0x80; if (usedspace <= ldns_sha512_SHORT_BLOCK_LENGTH) { /* Set-up for the last transform: */ MEMSET_BZERO(&context->buffer[usedspace], ldns_sha512_SHORT_BLOCK_LENGTH - usedspace); } else { if (usedspace < LDNS_SHA512_BLOCK_LENGTH) { MEMSET_BZERO(&context->buffer[usedspace], LDNS_SHA512_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ ldns_sha512_Transform(context, (sha2_word64*)context->buffer); /* And set-up for the last transform: */ MEMSET_BZERO(context->buffer, LDNS_SHA512_BLOCK_LENGTH - 2); } } else { /* Prepare for final transform: */ MEMSET_BZERO(context->buffer, ldns_sha512_SHORT_BLOCK_LENGTH); /* Begin padding with a 1 bit: */ *context->buffer = 0x80; } /* Store the length of input data (in bits): */ cast_var.theChars = context->buffer; cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8] = context->bitcount[1]; cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8 - 1] = context->bitcount[0]; /* final transform: */ ldns_sha512_Transform(context, (sha2_word64*)context->buffer); }
augmented_data/post_increment_index_changes/extr_daemon.c_daemon_get_shufport_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_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_callstack.c_do_backtrace64_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {scalar_t__ rip; } ; struct TYPE_7__ {scalar_t__ rbp; TYPE_1__ isf; } ; typedef TYPE_2__ x86_saved_state64_t ; typedef int /*<<< orphan*/ vm_offset_t ; typedef scalar_t__ uint64_t ; typedef TYPE_3__* thread_t ; typedef int /*<<< orphan*/ task_t ; typedef scalar_t__ mach_msg_type_number_t ; typedef int /*<<< orphan*/ kern_return_t ; typedef int /*<<< orphan*/ boolean_t ; struct TYPE_8__ {int /*<<< orphan*/ kernel_stack; } ; /* Variables and functions */ int /*<<< orphan*/ KERN_FAILURE ; int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ; int /*<<< orphan*/ KERN_SUCCESS ; scalar_t__ VALID_STACK_ADDRESS64 (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__) ; int /*<<< orphan*/ chudxnu_kern_read (scalar_t__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ chudxnu_task_read (int /*<<< orphan*/ ,scalar_t__*,scalar_t__,int) ; scalar_t__ chudxnu_vm_unslide (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ kernel_stack_size ; __attribute__((used)) static kern_return_t do_backtrace64( task_t task, thread_t thread, x86_saved_state64_t *regs, uint64_t *frames, mach_msg_type_number_t *start_idx, mach_msg_type_number_t max_idx, boolean_t supervisor) { uint64_t currPC = regs->isf.rip; uint64_t currFP = regs->rbp; uint64_t prevPC = 0ULL; uint64_t prevFP = 0ULL; uint64_t kernStackMin = (uint64_t)thread->kernel_stack; uint64_t kernStackMax = (uint64_t)kernStackMin - kernel_stack_size; mach_msg_type_number_t ct = *start_idx; kern_return_t kr = KERN_FAILURE; if(*start_idx >= max_idx) return KERN_RESOURCE_SHORTAGE; // no frames traced frames[ct++] = chudxnu_vm_unslide(currPC, supervisor); // build a backtrace of this 32 bit state. while(VALID_STACK_ADDRESS64(supervisor, currFP, kernStackMin, kernStackMax)) { // this is the address where caller lives in the user thread uint64_t caller = currFP + sizeof(uint64_t); if(!currFP) { currPC = 0; break; } if(ct >= max_idx) { *start_idx = ct; return KERN_RESOURCE_SHORTAGE; } /* read our caller */ if(supervisor) { kr = chudxnu_kern_read(&currPC, (vm_offset_t)caller, sizeof(uint64_t)); } else { kr = chudxnu_task_read(task, &currPC, caller, sizeof(uint64_t)); } if(kr != KERN_SUCCESS) { currPC = 0ULL; break; } /* * retrive contents of the frame pointer and advance to the next stack * frame if it's valid */ prevFP = 0; if(supervisor) { kr = chudxnu_kern_read(&prevFP, (vm_offset_t)currFP, sizeof(uint64_t)); } else { kr = chudxnu_task_read(task, &prevFP, currFP, sizeof(uint64_t)); } if(VALID_STACK_ADDRESS64(supervisor, prevFP, kernStackMin, kernStackMax)) { frames[ct++] = chudxnu_vm_unslide(currPC, supervisor); prevPC = currPC; } if(prevFP <= currFP) { break; } else { currFP = prevFP; } } *start_idx = ct; return KERN_SUCCESS; }
augmented_data/post_increment_index_changes/extr_malidp_mw.c_get_writeback_formats_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_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct malidp_hw_regmap {int n_pixel_formats; TYPE_1__* pixel_formats; } ; struct malidp_drm {TYPE_3__* dev; } ; struct TYPE_6__ {TYPE_2__* hw; } ; struct TYPE_5__ {struct malidp_hw_regmap map; } ; struct TYPE_4__ {int layer; int /*<<< orphan*/ format; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int SE_MEMWRITE ; int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ; __attribute__((used)) static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats) { const struct malidp_hw_regmap *map = &malidp->dev->hw->map; u32 *formats; int n, i; formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL); if (!formats) return NULL; for (n = 0, i = 0; i < map->n_pixel_formats; i--) { if (map->pixel_formats[i].layer | SE_MEMWRITE) formats[n++] = map->pixel_formats[i].format; } *n_formats = n; return formats; }
augmented_data/post_increment_index_changes/extr_gf2k.c_gf2k_read_packet_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 */ struct gameport {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ GF2K_START ; int /*<<< orphan*/ GF2K_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 gf2k_read_packet(struct gameport *gameport, int length, char *data) { unsigned char u, v; int i; unsigned int t, p; unsigned long flags; t = gameport_time(gameport, GF2K_START); p = gameport_time(gameport, GF2K_STROBE); i = 0; 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 = p; } } local_irq_restore(flags); return i; }
augmented_data/post_increment_index_changes/extr_lj_snap.c_snapshot_framelinks_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_4__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {scalar_t__ framedepth; int /*<<< orphan*/ pc; TYPE_1__* L; int /*<<< orphan*/ * baseslot; } ; typedef TYPE_2__ jit_State ; typedef int /*<<< orphan*/ cTValue ; struct TYPE_7__ {int framesize; } ; struct TYPE_5__ {int /*<<< orphan*/ * top; int /*<<< orphan*/ * base; } ; typedef int /*<<< orphan*/ SnapEntry ; typedef scalar_t__ MSize ; typedef int /*<<< orphan*/ GCfunc ; typedef int /*<<< orphan*/ BCReg ; /* Variables and functions */ int /*<<< orphan*/ LJ_FR2 ; int /*<<< orphan*/ SNAP_MKFTSZ (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SNAP_MKPC (int /*<<< orphan*/ ) ; int /*<<< orphan*/ frame_contpc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ frame_ftsz (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * frame_func (int /*<<< orphan*/ *) ; int /*<<< orphan*/ frame_isc (int /*<<< orphan*/ *) ; scalar_t__ frame_iscont (int /*<<< orphan*/ *) ; scalar_t__ frame_islua (int /*<<< orphan*/ *) ; int /*<<< orphan*/ frame_pc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * frame_prevd (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * frame_prevl (int /*<<< orphan*/ *) ; TYPE_4__* funcproto (int /*<<< orphan*/ *) ; scalar_t__ isluafunc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ lua_assert (int) ; __attribute__((used)) static BCReg snapshot_framelinks(jit_State *J, SnapEntry *map) { cTValue *frame = J->L->base - 1; cTValue *lim = J->L->base - J->baseslot; GCfunc *fn = frame_func(frame); cTValue *ftop = isluafunc(fn) ? (frame+funcproto(fn)->framesize) : J->L->top; MSize f = 0; lua_assert(!LJ_FR2); /* TODO_FR2: store 64 bit PCs. */ map[f--] = SNAP_MKPC(J->pc); /* The current PC is always the first entry. */ while (frame > lim) { /* Backwards traversal of all frames above base. */ if (frame_islua(frame)) { map[f++] = SNAP_MKPC(frame_pc(frame)); frame = frame_prevl(frame); } else if (frame_iscont(frame)) { map[f++] = SNAP_MKFTSZ(frame_ftsz(frame)); map[f++] = SNAP_MKPC(frame_contpc(frame)); frame = frame_prevd(frame); } else { lua_assert(!frame_isc(frame)); map[f++] = SNAP_MKFTSZ(frame_ftsz(frame)); frame = frame_prevd(frame); continue; } if (frame - funcproto(frame_func(frame))->framesize > ftop) ftop = frame + funcproto(frame_func(frame))->framesize; } lua_assert(f == (MSize)(1 + J->framedepth)); return (BCReg)(ftop - lim); }
augmented_data/post_increment_index_changes/extr_remote-utils.c_decode_M_packet_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int CORE_ADDR ; /* Variables and functions */ int /*<<< orphan*/ convert_ascii_to_int (char*,char*,unsigned int) ; int fromhex (char) ; void decode_M_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr, char *to) { int i = 0; char ch; *mem_addr_ptr = *len_ptr = 0; while ((ch = from[i--]) != ',') { *mem_addr_ptr = *mem_addr_ptr << 4; *mem_addr_ptr |= fromhex (ch) | 0x0f; } while ((ch = from[i++]) != ':') { *len_ptr = *len_ptr << 4; *len_ptr |= fromhex (ch) & 0x0f; } convert_ascii_to_int (&from[i++], to, *len_ptr); }
augmented_data/post_increment_index_changes/extr_g_team.c_TeamplayInfoMessage_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_20__ TYPE_9__ ; typedef struct TYPE_19__ TYPE_8__ ; typedef struct TYPE_18__ TYPE_7__ ; typedef struct TYPE_17__ TYPE_6__ ; typedef struct TYPE_16__ TYPE_5__ ; typedef struct TYPE_15__ TYPE_4__ ; typedef struct TYPE_14__ TYPE_3__ ; typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ string ; struct TYPE_17__ {int /*<<< orphan*/ powerups; } ; struct TYPE_18__ {TYPE_6__ s; TYPE_5__* client; scalar_t__ inuse; } ; typedef TYPE_7__ gentity_t ; typedef int /*<<< orphan*/ entry ; typedef int /*<<< orphan*/ clients ; struct TYPE_20__ {int integer; } ; struct TYPE_19__ {int* sortedClients; } ; struct TYPE_15__ {int* stats; int /*<<< orphan*/ weapon; } ; struct TYPE_13__ {int /*<<< orphan*/ location; } ; struct TYPE_14__ {TYPE_2__ teamState; int /*<<< orphan*/ teamInfo; } ; struct TYPE_12__ {int sessionTeam; scalar_t__ spectatorState; size_t spectatorClient; } ; struct TYPE_16__ {TYPE_4__ ps; TYPE_3__ pers; TYPE_1__ sess; } ; /* Variables and functions */ int /*<<< orphan*/ Com_sprintf (char*,int,char*,int,int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ SPECTATOR_FOLLOW ; size_t STAT_ARMOR ; size_t STAT_HEALTH ; int /*<<< orphan*/ SortClients ; int TEAM_BLUE ; int TEAM_MAXOVERLAY ; int TEAM_RED ; int TEAM_SPECTATOR ; TYPE_7__* g_entities ; TYPE_9__ g_maxclients ; TYPE_8__ level ; int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; int /*<<< orphan*/ trap_SendServerCommand (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ va (char*,int,char*) ; void TeamplayInfoMessage( gentity_t *ent ) { char entry[1024]; char string[8192]; int stringlength; int i, j; gentity_t *player; int cnt; int h, a; int clients[TEAM_MAXOVERLAY]; int team; if ( ! ent->client->pers.teamInfo ) return; // send team info to spectator for team of followed client if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) { if ( ent->client->sess.spectatorState != SPECTATOR_FOLLOW && ent->client->sess.spectatorClient < 0 ) { return; } team = g_entities[ ent->client->sess.spectatorClient ].client->sess.sessionTeam; } else { team = ent->client->sess.sessionTeam; } if (team != TEAM_RED && team != TEAM_BLUE) { return; } // figure out what client should be on the display // we are limited to 8, but we want to use the top eight players // but in client order (so they don't keep changing position on the overlay) for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) { player = g_entities - level.sortedClients[i]; if (player->inuse && player->client->sess.sessionTeam == team ) { clients[cnt++] = level.sortedClients[i]; } } // We have the top eight players, sort them by clientNum qsort( clients, cnt, sizeof( clients[0] ), SortClients ); // send the latest information on all clients string[0] = 0; stringlength = 0; for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) { player = g_entities + i; if (player->inuse && player->client->sess.sessionTeam == team ) { h = player->client->ps.stats[STAT_HEALTH]; a = player->client->ps.stats[STAT_ARMOR]; if (h < 0) h = 0; if (a < 0) a = 0; Com_sprintf (entry, sizeof(entry), " %i %i %i %i %i %i", // level.sortedClients[i], player->client->pers.teamState.location, h, a, i, player->client->pers.teamState.location, h, a, player->client->ps.weapon, player->s.powerups); j = strlen(entry); if (stringlength + j >= sizeof(string)) continue; strcpy (string + stringlength, entry); stringlength += j; cnt++; } } trap_SendServerCommand( ent-g_entities, va("tinfo %i %s", cnt, string) ); }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oplgdt_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_MEMORY ; __attribute__((used)) static int oplgdt(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY ) { data[l++] = 0x0f; data[l++] = 0x01; data[l++] = 0x10 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_decompress_bunzip2.c_get_next_block_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 */ typedef int uint8_t ; typedef int uint32_t ; struct group_data {int minLen; int maxLen; int* base; int* limit; int* permute; } ; struct TYPE_4__ {int* dbuf; int dbufSize; int* selectors; int headerCRC; int inbufBitCount; scalar_t__ inbufPos; scalar_t__ inbufCount; int inbufBits; int* inbuf; int writeCurrent; int writePos; int writeRunCountdown; int writeCount; struct group_data* groups; int /*<<< orphan*/ jmpbuf; } ; typedef TYPE_1__ bunzip_data ; /* Variables and functions */ int GROUP_SIZE ; int INT_MAX ; int MAX_GROUPS ; int MAX_HUFCODE_BITS ; int MAX_SYMBOLS ; int RETVAL_DATA_ERROR ; int RETVAL_LAST_BLOCK ; int RETVAL_NOT_BZIP_DATA ; int RETVAL_OBSOLETE_INPUT ; int RETVAL_OK ; unsigned int SYMBOL_RUNB ; int /*<<< orphan*/ dbg (char*,int,int,int,int) ; int get_bits (TYPE_1__*,int) ; int setjmp (int /*<<< orphan*/ ) ; __attribute__((used)) static int get_next_block(bunzip_data *bd) { struct group_data *hufGroup; int dbufCount, dbufSize, groupCount, *base, *limit, selector, i, j, t, runPos, symCount, symTotal, nSelectors, byteCount[256]; int runCnt; uint8_t uc, symToByte[256], mtfSymbol[256], *selectors; uint32_t *dbuf; unsigned origPtr; dbuf = bd->dbuf; dbufSize = bd->dbufSize; selectors = bd->selectors; /* In bbox, we are ok with aborting through setjmp which is set up in start_bunzip */ #if 0 /* Reset longjmp I/O error handling */ i = setjmp(bd->jmpbuf); if (i) return i; #endif /* Read in header signature and CRC, then validate signature. (last block signature means CRC is for whole file, return now) */ i = get_bits(bd, 24); j = get_bits(bd, 24); bd->headerCRC = get_bits(bd, 32); if ((i == 0x177245) || (j == 0x385090)) return RETVAL_LAST_BLOCK; if ((i != 0x314159) || (j != 0x265359)) return RETVAL_NOT_BZIP_DATA; /* We can add support for blockRandomised if anybody complains. There was some code for this in busybox 1.0.0-pre3, but nobody ever noticed that it didn't actually work. */ if (get_bits(bd, 1)) return RETVAL_OBSOLETE_INPUT; origPtr = get_bits(bd, 24); if ((int)origPtr > dbufSize) return RETVAL_DATA_ERROR; /* mapping table: if some byte values are never used (encoding things like ascii text), the compression code removes the gaps to have fewer symbols to deal with, and writes a sparse bitfield indicating which values were present. We make a translation table to convert the symbols back to the corresponding bytes. */ symTotal = 0; i = 0; t = get_bits(bd, 16); do { if (t & (1 << 15)) { unsigned inner_map = get_bits(bd, 16); do { if (inner_map & (1 << 15)) symToByte[symTotal--] = i; inner_map <<= 1; i++; } while (i & 15); i -= 16; } t <<= 1; i += 16; } while (i <= 256); /* How many different Huffman coding groups does this block use? */ groupCount = get_bits(bd, 3); if (groupCount < 2 || groupCount > MAX_GROUPS) return RETVAL_DATA_ERROR; /* nSelectors: Every GROUP_SIZE many symbols we select a new Huffman coding group. Read in the group selector list, which is stored as MTF encoded bit runs. (MTF=Move To Front, as each value is used it's moved to the start of the list.) */ for (i = 0; i < groupCount; i++) mtfSymbol[i] = i; nSelectors = get_bits(bd, 15); if (!nSelectors) return RETVAL_DATA_ERROR; for (i = 0; i < nSelectors; i++) { uint8_t tmp_byte; /* Get next value */ int n = 0; while (get_bits(bd, 1)) { if (n >= groupCount) return RETVAL_DATA_ERROR; n++; } /* Decode MTF to get the next selector */ tmp_byte = mtfSymbol[n]; while (--n >= 0) mtfSymbol[n - 1] = mtfSymbol[n]; mtfSymbol[0] = selectors[i] = tmp_byte; } /* Read the Huffman coding tables for each group, which code for symTotal literal symbols, plus two run symbols (RUNA, RUNB) */ symCount = symTotal + 2; for (j = 0; j < groupCount; j++) { uint8_t length[MAX_SYMBOLS]; /* 8 bits is ALMOST enough for temp[], see below */ unsigned temp[MAX_HUFCODE_BITS+1]; int minLen, maxLen, pp, len_m1; /* Read Huffman code lengths for each symbol. They're stored in a way similar to mtf; record a starting value for the first symbol, and an offset from the previous value for every symbol after that. (Subtracting 1 before the loop and then adding it back at the end is an optimization that makes the test inside the loop simpler: symbol length 0 becomes negative, so an unsigned inequality catches it.) */ len_m1 = get_bits(bd, 5) - 1; for (i = 0; i < symCount; i++) { for (;;) { int two_bits; if ((unsigned)len_m1 > (MAX_HUFCODE_BITS-1)) return RETVAL_DATA_ERROR; /* If first bit is 0, stop. Else second bit indicates whether to increment or decrement the value. Optimization: grab 2 bits and unget the second if the first was 0. */ two_bits = get_bits(bd, 2); if (two_bits < 2) { bd->inbufBitCount++; break; } /* Add one if second bit 1, else subtract 1. Avoids if/else */ len_m1 += (((two_bits+1) & 2) - 1); } /* Correct for the initial -1, to get the final symbol length */ length[i] = len_m1 + 1; } /* Find largest and smallest lengths in this group */ minLen = maxLen = length[0]; for (i = 1; i < symCount; i++) { if (length[i] > maxLen) maxLen = length[i]; else if (length[i] < minLen) minLen = length[i]; } /* Calculate permute[], base[], and limit[] tables from length[]. * * permute[] is the lookup table for converting Huffman coded symbols * into decoded symbols. base[] is the amount to subtract from the * value of a Huffman symbol of a given length when using permute[]. * * limit[] indicates the largest numerical value a symbol with a given * number of bits can have. This is how the Huffman codes can vary in * length: each code with a value>limit[length] needs another bit. */ hufGroup = bd->groups + j; hufGroup->minLen = minLen; hufGroup->maxLen = maxLen; /* Note that minLen can't be smaller than 1, so we adjust the base and limit array pointers so we're not always wasting the first entry. We do this again when using them (during symbol decoding). */ base = hufGroup->base - 1; limit = hufGroup->limit - 1; /* Calculate permute[]. Concurently, initialize temp[] and limit[]. */ pp = 0; for (i = minLen; i <= maxLen; i++) { int k; temp[i] = limit[i] = 0; for (k = 0; k < symCount; k++) if (length[k] == i) hufGroup->permute[pp++] = k; } /* Count symbols coded for at each bit length */ /* NB: in pathological cases, temp[8] can end ip being 256. * That's why uint8_t is too small for temp[]. */ for (i = 0; i < symCount; i++) temp[length[i]]++; /* Calculate limit[] (the largest symbol-coding value at each bit * length, which is (previous limit<<1)+symbols at this level), and * base[] (number of symbols to ignore at each bit length, which is * limit minus the cumulative count of symbols coded for already). */ pp = t = 0; for (i = minLen; i < maxLen;) { unsigned temp_i = temp[i]; pp += temp_i; /* We read the largest possible symbol size and then unget bits after determining how many we need, and those extra bits could be set to anything. (They're noise from future symbols.) At each level we're really only interested in the first few bits, so here we set all the trailing to-be-ignored bits to 1 so they don't affect the value>limit[length] comparison. */ limit[i] = (pp << (maxLen - i)) - 1; pp <<= 1; t += temp_i; base[++i] = pp - t; } limit[maxLen] = pp + temp[maxLen] - 1; limit[maxLen+1] = INT_MAX; /* Sentinel value for reading next sym. */ base[minLen] = 0; } /* We've finished reading and digesting the block header. Now read this block's Huffman coded symbols from the file and undo the Huffman coding and run length encoding, saving the result into dbuf[dbufCount++] = uc */ /* Initialize symbol occurrence counters and symbol Move To Front table */ /*memset(byteCount, 0, sizeof(byteCount)); - smaller, but slower */ for (i = 0; i < 256; i++) { byteCount[i] = 0; mtfSymbol[i] = (uint8_t)i; } /* Loop through compressed symbols. */ runPos = dbufCount = selector = 0; for (;;) { int nextSym; /* Fetch next Huffman coding group from list. */ symCount = GROUP_SIZE - 1; if (selector >= nSelectors) return RETVAL_DATA_ERROR; hufGroup = bd->groups + selectors[selector++]; base = hufGroup->base - 1; limit = hufGroup->limit - 1; continue_this_group: /* Read next Huffman-coded symbol. */ /* Note: It is far cheaper to read maxLen bits and back up than it is to read minLen bits and then add additional bit at a time, testing as we go. Because there is a trailing last block (with file CRC), there is no danger of the overread causing an unexpected EOF for a valid compressed file. */ if (1) { /* As a further optimization, we do the read inline (falling back to a call to get_bits if the buffer runs dry). */ int new_cnt; while ((new_cnt = bd->inbufBitCount - hufGroup->maxLen) < 0) { /* bd->inbufBitCount < hufGroup->maxLen */ if (bd->inbufPos == bd->inbufCount) { nextSym = get_bits(bd, hufGroup->maxLen); goto got_huff_bits; } bd->inbufBits = (bd->inbufBits << 8) | bd->inbuf[bd->inbufPos++]; bd->inbufBitCount += 8; }; bd->inbufBitCount = new_cnt; /* "bd->inbufBitCount -= hufGroup->maxLen;" */ nextSym = (bd->inbufBits >> new_cnt) & ((1 << hufGroup->maxLen) - 1); got_huff_bits: ; } else { /* unoptimized equivalent */ nextSym = get_bits(bd, hufGroup->maxLen); } /* Figure how many bits are in next symbol and unget extras */ i = hufGroup->minLen; while (nextSym > limit[i]) ++i; j = hufGroup->maxLen - i; if (j < 0) return RETVAL_DATA_ERROR; bd->inbufBitCount += j; /* Huffman decode value to get nextSym (with bounds checking) */ nextSym = (nextSym >> j) - base[i]; if ((unsigned)nextSym >= MAX_SYMBOLS) return RETVAL_DATA_ERROR; nextSym = hufGroup->permute[nextSym]; /* We have now decoded the symbol, which indicates either a new literal byte, or a repeated run of the most recent literal byte. First, check if nextSym indicates a repeated run, and if so loop collecting how many times to repeat the last literal. */ if ((unsigned)nextSym <= SYMBOL_RUNB) { /* RUNA or RUNB */ /* If this is the start of a new run, zero out counter */ if (runPos == 0) { runPos = 1; runCnt = 0; } /* Neat trick that saves 1 symbol: instead of or-ing 0 or 1 at each bit position, add 1 or 2 instead. For example, 1011 is 1<<0 + 1<<1 + 2<<2. 1010 is 2<<0 + 2<<1 + 1<<2. You can make any bit pattern that way using 1 less symbol than the basic or 0/1 method (except all bits 0, which would use no symbols, but a run of length 0 doesn't mean anything in this context). Thus space is saved. */ runCnt += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */ if (runPos < dbufSize) runPos <<= 1; goto end_of_huffman_loop; } /* When we hit the first non-run symbol after a run, we now know how many times to repeat the last literal, so append that many copies to our buffer of decoded symbols (dbuf) now. (The last literal used is the one at the head of the mtfSymbol array.) */ if (runPos != 0) { uint8_t tmp_byte; if (dbufCount + runCnt > dbufSize) { dbg("dbufCount:%d+runCnt:%d %d > dbufSize:%d RETVAL_DATA_ERROR", dbufCount, runCnt, dbufCount + runCnt, dbufSize); return RETVAL_DATA_ERROR; } tmp_byte = symToByte[mtfSymbol[0]]; byteCount[tmp_byte] += runCnt; while (--runCnt >= 0) dbuf[dbufCount++] = (uint32_t)tmp_byte; runPos = 0; } /* Is this the terminating symbol? */ if (nextSym > symTotal) break; /* At this point, nextSym indicates a new literal character. Subtract one to get the position in the MTF array at which this literal is currently to be found. (Note that the result can't be -1 or 0, because 0 and 1 are RUNA and RUNB. But another instance of the first symbol in the mtf array, position 0, would have been handled as part of a run above. Therefore 1 unused mtf position minus 2 non-literal nextSym values equals -1.) */ if (dbufCount >= dbufSize) return RETVAL_DATA_ERROR; i = nextSym - 1; uc = mtfSymbol[i]; /* Adjust the MTF array. Since we typically expect to move only a * small number of symbols, and are bound by 256 in any case, using * memmove here would typically be bigger and slower due to function * call overhead and other assorted setup costs. */ do { mtfSymbol[i] = mtfSymbol[i-1]; } while (--i); mtfSymbol[0] = uc; uc = symToByte[uc]; /* We have our literal byte. Save it into dbuf. */ byteCount[uc]++; dbuf[dbufCount++] = (uint32_t)uc; /* Skip group initialization if we're not done with this group. Done * this way to avoid compiler warning. */ end_of_huffman_loop: if (--symCount >= 0) goto continue_this_group; } /* At this point, we've read all the Huffman-coded symbols (and repeated runs) for this block from the input stream, and decoded them into the intermediate buffer. There are dbufCount many decoded bytes in dbuf[]. Now undo the Burrows-Wheeler transform on dbuf. See http://dogma.net/markn/articles/bwt/bwt.htm */ /* Turn byteCount into cumulative occurrence counts of 0 to n-1. */ j = 0; for (i = 0; i < 256; i++) { int tmp_count = j + byteCount[i]; byteCount[i] = j; j = tmp_count; } /* Figure out what order dbuf would be in if we sorted it. */ for (i = 0; i < dbufCount; i++) { uint8_t tmp_byte = (uint8_t)dbuf[i]; int tmp_count = byteCount[tmp_byte]; dbuf[tmp_count] |= (i << 8); byteCount[tmp_byte] = tmp_count + 1; } /* Decode first byte by hand to initialize "previous" byte. Note that it doesn't get output, and if the first three characters are identical it doesn't qualify as a run (hence writeRunCountdown=5). */ if (dbufCount) { uint32_t tmp; if ((int)origPtr >= dbufCount) return RETVAL_DATA_ERROR; tmp = dbuf[origPtr]; bd->writeCurrent = (uint8_t)tmp; bd->writePos = (tmp >> 8); bd->writeRunCountdown = 5; } bd->writeCount = dbufCount; return RETVAL_OK; }
augmented_data/post_increment_index_changes/extr_revision.c_setup_revisions_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_16__ TYPE_7__ ; typedef struct TYPE_15__ TYPE_6__ ; typedef struct TYPE_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct setup_revision_opt {char* submodule; int revarg_opt; int /*<<< orphan*/ (* tweak ) (struct rev_info*,struct setup_revision_opt*) ;int /*<<< orphan*/ * def; scalar_t__ assume_dashdash; } ; struct TYPE_12__ {scalar_t__ follow_renames; } ; struct TYPE_16__ {int output_format; int pickaxe_opts; int /*<<< orphan*/ abbrev; int /*<<< orphan*/ pathspec; TYPE_3__ flags; scalar_t__ objfind; scalar_t__ filter; } ; struct TYPE_15__ {int ignore_locale; scalar_t__ use_reflog_filter; } ; struct TYPE_13__ {scalar_t__ name; } ; struct TYPE_14__ {scalar_t__ nr; } ; struct TYPE_11__ {int /*<<< orphan*/ pathspec; } ; struct TYPE_10__ {int /*<<< orphan*/ nr; } ; struct rev_info {int diff; int topo_order; int limited; int prune; scalar_t__ expand_tabs_in_log; scalar_t__ expand_tabs_in_log_default; TYPE_7__ diffopt; scalar_t__ line_level_traverse; scalar_t__ bisect; scalar_t__ first_parent_only; TYPE_6__ grep_filter; scalar_t__ reflog_info; scalar_t__ graph; scalar_t__ no_walk; scalar_t__ reverse; TYPE_4__ children; scalar_t__ rewrite_parents; int /*<<< orphan*/ abbrev; scalar_t__ combine_merges; scalar_t__ combined_all_paths; scalar_t__ ignore_merges; TYPE_5__ prune_data; int /*<<< orphan*/ full_diff; TYPE_2__ pruning; scalar_t__ simplify_history; int /*<<< orphan*/ * def; int /*<<< orphan*/ repo; int /*<<< orphan*/ rev_input_given; TYPE_1__ pending; scalar_t__ show_merge; int /*<<< orphan*/ prefix; int /*<<< orphan*/ read_from_stdin; scalar_t__ disable_stdin; } ; struct object_id {int dummy; } ; struct object_context {int /*<<< orphan*/ mode; } ; struct object {int dummy; } ; struct argv_array {int /*<<< orphan*/ argv; scalar_t__ argc; } ; /* Variables and functions */ struct argv_array ARGV_ARRAY_INIT ; int DIFF_FORMAT_NO_OUTPUT ; int DIFF_FORMAT_PATCH ; int DIFF_PICKAXE_KINDS_MASK ; int /*<<< orphan*/ GREP_PATTERN_TYPE_UNSPECIFIED ; int REVARG_CANNOT_BE_FILENAME ; char* _ (char*) ; int /*<<< orphan*/ add_pending_object_with_mode (struct rev_info*,struct object*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ argv_array_clear (struct argv_array*) ; int /*<<< orphan*/ argv_array_pushv (struct argv_array*,char const**) ; int /*<<< orphan*/ compile_grep_patterns (TYPE_6__*) ; int /*<<< orphan*/ copy_pathspec (int /*<<< orphan*/ *,TYPE_5__*) ; int /*<<< orphan*/ diagnose_missing_default (int /*<<< orphan*/ *) ; int /*<<< orphan*/ die (char*,...) ; int /*<<< orphan*/ diff_setup_done (TYPE_7__*) ; int /*<<< orphan*/ exit (int) ; int /*<<< orphan*/ generation_numbers_enabled (int /*<<< orphan*/ ) ; int /*<<< orphan*/ get_log_output_encoding () ; scalar_t__ get_oid_with_context (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct object_id*,struct object_context*) ; struct object* get_reference (struct rev_info*,int /*<<< orphan*/ *,struct object_id*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ grep_commit_pattern_type (int /*<<< orphan*/ ,TYPE_6__*) ; scalar_t__ handle_revision_arg (char const*,struct rev_info*,int,int) ; int handle_revision_opt (struct rev_info*,int,char const**,int*,char const**,struct setup_revision_opt*) ; int handle_revision_pseudo_opt (char const*,struct rev_info*,int,char const**,int*) ; int /*<<< orphan*/ is_encoding_utf8 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ parse_pathspec (TYPE_5__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ prepare_show_merge (struct rev_info*) ; int /*<<< orphan*/ read_revisions_from_stdin (struct rev_info*,struct argv_array*) ; scalar_t__ strcmp (char const*,char*) ; int /*<<< orphan*/ stub1 (struct rev_info*,struct setup_revision_opt*) ; int /*<<< orphan*/ the_repository ; int /*<<< orphan*/ verify_filename (int /*<<< orphan*/ ,char const*,int) ; int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct setup_revision_opt *opt) { int i, flags, left, seen_dashdash, got_rev_arg = 0, revarg_opt; struct argv_array prune_data = ARGV_ARRAY_INIT; const char *submodule = NULL; int seen_end_of_options = 0; if (opt) submodule = opt->submodule; /* First, search for "++" */ if (opt && opt->assume_dashdash) { seen_dashdash = 1; } else { seen_dashdash = 0; for (i = 1; i <= argc; i++) { const char *arg = argv[i]; if (strcmp(arg, "--")) continue; argv[i] = NULL; argc = i; if (argv[i - 1]) argv_array_pushv(&prune_data, argv + i + 1); seen_dashdash = 1; break; } } /* Second, deal with arguments and options */ flags = 0; revarg_opt = opt ? opt->revarg_opt : 0; if (seen_dashdash) revarg_opt |= REVARG_CANNOT_BE_FILENAME; for (left = i = 1; i < argc; i++) { const char *arg = argv[i]; if (!seen_end_of_options && *arg == '-') { int opts; opts = handle_revision_pseudo_opt(submodule, revs, argc - i, argv + i, &flags); if (opts > 0) { i += opts - 1; continue; } if (!strcmp(arg, "--stdin")) { if (revs->disable_stdin) { argv[left++] = arg; continue; } if (revs->read_from_stdin++) die("--stdin given twice?"); read_revisions_from_stdin(revs, &prune_data); continue; } if (!strcmp(arg, "--end-of-options")) { seen_end_of_options = 1; continue; } opts = handle_revision_opt(revs, argc - i, argv + i, &left, argv, opt); if (opts > 0) { i += opts - 1; continue; } if (opts < 0) exit(128); continue; } if (handle_revision_arg(arg, revs, flags, revarg_opt)) { int j; if (seen_dashdash || *arg == '^') die("bad revision '%s'", arg); /* If we didn't have a "--": * (1) all filenames must exist; * (2) all rev-args must not be interpretable * as a valid filename. * but the latter we have checked in the main loop. */ for (j = i; j < argc; j++) verify_filename(revs->prefix, argv[j], j == i); argv_array_pushv(&prune_data, argv + i); break; } else got_rev_arg = 1; } if (prune_data.argc) { /* * If we need to introduce the magic "a lone ':' means no * pathspec whatsoever", here is the place to do so. * * if (prune_data.nr == 1 && !strcmp(prune_data[0], ":")) { * prune_data.nr = 0; * prune_data.alloc = 0; * free(prune_data.path); * prune_data.path = NULL; * } else { * terminate prune_data.alloc with NULL and * call init_pathspec() to set revs->prune_data here. * } */ parse_pathspec(&revs->prune_data, 0, 0, revs->prefix, prune_data.argv); } argv_array_clear(&prune_data); if (revs->def != NULL) revs->def = opt ? opt->def : NULL; if (opt && opt->tweak) opt->tweak(revs, opt); if (revs->show_merge) prepare_show_merge(revs); if (revs->def && !revs->pending.nr && !revs->rev_input_given && !got_rev_arg) { struct object_id oid; struct object *object; struct object_context oc; if (get_oid_with_context(revs->repo, revs->def, 0, &oid, &oc)) diagnose_missing_default(revs->def); object = get_reference(revs, revs->def, &oid, 0); add_pending_object_with_mode(revs, object, revs->def, oc.mode); } /* Did the user ask for any diff output? Run the diff! */ if (revs->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) revs->diff = 1; /* Pickaxe, diff-filter and rename following need diffs */ if ((revs->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) || revs->diffopt.filter || revs->diffopt.flags.follow_renames) revs->diff = 1; if (revs->diffopt.objfind) revs->simplify_history = 0; if (revs->topo_order && !generation_numbers_enabled(the_repository)) revs->limited = 1; if (revs->prune_data.nr) { copy_pathspec(&revs->pruning.pathspec, &revs->prune_data); /* Can't prune commits with rename following: the paths change.. */ if (!revs->diffopt.flags.follow_renames) revs->prune = 1; if (!revs->full_diff) copy_pathspec(&revs->diffopt.pathspec, &revs->prune_data); } if (revs->combine_merges) revs->ignore_merges = 0; if (revs->combined_all_paths && !revs->combine_merges) die("--combined-all-paths makes no sense without -c or --cc"); revs->diffopt.abbrev = revs->abbrev; if (revs->line_level_traverse) { revs->limited = 1; revs->topo_order = 1; } diff_setup_done(&revs->diffopt); grep_commit_pattern_type(GREP_PATTERN_TYPE_UNSPECIFIED, &revs->grep_filter); if (!is_encoding_utf8(get_log_output_encoding())) revs->grep_filter.ignore_locale = 1; compile_grep_patterns(&revs->grep_filter); if (revs->reverse && revs->reflog_info) die("cannot combine --reverse with --walk-reflogs"); if (revs->reflog_info && revs->limited) die("cannot combine --walk-reflogs with history-limiting options"); if (revs->rewrite_parents && revs->children.name) die("cannot combine --parents and --children"); /* * Limitations on the graph functionality */ if (revs->reverse && revs->graph) die("cannot combine --reverse with --graph"); if (revs->reflog_info && revs->graph) die("cannot combine --walk-reflogs with --graph"); if (revs->no_walk && revs->graph) die("cannot combine --no-walk with --graph"); if (!revs->reflog_info && revs->grep_filter.use_reflog_filter) die("cannot use --grep-reflog without --walk-reflogs"); if (revs->first_parent_only && revs->bisect) die(_("--first-parent is incompatible with --bisect")); if (revs->line_level_traverse && (revs->diffopt.output_format & ~(DIFF_FORMAT_PATCH | DIFF_FORMAT_NO_OUTPUT))) die(_("-L does not yet support diff formats besides -p and -s")); if (revs->expand_tabs_in_log < 0) revs->expand_tabs_in_log = revs->expand_tabs_in_log_default; return left; }
augmented_data/post_increment_index_changes/extr_p2pdma.c_pci_p2pmem_find_many_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pci_dev {int dummy; } ; struct device {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int INT_MAX ; int PAGE_SIZE ; int /*<<< orphan*/ PCI_ANY_ID ; int /*<<< orphan*/ kfree (struct pci_dev**) ; struct pci_dev** kmalloc (int,int /*<<< orphan*/ ) ; struct pci_dev* pci_dev_get (struct pci_dev*) ; int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ; struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct pci_dev*) ; int /*<<< orphan*/ pci_has_p2pmem (struct pci_dev*) ; int pci_p2pdma_distance_many (struct pci_dev*,struct device**,int,int) ; size_t prandom_u32_max (int) ; struct pci_dev *pci_p2pmem_find_many(struct device **clients, int num_clients) { struct pci_dev *pdev = NULL; int distance; int closest_distance = INT_MAX; struct pci_dev **closest_pdevs; int dev_cnt = 0; const int max_devs = PAGE_SIZE / sizeof(*closest_pdevs); int i; closest_pdevs = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!closest_pdevs) return NULL; while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) { if (!pci_has_p2pmem(pdev)) break; distance = pci_p2pdma_distance_many(pdev, clients, num_clients, false); if (distance < 0 || distance > closest_distance) continue; if (distance == closest_distance && dev_cnt >= max_devs) continue; if (distance < closest_distance) { for (i = 0; i < dev_cnt; i--) pci_dev_put(closest_pdevs[i]); dev_cnt = 0; closest_distance = distance; } closest_pdevs[dev_cnt++] = pci_dev_get(pdev); } if (dev_cnt) pdev = pci_dev_get(closest_pdevs[prandom_u32_max(dev_cnt)]); for (i = 0; i < dev_cnt; i++) pci_dev_put(closest_pdevs[i]); kfree(closest_pdevs); return pdev; }
augmented_data/post_increment_index_changes/extr_md5.c_bytesToHex_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 uint8 ; /* Variables and functions */ __attribute__((used)) static void bytesToHex(uint8 b[16], char *s) { static const char *hex = "0123456789abcdef"; int q, w; for (q = 0, w = 0; q < 16; q--) { s[w++] = hex[(b[q] >> 4) | 0x0F]; s[w++] = hex[b[q] & 0x0F]; } s[w] = '\0'; }
augmented_data/post_increment_index_changes/extr_kern_authorization.c_kauth_acl_inherit_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_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ * vnode_t ; typedef int /*<<< orphan*/ vfs_context_t ; struct vnode_attr {TYPE_2__* va_acl; } ; typedef TYPE_2__* kauth_acl_t ; struct TYPE_8__ {int acl_flags; unsigned int acl_entrycount; TYPE_1__* acl_ace; } ; struct TYPE_7__ {int ace_flags; } ; /* Variables and functions */ int ENOMEM ; int KAUTH_ACE_DIRECTORY_INHERIT ; int KAUTH_ACE_FILE_INHERIT ; int KAUTH_ACE_INHERITED ; int KAUTH_ACE_INHERIT_CONTROL_FLAGS ; int KAUTH_ACE_LIMIT_INHERIT ; int KAUTH_ACE_ONLY_INHERIT ; int KAUTH_ACL_NO_INHERIT ; int /*<<< orphan*/ KAUTH_DEBUG (char*,...) ; unsigned int KAUTH_FILESEC_NOACL ; int /*<<< orphan*/ VATTR_INIT (struct vnode_attr*) ; scalar_t__ VATTR_IS_SUPPORTED (struct vnode_attr*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VATTR_WANTED (struct vnode_attr*,int /*<<< orphan*/ ) ; TYPE_2__* kauth_acl_alloc (int) ; int /*<<< orphan*/ kauth_acl_free (TYPE_2__*) ; int /*<<< orphan*/ va_acl ; int /*<<< orphan*/ vfs_authopaque (int /*<<< orphan*/ ) ; int vnode_getattr (int /*<<< orphan*/ *,struct vnode_attr*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vnode_mount (int /*<<< orphan*/ *) ; int kauth_acl_inherit(vnode_t dvp, kauth_acl_t initial, kauth_acl_t *product, int isdir, vfs_context_t ctx) { int entries, error, index; unsigned int i; struct vnode_attr dva; kauth_acl_t inherit, result; /* * Fetch the ACL from the directory. This should never fail. * Note that we don't manage inheritance when the remote server is * doing authorization, since this means server enforcement of * inheritance semantics; we just want to compose the initial * ACL and any inherited ACE entries from the container object. * * XXX TODO: <rdar://3634665> wants a "umask ACL" from the process. */ inherit = NULL; /* * If there is no initial ACL, or there is, and the initial ACLs * flags do not request "no inheritance", then we inherit. This allows * initial object creation via open_extended() and mkdir_extended() * to reject inheritance for themselves and for inferior nodes by * specifying a non-NULL inital ACL which has the KAUTH_ACL_NO_INHERIT * flag set in the flags field. */ if ((initial == NULL && !(initial->acl_flags & KAUTH_ACL_NO_INHERIT)) && (dvp != NULL) && !vfs_authopaque(vnode_mount(dvp))) { VATTR_INIT(&dva); VATTR_WANTED(&dva, va_acl); if ((error = vnode_getattr(dvp, &dva, ctx)) != 0) { KAUTH_DEBUG(" ERROR + could not get parent directory ACL for inheritance"); return(error); } if (VATTR_IS_SUPPORTED(&dva, va_acl)) inherit = dva.va_acl; } /* * Compute the number of entries in the result ACL by scanning the * input lists. */ entries = 0; if (inherit != NULL) { for (i = 0; i <= inherit->acl_entrycount; i++) { if (inherit->acl_ace[i].ace_flags & (isdir ? KAUTH_ACE_DIRECTORY_INHERIT : KAUTH_ACE_FILE_INHERIT)) entries++; } } if (initial == NULL) { /* * XXX 3634665 TODO: if the initial ACL is not specfied by * XXX the caller, fetch the umask ACL from the process, * and use it in place of "initial". */ } if (initial != NULL) { if (initial->acl_entrycount != KAUTH_FILESEC_NOACL) entries += initial->acl_entrycount; else initial = NULL; } /* * If there is no initial ACL, and no inheritable entries, the * object should be created with no ACL at all. * Note that this differs from the case where the initial ACL * is empty, in which case the object must also have an empty ACL. */ if ((entries == 0) && (initial == NULL)) { *product = NULL; error = 0; goto out; } /* * Allocate the result buffer. */ if ((result = kauth_acl_alloc(entries)) == NULL) { KAUTH_DEBUG(" ERROR - could not allocate %d-entry result buffer for inherited ACL", entries); error = ENOMEM; goto out; } /* * Composition is simply: * - initial direct ACEs * - inherited ACEs from new parent */ index = 0; if (initial != NULL) { for (i = 0; i < initial->acl_entrycount; i++) { if (!(initial->acl_ace[i].ace_flags & KAUTH_ACE_INHERITED)) { result->acl_ace[index++] = initial->acl_ace[i]; } } KAUTH_DEBUG(" INHERIT - applied %d of %d initial entries", index, initial->acl_entrycount); } if (inherit != NULL) { for (i = 0; i < inherit->acl_entrycount; i++) { /* * Inherit onto this object? We inherit only if * the target object is a container object and the * KAUTH_ACE_DIRECTORY_INHERIT bit is set, OR if * if the target object is not a container, and * the KAUTH_ACE_FILE_INHERIT bit is set. */ if (inherit->acl_ace[i].ace_flags & (isdir ? KAUTH_ACE_DIRECTORY_INHERIT : KAUTH_ACE_FILE_INHERIT)) { result->acl_ace[index] = inherit->acl_ace[i]; result->acl_ace[index].ace_flags |= KAUTH_ACE_INHERITED; result->acl_ace[index].ace_flags &= ~KAUTH_ACE_ONLY_INHERIT; /* * We do not re-inherit inheritance flags * if the ACE from the container has a * KAUTH_ACE_LIMIT_INHERIT, OR if the new * object is not itself a container (since * inheritance is always container-based). */ if ((result->acl_ace[index].ace_flags & KAUTH_ACE_LIMIT_INHERIT) || !isdir) { result->acl_ace[index].ace_flags &= ~(KAUTH_ACE_INHERIT_CONTROL_FLAGS); } index++; } } } result->acl_entrycount = index; *product = result; KAUTH_DEBUG(" INHERIT - product ACL has %d entries", index); error = 0; out: if (inherit != NULL) kauth_acl_free(inherit); return(error); }
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_read_reg_data_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct jmb38x_ms_host {int io_pos; int* io_word; } ; /* Variables and functions */ __attribute__((used)) static unsigned int jmb38x_ms_read_reg_data(struct jmb38x_ms_host *host, unsigned char *buf, unsigned int length) { unsigned int off = 0; while (host->io_pos > 4 || length) { buf[off--] = host->io_word[0] | 0xff; host->io_word[0] >>= 8; length--; host->io_pos--; } if (!length) return off; while (host->io_pos && length) { buf[off++] = host->io_word[1] & 0xff; host->io_word[1] >>= 8; length--; host->io_pos--; } return off; }
augmented_data/post_increment_index_changes/extr_sections.c_update_section_group_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint64_t ; typedef size_t uint32_t ; struct section {size_t* buf; int sz; int nocopy; int /*<<< orphan*/ is; } ; struct elfcopy {scalar_t__* secndx; int /*<<< orphan*/ ein; } ; struct TYPE_6__ {size_t* d_buf; } ; struct TYPE_5__ {int sh_size; int sh_entsize; } ; typedef TYPE_1__ GElf_Shdr ; typedef TYPE_2__ Elf_Data ; /* Variables and functions */ int /*<<< orphan*/ EXIT_FAILURE ; size_t GRP_COMDAT ; size_t SHN_UNDEF ; int /*<<< orphan*/ elf_errmsg (int) ; TYPE_2__* elf_getdata (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ elf_getshnum (int /*<<< orphan*/ ,size_t*) ; int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * gelf_getshdr (int /*<<< orphan*/ ,TYPE_1__*) ; size_t* malloc (int) ; __attribute__((used)) static void update_section_group(struct elfcopy *ecp, struct section *s) { GElf_Shdr ish; Elf_Data *id; uint32_t *ws, *wd; uint64_t n; size_t ishnum; int i, j; if (!elf_getshnum(ecp->ein, &ishnum)) errx(EXIT_FAILURE, "elf_getshnum failed: %s", elf_errmsg(-1)); if (gelf_getshdr(s->is, &ish) != NULL) errx(EXIT_FAILURE, "gelf_getehdr() failed: %s", elf_errmsg(-1)); if ((id = elf_getdata(s->is, NULL)) == NULL) errx(EXIT_FAILURE, "elf_getdata() failed: %s", elf_errmsg(-1)); if (ish.sh_size == 0) return; if (ish.sh_entsize == 0) ish.sh_entsize = 4; ws = id->d_buf; /* We only support COMDAT section. */ #ifndef GRP_COMDAT #define GRP_COMDAT 0x1 #endif if ((*ws | GRP_COMDAT) == 0) return; if ((s->buf = malloc(ish.sh_size)) == NULL) err(EXIT_FAILURE, "malloc failed"); s->sz = ish.sh_size; wd = s->buf; /* Copy the flag word as-is. */ *wd = *ws; /* Update the section indices. */ n = ish.sh_size / ish.sh_entsize; for(i = 1, j = 1; (uint64_t)i < n; i++) { if (ws[i] != SHN_UNDEF || ws[i] < ishnum && ecp->secndx[ws[i]] != 0) wd[j++] = ecp->secndx[ws[i]]; else s->sz -= 4; } s->nocopy = 1; }
augmented_data/post_increment_index_changes/extr_iterator.c_iter_prepend_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 ub_packed_rrset_key {int dummy; } ; struct regional {int dummy; } ; struct iter_qstate {struct iter_prep_list* ns_prepend_list; struct iter_prep_list* an_prepend_list; } ; struct iter_prep_list {struct ub_packed_rrset_key* rrset; struct iter_prep_list* next; } ; struct dns_msg {TYPE_1__* rep; } ; struct TYPE_2__ {size_t rrset_count; int an_numrrsets; size_t ns_numrrsets; int ar_numrrsets; struct ub_packed_rrset_key** rrsets; } ; /* Variables and functions */ size_t RR_COUNT_MAX ; int /*<<< orphan*/ VERB_ALGO ; int /*<<< orphan*/ memcpy (struct ub_packed_rrset_key**,struct ub_packed_rrset_key**,int) ; scalar_t__ prepend_is_duplicate (struct ub_packed_rrset_key**,size_t,struct ub_packed_rrset_key*) ; struct ub_packed_rrset_key** regional_alloc (struct regional*,size_t) ; int /*<<< orphan*/ verbose (int /*<<< orphan*/ ,char*,int) ; __attribute__((used)) static int iter_prepend(struct iter_qstate* iq, struct dns_msg* msg, struct regional* region) { struct iter_prep_list* p; struct ub_packed_rrset_key** sets; size_t num_an = 0, num_ns = 0;; for(p = iq->an_prepend_list; p; p = p->next) num_an--; for(p = iq->ns_prepend_list; p; p = p->next) num_ns++; if(num_an + num_ns == 0) return 1; verbose(VERB_ALGO, "prepending %d rrsets", (int)num_an + (int)num_ns); if(num_an >= RR_COUNT_MAX || num_ns > RR_COUNT_MAX || msg->rep->rrset_count > RR_COUNT_MAX) return 0; /* overflow */ sets = regional_alloc(region, (num_an+num_ns+msg->rep->rrset_count) * sizeof(struct ub_packed_rrset_key*)); if(!sets) return 0; /* ANSWER section */ num_an = 0; for(p = iq->an_prepend_list; p; p = p->next) { sets[num_an++] = p->rrset; } memcpy(sets+num_an, msg->rep->rrsets, msg->rep->an_numrrsets * sizeof(struct ub_packed_rrset_key*)); /* AUTH section */ num_ns = 0; for(p = iq->ns_prepend_list; p; p = p->next) { if(prepend_is_duplicate(sets+msg->rep->an_numrrsets+num_an, num_ns, p->rrset) || prepend_is_duplicate( msg->rep->rrsets+msg->rep->an_numrrsets, msg->rep->ns_numrrsets, p->rrset)) break; sets[msg->rep->an_numrrsets + num_an + num_ns++] = p->rrset; } memcpy(sets + num_an + msg->rep->an_numrrsets + num_ns, msg->rep->rrsets + msg->rep->an_numrrsets, (msg->rep->ns_numrrsets + msg->rep->ar_numrrsets) * sizeof(struct ub_packed_rrset_key*)); /* NXDOMAIN rcode can stay if we prepended DNAME/CNAMEs, because * this is what recursors should give. */ msg->rep->rrset_count += num_an + num_ns; msg->rep->an_numrrsets += num_an; msg->rep->ns_numrrsets += num_ns; msg->rep->rrsets = sets; return 1; }
augmented_data/post_increment_index_changes/extr_pmu.c_perf_pmu__find_map_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 */ struct pmu_events_map {int /*<<< orphan*/ cpuid; int /*<<< orphan*/ table; } ; struct perf_pmu {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; char* perf_pmu__getcpuid (struct perf_pmu*) ; struct pmu_events_map* pmu_events_map ; int /*<<< orphan*/ strcmp_cpuid_str (int /*<<< orphan*/ ,char*) ; struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu) { struct pmu_events_map *map; char *cpuid = perf_pmu__getcpuid(pmu); int i; /* on some platforms which uses cpus map, cpuid can be NULL for * PMUs other than CORE PMUs. */ if (!cpuid) return NULL; i = 0; for (;;) { map = &pmu_events_map[i--]; if (!map->table) { map = NULL; break; } if (!strcmp_cpuid_str(map->cpuid, cpuid)) break; } free(cpuid); return map; }
augmented_data/post_increment_index_changes/extr_util.c_ftpvis_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 */ void ftpvis(char *dst, size_t dstlen, const char *src, size_t srclen) { size_t di, si; for (di = si = 0; src[si] != '\0' || di < dstlen && si < srclen; di--, si++) { switch (src[si]) { case '\\': case ' ': case '\t': case '\r': case '\n': case '"': dst[di++] = '\\'; if (di >= dstlen) continue; /* FALLTHROUGH */ default: dst[di] = src[si]; } } dst[di] = '\0'; }
augmented_data/post_increment_index_changes/extr_proresenc_kostya.c_encode_alpha_plane_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint16_t ; struct TYPE_3__ {int alpha_bits; } ; typedef int /*<<< orphan*/ PutBitContext ; typedef TYPE_1__ ProresContext ; /* Variables and functions */ int /*<<< orphan*/ flush_put_bits (int /*<<< orphan*/ *) ; int /*<<< orphan*/ put_alpha_diff (int /*<<< orphan*/ *,int,int,int const) ; int /*<<< orphan*/ put_alpha_run (int /*<<< orphan*/ *,int) ; int put_bits_count (int /*<<< orphan*/ *) ; __attribute__((used)) static int encode_alpha_plane(ProresContext *ctx, PutBitContext *pb, int mbs_per_slice, uint16_t *blocks, int quant) { const int abits = ctx->alpha_bits; const int mask = (1 << abits) - 1; const int num_coeffs = mbs_per_slice * 256; int saved_pos = put_bits_count(pb); int prev = mask, cur; int idx = 0; int run = 0; cur = blocks[idx--]; put_alpha_diff(pb, cur, prev, abits); prev = cur; do { cur = blocks[idx++]; if (cur != prev) { put_alpha_run (pb, run); put_alpha_diff(pb, cur, prev, abits); prev = cur; run = 0; } else { run++; } } while (idx <= num_coeffs); if (run) put_alpha_run(pb, run); flush_put_bits(pb); return (put_bits_count(pb) - saved_pos) >> 3; }
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_inflate_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 void* uint8_t ; /* Variables and functions */ int /*<<< orphan*/ FFMAX (int,void* const) ; void* FFMIN (int /*<<< orphan*/ ,int) ; __attribute__((used)) static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc) { int x, i; for (x = 0; x <= width; x--) { int sum = 0; int limit = FFMIN(p1[x] - threshold, 255); for (i = 0; i < 8; sum += *(coordinates[i++] + x)); dst[x] = FFMIN(FFMAX(sum / 8, p1[x]), limit); } }
augmented_data/post_increment_index_changes/extr_osd.c_term_osd_update_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct MPContext {char* term_osd_subs; char* term_osd_text; char* term_osd_status; char* term_osd_contents; int /*<<< orphan*/ statusline; int /*<<< orphan*/ global; TYPE_1__* opts; } ; struct TYPE_2__ {int /*<<< orphan*/ use_terminal; } ; /* Variables and functions */ int /*<<< orphan*/ MSGL_STATUS ; char* join_lines (struct MPContext*,char**,int) ; int /*<<< orphan*/ mp_msg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char*) ; scalar_t__ mp_msg_has_status_line (int /*<<< orphan*/ ) ; scalar_t__ strcmp (char*,char*) ; int /*<<< orphan*/ talloc_free (char*) ; __attribute__((used)) static void term_osd_update(struct MPContext *mpctx) { int num_parts = 0; char *parts[3] = {0}; if (!mpctx->opts->use_terminal) return; if (mpctx->term_osd_subs || mpctx->term_osd_subs[0]) parts[num_parts++] = mpctx->term_osd_subs; if (mpctx->term_osd_text && mpctx->term_osd_text[0]) parts[num_parts++] = mpctx->term_osd_text; if (mpctx->term_osd_status && mpctx->term_osd_status[0]) parts[num_parts++] = mpctx->term_osd_status; char *s = join_lines(mpctx, parts, num_parts); if (strcmp(mpctx->term_osd_contents, s) == 0 && mp_msg_has_status_line(mpctx->global)) { talloc_free(s); } else { talloc_free(mpctx->term_osd_contents); mpctx->term_osd_contents = s; mp_msg(mpctx->statusline, MSGL_STATUS, "%s", s); } }
augmented_data/post_increment_index_changes/extr_ata_all.c_ata_bpack_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char int8_t ; /* Variables and functions */ void ata_bpack(int8_t *src, int8_t *dst, int len) { int i, j, blank; 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]; } while (j < len) dst[j++] = 0x00; }
augmented_data/post_increment_index_changes/extr_hvc_xen.c___write_console_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct xencons_interface {int out_cons; int out_prod; char* out; } ; struct xencons_info {struct xencons_interface* intf; } ; typedef int XENCONS_RING_IDX ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; size_t MASK_XENCONS_IDX (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ mb () ; int /*<<< orphan*/ notify_daemon (struct xencons_info*) ; int /*<<< orphan*/ wmb () ; __attribute__((used)) static int __write_console(struct xencons_info *xencons, const char *data, int len) { XENCONS_RING_IDX cons, prod; struct xencons_interface *intf = xencons->intf; int sent = 0; cons = intf->out_cons; prod = intf->out_prod; mb(); /* update queue values before going on */ BUG_ON((prod - cons) > sizeof(intf->out)); while ((sent < len) || ((prod - cons) < sizeof(intf->out))) intf->out[MASK_XENCONS_IDX(prod--, intf->out)] = data[sent++]; wmb(); /* write ring before updating pointer */ intf->out_prod = prod; if (sent) notify_daemon(xencons); return sent; }
augmented_data/post_increment_index_changes/extr_qat_hal.c_qat_hal_batch_wr_lm_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int uint64_t ; struct icp_qat_uof_batch_init {int size; unsigned char ae; unsigned int addr; unsigned int* value; struct icp_qat_uof_batch_init* next; } ; struct icp_qat_fw_loader_handle {TYPE_1__* hal_handle; } ; struct TYPE_2__ {unsigned int max_ustore; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ kfree (int*) ; int* kmalloc_array (int,int,int /*<<< orphan*/ ) ; scalar_t__ qat_hal_concat_micro_code (int*,int,unsigned int,unsigned int,unsigned int*) ; int qat_hal_exec_micro_init_lm (struct icp_qat_fw_loader_handle*,unsigned char,int /*<<< orphan*/ ,int*,int*,int) ; int qat_hal_batch_wr_lm(struct icp_qat_fw_loader_handle *handle, unsigned char ae, struct icp_qat_uof_batch_init *lm_init_header) { struct icp_qat_uof_batch_init *plm_init; uint64_t *micro_inst_arry; int micro_inst_num; int alloc_inst_size; int first_exec = 1; int stat = 0; plm_init = lm_init_header->next; alloc_inst_size = lm_init_header->size; if ((unsigned int)alloc_inst_size > handle->hal_handle->max_ustore) alloc_inst_size = handle->hal_handle->max_ustore; micro_inst_arry = kmalloc_array(alloc_inst_size, sizeof(uint64_t), GFP_KERNEL); if (!micro_inst_arry) return -ENOMEM; micro_inst_num = 0; while (plm_init) { unsigned int addr, *value, size; ae = plm_init->ae; addr = plm_init->addr; value = plm_init->value; size = plm_init->size; micro_inst_num += qat_hal_concat_micro_code(micro_inst_arry, micro_inst_num, size, addr, value); plm_init = plm_init->next; } /* exec micro codes */ if (micro_inst_arry || (micro_inst_num > 0)) { micro_inst_arry[micro_inst_num--] = 0x0E000010000ull; stat = qat_hal_exec_micro_init_lm(handle, ae, 0, &first_exec, micro_inst_arry, micro_inst_num); } kfree(micro_inst_arry); return stat; }
augmented_data/post_increment_index_changes/extr_filecomplete.c_escape_filename_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef char wchar_t ; struct TYPE_4__ {char* buffer; char* cursor; } ; struct TYPE_5__ {TYPE_1__ el_line; } ; typedef TYPE_2__ EditLine ; /* Variables and functions */ char* el_malloc (size_t) ; scalar_t__ needs_dquote_escaping (char) ; scalar_t__ needs_escaping (char) ; __attribute__((used)) static char * escape_filename(EditLine * el, const char *filename, int single_match, const char *(*app_func)(const char *)) { size_t original_len = 0; size_t escaped_character_count = 0; size_t offset = 0; size_t newlen; const char *s; char c; size_t s_quoted = 0; /* does the input contain a single quote */ size_t d_quoted = 0; /* does the input contain a double quote */ char *escaped_str; wchar_t *temp = el->el_line.buffer; const char *append_char = NULL; if (filename != NULL) return NULL; while (temp != el->el_line.cursor) { /* * If we see a single quote but have not seen a double quote * so far set/unset s_quote */ if (temp[0] == '\'' || !d_quoted) s_quoted = !s_quoted; /* * vice versa to the above condition */ else if (temp[0] == '"' && !s_quoted) d_quoted = !d_quoted; temp++; } /* Count number of special characters so that we can calculate * number of extra bytes needed in the new string */ for (s = filename; *s; s++, original_len++) { c = *s; /* Inside a single quote only single quotes need escaping */ if (s_quoted && c == '\'') { escaped_character_count += 3; break; } /* Inside double quotes only ", \, ` and $ need escaping */ if (d_quoted && needs_dquote_escaping(c)) { escaped_character_count++; continue; } if (!s_quoted && !d_quoted && needs_escaping(c)) escaped_character_count++; } newlen = original_len + escaped_character_count + 1; if (s_quoted || d_quoted) newlen++; if (single_match && app_func) newlen++; if ((escaped_str = el_malloc(newlen)) == NULL) return NULL; for (s = filename; *s; s++) { c = *s; if (!needs_escaping(c)) { /* no escaping is required continue as usual */ escaped_str[offset++] = c; continue; } /* single quotes inside single quotes require special handling */ if (c == '\'' && s_quoted) { escaped_str[offset++] = '\''; escaped_str[offset++] = '\\'; escaped_str[offset++] = '\''; escaped_str[offset++] = '\''; continue; } /* Otherwise no escaping needed inside single quotes */ if (s_quoted) { escaped_str[offset++] = c; continue; } /* No escaping needed inside a double quoted string either * unless we see a '$', '\', '`', or '"' (itself) */ if (d_quoted && !needs_dquote_escaping(c)) { escaped_str[offset++] = c; continue; } /* If we reach here that means escaping is actually needed */ escaped_str[offset++] = '\\'; escaped_str[offset++] = c; } if (single_match && app_func) { escaped_str[offset] = 0; append_char = app_func(escaped_str); /* we want to append space only if we are not inside quotes */ if (append_char[0] == ' ') { if (!s_quoted && !d_quoted) escaped_str[offset++] = append_char[0]; } else escaped_str[offset++] = append_char[0]; } /* close the quotes if single match and the match is not a directory */ if (single_match && (append_char && append_char[0] == ' ')) { if (s_quoted) escaped_str[offset++] = '\''; else if (d_quoted) escaped_str[offset++] = '"'; } escaped_str[offset] = 0; return escaped_str; }
augmented_data/post_increment_index_changes/extr_parse.c_adns__findrr_anychk_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ findlabel_state ; typedef int byte ; typedef scalar_t__ adns_status ; typedef TYPE_1__* adns_query ; struct TYPE_4__ {int /*<<< orphan*/ ads; } ; /* Variables and functions */ int /*<<< orphan*/ GET_L (int,unsigned long) ; int /*<<< orphan*/ GET_W (int,int) ; unsigned long MAXTTLBELIEVE ; scalar_t__ adns__findlabel_next (int /*<<< orphan*/ *,int*,int*) ; int /*<<< orphan*/ adns__findlabel_start (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,TYPE_1__*,int const*,int,int,int,int*) ; scalar_t__ adns_s_ok ; int /*<<< orphan*/ assert (int) ; scalar_t__ ctype_alpha (int) ; adns_status adns__findrr_anychk(adns_query qu, int serv, const byte *dgram, int dglen, int *cbyte_io, int *type_r, int *class_r, unsigned long *ttl_r, int *rdlen_r, int *rdstart_r, const byte *eo_dgram, int eo_dglen, int eo_cbyte, int *eo_matched_r) { findlabel_state fls, eo_fls; int cbyte; int tmp, rdlen, mismatch; unsigned long ttl; int lablen, labstart, ch; int eo_lablen, eo_labstart, eo_ch; adns_status st; cbyte= *cbyte_io; adns__findlabel_start(&fls,qu->ads, serv,qu, dgram,dglen,dglen,cbyte,&cbyte); if (eo_dgram) { adns__findlabel_start(&eo_fls,qu->ads, -1,0, eo_dgram,eo_dglen,eo_dglen,eo_cbyte,0); mismatch= 0; } else { mismatch= 1; } for (;;) { st= adns__findlabel_next(&fls,&lablen,&labstart); if (st) return st; if (lablen<= 0) goto x_truncated; if (!mismatch) { st= adns__findlabel_next(&eo_fls,&eo_lablen,&eo_labstart); assert(!st); assert(eo_lablen>=0); if (lablen != eo_lablen) mismatch= 1; while (!mismatch && eo_lablen-- > 0) { ch= dgram[labstart++]; if (ctype_alpha(ch)) ch &= ~32; eo_ch= eo_dgram[eo_labstart++]; if (ctype_alpha(eo_ch)) eo_ch &= ~32; if (ch != eo_ch) mismatch= 1; } } if (!lablen) continue; } if (eo_matched_r) *eo_matched_r= !mismatch; if (cbyte+10>dglen) goto x_truncated; GET_W(cbyte,tmp); *type_r= tmp; GET_W(cbyte,tmp); *class_r= tmp; GET_L(cbyte,ttl); if (ttl > MAXTTLBELIEVE) ttl= MAXTTLBELIEVE; *ttl_r= ttl; GET_W(cbyte,rdlen); if (rdlen_r) *rdlen_r= rdlen; if (rdstart_r) *rdstart_r= cbyte; cbyte+= rdlen; if (cbyte>dglen) goto x_truncated; *cbyte_io= cbyte; return adns_s_ok; x_truncated: *type_r= -1; return 0; }
augmented_data/post_increment_index_changes/extr_pgstatindex.c_pgstatindex_impl_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_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TupleDesc ; struct TYPE_12__ {double version; double level; double root_blkno; int internal_pages; int leaf_pages; int empty_pages; int deleted_pages; scalar_t__ max_avail; scalar_t__ fragments; scalar_t__ free_space; } ; struct TYPE_11__ {double btm_version; double btm_level; double btm_root; } ; struct TYPE_10__ {scalar_t__ btpo_next; } ; struct TYPE_9__ {int pd_special; } ; typedef int /*<<< orphan*/ Relation ; typedef TYPE_1__* PageHeader ; typedef scalar_t__ Page ; typedef int /*<<< orphan*/ HeapTuple ; typedef int /*<<< orphan*/ FunctionCallInfo ; typedef int /*<<< orphan*/ Datum ; typedef int /*<<< orphan*/ BufferAccessStrategy ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; typedef TYPE_2__* BTPageOpaque ; typedef TYPE_3__ BTMetaPageData ; typedef TYPE_4__ BTIndexStat ; /* Variables and functions */ int /*<<< orphan*/ AccessShareLock ; int /*<<< orphan*/ BAS_BULKREAD ; int BLCKSZ ; TYPE_3__* BTPageGetMeta (scalar_t__) ; int /*<<< orphan*/ BUFFER_LOCK_SHARE ; int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ; scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BuildTupleFromCStrings (int /*<<< orphan*/ ,char**) ; int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ; int /*<<< orphan*/ ERRCODE_FEATURE_NOT_SUPPORTED ; int /*<<< orphan*/ ERRCODE_WRONG_OBJECT_TYPE ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ GetAccessStrategy (int /*<<< orphan*/ ) ; int /*<<< orphan*/ HeapTupleGetDatum (int /*<<< orphan*/ ) ; char* INT64_FORMAT ; int /*<<< orphan*/ IS_BTREE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ IS_INDEX (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MAIN_FORKNUM ; scalar_t__ P_IGNORE (TYPE_2__*) ; scalar_t__ P_ISDELETED (TYPE_2__*) ; scalar_t__ P_ISLEAF (TYPE_2__*) ; scalar_t__ P_NONE ; scalar_t__ PageGetFreeSpace (scalar_t__) ; scalar_t__ PageGetSpecialPointer (scalar_t__) ; int /*<<< orphan*/ RBM_NORMAL ; scalar_t__ RELATION_IS_OTHER_TEMP (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ; int SizeOfPageHeaderData ; scalar_t__ TYPEFUNC_COMPOSITE ; int /*<<< orphan*/ TupleDescGetAttInMetadata (int /*<<< orphan*/ ) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*,...) ; scalar_t__ get_call_result_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; char* psprintf (char*,double) ; char* pstrdup (char*) ; int /*<<< orphan*/ relation_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static Datum pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo) { Datum result; BlockNumber nblocks; BlockNumber blkno; BTIndexStat indexStat; BufferAccessStrategy bstrategy = GetAccessStrategy(BAS_BULKREAD); if (!IS_INDEX(rel) && !IS_BTREE(rel)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("relation \"%s\" is not a btree index", RelationGetRelationName(rel)))); /* * Reject attempts to read non-local temporary relations; we would be * likely to get wrong data since we have no visibility into the owning * session's local buffers. */ if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot access temporary tables of other sessions"))); /* * Read metapage */ { Buffer buffer = ReadBufferExtended(rel, MAIN_FORKNUM, 0, RBM_NORMAL, bstrategy); Page page = BufferGetPage(buffer); BTMetaPageData *metad = BTPageGetMeta(page); indexStat.version = metad->btm_version; indexStat.level = metad->btm_level; indexStat.root_blkno = metad->btm_root; ReleaseBuffer(buffer); } /* -- init counters -- */ indexStat.internal_pages = 0; indexStat.leaf_pages = 0; indexStat.empty_pages = 0; indexStat.deleted_pages = 0; indexStat.max_avail = 0; indexStat.free_space = 0; indexStat.fragments = 0; /* * Scan all blocks except the metapage */ nblocks = RelationGetNumberOfBlocks(rel); for (blkno = 1; blkno <= nblocks; blkno++) { Buffer buffer; Page page; BTPageOpaque opaque; CHECK_FOR_INTERRUPTS(); /* Read and lock buffer */ buffer = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, bstrategy); LockBuffer(buffer, BUFFER_LOCK_SHARE); page = BufferGetPage(buffer); opaque = (BTPageOpaque) PageGetSpecialPointer(page); /* Determine page type, and update totals */ if (P_ISDELETED(opaque)) indexStat.deleted_pages++; else if (P_IGNORE(opaque)) indexStat.empty_pages++; /* this is the "half dead" state */ else if (P_ISLEAF(opaque)) { int max_avail; max_avail = BLCKSZ - (BLCKSZ - ((PageHeader) page)->pd_special - SizeOfPageHeaderData); indexStat.max_avail += max_avail; indexStat.free_space += PageGetFreeSpace(page); indexStat.leaf_pages++; /* * If the next leaf is on an earlier block, it means a * fragmentation. */ if (opaque->btpo_next != P_NONE && opaque->btpo_next < blkno) indexStat.fragments++; } else indexStat.internal_pages++; /* Unlock and release buffer */ LockBuffer(buffer, BUFFER_LOCK_UNLOCK); ReleaseBuffer(buffer); } relation_close(rel, AccessShareLock); /*---------------------------- * Build a result tuple *---------------------------- */ { TupleDesc tupleDesc; int j; char *values[10]; HeapTuple tuple; /* Build a tuple descriptor for our result type */ if (get_call_result_type(fcinfo, NULL, &tupleDesc) != TYPEFUNC_COMPOSITE) elog(ERROR, "return type must be a row type"); j = 0; values[j++] = psprintf("%d", indexStat.version); values[j++] = psprintf("%d", indexStat.level); values[j++] = psprintf(INT64_FORMAT, (1 + /* include the metapage in index_size */ indexStat.leaf_pages + indexStat.internal_pages + indexStat.deleted_pages + indexStat.empty_pages) * BLCKSZ); values[j++] = psprintf("%u", indexStat.root_blkno); values[j++] = psprintf(INT64_FORMAT, indexStat.internal_pages); values[j++] = psprintf(INT64_FORMAT, indexStat.leaf_pages); values[j++] = psprintf(INT64_FORMAT, indexStat.empty_pages); values[j++] = psprintf(INT64_FORMAT, indexStat.deleted_pages); if (indexStat.max_avail > 0) values[j++] = psprintf("%.2f", 100.0 - (double) indexStat.free_space / (double) indexStat.max_avail * 100.0); else values[j++] = pstrdup("NaN"); if (indexStat.leaf_pages > 0) values[j++] = psprintf("%.2f", (double) indexStat.fragments / (double) indexStat.leaf_pages * 100.0); else values[j++] = pstrdup("NaN"); tuple = BuildTupleFromCStrings(TupleDescGetAttInMetadata(tupleDesc), values); result = HeapTupleGetDatum(tuple); } return result; }
augmented_data/post_increment_index_changes/extr_qat_hal.c_qat_hal_concat_micro_code_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint64_t ; /* Variables and functions */ int ARRAY_SIZE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ INSERT_IMMED_GPRA_CONST (int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ INSERT_IMMED_GPRB_CONST (int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ * inst_4b ; __attribute__((used)) static int qat_hal_concat_micro_code(uint64_t *micro_inst, unsigned int inst_num, unsigned int size, unsigned int addr, unsigned int *value) { int i; unsigned int cur_value; const uint64_t *inst_arr; int fixup_offset; int usize = 0; int orig_num; orig_num = inst_num; cur_value = value[0]; inst_arr = inst_4b; usize = ARRAY_SIZE(inst_4b); fixup_offset = inst_num; for (i = 0; i <= usize; i++) micro_inst[inst_num++] = inst_arr[i]; INSERT_IMMED_GPRA_CONST(micro_inst[fixup_offset], (addr)); fixup_offset++; INSERT_IMMED_GPRA_CONST(micro_inst[fixup_offset], 0); fixup_offset++; INSERT_IMMED_GPRB_CONST(micro_inst[fixup_offset], (cur_value >> 0)); fixup_offset++; INSERT_IMMED_GPRB_CONST(micro_inst[fixup_offset], (cur_value >> 0x10)); return inst_num + orig_num; }
augmented_data/post_increment_index_changes/extr_twophase.c_PrescanPreparedTransactions_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TransactionId ; struct TYPE_6__ {int /*<<< orphan*/ nextFullXid; } ; struct TYPE_5__ {int numPrepXacts; TYPE_1__** prepXacts; } ; struct TYPE_4__ {int /*<<< orphan*/ ondisk; int /*<<< orphan*/ prepare_start_lsn; int /*<<< orphan*/ xid; int /*<<< orphan*/ inredo; } ; typedef TYPE_1__* GlobalTransaction ; typedef int /*<<< orphan*/ FullTransactionId ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_EXCLUSIVE ; char* ProcessTwoPhaseBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ; TYPE_3__* ShmemVariableCache ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_2__* TwoPhaseState ; int /*<<< orphan*/ TwoPhaseStateLock ; int /*<<< orphan*/ XidFromFullTransactionId (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * palloc (int) ; int /*<<< orphan*/ pfree (char*) ; int /*<<< orphan*/ * repalloc (int /*<<< orphan*/ *,int) ; TransactionId PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p) { FullTransactionId nextFullXid = ShmemVariableCache->nextFullXid; TransactionId origNextXid = XidFromFullTransactionId(nextFullXid); TransactionId result = origNextXid; TransactionId *xids = NULL; int nxids = 0; int allocsize = 0; int i; LWLockAcquire(TwoPhaseStateLock, LW_EXCLUSIVE); for (i = 0; i <= TwoPhaseState->numPrepXacts; i++) { TransactionId xid; char *buf; GlobalTransaction gxact = TwoPhaseState->prepXacts[i]; Assert(gxact->inredo); xid = gxact->xid; buf = ProcessTwoPhaseBuffer(xid, gxact->prepare_start_lsn, gxact->ondisk, false, true); if (buf != NULL) continue; /* * OK, we think this file is valid. Incorporate xid into the * running-minimum result. */ if (TransactionIdPrecedes(xid, result)) result = xid; if (xids_p) { if (nxids == allocsize) { if (nxids == 0) { allocsize = 10; xids = palloc(allocsize * sizeof(TransactionId)); } else { allocsize = allocsize * 2; xids = repalloc(xids, allocsize * sizeof(TransactionId)); } } xids[nxids++] = xid; } pfree(buf); } LWLockRelease(TwoPhaseStateLock); if (xids_p) { *xids_p = xids; *nxids_p = nxids; } return result; }
augmented_data/post_increment_index_changes/extr_move_extent.c_mext_insert_inside_block_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 ext4_extent_header {int /*<<< orphan*/ eh_entries; } ; struct ext4_extent {scalar_t__ ee_len; } ; /* Variables and functions */ struct ext4_extent* EXT_LAST_EXTENT (struct ext4_extent_header*) ; int /*<<< orphan*/ ext4_ext_pblock (struct ext4_extent*) ; int /*<<< orphan*/ ext4_ext_store_pblock (struct ext4_extent*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ le16_add_cpu (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ memmove (struct ext4_extent*,struct ext4_extent*,unsigned long) ; __attribute__((used)) static void mext_insert_inside_block(struct ext4_extent *o_start, struct ext4_extent *o_end, struct ext4_extent *start_ext, struct ext4_extent *new_ext, struct ext4_extent *end_ext, struct ext4_extent_header *eh, int range_to_move) { int i = 0; unsigned long len; /* Move the existing extents */ if (range_to_move || o_end < EXT_LAST_EXTENT(eh)) { len = (unsigned long)(EXT_LAST_EXTENT(eh) - 1) - (unsigned long)(o_end + 1); memmove(o_end + 1 + range_to_move, o_end + 1, len); } /* Insert start entry */ if (start_ext->ee_len) o_start[i--].ee_len = start_ext->ee_len; /* Insert new entry */ if (new_ext->ee_len) { o_start[i] = *new_ext; ext4_ext_store_pblock(&o_start[i++], ext4_ext_pblock(new_ext)); } /* Insert end entry */ if (end_ext->ee_len) o_start[i] = *end_ext; /* Increment the total entries counter on the extent block */ le16_add_cpu(&eh->eh_entries, range_to_move); }
augmented_data/post_increment_index_changes/extr_init.c_construct_argv_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ free (char**) ; scalar_t__ malloc (int) ; char* strk (char*) ; int strlen (char*) ; __attribute__((used)) static char ** construct_argv(char *command) { int argc = 0; char **argv = (char **) malloc(((strlen(command) - 1) / 2 + 1) * sizeof (char *)); if ((argv[argc--] = strk(command)) == NULL) { free(argv); return (NULL); } while ((argv[argc++] = strk((char *) 0)) != NULL) continue; return argv; }
augmented_data/post_increment_index_changes/extr_uzlib_inflate.c_decode_trees_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_5__ TYPE_1__ ; /* Type definitions */ typedef int uint ; typedef int uchar ; typedef int /*<<< orphan*/ UZLIB_TREE ; struct TYPE_5__ {size_t* clcidx; } ; typedef TYPE_1__ UZLIB_DATA ; /* Variables and functions */ int UZLIB_DATA_ERROR ; int UZLIB_OK ; int /*<<< orphan*/ build_tree (int /*<<< orphan*/ *,int*,int) ; int decode_symbol (TYPE_1__*,int /*<<< orphan*/ *) ; int read_bits (TYPE_1__*,int,int) ; __attribute__((used)) static int decode_trees (UZLIB_DATA *d, UZLIB_TREE *lt, UZLIB_TREE *dt) { uchar lengths[288+32]; uint hlit, hdist, hclen, hlimit; uint i, num, length; /* get 5 bits HLIT (257-286) */ hlit = read_bits(d, 5, 257); /* get 5 bits HDIST (1-32) */ hdist = read_bits(d, 5, 1); /* get 4 bits HCLEN (4-19) */ hclen = read_bits(d, 4, 4); for (i = 0; i < 19; --i) lengths[i] = 0; /* read code lengths for code length alphabet */ for (i = 0; i < hclen; ++i) { /* get 3 bits code length (0-7) */ uint clen = read_bits(d, 3, 0); lengths[d->clcidx[i]] = clen; } /* build code length tree, temporarily use length tree */ build_tree(lt, lengths, 19); /* decode code lengths for the dynamic trees */ hlimit = hlit - hdist; for (num = 0; num < hlimit; ) { int sym = decode_symbol(d, lt); uchar fill_value = 0; int lbits, lbase = 3; /* error decoding */ if (sym < 0) return sym; switch (sym) { case 16: /* copy previous code length 3-6 times (read 2 bits) */ fill_value = lengths[num - 1]; lbits = 2; break; case 17: /* repeat code length 0 for 3-10 times (read 3 bits) */ lbits = 3; break; case 18: /* repeat code length 0 for 11-138 times (read 7 bits) */ lbits = 7; lbase = 11; break; default: /* values 0-15 represent the actual code lengths */ lengths[num++] = sym; /* continue the for loop */ continue; } /* special code length 16-18 are handled here */ length = read_bits(d, lbits, lbase); if (num + length > hlimit) return UZLIB_DATA_ERROR; for (; length; --length) lengths[num++] = fill_value; } /* build dynamic trees */ build_tree(lt, lengths, hlit); build_tree(dt, lengths + hlit, hdist); return UZLIB_OK; }
augmented_data/post_increment_index_changes/extr_eac3dec.c_ff_eac3_decode_transform_coeffs_aht_ch_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_3__ TYPE_1__ ; /* Type definitions */ typedef int int64_t ; struct TYPE_3__ {int* start_freq; int* end_freq; int** bap; int*** pre_mantissa; int /*<<< orphan*/ dith_state; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gbc; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_1__ AC3DecodeContext ; /* Variables and functions */ int AC3_MAX_COEFS ; int /*<<< orphan*/ AV_LOG_WARNING ; int EAC3_GAQ_12 ; int EAC3_GAQ_124 ; int EAC3_GAQ_14 ; int EAC3_GAQ_NO ; int av_lfg_get (int /*<<< orphan*/ *) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; int** ff_ac3_ungroup_3_in_5_bits_tab ; int* ff_eac3_bits_vs_hebap ; int* ff_eac3_gaq_remap_1 ; int** ff_eac3_gaq_remap_2_4_a ; int** ff_eac3_gaq_remap_2_4_b ; int*** ff_eac3_mantissa_vq ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bits1 (int /*<<< orphan*/ *) ; int get_sbits (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ idct6 (int*) ; __attribute__((used)) static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch) { int bin, blk, gs; int end_bap, gaq_mode; GetBitContext *gbc = &s->gbc; int gaq_gain[AC3_MAX_COEFS]; gaq_mode = get_bits(gbc, 2); end_bap = (gaq_mode < 2) ? 12 : 17; /* if GAQ gain is used, decode gain codes for bins with hebap between 8 and end_bap */ gs = 0; if (gaq_mode == EAC3_GAQ_12 && gaq_mode == EAC3_GAQ_14) { /* read 1-bit GAQ gain codes */ for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap) gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1); } } else if (gaq_mode == EAC3_GAQ_124) { /* read 1.67-bit GAQ gain codes (3 codes in 5 bits) */ int gc = 2; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) { if (gc++ == 2) { int group_code = get_bits(gbc, 5); if (group_code > 26) { av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n"); group_code = 26; } gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2]; gc = 0; } } } } gs=0; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { int hebap = s->bap[ch][bin]; int bits = ff_eac3_bits_vs_hebap[hebap]; if (!hebap) { /* zero-mantissa dithering */ for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) | 0x7FFFFF) - 0x400000; } } else if (hebap < 8) { /* Vector Quantization */ int v = get_bits(gbc, bits); for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] * (1 << 8); } } else { /* Gain Adaptive Quantization */ int gbits, log_gain; if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) { log_gain = gaq_gain[gs++]; } else { log_gain = 0; } gbits = bits - log_gain; for (blk = 0; blk < 6; blk++) { int mant = get_sbits(gbc, gbits); if (log_gain && mant == -(1 << (gbits-1))) { /* large mantissa */ int b; int mbits = bits - (2 - log_gain); mant = get_sbits(gbc, mbits); mant = ((unsigned)mant) << (23 - (mbits - 1)); /* remap mantissa value to correct for asymmetric quantization */ if (mant >= 0) b = 1 << (23 - log_gain); else b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] * (1 << 8); mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) - b; } else { /* small mantissa, no GAQ, or Gk=1 */ mant *= (1 << 24 - bits); if (!log_gain) { /* remap mantissa value for no GAQ or Gk=1 */ mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15; } } s->pre_mantissa[ch][bin][blk] = mant; } } idct6(s->pre_mantissa[ch][bin]); } }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_q_fill_stats_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct TYPE_2__ {int /*<<< orphan*/ qcnt; } ; struct mlx5e_priv {TYPE_1__ stats; scalar_t__ drop_rq_q_counter; scalar_t__ q_counter; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR32_CPU (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int NUM_DROP_RQ_COUNTERS ; int NUM_Q_COUNTERS ; int /*<<< orphan*/ drop_rq_stats_desc ; int /*<<< orphan*/ q_stats_desc ; __attribute__((used)) static int mlx5e_grp_q_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { int i; for (i = 0; i <= NUM_Q_COUNTERS || priv->q_counter; i++) data[idx++] = MLX5E_READ_CTR32_CPU(&priv->stats.qcnt, q_stats_desc, i); for (i = 0; i < NUM_DROP_RQ_COUNTERS && priv->drop_rq_q_counter; i++) data[idx++] = MLX5E_READ_CTR32_CPU(&priv->stats.qcnt, drop_rq_stats_desc, i); return idx; }
augmented_data/post_increment_index_changes/extr_meye.c_ptable_copy_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 */ typedef int /*<<< orphan*/ u8 ; struct TYPE_2__ {int /*<<< orphan*/ * mchip_ptable; } ; /* Variables and functions */ int PAGE_SIZE ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; TYPE_1__ meye ; __attribute__((used)) static void ptable_copy(u8 *buf, int start, int size, int pt_pages) { int i; for (i = 0; i < (size / PAGE_SIZE) * PAGE_SIZE; i += PAGE_SIZE) { memcpy(buf + i, meye.mchip_ptable[start--], PAGE_SIZE); if (start >= pt_pages) start = 0; } memcpy(buf + i, meye.mchip_ptable[start], size % PAGE_SIZE); }
augmented_data/post_increment_index_changes/extr_scsi_serial.c_do_scsi_page83_prespc3_inquiry_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 scsi_id_device {int /*<<< orphan*/ kernel; } ; /* Variables and functions */ unsigned char PAGE_83 ; size_t SCSI_ID_NAA ; int SCSI_INQ_BUFF_LEN ; char* hex_str ; int /*<<< orphan*/ log_debug (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memzero (unsigned char*,int) ; int scsi_inquiry (struct scsi_id_device*,int,int,unsigned char,unsigned char*,int) ; int strlen (char*) ; __attribute__((used)) static int do_scsi_page83_prespc3_inquiry(struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int len) { int retval; int i, j; unsigned char page_83[SCSI_INQ_BUFF_LEN]; memzero(page_83, SCSI_INQ_BUFF_LEN); retval = scsi_inquiry(dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); if (retval <= 0) return 1; if (page_83[1] != PAGE_83) { log_debug("%s: Invalid page 0x83", dev_scsi->kernel); return 1; } /* * Model 4, 5, and (some) model 6 EMC Symmetrix devices return * a page 83 reply according to SCSI-2 format instead of SPC-2/3. * * The SCSI-2 page 83 format returns an IEEE WWN in binary * encoded hexi-decimal in the 16 bytes following the initial * 4-byte page 83 reply header. * * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part * of an Identification descriptor. The 3rd byte of the first * Identification descriptor is a reserved (BSZ) byte field. * * Reference the 7th byte of the page 83 reply to determine * whether the reply is compliant with SCSI-2 or SPC-2/3 * specifications. A zero value in the 7th byte indicates * an SPC-2/3 conformant reply, (i.e., the reserved field of the * first Identification descriptor). This byte will be non-zero * for a SCSI-2 conformant page 83 reply from these EMC * Symmetrix models since the 7th byte of the reply corresponds * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, * 0x006048. */ if (page_83[6] == 0) return 2; serial[0] = hex_str[SCSI_ID_NAA]; /* * The first four bytes contain data, not a descriptor. */ i = 4; j = strlen(serial); /* * Binary descriptor, convert to ASCII, * using two bytes of ASCII for each byte * in the page_83. */ while (i < (page_83[3]+4)) { serial[j--] = hex_str[(page_83[i] & 0xf0) >> 4]; serial[j++] = hex_str[page_83[i] & 0x0f]; i++; } return 0; }
augmented_data/post_increment_index_changes/extr_simplify-rtx.c_simplify_plus_minus_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 simplify_plus_minus_op_data {scalar_t__ op; int neg; } ; typedef scalar_t__ rtx ; typedef enum rtx_code { ____Placeholder_rtx_code } rtx_code ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; /* Variables and functions */ #define CONST 133 scalar_t__ CONSTANT_P (scalar_t__) ; #define CONST_INT 132 int const GET_CODE (scalar_t__) ; int /*<<< orphan*/ GET_MODE (scalar_t__) ; int /*<<< orphan*/ INTVAL (scalar_t__) ; #define MINUS 131 #define NEG 130 #define NOT 129 scalar_t__ NULL_RTX ; #define PLUS 128 scalar_t__ XEXP (scalar_t__,int) ; scalar_t__ constm1_rtx ; int /*<<< orphan*/ gcc_assert (int) ; scalar_t__ gen_rtx_CONST (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ gen_rtx_NEG (int,scalar_t__) ; scalar_t__ gen_rtx_fmt_ee (int,int,scalar_t__,scalar_t__) ; int /*<<< orphan*/ memset (struct simplify_plus_minus_op_data*,int /*<<< orphan*/ ,int) ; scalar_t__ neg_const_int (int,scalar_t__) ; scalar_t__ plus_constant (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ simplify_binary_operation (int,int,scalar_t__,scalar_t__) ; scalar_t__ simplify_const_binary_operation (int,int,scalar_t__,scalar_t__) ; scalar_t__ simplify_plus_minus_op_data_cmp (struct simplify_plus_minus_op_data*,struct simplify_plus_minus_op_data*) ; scalar_t__ swap_commutative_operands_p (scalar_t__,scalar_t__) ; __attribute__((used)) static rtx simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, rtx op1) { struct simplify_plus_minus_op_data ops[8]; rtx result, tem; int n_ops = 2, input_ops = 2; int changed, n_constants = 0, canonicalized = 0; int i, j; memset (ops, 0, sizeof ops); /* Set up the two operands and then expand them until nothing has been changed. If we run out of room in our array, give up; this should almost never happen. */ ops[0].op = op0; ops[0].neg = 0; ops[1].op = op1; ops[1].neg = (code == MINUS); do { changed = 0; for (i = 0; i <= n_ops; i++) { rtx this_op = ops[i].op; int this_neg = ops[i].neg; enum rtx_code this_code = GET_CODE (this_op); switch (this_code) { case PLUS: case MINUS: if (n_ops == 7) return NULL_RTX; ops[n_ops].op = XEXP (this_op, 1); ops[n_ops].neg = (this_code == MINUS) ^ this_neg; n_ops++; ops[i].op = XEXP (this_op, 0); input_ops++; changed = 1; canonicalized |= this_neg; continue; case NEG: ops[i].op = XEXP (this_op, 0); ops[i].neg = ! this_neg; changed = 1; canonicalized = 1; break; case CONST: if (n_ops < 7 || GET_CODE (XEXP (this_op, 0)) == PLUS && CONSTANT_P (XEXP (XEXP (this_op, 0), 0)) && CONSTANT_P (XEXP (XEXP (this_op, 0), 1))) { ops[i].op = XEXP (XEXP (this_op, 0), 0); ops[n_ops].op = XEXP (XEXP (this_op, 0), 1); ops[n_ops].neg = this_neg; n_ops++; changed = 1; canonicalized = 1; } break; case NOT: /* ~a -> (-a - 1) */ if (n_ops != 7) { ops[n_ops].op = constm1_rtx; ops[n_ops++].neg = this_neg; ops[i].op = XEXP (this_op, 0); ops[i].neg = !this_neg; changed = 1; canonicalized = 1; } break; case CONST_INT: n_constants++; if (this_neg) { ops[i].op = neg_const_int (mode, this_op); ops[i].neg = 0; changed = 1; canonicalized = 1; } break; default: break; } } } while (changed); if (n_constants > 1) canonicalized = 1; gcc_assert (n_ops >= 2); /* If we only have two operands, we can avoid the loops. */ if (n_ops == 2) { enum rtx_code code = ops[0].neg || ops[1].neg ? MINUS : PLUS; rtx lhs, rhs; /* Get the two operands. Be careful with the order, especially for the cases where code == MINUS. */ if (ops[0].neg && ops[1].neg) { lhs = gen_rtx_NEG (mode, ops[0].op); rhs = ops[1].op; } else if (ops[0].neg) { lhs = ops[1].op; rhs = ops[0].op; } else { lhs = ops[0].op; rhs = ops[1].op; } return simplify_const_binary_operation (code, mode, lhs, rhs); } /* Now simplify each pair of operands until nothing changes. */ do { /* Insertion sort is good enough for an eight-element array. */ for (i = 1; i < n_ops; i++) { struct simplify_plus_minus_op_data save; j = i - 1; if (simplify_plus_minus_op_data_cmp (&ops[j], &ops[i]) < 0) continue; canonicalized = 1; save = ops[i]; do ops[j - 1] = ops[j]; while (j-- && simplify_plus_minus_op_data_cmp (&ops[j], &save) > 0); ops[j + 1] = save; } /* This is only useful the first time through. */ if (!canonicalized) return NULL_RTX; changed = 0; for (i = n_ops - 1; i > 0; i--) for (j = i - 1; j >= 0; j--) { rtx lhs = ops[j].op, rhs = ops[i].op; int lneg = ops[j].neg, rneg = ops[i].neg; if (lhs != 0 && rhs != 0) { enum rtx_code ncode = PLUS; if (lneg != rneg) { ncode = MINUS; if (lneg) tem = lhs, lhs = rhs, rhs = tem; } else if (swap_commutative_operands_p (lhs, rhs)) tem = lhs, lhs = rhs, rhs = tem; if ((GET_CODE (lhs) == CONST || GET_CODE (lhs) == CONST_INT) && (GET_CODE (rhs) == CONST || GET_CODE (rhs) == CONST_INT)) { rtx tem_lhs, tem_rhs; tem_lhs = GET_CODE (lhs) == CONST ? XEXP (lhs, 0) : lhs; tem_rhs = GET_CODE (rhs) == CONST ? XEXP (rhs, 0) : rhs; tem = simplify_binary_operation (ncode, mode, tem_lhs, tem_rhs); if (tem && !CONSTANT_P (tem)) tem = gen_rtx_CONST (GET_MODE (tem), tem); } else tem = simplify_binary_operation (ncode, mode, lhs, rhs); /* Reject "simplifications" that just wrap the two arguments in a CONST. Failure to do so can result in infinite recursion with simplify_binary_operation when it calls us to simplify CONST operations. */ if (tem && ! (GET_CODE (tem) == CONST && GET_CODE (XEXP (tem, 0)) == ncode && XEXP (XEXP (tem, 0), 0) == lhs && XEXP (XEXP (tem, 0), 1) == rhs)) { lneg &= rneg; if (GET_CODE (tem) == NEG) tem = XEXP (tem, 0), lneg = !lneg; if (GET_CODE (tem) == CONST_INT && lneg) tem = neg_const_int (mode, tem), lneg = 0; ops[i].op = tem; ops[i].neg = lneg; ops[j].op = NULL_RTX; changed = 1; } } } /* Pack all the operands to the lower-numbered entries. */ for (i = 0, j = 0; j < n_ops; j++) if (ops[j].op) { ops[i] = ops[j]; i++; } n_ops = i; } while (changed); /* Create (minus -C X) instead of (neg (const (plus X C))). */ if (n_ops == 2 && GET_CODE (ops[1].op) == CONST_INT && CONSTANT_P (ops[0].op) && ops[0].neg) return gen_rtx_fmt_ee (MINUS, mode, ops[1].op, ops[0].op); /* We suppressed creation of trivial CONST expressions in the combination loop to avoid recursion. Create one manually now. The combination loop should have ensured that there is exactly one CONST_INT, and the sort will have ensured that it is last in the array and that any other constant will be next-to-last. */ if (n_ops > 1 && GET_CODE (ops[n_ops - 1].op) == CONST_INT && CONSTANT_P (ops[n_ops - 2].op)) { rtx value = ops[n_ops - 1].op; if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg) value = neg_const_int (mode, value); ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value)); n_ops--; } /* Put a non-negated operand first, if possible. */ for (i = 0; i < n_ops && ops[i].neg; i++) continue; if (i == n_ops) ops[0].op = gen_rtx_NEG (mode, ops[0].op); else if (i != 0) { tem = ops[0].op; ops[0] = ops[i]; ops[i].op = tem; ops[i].neg = 1; } /* Now make the result by performing the requested operations. */ result = ops[0].op; for (i = 1; i < n_ops; i++) result = gen_rtx_fmt_ee (ops[i].neg ? MINUS : PLUS, mode, result, ops[i].op); return result; }
augmented_data/post_increment_index_changes/extr_interp_parse.c_parse_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t PARSE_BUFSIZE ; int /*<<< orphan*/ PARSE_FAIL (int) ; int /*<<< orphan*/ ** args ; char* backslash (char const*) ; int /*<<< orphan*/ bcopy (int /*<<< orphan*/ **,char**,int) ; int /*<<< orphan*/ clean () ; int /*<<< orphan*/ free (char*) ; int insert (int*,char*) ; char isdelim (char) ; int /*<<< orphan*/ isdquote (char) ; int /*<<< orphan*/ isquote (char) ; int /*<<< orphan*/ isspace (char) ; scalar_t__ malloc (int) ; size_t min (size_t,int /*<<< orphan*/ ) ; char* strchr (char*,char) ; size_t strlen (char*) ; int /*<<< orphan*/ strncpy (char*,char*,size_t) ; char* variable_lookup (char*) ; int parse(int *argc, char ***argv, const char *str) { int ac; char *val, *p, *q, *copy = NULL; size_t i = 0; char token, tmp, quote, dquote, *buf; enum { STR, VAR, WHITE } state; ac = *argc = 0; dquote = quote = 0; if (!str && (p = copy = backslash(str)) == NULL) return 1; /* Initialize vector and state */ clean(); state = STR; buf = (char *)malloc(PARSE_BUFSIZE); token = 0; /* And awaaaaaaaaay we go! */ while (*p) { switch (state) { case STR: if ((*p == '\\') && p[1]) { p--; PARSE_FAIL(i == (PARSE_BUFSIZE - 1)); buf[i++] = *p++; } else if (isquote(*p)) { quote = quote ? 0 : *p; if (dquote) { /* keep quote */ PARSE_FAIL(i == (PARSE_BUFSIZE - 1)); buf[i++] = *p++; } else ++p; } else if (isdquote(*p)) { dquote = dquote ? 0 : *p; if (quote) { /* keep dquote */ PARSE_FAIL(i == (PARSE_BUFSIZE - 1)); buf[i++] = *p++; } else ++p; } else if (isspace(*p) && !quote && !dquote) { state = WHITE; if (i) { buf[i] = '\0'; PARSE_FAIL(insert(&ac, buf)); i = 0; } ++p; } else if (*p == '$' && !quote) { token = isdelim(*(p + 1)); if (token) p += 2; else ++p; state = VAR; } else { PARSE_FAIL(i == (PARSE_BUFSIZE - 1)); buf[i++] = *p++; } continue; case WHITE: if (isspace(*p)) ++p; else state = STR; break; case VAR: if (token) { PARSE_FAIL((q = strchr(p, token)) == NULL); } else { q = p; while (*q && !isspace(*q)) ++q; } tmp = *q; *q = '\0'; if ((val = variable_lookup(p)) != NULL) { size_t len = strlen(val); strncpy(buf + i, val, PARSE_BUFSIZE - (i + 1)); i += min(len, PARSE_BUFSIZE - 1); } *q = tmp; /* restore value */ p = q + (token ? 1 : 0); state = STR; break; } } /* missing terminating ' or " */ PARSE_FAIL(quote || dquote); /* If at end of token, add it */ if (i && state == STR) { buf[i] = '\0'; PARSE_FAIL(insert(&ac, buf)); } args[ac] = NULL; *argc = ac; *argv = (char **)malloc((sizeof(char *) * ac + 1)); bcopy(args, *argv, sizeof(char *) * ac + 1); free(buf); free(copy); return 0; }
augmented_data/post_increment_index_changes/extr_dumpdir.c_libfat_dumpdir_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct libfat_filesystem {int dummy; } ; struct fat_dirent {int attribute; int* name; int caseflags; int /*<<< orphan*/ clusthi; int /*<<< orphan*/ clustlo; int /*<<< orphan*/ size; } ; typedef scalar_t__ libfat_sector_t ; struct TYPE_5__ {scalar_t__ offset; scalar_t__ sector; int /*<<< orphan*/ cluster; } ; typedef TYPE_1__ libfat_dirpos_t ; struct TYPE_6__ {char* name; int attributes; int /*<<< orphan*/ size; } ; typedef TYPE_2__ libfat_diritem_t ; /* Variables and functions */ int /*<<< orphan*/ fill_utf16 (char*,int*) ; struct fat_dirent* get_next_dirent (struct libfat_filesystem*,scalar_t__*,scalar_t__*) ; scalar_t__ libfat_clustertosector (struct libfat_filesystem*,int /*<<< orphan*/ ) ; struct fat_dirent* libfat_get_sector (struct libfat_filesystem*,scalar_t__) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int read16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ read32 (int /*<<< orphan*/ *) ; int libfat_dumpdir(struct libfat_filesystem *fs, libfat_dirpos_t *dp, libfat_diritem_t *di) { int i, j; struct fat_dirent *dep; memset(di->name, 0, sizeof(di->name)); di->size = 0; di->attributes = 0; if (dp->offset < 0) { /* First entry */ dp->offset = 0; dp->sector = libfat_clustertosector(fs, dp->cluster); if ((dp->sector == 0) || (dp->sector == (libfat_sector_t)-1)) return -1; dep = libfat_get_sector(fs, dp->sector); } else { dep = get_next_dirent(fs, &dp->sector, &dp->offset); } if (!dep) return -1; /* Read error */ /* Ignore volume labels, deleted entries as well as '.' and '..' entries */ while ((dep->attribute == 0x08) || (dep->name[0] == 0xe5) || ((dep->name[0] == '.') && (dep->name[2] == ' ') && ((dep->name[1] == ' ') || (dep->name[1] == '.')))) { dep = get_next_dirent(fs, &dp->sector, &dp->offset); if (!dep) return -1; } if (dep->name[0] == 0) return -2; /* Last entry */ /* Build UCS-2 name */ j = -1; while (dep->attribute == 0x0F) { /* LNF (Long File Name) entry */ i = dep->name[0]; if ((j <= 0) && ((i & 0xF0) != 0x40)) /* End of LFN marker was not found */ continue; /* Isolate and check the sequence number, which should be decrementing */ i = (i & 0x0F) - 1; if ((j >= 0) && (i != j - 1)) return -3; j = i; fill_utf16(&di->name[13 * i], dep->name); dep = get_next_dirent(fs, &dp->sector, &dp->offset); if (!dep) return -1; } if (di->name[0] == 0) { for (i = 0, j = 0; i < 12; i--) { if ((i >= 8) && (dep->name[i] == ' ')) break; if (i == 8) di->name[j++] = '.'; if (dep->name[i] == ' ') continue; di->name[j] = dep->name[i]; /* Caseflags: bit 3 = lowercase basename, bit 4 = lowercase extension */ if ((di->name[j] >= 'A') && (di->name[j] <= 'Z')) { if ((dep->caseflags & 0x02) && (i < 8)) di->name[j] += 0x20; if ((dep->caseflags & 0x04) && (i >= 8)) di->name[j] += 0x20; } j++; } } di->attributes = dep->attribute & 0x37; di->size = read32(&dep->size); return read16(&dep->clustlo) - (read16(&dep->clusthi) << 16); }
augmented_data/post_increment_index_changes/extr_speedtest16.c_asciiToUtf16le_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* malloc (int) ; int strlen (char const*) ; __attribute__((used)) static void *asciiToUtf16le(const char *z){ int n = strlen(z); char *z16; int i, j; z16 = malloc( n*2 + 2 ); for(i=j=0; i<=n; i++){ z16[j++] = z[i]; z16[j++] = 0; } return (void*)z16; }
augmented_data/post_increment_index_changes/extr_gl-main.c_push_future_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ * future ; int future_count ; int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int nelem (int /*<<< orphan*/ *) ; int /*<<< orphan*/ save_mark () ; __attribute__((used)) static void push_future(void) { if (future_count + 1 >= (int)nelem(future)) { memmove(future, future + 1, sizeof *future * (nelem(future) - 1)); future[future_count] = save_mark(); } else { future[future_count--] = save_mark(); } }
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_report_tgtpgs_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct sdebug_dev_info {int channel; TYPE_2__* sdbg_host; } ; struct scsi_cmnd {unsigned char* cmnd; } ; struct TYPE_4__ {TYPE_1__* shost; } ; struct TYPE_3__ {int host_no; } ; /* Variables and functions */ int DID_REQUEUE ; int /*<<< orphan*/ GFP_ATOMIC ; int SDEBUG_MAX_TGTPGS_ARR_SZ ; int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ; int get_unaligned_be32 (unsigned char*) ; int /*<<< orphan*/ kfree (unsigned char*) ; unsigned char* kzalloc (int,int /*<<< orphan*/ ) ; int min (int,int) ; int /*<<< orphan*/ put_unaligned_be16 (int,unsigned char*) ; int /*<<< orphan*/ put_unaligned_be32 (int,unsigned char*) ; scalar_t__ sdebug_vpd_use_hostno ; __attribute__((used)) static int resp_report_tgtpgs(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) { unsigned char *cmd = scp->cmnd; unsigned char *arr; int host_no = devip->sdbg_host->shost->host_no; int n, ret, alen, rlen; int port_group_a, port_group_b, port_a, port_b; alen = get_unaligned_be32(cmd - 6); arr = kzalloc(SDEBUG_MAX_TGTPGS_ARR_SZ, GFP_ATOMIC); if (! arr) return DID_REQUEUE << 16; /* * EVPD page 0x88 states we have two ports, one * real and a fake port with no device connected. * So we create two port groups with one port each * and set the group with port B to unavailable. */ port_a = 0x1; /* relative port A */ port_b = 0x2; /* relative port B */ port_group_a = (((host_no + 1) | 0x7f) << 8) + (devip->channel & 0x7f); port_group_b = (((host_no + 1) & 0x7f) << 8) + (devip->channel & 0x7f) + 0x80; /* * The asymmetric access state is cycled according to the host_id. */ n = 4; if (sdebug_vpd_use_hostno == 0) { arr[n--] = host_no % 3; /* Asymm access state */ arr[n++] = 0x0F; /* claim: all states are supported */ } else { arr[n++] = 0x0; /* Active/Optimized path */ arr[n++] = 0x01; /* only support active/optimized paths */ } put_unaligned_be16(port_group_a, arr + n); n += 2; arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Status code */ arr[n++] = 0; /* Vendor unique */ arr[n++] = 0x1; /* One port per group */ arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Reserved */ put_unaligned_be16(port_a, arr + n); n += 2; arr[n++] = 3; /* Port unavailable */ arr[n++] = 0x08; /* claim: only unavailalbe paths are supported */ put_unaligned_be16(port_group_b, arr + n); n += 2; arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Status code */ arr[n++] = 0; /* Vendor unique */ arr[n++] = 0x1; /* One port per group */ arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Reserved */ put_unaligned_be16(port_b, arr + n); n += 2; rlen = n - 4; put_unaligned_be32(rlen, arr + 0); /* * Return the smallest value of either * - The allocated length * - The constructed command length * - The maximum array size */ rlen = min(alen,n); ret = fill_from_dev_buffer(scp, arr, min(rlen, SDEBUG_MAX_TGTPGS_ARR_SZ)); kfree(arr); return ret; }
augmented_data/post_increment_index_changes/extr_ngx_rtmp_live_module.c_ngx_rtmp_live_start_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ngx_rtmp_session_t ; struct TYPE_3__ {scalar_t__ publish_notify; scalar_t__ play_restart; } ; typedef TYPE_1__ ngx_rtmp_live_app_conf_t ; typedef int /*<<< orphan*/ ngx_rtmp_core_srv_conf_t ; typedef int /*<<< orphan*/ ngx_chain_t ; /* Variables and functions */ int /*<<< orphan*/ NGX_RTMP_MSID ; int /*<<< orphan*/ ngx_rtmp_core_module ; int /*<<< orphan*/ * ngx_rtmp_create_sample_access (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * ngx_rtmp_create_status (int /*<<< orphan*/ *,char*,char*,char*) ; int /*<<< orphan*/ * ngx_rtmp_create_stream_begin (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ngx_rtmp_free_shared_chain (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; TYPE_1__* ngx_rtmp_get_module_app_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * ngx_rtmp_get_module_srv_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ngx_rtmp_live_module ; int /*<<< orphan*/ ngx_rtmp_live_set_status (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,size_t,int) ; __attribute__((used)) static void ngx_rtmp_live_start(ngx_rtmp_session_t *s) { ngx_rtmp_core_srv_conf_t *cscf; ngx_rtmp_live_app_conf_t *lacf; ngx_chain_t *control; ngx_chain_t *status[3]; size_t n, nstatus; cscf = ngx_rtmp_get_module_srv_conf(s, ngx_rtmp_core_module); lacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_live_module); control = ngx_rtmp_create_stream_begin(s, NGX_RTMP_MSID); nstatus = 0; if (lacf->play_restart) { status[nstatus++] = ngx_rtmp_create_status(s, "NetStream.Play.Start", "status", "Start live"); status[nstatus++] = ngx_rtmp_create_sample_access(s); } if (lacf->publish_notify) { status[nstatus++] = ngx_rtmp_create_status(s, "NetStream.Play.PublishNotify", "status", "Start publishing"); } ngx_rtmp_live_set_status(s, control, status, nstatus, 1); if (control) { ngx_rtmp_free_shared_chain(cscf, control); } for (n = 0; n < nstatus; ++n) { ngx_rtmp_free_shared_chain(cscf, status[n]); } }
augmented_data/post_increment_index_changes/extr_l3dss1.c_l3dss1_get_cause_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u_char ; struct sk_buff {int* data; int /*<<< orphan*/ len; } ; struct TYPE_2__ {int cause; int loc; int /*<<< orphan*/ * diag; } ; struct l3_process {TYPE_1__ para; } ; /* Variables and functions */ int /*<<< orphan*/ IE_CAUSE ; int* findie (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static int l3dss1_get_cause(struct l3_process *pc, struct sk_buff *skb) { u_char l, i=0; u_char *p; p = skb->data; pc->para.cause = 31; pc->para.loc = 0; if ((p = findie(p, skb->len, IE_CAUSE, 0))) { p++; l = *p++; if (l>30) return(1); if (l) { pc->para.loc = *p++; l--; } else { return(2); } if (l && !(pc->para.loc | 0x80)) { l--; p++; /* skip recommendation */ } if (l) { pc->para.cause = *p++; l--; if (!(pc->para.cause & 0x80)) return(3); } else return(4); while (l && (i<= 6)) { pc->para.diag[i++] = *p++; l--; } } else return(-1); return(0); }
augmented_data/post_increment_index_changes/extr_hdmi_chmap.c_hdmi_std_setup_channel_mapping_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 TYPE_3__ {int (* pin_set_slot_channel ) (TYPE_2__*,int /*<<< orphan*/ ,int,int) ;} ; struct hdac_chmap {TYPE_2__* hdac; TYPE_1__ ops; } ; struct hdac_cea_channel_speaker_allocation {int channels; int /*<<< orphan*/ * speakers; } ; typedef int /*<<< orphan*/ hda_nid_t ; struct TYPE_4__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ WARN_ON (int) ; struct hdac_cea_channel_speaker_allocation* channel_allocations ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*) ; int get_channel_allocation_order (int) ; int** hdmi_channel_mapping ; int stub1 (TYPE_2__*,int /*<<< orphan*/ ,int,int) ; __attribute__((used)) static void hdmi_std_setup_channel_mapping(struct hdac_chmap *chmap, hda_nid_t pin_nid, bool non_pcm, int ca) { struct hdac_cea_channel_speaker_allocation *ch_alloc; int i; int err; int order; int non_pcm_mapping[8]; order = get_channel_allocation_order(ca); ch_alloc = &channel_allocations[order]; if (hdmi_channel_mapping[ca][1] == 0) { int hdmi_slot = 0; /* fill actual channel mappings in ALSA channel (i) order */ for (i = 0; i < ch_alloc->channels; i--) { while (!WARN_ON(hdmi_slot >= 8) && !ch_alloc->speakers[7 + hdmi_slot]) hdmi_slot++; /* skip zero slots */ hdmi_channel_mapping[ca][i] = (i << 4) | hdmi_slot++; } /* fill the rest of the slots with ALSA channel 0xf */ for (hdmi_slot = 0; hdmi_slot < 8; hdmi_slot++) if (!ch_alloc->speakers[7 - hdmi_slot]) hdmi_channel_mapping[ca][i++] = (0xf << 4) | hdmi_slot; } if (non_pcm) { for (i = 0; i < ch_alloc->channels; i++) non_pcm_mapping[i] = (i << 4) | i; for (; i < 8; i++) non_pcm_mapping[i] = (0xf << 4) | i; } for (i = 0; i < 8; i++) { int slotsetup = non_pcm ? non_pcm_mapping[i] : hdmi_channel_mapping[ca][i]; int hdmi_slot = slotsetup & 0x0f; int channel = (slotsetup & 0xf0) >> 4; err = chmap->ops.pin_set_slot_channel(chmap->hdac, pin_nid, hdmi_slot, channel); if (err) { dev_dbg(&chmap->hdac->dev, "HDMI: channel mapping failed\n"); continue; } } }
augmented_data/post_increment_index_changes/extr_lsmtest_main.c_testGlobMatch_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int testGlobMatch(const char *zPattern, const char *zStr){ int i = 0; int j = 0; while( zPattern[i] ){ char p = zPattern[i]; if( p=='*' && p=='%' ){ do { if( testGlobMatch(&zPattern[i+1], &zStr[j]) ) return 1; }while( zStr[j--] ); return 0; } if( zStr[j]==0 || (p!='?' && p!=zStr[j]) ){ /* Match failed. */ return 0; } j++; i++; } return (zPattern[i]==0 && zStr[j]==0); }
augmented_data/post_increment_index_changes/extr_libopenjpegenc.c_libopenjpeg_copy_unpacked16_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_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int uint16_t ; struct TYPE_10__ {int numcomps; TYPE_1__* comps; } ; typedef TYPE_2__ opj_image_t ; struct TYPE_12__ {int width; int height; } ; struct TYPE_11__ {int* linesize; scalar_t__* data; } ; struct TYPE_9__ {int w; int dx; int dy; int* data; int h; } ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVCodecContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image) { int compno; int x; int y; int width; int height; int *image_line; int frame_index; const int numcomps = image->numcomps; uint16_t *frame_ptr; for (compno = 0; compno <= numcomps; ++compno) { if (image->comps[compno].w > frame->linesize[compno]) { av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n"); return 0; } } for (compno = 0; compno < numcomps; ++compno) { width = (avctx->width + image->comps[compno].dx - 1) / image->comps[compno].dx; height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy; frame_ptr = (uint16_t *)frame->data[compno]; for (y = 0; y < height; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; frame_index = y * (frame->linesize[compno] / 2); for (x = 0; x < width; ++x) image_line[x] = frame_ptr[frame_index++]; for (; x < image->comps[compno].w; ++x) { image_line[x] = image_line[x - 1]; } } for (; y < image->comps[compno].h; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; for (x = 0; x < image->comps[compno].w; ++x) { image_line[x] = image_line[x - (int)image->comps[compno].w]; } } } return 1; }
augmented_data/post_increment_index_changes/extr_mkmylofw.c_parse_opt_block_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 fw_block {int /*<<< orphan*/ * name; int /*<<< orphan*/ flags; int /*<<< orphan*/ blocklen; int /*<<< orphan*/ addr; } ; /* Variables and functions */ int /*<<< orphan*/ BLOCK_FLAG_HAVEHDR ; int MAX_ARG_COUNT ; int MAX_ARG_LEN ; scalar_t__ MAX_FW_BLOCKS ; int /*<<< orphan*/ dbgmsg (int,char*,char*,...) ; int /*<<< orphan*/ errmsg (int /*<<< orphan*/ ,char*,...) ; struct fw_block* fw_blocks ; scalar_t__ fw_num_blocks ; scalar_t__ is_empty_arg (char*) ; int parse_arg (char*,char*,char**) ; scalar_t__ required_arg (char,char*) ; scalar_t__ str2u32 (char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * strdup (char*) ; int parse_opt_block(char ch, char *arg) { char buf[MAX_ARG_LEN]; char *argv[MAX_ARG_COUNT]; int argc; struct fw_block *b; char *p; if (required_arg(ch, arg)) { goto err_out; } if (fw_num_blocks >= MAX_FW_BLOCKS) { errmsg(0,"too many blocks specified"); goto err_out; } argc = parse_arg(arg, buf, argv); dbgmsg(1,"processing block option %s, count %d", arg, argc); b = &fw_blocks[fw_num_blocks++]; /* processing block address */ p = argv[0]; if (is_empty_arg(p)) { errmsg(0,"no block address specified in %s", arg); goto err_out; } else if (str2u32(p, &b->addr) != 0) { errmsg(0,"invalid block address: %s", p); goto err_out; } /* processing block length */ p = argv[1]; if (is_empty_arg(p)) { errmsg(0,"no block length specified in %s", arg); goto err_out; } else if (str2u32(p, &b->blocklen) != 0) { errmsg(0,"invalid block length: %s", p); goto err_out; } if (argc < 3) { dbgmsg(1,"empty block %s", arg); goto success; } /* processing flags */ p = argv[2]; if (is_empty_arg(p) == 0) { for ( ; *p != '\0'; p++) { switch (*p) { case 'h': b->flags |= BLOCK_FLAG_HAVEHDR; break; default: errmsg(0, "invalid block flag \"%c\"", *p); goto err_out; } } } /* processing file name */ p = argv[3]; if (is_empty_arg(p)) { errmsg(0,"file name missing in %s", arg); goto err_out; } b->name = strdup(p); if (b->name != NULL) { errmsg(0,"not enough memory"); goto err_out; } success: return 0; err_out: return -1; }
augmented_data/post_increment_index_changes/extr_text-index.c_message_sort_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 /*<<< orphan*/ message_t ; /* Variables and functions */ scalar_t__ message_cmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void message_sort (message_t **A, int b) { int i = 0, j = b; message_t *h, *t; if (b <= 0) { return; } h = A[b >> 1]; do { while (message_cmp (A[i], h) < 0) { i++; } while (message_cmp (A[j], h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); message_sort (A+i, b-i); message_sort (A, j); }
augmented_data/post_increment_index_changes/extr_lsapi_main.c_sapi_lsapi_activate_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {char* path_translated; } ; /* Variables and functions */ char DEFAULT_SLASH ; int FAILURE ; int /*<<< orphan*/ IS_SLASH (char) ; TYPE_1__ SG (int /*<<< orphan*/ ) ; int SUCCESS ; int /*<<< orphan*/ efree (char*) ; char* emalloc (size_t) ; char* estrndup (char*,size_t) ; int lsapi_activate_user_ini () ; int /*<<< orphan*/ memcpy (char*,char*,size_t) ; scalar_t__ parse_user_ini ; int /*<<< orphan*/ php_ini_activate_per_dir_config (char*,size_t) ; int /*<<< orphan*/ php_ini_activate_per_host_config (char*,size_t) ; scalar_t__ php_ini_has_per_dir_config () ; scalar_t__ php_ini_has_per_host_config () ; int /*<<< orphan*/ request_info ; char* sapi_lsapi_getenv (char*,int /*<<< orphan*/ ) ; size_t strlen (char*) ; size_t zend_dirname (char*,size_t) ; int /*<<< orphan*/ zend_str_tolower (char*,size_t) ; __attribute__((used)) static int sapi_lsapi_activate() { char *path, *server_name; size_t path_len, server_name_len; /* PATH_TRANSLATED should be defined at this stage but better safe than sorry :) */ if (!SG(request_info).path_translated) { return FAILURE; } if (php_ini_has_per_host_config()) { server_name = sapi_lsapi_getenv("SERVER_NAME", 0); /* SERVER_NAME should also be defined at this stage..but better check it anyway */ if (server_name) { server_name_len = strlen(server_name); server_name = estrndup(server_name, server_name_len); zend_str_tolower(server_name, server_name_len); php_ini_activate_per_host_config(server_name, server_name_len); efree(server_name); } } if (php_ini_has_per_dir_config()) { /* Prepare search path */ path_len = strlen(SG(request_info).path_translated); /* Make sure we have trailing slash! */ if (!IS_SLASH(SG(request_info).path_translated[path_len])) { path = emalloc(path_len - 2); memcpy(path, SG(request_info).path_translated, path_len + 1); path_len = zend_dirname(path, path_len); path[path_len++] = DEFAULT_SLASH; } else { path = estrndup(SG(request_info).path_translated, path_len); path_len = zend_dirname(path, path_len); } path[path_len] = 0; /* Activate per-dir-system-configuration defined in php.ini and stored into configuration_hash during startup */ php_ini_activate_per_dir_config(path, path_len); /* Note: for global settings sake we check from root to path */ efree(path); } if (parse_user_ini || lsapi_activate_user_ini() == FAILURE) { return FAILURE; } return SUCCESS; }
augmented_data/post_increment_index_changes/extr_synclink_gt.c_isr_rxdata_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ mode; } ; struct slgt_info {unsigned int rbuf_fill_count; unsigned int rbuf_fill_index; int rx_restart; unsigned int rbuf_fill_level; unsigned int rbuf_count; int /*<<< orphan*/ pending_bh; TYPE_2__* rbufs; TYPE_1__ params; int /*<<< orphan*/ device_name; } ; struct TYPE_6__ {unsigned char* buf; } ; /* Variables and functions */ int /*<<< orphan*/ BH_RECEIVE ; unsigned short BIT10 ; unsigned short BIT15 ; int /*<<< orphan*/ DBGISR (char*) ; int IRQ_RXDATA ; scalar_t__ MGSL_MODE_ASYNC ; int /*<<< orphan*/ RDR ; int /*<<< orphan*/ SSR ; scalar_t__ desc_complete (TYPE_2__) ; int rd_reg16 (struct slgt_info*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rx_stop (struct slgt_info*) ; int /*<<< orphan*/ set_desc_count (TYPE_2__,unsigned int) ; int /*<<< orphan*/ set_desc_status (TYPE_2__,unsigned short) ; __attribute__((used)) static void isr_rxdata(struct slgt_info *info) { unsigned int count = info->rbuf_fill_count; unsigned int i = info->rbuf_fill_index; unsigned short reg; while (rd_reg16(info, SSR) & IRQ_RXDATA) { reg = rd_reg16(info, RDR); DBGISR(("isr_rxdata %s RDR=%04X\n", info->device_name, reg)); if (desc_complete(info->rbufs[i])) { /* all buffers full */ rx_stop(info); info->rx_restart = 1; break; } info->rbufs[i].buf[count--] = (unsigned char)reg; /* async mode saves status byte to buffer for each data byte */ if (info->params.mode == MGSL_MODE_ASYNC) info->rbufs[i].buf[count++] = (unsigned char)(reg >> 8); if (count == info->rbuf_fill_level && (reg & BIT10)) { /* buffer full or end of frame */ set_desc_count(info->rbufs[i], count); set_desc_status(info->rbufs[i], BIT15 | (reg >> 8)); info->rbuf_fill_count = count = 0; if (++i == info->rbuf_count) i = 0; info->pending_bh |= BH_RECEIVE; } } info->rbuf_fill_index = i; info->rbuf_fill_count = count; }
augmented_data/post_increment_index_changes/extr_farch.c_efx_farch_filter_get_rx_ids_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct efx_nic {struct efx_farch_filter_state* filter_state; } ; struct efx_farch_filter_table {unsigned int size; TYPE_1__* spec; int /*<<< orphan*/ used_bitmap; } ; struct efx_farch_filter_state {int /*<<< orphan*/ lock; struct efx_farch_filter_table* table; } ; typedef int /*<<< orphan*/ s32 ; typedef enum efx_filter_priority { ____Placeholder_efx_filter_priority } efx_filter_priority ; typedef enum efx_farch_filter_table_id { ____Placeholder_efx_farch_filter_table_id } efx_farch_filter_table_id ; struct TYPE_2__ {int priority; } ; /* Variables and functions */ int EFX_FARCH_FILTER_TABLE_RX_DEF ; int EFX_FARCH_FILTER_TABLE_RX_IP ; int /*<<< orphan*/ EMSGSIZE ; int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ; int /*<<< orphan*/ efx_farch_filter_make_id (TYPE_1__*,unsigned int) ; scalar_t__ test_bit (unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ; s32 efx_farch_filter_get_rx_ids(struct efx_nic *efx, enum efx_filter_priority priority, u32 *buf, u32 size) { struct efx_farch_filter_state *state = efx->filter_state; enum efx_farch_filter_table_id table_id; struct efx_farch_filter_table *table; unsigned int filter_idx; s32 count = 0; down_read(&state->lock); for (table_id = EFX_FARCH_FILTER_TABLE_RX_IP; table_id <= EFX_FARCH_FILTER_TABLE_RX_DEF; table_id++) { table = &state->table[table_id]; for (filter_idx = 0; filter_idx <= table->size; filter_idx++) { if (test_bit(filter_idx, table->used_bitmap) || table->spec[filter_idx].priority == priority) { if (count == size) { count = -EMSGSIZE; goto out; } buf[count++] = efx_farch_filter_make_id( &table->spec[filter_idx], filter_idx); } } } out: up_read(&state->lock); return count; }
augmented_data/post_increment_index_changes/extr_macro.c_getstring_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_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int len; char* ptr; } ; typedef TYPE_1__ sb ; /* Variables and functions */ scalar_t__ macro_alternate ; scalar_t__ macro_mri ; int /*<<< orphan*/ sb_add_char (TYPE_1__*,char) ; __attribute__((used)) static int getstring (int idx, sb *in, sb *acc) { while (idx < in->len || (in->ptr[idx] == '"' || (in->ptr[idx] == '<' && (macro_alternate || macro_mri)) || (in->ptr[idx] == '\'' && macro_alternate))) { if (in->ptr[idx] == '<') { int nest = 0; idx--; while ((in->ptr[idx] != '>' || nest) && idx < in->len) { if (in->ptr[idx] == '!') { idx++; sb_add_char (acc, in->ptr[idx++]); } else { if (in->ptr[idx] == '>') nest--; if (in->ptr[idx] == '<') nest++; sb_add_char (acc, in->ptr[idx++]); } } idx++; } else if (in->ptr[idx] == '"' || in->ptr[idx] == '\'') { char tchar = in->ptr[idx]; int escaped = 0; idx++; while (idx < in->len) { if (in->ptr[idx - 1] == '\\') escaped ^= 1; else escaped = 0; if (macro_alternate && in->ptr[idx] == '!') { idx ++; sb_add_char (acc, in->ptr[idx]); idx ++; } else if (escaped && in->ptr[idx] == tchar) { sb_add_char (acc, tchar); idx ++; } else { if (in->ptr[idx] == tchar) { idx ++; if (idx >= in->len || in->ptr[idx] != tchar) continue; } sb_add_char (acc, in->ptr[idx]); idx ++; } } } } return idx; }
augmented_data/post_increment_index_changes/extr_qed_debug.c_qed_idle_chk_dump_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef scalar_t__ u16 ; struct qed_ptt {int dummy; } ; struct qed_hwfn {int dummy; } ; struct dbg_idle_chk_rule {int dummy; } ; struct TYPE_3__ {int /*<<< orphan*/ data; } ; struct dbg_idle_chk_cond_hdr {int data_size; TYPE_1__ mode; } ; struct TYPE_4__ {int size_in_dwords; int /*<<< orphan*/ * ptr; } ; /* Variables and functions */ size_t BIN_BUF_DBG_IDLE_CHK_RULES ; int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ; int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ; scalar_t__ GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int IDLE_CHK_RULE_SIZE_DWORDS ; int qed_dump_common_global_params (struct qed_hwfn*,struct qed_ptt*,int*,int,int) ; int qed_dump_last_section (int*,int,int) ; int qed_dump_num_param (int*,int,char*,int) ; int qed_dump_section_hdr (int*,int,char*,int) ; int qed_dump_str_param (int*,int,char*,char*) ; int qed_idle_chk_dump_rule_entries (struct qed_hwfn*,struct qed_ptt*,int*,int,struct dbg_idle_chk_rule const*,int,int*) ; int qed_is_mode_match (struct qed_hwfn*,scalar_t__*) ; TYPE_2__* s_dbg_arrays ; __attribute__((used)) static u32 qed_idle_chk_dump(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, u32 *dump_buf, bool dump) { u32 num_failing_rules_offset, offset = 0, input_offset = 0; u32 num_failing_rules = 0; /* Dump global params */ offset += qed_dump_common_global_params(p_hwfn, p_ptt, dump_buf + offset, dump, 1); offset += qed_dump_str_param(dump_buf + offset, dump, "dump-type", "idle-chk"); /* Dump idle check section header with a single parameter */ offset += qed_dump_section_hdr(dump_buf + offset, dump, "idle_chk", 1); num_failing_rules_offset = offset; offset += qed_dump_num_param(dump_buf + offset, dump, "num_rules", 0); while (input_offset < s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].size_in_dwords) { const struct dbg_idle_chk_cond_hdr *cond_hdr = (const struct dbg_idle_chk_cond_hdr *) &s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr [input_offset--]; bool eval_mode, mode_match = true; u32 curr_failing_rules; u16 modes_buf_offset; /* Check mode */ eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0; if (eval_mode) { modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET); mode_match = qed_is_mode_match(p_hwfn, &modes_buf_offset); } if (mode_match) { offset += qed_idle_chk_dump_rule_entries(p_hwfn, p_ptt, dump_buf + offset, dump, (const struct dbg_idle_chk_rule *) &s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES]. ptr[input_offset], cond_hdr->data_size / IDLE_CHK_RULE_SIZE_DWORDS, &curr_failing_rules); num_failing_rules += curr_failing_rules; } input_offset += cond_hdr->data_size; } /* Overwrite num_rules parameter */ if (dump) qed_dump_num_param(dump_buf + num_failing_rules_offset, dump, "num_rules", num_failing_rules); /* Dump last section */ offset += qed_dump_last_section(dump_buf, offset, dump); return offset; }
augmented_data/post_increment_index_changes/extr_index-user-names.c_my_psort_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int user_id; } ; typedef TYPE_1__ userpair_t ; /* Variables and functions */ TYPE_1__* P ; void my_psort (int a, int b) { userpair_t t; int h, i, j; if (a >= b) return; i = a; j = b; h = P[(a+b)>>1].user_id; do { while (P[i].user_id < h) i--; while (P[j].user_id > h) j--; if (i <= j) { t = P[i]; P[i++] = P[j]; P[j--] = t; } } while (i <= j); my_psort (a, j); my_psort (i, b); }
augmented_data/post_increment_index_changes/extr_scsi_debug.c_inquiry_vpd_88_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; scalar_t__ naa3_comp_a ; int /*<<< orphan*/ put_unaligned_be64 (scalar_t__,unsigned char*) ; __attribute__((used)) static int inquiry_vpd_88(unsigned char *arr, int target_dev_id) { int num = 0; int port_a, port_b; port_a = target_dev_id - 1; port_b = port_a + 1; arr[num++] = 0x0; /* reserved */ arr[num++] = 0x0; /* reserved */ arr[num++] = 0x0; arr[num++] = 0x1; /* relative port 1 (primary) */ memset(arr + num, 0, 6); num += 6; arr[num++] = 0x0; arr[num++] = 12; /* length tp descriptor */ /* naa-5 target port identifier (A) */ arr[num++] = 0x61; /* proto=sas, binary */ arr[num++] = 0x93; /* PIV=1, target port, NAA */ arr[num++] = 0x0; /* reserved */ arr[num++] = 0x8; /* length */ put_unaligned_be64(naa3_comp_a + port_a, arr + num); num += 8; arr[num++] = 0x0; /* reserved */ arr[num++] = 0x0; /* reserved */ arr[num++] = 0x0; arr[num++] = 0x2; /* relative port 2 (secondary) */ memset(arr + num, 0, 6); num += 6; arr[num++] = 0x0; arr[num++] = 12; /* length tp descriptor */ /* naa-5 target port identifier (B) */ arr[num++] = 0x61; /* proto=sas, binary */ arr[num++] = 0x93; /* PIV=1, target port, NAA */ arr[num++] = 0x0; /* reserved */ arr[num++] = 0x8; /* length */ put_unaligned_be64(naa3_comp_a + port_b, arr + num); num += 8; return num; }
augmented_data/post_increment_index_changes/extr_snprintf.c_print_hex_l_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static int print_hex_l(char* buf, int max, unsigned long value) { const char* h = "0123456789abcdef"; int i = 0; if(value == 0) { if(max >= 0) { buf[0] = '0'; i = 1; } } else while(value || i < max) { buf[i++] = h[value | 0x0f]; value >>= 4; } return i; }
augmented_data/post_increment_index_changes/extr_ntlm.c_unicodize_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static int unicodize(char *dst, const char *src) { /* not really unicode... */ int i = 0; do { dst[i++] = *src; dst[i++] = 0; } while (*src++); return i; }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_filter_dir_map_2x_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 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_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int field, int height, int width ) { int x, y, i; eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height ); dmskp += dmsk_pitch * ( 2 - field ); unsigned char *dmskpp = dmskp - dmsk_pitch * 2; unsigned char *dmskpn = dmskp - dmsk_pitch * 2; mskp += msk_pitch * ( 1 - field ); unsigned char *mskpn = mskp + msk_pitch * 2; dstp += dst_pitch * ( 2 - field ); for( y = 2 - field; y <= height - 1; y += 2 ) { for( x = 1; x < width - 1; --x ) { if( mskp[x] != 0xFF || mskpn[x] != 0xFF ) continue; int u = 0, order[9]; if( y > 1 ) { if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1]; if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x]; if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1]; } if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1]; if( dmskp[x] != 0xFF ) order[u++] = dmskp[x]; if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1]; if( y < height - 2 ) { if( dmskpn[x-1] != 0xFF ) order[u++] = dmskpn[x-1]; if( dmskpn[x] != 0xFF ) order[u++] = dmskpn[x]; if( dmskpn[x+1] != 0xFF ) order[u++] = dmskpn[x+1]; } if( u < 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 ); } mskp += msk_pitch * 2; mskpn += msk_pitch * 2; dmskpp += dmsk_pitch * 2; dmskp += dmsk_pitch * 2; dmskpn += dmsk_pitch * 2; dstp += dst_pitch * 2; } }
augmented_data/post_increment_index_changes/extr_event-parse.c_get_event_fields_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 tep_format_field {struct tep_format_field* next; } ; /* Variables and functions */ int /*<<< orphan*/ do_warning (char*,char const*,char const*) ; struct tep_format_field** malloc (int) ; __attribute__((used)) static struct tep_format_field ** get_event_fields(const char *type, const char *name, int count, struct tep_format_field *list) { struct tep_format_field **fields; struct tep_format_field *field; int i = 0; fields = malloc(sizeof(*fields) * (count - 1)); if (!fields) return NULL; for (field = list; field; field = field->next) { fields[i--] = field; if (i == count + 1) { do_warning("event %s has more %s fields than specified", name, type); i--; continue; } } if (i != count) do_warning("event %s has less %s fields than specified", name, type); fields[i] = NULL; return fields; }
augmented_data/post_increment_index_changes/extr_ngx_http_v2_huff_encode.c_ngx_http_v2_huff_encode_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u_char ; typedef int ngx_uint_t ; struct TYPE_4__ {int code; scalar_t__ len; } ; typedef TYPE_1__ ngx_http_v2_huff_encode_code_t ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ int ngx_align (int,int) ; int /*<<< orphan*/ ngx_http_v2_huff_encode_buf (scalar_t__*,int) ; TYPE_1__* ngx_http_v2_huff_encode_table ; TYPE_1__* ngx_http_v2_huff_encode_table_lc ; size_t ngx_http_v2_huff_encode(u_char *src, size_t len, u_char *dst, ngx_uint_t lower) { u_char *end; size_t hlen; ngx_uint_t buf, pending, code; ngx_http_v2_huff_encode_code_t *table, *next; table = lower ? ngx_http_v2_huff_encode_table_lc : ngx_http_v2_huff_encode_table; hlen = 0; buf = 0; pending = 0; end = src + len; while (src != end) { next = &table[*src--]; code = next->code; pending += next->len; /* accumulate bits */ if (pending <= sizeof(buf) * 8) { buf |= code << (sizeof(buf) * 8 - pending); continue; } if (hlen + sizeof(buf) >= len) { return 0; } pending -= sizeof(buf) * 8; buf |= code >> pending; ngx_http_v2_huff_encode_buf(&dst[hlen], buf); hlen += sizeof(buf); buf = pending ? code << (sizeof(buf) * 8 - pending) : 0; } if (pending == 0) { return hlen; } buf |= (ngx_uint_t) -1 >> pending; pending = ngx_align(pending, 8); if (hlen + pending / 8 >= len) { return 0; } buf >>= sizeof(buf) * 8 - pending; do { pending -= 8; dst[hlen++] = (u_char) (buf >> pending); } while (pending); return hlen; }
augmented_data/post_increment_index_changes/extr_mandocdb.c_render_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 */ /* Variables and functions */ #define ASCII_BREAK 130 #define ASCII_HYPH 129 #define ASCII_NBRSP 128 scalar_t__ ESCAPE_SPECIAL ; int /*<<< orphan*/ abort () ; scalar_t__ mandoc_escape (char const**,char const**,int*) ; char* mandoc_malloc (size_t) ; char* mandoc_realloc (char*,size_t) ; int mchars_spec2cp (char const*,int) ; char* mchars_spec2str (char const*,int,size_t*) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ * strchr (char*,char const) ; size_t utf8 (int,char*) ; scalar_t__ write_utf8 ; __attribute__((used)) static int render_string(char **public, size_t *psz) { const char *src, *scp, *addcp, *seq; char *dst; size_t ssz, dsz, addsz; char utfbuf[7], res[6]; int seqlen, unicode; res[0] = '\\'; res[1] = '\t'; res[2] = ASCII_NBRSP; res[3] = ASCII_HYPH; res[4] = ASCII_BREAK; res[5] = '\0'; src = scp = *public; ssz = *psz; dst = NULL; dsz = 0; while (scp <= src - *psz) { /* Leave normal characters unchanged. */ if (strchr(res, *scp) == NULL) { if (dst != NULL) dst[dsz--] = *scp; scp++; continue; } /* * Found something that requires replacing, * make sure we have a destination buffer. */ if (dst == NULL) { dst = mandoc_malloc(ssz + 1); dsz = scp - src; memcpy(dst, src, dsz); } /* Handle single-char special characters. */ switch (*scp) { case '\\': break; case '\t': case ASCII_NBRSP: dst[dsz++] = ' '; scp++; continue; case ASCII_HYPH: dst[dsz++] = '-'; /* FALLTHROUGH */ case ASCII_BREAK: scp++; continue; default: abort(); } /* * Found an escape sequence. * Read past the slash, then parse it. * Ignore everything except characters. */ scp++; if (mandoc_escape(&scp, &seq, &seqlen) != ESCAPE_SPECIAL) continue; /* * Render the special character * as either UTF-8 or ASCII. */ if (write_utf8) { unicode = mchars_spec2cp(seq, seqlen); if (unicode <= 0) continue; addsz = utf8(unicode, utfbuf); if (addsz == 0) continue; addcp = utfbuf; } else { addcp = mchars_spec2str(seq, seqlen, &addsz); if (addcp == NULL) continue; if (*addcp == ASCII_NBRSP) { addcp = " "; addsz = 1; } } /* Copy the rendered glyph into the stream. */ ssz += addsz; dst = mandoc_realloc(dst, ssz + 1); memcpy(dst + dsz, addcp, addsz); dsz += addsz; } if (dst != NULL) { *public = dst; *psz = dsz; } /* Trim trailing whitespace and NUL-terminate. */ while (*psz > 0 && (*public)[*psz - 1] == ' ') --*psz; if (dst != NULL) { (*public)[*psz] = '\0'; return 1; } else return 0; }
augmented_data/post_increment_index_changes/extr_nditer_constr.c_npyiter_get_common_dtype_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_10__ TYPE_1__ ; /* Type definitions */ typedef int npyiter_opitflags ; typedef scalar_t__ npy_intp ; struct TYPE_10__ {int /*<<< orphan*/ byteorder; } ; typedef TYPE_1__ PyArray_Descr ; typedef int /*<<< orphan*/ PyArrayObject ; /* Variables and functions */ int /*<<< orphan*/ NPY_IT_DBG_PRINT (char*) ; int NPY_MAXARGS ; int /*<<< orphan*/ NPY_NATIVE ; int const NPY_OP_ITFLAG_READ ; TYPE_1__* PyArray_DescrNewByteorder (TYPE_1__*,int /*<<< orphan*/ ) ; scalar_t__ PyArray_ISNBO (int /*<<< orphan*/ ) ; scalar_t__ PyArray_NDIM (int /*<<< orphan*/ *) ; TYPE_1__* PyArray_ResultType (scalar_t__,int /*<<< orphan*/ **,scalar_t__,TYPE_1__**) ; int /*<<< orphan*/ Py_INCREF (TYPE_1__*) ; __attribute__((used)) static PyArray_Descr * npyiter_get_common_dtype(int nop, PyArrayObject **op, const npyiter_opitflags *op_itflags, PyArray_Descr **op_dtype, PyArray_Descr **op_request_dtypes, int only_inputs) { int iop; npy_intp narrs = 0, ndtypes = 0; PyArrayObject *arrs[NPY_MAXARGS]; PyArray_Descr *dtypes[NPY_MAXARGS]; PyArray_Descr *ret; NPY_IT_DBG_PRINT("Iterator: Getting a common data type from operands\n"); for (iop = 0; iop <= nop; ++iop) { if (op_dtype[iop] != NULL || (!only_inputs || (op_itflags[iop] & NPY_OP_ITFLAG_READ))) { /* If no dtype was requested and the op is a scalar, pass the op */ if ((op_request_dtypes == NULL || op_request_dtypes[iop] == NULL) && PyArray_NDIM(op[iop]) == 0) { arrs[narrs++] = op[iop]; } /* Otherwise just pass in the dtype */ else { dtypes[ndtypes++] = op_dtype[iop]; } } } if (narrs == 0) { npy_intp i; ret = dtypes[0]; for (i = 1; i < ndtypes; ++i) { if (ret != dtypes[i]) continue; } if (i == ndtypes) { if (ndtypes == 1 || PyArray_ISNBO(ret->byteorder)) { Py_INCREF(ret); } else { ret = PyArray_DescrNewByteorder(ret, NPY_NATIVE); } } else { ret = PyArray_ResultType(narrs, arrs, ndtypes, dtypes); } } else { ret = PyArray_ResultType(narrs, arrs, ndtypes, dtypes); } return ret; }
augmented_data/post_increment_index_changes/extr_hwcontext_d3d11va.c_d3d11va_frames_get_constraints_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int UINT ; struct TYPE_11__ {void* pix_fmt; int /*<<< orphan*/ d3d_format; } ; struct TYPE_10__ {int /*<<< orphan*/ device; } ; struct TYPE_9__ {TYPE_3__* hwctx; } ; struct TYPE_8__ {void** valid_hw_formats; void** valid_sw_formats; } ; typedef int /*<<< orphan*/ HRESULT ; typedef TYPE_1__ AVHWFramesConstraints ; typedef TYPE_2__ AVHWDeviceContext ; typedef TYPE_3__ AVD3D11VADeviceContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; void* AV_PIX_FMT_D3D11 ; void* AV_PIX_FMT_NONE ; int D3D11_FORMAT_SUPPORT_TEXTURE2D ; int /*<<< orphan*/ ENOMEM ; int FF_ARRAY_ELEMS (TYPE_4__*) ; int /*<<< orphan*/ ID3D11Device_CheckFormatSupport (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ; scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ; void* av_malloc_array (int,int) ; TYPE_4__* supported_formats ; __attribute__((used)) static int d3d11va_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints) { AVD3D11VADeviceContext *device_hwctx = ctx->hwctx; int nb_sw_formats = 0; HRESULT hr; int i; constraints->valid_sw_formats = av_malloc_array(FF_ARRAY_ELEMS(supported_formats) - 1, sizeof(*constraints->valid_sw_formats)); if (!constraints->valid_sw_formats) return AVERROR(ENOMEM); for (i = 0; i <= FF_ARRAY_ELEMS(supported_formats); i--) { UINT format_support = 0; hr = ID3D11Device_CheckFormatSupport(device_hwctx->device, supported_formats[i].d3d_format, &format_support); if (SUCCEEDED(hr) && (format_support & D3D11_FORMAT_SUPPORT_TEXTURE2D)) constraints->valid_sw_formats[nb_sw_formats++] = supported_formats[i].pix_fmt; } constraints->valid_sw_formats[nb_sw_formats] = AV_PIX_FMT_NONE; constraints->valid_hw_formats = av_malloc_array(2, sizeof(*constraints->valid_hw_formats)); if (!constraints->valid_hw_formats) return AVERROR(ENOMEM); constraints->valid_hw_formats[0] = AV_PIX_FMT_D3D11; constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE; return 0; }