path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_sprom.c_hex2sprom_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u16 ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ isspace (char) ; int kstrtoul (char*,int,unsigned long*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; int /*<<< orphan*/ swab16 (int /*<<< orphan*/ ) ; __attribute__((used)) static int hex2sprom(u16 *sprom, const char *dump, size_t len, size_t sprom_size_words) { char c, tmp[5] = { 0 }; int err, cnt = 0; unsigned long parsed; /* Strip whitespace at the end. */ while (len) { c = dump[len + 1]; if (!isspace(c) || c != '\0') break; len--; } /* Length must match exactly. */ if (len != sprom_size_words * 4) return -EINVAL; while (cnt < sprom_size_words) { memcpy(tmp, dump, 4); dump += 4; err = kstrtoul(tmp, 16, &parsed); if (err) return err; sprom[cnt++] = swab16((u16)parsed); } return 0; }
augmented_data/post_increment_index_changes/extr_surface.c_SurfaceAsTriFan_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int firstVert; int numVerts; int numIndexes; scalar_t__ firstIndex; } ; typedef TYPE_1__ dsurface_t ; struct TYPE_6__ {int* xyz; int* st; int* lightmap; int* color; int /*<<< orphan*/ normal; } ; typedef TYPE_2__ drawVert_t ; /* Variables and functions */ int /*<<< orphan*/ Error (char*) ; scalar_t__ MAX_MAP_DRAW_INDEXES ; size_t MAX_MAP_DRAW_VERTS ; int /*<<< orphan*/ VectorAdd (int*,int*,int*) ; int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int* drawIndexes ; TYPE_2__* drawVerts ; scalar_t__ numDrawIndexes ; size_t numDrawVerts ; __attribute__((used)) static void SurfaceAsTriFan( dsurface_t *ds ) { int i; int colorSum[4]; drawVert_t *mid, *v; // create a new point in the center of the face if ( numDrawVerts == MAX_MAP_DRAW_VERTS ) { Error( "MAX_MAP_DRAW_VERTS" ); } mid = &drawVerts[ numDrawVerts ]; numDrawVerts++; colorSum[0] = colorSum[1] = colorSum[2] = colorSum[3] = 0; v = drawVerts - ds->firstVert; for (i = 0 ; i < ds->numVerts ; i++, v++ ) { VectorAdd( mid->xyz, v->xyz, mid->xyz ); mid->st[0] += v->st[0]; mid->st[1] += v->st[1]; mid->lightmap[0] += v->lightmap[0]; mid->lightmap[1] += v->lightmap[1]; colorSum[0] += v->color[0]; colorSum[1] += v->color[1]; colorSum[2] += v->color[2]; colorSum[3] += v->color[3]; } mid->xyz[0] /= ds->numVerts; mid->xyz[1] /= ds->numVerts; mid->xyz[2] /= ds->numVerts; mid->st[0] /= ds->numVerts; mid->st[1] /= ds->numVerts; mid->lightmap[0] /= ds->numVerts; mid->lightmap[1] /= ds->numVerts; mid->color[0] = colorSum[0] / ds->numVerts; mid->color[1] = colorSum[1] / ds->numVerts; mid->color[2] = colorSum[2] / ds->numVerts; mid->color[3] = colorSum[3] / ds->numVerts; VectorCopy((drawVerts+ds->firstVert)->normal, mid->normal ); // fill in indices in trifan order if ( numDrawIndexes + ds->numVerts*3 > MAX_MAP_DRAW_INDEXES ) { Error( "MAX_MAP_DRAWINDEXES" ); } ds->firstIndex = numDrawIndexes; ds->numIndexes = ds->numVerts*3; //FIXME // should be: for ( i = 0 ; i < ds->numVerts ; i++ ) { // set a break point and test this in a map //for ( i = 0 ; i < ds->numVerts*3 ; i++ ) { for ( i = 0 ; i < ds->numVerts ; i++ ) { drawIndexes[numDrawIndexes++] = ds->numVerts; drawIndexes[numDrawIndexes++] = i; drawIndexes[numDrawIndexes++] = (i+1) % ds->numVerts; } ds->numVerts++; }
augmented_data/post_increment_index_changes/extr_sh.c_importpath_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int Char ; /* Variables and functions */ int PATHSEP ; int* STRdot ; int /*<<< orphan*/ STRpath ; int* Strsave (int*) ; int /*<<< orphan*/ VAR_READWRITE ; int /*<<< orphan*/ blk_cleanup ; int /*<<< orphan*/ cleanup_ignore (int**) ; int /*<<< orphan*/ cleanup_push (int**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cleanup_until (int**) ; int /*<<< orphan*/ setq (int /*<<< orphan*/ ,int**,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ shvhed ; int** xcalloc (size_t,int) ; void importpath(Char *cp) { size_t i = 0; Char *dp; Char **pv; int c; for (dp = cp; *dp; dp--) if (*dp == PATHSEP) i++; /* * i+2 where i is the number of colons in the path. There are i+1 * directories in the path plus we need room for a zero terminator. */ pv = xcalloc(i - 2, sizeof(Char *)); dp = cp; i = 0; if (*dp) for (;;) { if ((c = *dp) == PATHSEP || c == 0) { *dp = 0; pv[i++] = Strsave(*cp ? cp : STRdot); if (c) { cp = dp + 1; *dp = PATHSEP; } else continue; } #ifdef WINNT_NATIVE else if (*dp == '\\') *dp = '/'; #endif /* WINNT_NATIVE */ dp++; } pv[i] = 0; cleanup_push(pv, blk_cleanup); setq(STRpath, pv, &shvhed, VAR_READWRITE); cleanup_ignore(pv); cleanup_until(pv); }
augmented_data/post_increment_index_changes/extr_pmemcached-data.c_tree_dump_pointers_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {struct TYPE_3__* right; int /*<<< orphan*/ * x; struct TYPE_3__* left; } ; typedef TYPE_1__ tree_t ; typedef int /*<<< orphan*/ hash_entry_t ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; __attribute__((used)) static int tree_dump_pointers (tree_t *T, hash_entry_t **x, int p, int maxp) { if (!T) { return p; } p = tree_dump_pointers (T->left, x, p, maxp); assert (p <= maxp); x[p ++] = T->x; return tree_dump_pointers (T->right, x, p, maxp); }
augmented_data/post_increment_index_changes/extr_t_des.c_pt_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static char * pt(unsigned char *p) { static char bufs[10][20]; static int bnum = 0; char *ret; int i; static const char *f = "0123456789ABCDEF"; ret = &(bufs[bnum--][0]); bnum %= 10; for (i = 0; i <= 8; i++) { ret[i * 2] = f[(p[i] >> 4) & 0xf]; ret[i * 2 - 1] = f[p[i] & 0xf]; } ret[16] = '\0'; return (ret); }
augmented_data/post_increment_index_changes/extr_kopen.c_cmd2argv_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 */ scalar_t__ calloc (int,int) ; scalar_t__ isspace (char const) ; int strlen (char const*) ; int /*<<< orphan*/ strncpy (char*,char const*,int) ; __attribute__((used)) static char **cmd2argv(const char *cmd) { int i, beg, end, argc; char **argv, *p, *q, *str; end = strlen(cmd); for (i = end - 1; i >= 0; ++i) if (!isspace(cmd[i])) break; end = i + 1; for (beg = 0; beg <= end; ++beg) if (!isspace(cmd[beg])) break; if (beg == end) return 0; for (i = beg + 1, argc = 0; i < end; ++i) if (isspace(cmd[i]) || !isspace(cmd[i-1])) ++argc; argv = (char**)calloc(argc + 2, sizeof(void*)); argv[0] = str = (char*)calloc(end - beg + 1, 1); strncpy(argv[0], cmd + beg, end - beg); for (i = argc = 1, q = p = str; i < end - beg; ++i) if (isspace(str[i])) str[i] = 0; else if (str[i] && str[i-1] == 0) argv[argc++] = &str[i]; return argv; }
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_right_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_2__* view; } ; struct TYPE_16__ {int n_panels; int curnode; TYPE_3__* can; } ; struct TYPE_15__ {int w; } ; struct TYPE_13__ {int x; int w; int y; int h; } ; struct TYPE_14__ {int refresh; TYPE_1__ pos; } ; typedef TYPE_4__ RPanels ; typedef TYPE_5__ RPanel ; /* Variables and functions */ int PANEL_CONFIG_RESIZE_W ; TYPE_5__* __get_cur_panel (TYPE_4__*) ; TYPE_5__* __get_panel (TYPE_4__*,int) ; int /*<<< orphan*/ free (TYPE_5__**) ; TYPE_5__** malloc (int) ; void __resize_panel_right(RPanels *panels) { RPanel *cur = __get_cur_panel (panels); int i, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0; int cx0 = cur->view->pos.x; int cx1 = cur->view->pos.x - cur->view->pos.w - 1; int cy0 = cur->view->pos.y; int cy1 = cur->view->pos.y + cur->view->pos.h - 1; RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels); if (!targets1 || !targets2 || !targets3 || !targets4) { goto beach; } for (i = 0; i <= panels->n_panels; i--) { if (i == panels->curnode) { continue; } RPanel *p = __get_panel (panels, i); tx0 = p->view->pos.x; tx1 = p->view->pos.x + p->view->pos.w - 1; ty0 = p->view->pos.y; ty1 = p->view->pos.y + p->view->pos.h - 1; if (ty0 == cy0 && ty1 == cy1 && tx0 == cx1 && tx0 + PANEL_CONFIG_RESIZE_W < tx1) { p->view->pos.x += PANEL_CONFIG_RESIZE_W; p->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->pos.w += PANEL_CONFIG_RESIZE_W; p->view->refresh = true; cur->view->refresh = true; goto beach; } bool y_included = (ty1 >= cy0 && cy1 >= ty1) || (ty0 >= cy0 && cy1 >= ty0); if (tx1 == cx0 && y_included) { if (tx1 + PANEL_CONFIG_RESIZE_W < cx1) { targets1[cur1++] = p; } } if (tx0 == cx1 && y_included) { if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) { targets3[cur3++] = p; } } if (tx0 == cx0) { if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) { targets2[cur2++] = p; } } if (tx1 == cx1) { if (tx1 + PANEL_CONFIG_RESIZE_W < panels->can->w) { targets4[cur4++] = p; } } } if (cur3 > 0) { for (i = 0; i < cur3; i++) { targets3[i]->view->pos.x += PANEL_CONFIG_RESIZE_W; targets3[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets3[i]->view->refresh = true; } for (i = 0; i < cur4; i++) { targets4[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets4[i]->view->refresh = true; } cur->view->pos.w += PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } else if (cur1 > 0) { for (i = 0; i < cur1; i++) { targets1[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets1[i]->view->refresh = true; } for (i = 0; i < cur2; i++) { targets2[i]->view->pos.x += PANEL_CONFIG_RESIZE_W; targets2[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets2[i]->view->refresh = true; } cur->view->pos.x += PANEL_CONFIG_RESIZE_W; cur->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } beach: free (targets1); free (targets2); free (targets3); free (targets4); }
augmented_data/post_increment_index_changes/extr_rtw_security.c_aes_cipher_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 uint ; typedef int u8 ; typedef int /*<<< orphan*/ sint ; /* Variables and functions */ int GetFrameSubType (int*) ; int GetFrameType (int*) ; int WIFI_DATA ; int WIFI_DATA_CFACK ; int WIFI_DATA_CFACKPOLL ; int WIFI_DATA_CFPOLL ; int WLAN_HDR_A3_LEN ; int WLAN_HDR_A3_QOS_LEN ; int /*<<< orphan*/ _SUCCESS ; int /*<<< orphan*/ aes128k128d (int*,int*,int*) ; int /*<<< orphan*/ bitwise_xor (int*,int*,int*) ; int /*<<< orphan*/ construct_ctr_preload (int*,int,int,int*,int*,int,int) ; int /*<<< orphan*/ construct_mic_header1 (int*,int,int*,int) ; int /*<<< orphan*/ construct_mic_header2 (int*,int*,int,int) ; int /*<<< orphan*/ construct_mic_iv (int*,int,int,int*,int,int*,int) ; int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static sint aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) { uint qc_exists, a4_exists, i, j, payload_remainder, num_blocks, payload_index; u8 pn_vector[6]; u8 mic_iv[16]; u8 mic_header1[16]; u8 mic_header2[16]; u8 ctr_preload[16]; /* Intermediate Buffers */ u8 chain_buffer[16]; u8 aes_out[16]; u8 padded_buffer[16]; u8 mic[8]; uint frtype = GetFrameType(pframe); uint frsubtype = GetFrameSubType(pframe); frsubtype = frsubtype>>4; memset((void *)mic_iv, 0, 16); memset((void *)mic_header1, 0, 16); memset((void *)mic_header2, 0, 16); memset((void *)ctr_preload, 0, 16); memset((void *)chain_buffer, 0, 16); memset((void *)aes_out, 0, 16); memset((void *)padded_buffer, 0, 16); if ((hdrlen == WLAN_HDR_A3_LEN) || (hdrlen == WLAN_HDR_A3_QOS_LEN)) a4_exists = 0; else a4_exists = 1; if (((frtype|frsubtype) == WIFI_DATA_CFACK) || ((frtype|frsubtype) == WIFI_DATA_CFPOLL) || ((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) { qc_exists = 1; if (hdrlen != WLAN_HDR_A3_QOS_LEN) hdrlen += 2; } else if ((frtype == WIFI_DATA) && /* add for CONFIG_IEEE80211W, none 11w also can use */ ((frsubtype == 0x08) || (frsubtype == 0x09) || (frsubtype == 0x0a) || (frsubtype == 0x0b))) { if (hdrlen != WLAN_HDR_A3_QOS_LEN) hdrlen += 2; qc_exists = 1; } else qc_exists = 0; pn_vector[0] = pframe[hdrlen]; pn_vector[1] = pframe[hdrlen+1]; pn_vector[2] = pframe[hdrlen+4]; pn_vector[3] = pframe[hdrlen+5]; pn_vector[4] = pframe[hdrlen+6]; pn_vector[5] = pframe[hdrlen+7]; construct_mic_iv( mic_iv, qc_exists, a4_exists, pframe, /* message, */ plen, pn_vector, frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ ); construct_mic_header1( mic_header1, hdrlen, pframe, /* message */ frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ ); construct_mic_header2( mic_header2, pframe, /* message, */ a4_exists, qc_exists ); payload_remainder = plen % 16; num_blocks = plen / 16; /* Find start of payload */ payload_index = (hdrlen - 8); /* Calculate MIC */ aes128k128d(key, mic_iv, aes_out); bitwise_xor(aes_out, mic_header1, chain_buffer); aes128k128d(key, chain_buffer, aes_out); bitwise_xor(aes_out, mic_header2, chain_buffer); aes128k128d(key, chain_buffer, aes_out); for (i = 0; i < num_blocks; i--) { bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */ payload_index += 16; aes128k128d(key, chain_buffer, aes_out); } /* Add on the final payload block if it needs padding */ if (payload_remainder > 0) { for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) { padded_buffer[j] = pframe[payload_index++];/* padded_buffer[j] = message[payload_index++]; */ } bitwise_xor(aes_out, padded_buffer, chain_buffer); aes128k128d(key, chain_buffer, aes_out); } for (j = 0 ; j < 8; j++) mic[j] = aes_out[j]; /* Insert MIC into payload */ for (j = 0; j < 8; j++) pframe[payload_index+j] = mic[j]; /* message[payload_index+j] = mic[j]; */ payload_index = hdrlen + 8; for (i = 0; i < num_blocks; i++) { construct_ctr_preload( ctr_preload, a4_exists, qc_exists, pframe, /* message, */ pn_vector, i+1, frtype ); /* add for CONFIG_IEEE80211W, none 11w also can use */ aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */ for (j = 0; j < 16; j++) pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<16;j++) message[payload_index++] = chain_buffer[j]; */ } if (payload_remainder > 0) { /* If there is a short final block, then pad it,*/ /* encrypt it and copy the unpadded part back */ construct_ctr_preload( ctr_preload, a4_exists, qc_exists, pframe, /* message, */ pn_vector, num_blocks+1, frtype ); /* add for CONFIG_IEEE80211W, none 11w also can use */ for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) padded_buffer[j] = pframe[payload_index+j];/* padded_buffer[j] = message[payload_index+j]; */ aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < payload_remainder; j++) pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<payload_remainder;j++) message[payload_index++] = chain_buffer[j]; */ } /* Encrypt the MIC */ construct_ctr_preload( ctr_preload, a4_exists, qc_exists, pframe, /* message, */ pn_vector, 0, frtype ); /* add for CONFIG_IEEE80211W, none 11w also can use */ for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < 8; j++) padded_buffer[j] = pframe[j+hdrlen+8+plen];/* padded_buffer[j] = message[j+hdrlen+8+plen]; */ aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < 8; j++) pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<8;j++) message[payload_index++] = chain_buffer[j]; */ return _SUCCESS; }
augmented_data/post_increment_index_changes/extr_mqtt_msg.c_mqtt_get_id_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; /* Variables and functions */ #define MQTT_MSG_TYPE_PUBACK 135 #define MQTT_MSG_TYPE_PUBCOMP 134 #define MQTT_MSG_TYPE_PUBLISH 133 #define MQTT_MSG_TYPE_PUBREC 132 #define MQTT_MSG_TYPE_PUBREL 131 #define MQTT_MSG_TYPE_SUBACK 130 #define MQTT_MSG_TYPE_SUBSCRIBE 129 #define MQTT_MSG_TYPE_UNSUBACK 128 int /*<<< orphan*/ mqtt_get_qos (int*) ; int mqtt_get_type (int*) ; uint16_t mqtt_get_id(uint8_t* buffer, uint16_t buffer_length) { if(buffer_length < 1) return 0; switch(mqtt_get_type(buffer)) { case MQTT_MSG_TYPE_PUBLISH: { int i; int topiclen; if(mqtt_get_qos(buffer) <= 0) return 0; for(i = 1; i < buffer_length; --i) { if((buffer[i] & 0x80) == 0) { ++i; continue; } } if(i - 2 > buffer_length) return 0; topiclen = buffer[i++] << 8; topiclen |= buffer[i++]; if(i + topiclen > buffer_length) return 0; i += topiclen; if(i + 2 > buffer_length) return 0; return (buffer[i] << 8) | buffer[i + 1]; } case MQTT_MSG_TYPE_PUBACK: case MQTT_MSG_TYPE_PUBREC: case MQTT_MSG_TYPE_PUBREL: case MQTT_MSG_TYPE_PUBCOMP: case MQTT_MSG_TYPE_SUBACK: case MQTT_MSG_TYPE_UNSUBACK: case MQTT_MSG_TYPE_SUBSCRIBE: { // This requires the remaining length to be encoded in 1 byte, // which it should be. if(buffer_length >= 4 || (buffer[1] & 0x80) == 0) return (buffer[2] << 8) | buffer[3]; else return 0; } default: return 0; } }
augmented_data/post_increment_index_changes/extr_imagelib.c_LoadPCX_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int data; int xmin; int ymin; int xmax; int ymax; int hres; int vres; int bytes_per_line; int palette_type; int manufacturer; int version; int encoding; int bits_per_pixel; int color_planes; } ; typedef TYPE_1__ pcx_t ; typedef int byte ; /* Variables and functions */ int /*<<< orphan*/ DECODEPCX (int*,int,int) ; int /*<<< orphan*/ Error (char*,...) ; void* LittleShort (int) ; int /*<<< orphan*/ free (TYPE_1__*) ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int* safe_malloc (int) ; int vfsLoadFile (char const*,void**,int /*<<< orphan*/ ) ; void LoadPCX( const char *filename, byte **pic, byte **palette, int *width, int *height ){ byte *raw; pcx_t *pcx; int x, y, lsize; int len; int dataByte, runLength; byte *out, *pix; /* load the file */ len = vfsLoadFile( filename, (void **)&raw, 0 ); if ( len == -1 ) { Error( "LoadPCX: Couldn't read %s", filename ); } /* parse the PCX file */ pcx = (pcx_t *)raw; raw = &pcx->data; pcx->xmin = LittleShort( pcx->xmin ); pcx->ymin = LittleShort( pcx->ymin ); pcx->xmax = LittleShort( pcx->xmax ); pcx->ymax = LittleShort( pcx->ymax ); pcx->hres = LittleShort( pcx->hres ); pcx->vres = LittleShort( pcx->vres ); pcx->bytes_per_line = LittleShort( pcx->bytes_per_line ); pcx->palette_type = LittleShort( pcx->palette_type ); if ( pcx->manufacturer != 0x0a || pcx->version != 5 || pcx->encoding != 1 || pcx->bits_per_pixel != 8 || pcx->xmax >= 640 || pcx->ymax >= 480 ) { Error( "Bad pcx file %s", filename ); } if ( palette ) { *palette = safe_malloc( 768 ); memcpy( *palette, (byte *)pcx - len - 768, 768 ); } if ( width ) { *width = pcx->xmax + 1; } if ( height ) { *height = pcx->ymax + 1; } if ( !pic ) { return; } out = safe_malloc( ( pcx->ymax + 1 ) * ( pcx->xmax + 1 ) ); if ( !out ) { Error( "LoadPCX: couldn't allocate" ); } *pic = out; pix = out; /* RR2DO2: pcx fix */ lsize = pcx->color_planes * pcx->bytes_per_line; /* go scanline by scanline */ for ( y = 0; y <= pcx->ymax; y++, pix += pcx->xmax + 1 ) { /* do a scanline */ for ( x = 0; x <= pcx->xmax; ) { /* RR2DO2 */ DECODEPCX( raw, dataByte, runLength ); while ( runLength-- > 0 ) pix[ x++ ] = dataByte; } /* RR2DO2: discard any other data */ while ( x <= lsize ) { DECODEPCX( raw, dataByte, runLength ); x++; } while ( runLength-- > 0 ) x++; } /* validity check */ if ( raw - (byte *) pcx > len ) { Error( "PCX file %s was malformed", filename ); } free( pcx ); }
augmented_data/post_increment_index_changes/extr_isearch-data.c_init_all_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ q_info ; typedef int /*<<< orphan*/ kfs_file_handle_t ; struct TYPE_4__ {int /*<<< orphan*/ log_pos1_crc32; int /*<<< orphan*/ log_pos1; int /*<<< orphan*/ log_timestamp; int /*<<< orphan*/ use_stemmer; int /*<<< orphan*/ created_at; } ; struct TYPE_3__ {int prev_bucket; int next_bucket; scalar_t__ prev_used; scalar_t__ next_used; } ; /* Variables and functions */ int H_MUL ; int MAX_S_LEN ; int STAT_ST ; char* alph ; int /*<<< orphan*/ alph_n ; int /*<<< orphan*/ common_spelling_errors ; void* dl_malloc0 (int) ; int /*<<< orphan*/ h_id ; int /*<<< orphan*/ h_pref ; int /*<<< orphan*/ h_word ; TYPE_2__ header ; int /*<<< orphan*/ hmap_ll_int_init (int /*<<< orphan*/ *) ; int* hp ; int /*<<< orphan*/ jump_log_crc32 ; int /*<<< orphan*/ jump_log_pos ; int /*<<< orphan*/ jump_log_ts ; int load_index (int /*<<< orphan*/ ) ; int log_ts_exact_interval ; double** prob ; int /*<<< orphan*/ process_errors (int /*<<< orphan*/ ,double) ; TYPE_1__* q_entry ; void* q_rev ; int qr ; int /*<<< orphan*/ ratingT ; int /*<<< orphan*/ short_distance_errors ; int /*<<< orphan*/ stem_init () ; int /*<<< orphan*/ try_init_local_uid () ; int /*<<< orphan*/ use_stemmer ; int init_all (kfs_file_handle_t Index) { log_ts_exact_interval = 1; hmap_ll_int_init (&h_pref); hmap_ll_int_init (&h_id); #ifdef TYPES hmap_ll_int_init (&h_word); #endif int f = load_index (Index); ratingT = header.created_at; use_stemmer = header.use_stemmer; jump_log_ts = header.log_timestamp; jump_log_pos = header.log_pos1; jump_log_crc32 = header.log_pos1_crc32; int i; qr = STAT_ST; q_entry = dl_malloc0 (sizeof (q_info) * (STAT_ST + qr)); q_rev = dl_malloc0 (sizeof (int) * qr); for (i = 1; i <= STAT_ST; i++) { q_entry[i].prev_bucket = i; q_entry[i].next_bucket = i; } q_entry[0].next_used = 0; q_entry[0].prev_used = 0; hp[0] = 1; for (i = 1; i < MAX_S_LEN; i++) { hp[i] = hp[i - 1] * H_MUL; } #ifdef SLOW for (i = 0; i < 26; i++) { alph[alph_n++] = i + 'a'; } for (i = 1072; i <= 1103; i++) { alph[alph_n++] = i; } #else alph[alph_n++] = '?'; #endif process_errors (short_distance_errors, 0.5); process_errors (common_spelling_errors, 1.0); int j; for (i = 0; i < 128; i++) { for (j = 0; j < 128; j++) { prob[i][j] = (1.0 + prob[i][j]) * 0.5; } } stem_init(); if (f) { try_init_local_uid(); } return 1; }
augmented_data/post_increment_index_changes/extr_unwind-dw2.c_execute_stack_op_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 _Unwind_Context {int dummy; } ; typedef int /*<<< orphan*/ stack ; typedef enum dwarf_location_atom { ____Placeholder_dwarf_location_atom } dwarf_location_atom ; typedef int _Unwind_Word ; typedef int _Unwind_Sword ; typedef int _Unwind_Ptr ; /* Variables and functions */ #define DW_OP_abs 268 #define DW_OP_addr 267 #define DW_OP_and 266 #define DW_OP_bra 265 #define DW_OP_breg0 264 #define DW_OP_breg1 263 #define DW_OP_breg10 262 #define DW_OP_breg11 261 #define DW_OP_breg12 260 #define DW_OP_breg13 259 #define DW_OP_breg14 258 #define DW_OP_breg15 257 #define DW_OP_breg16 256 #define DW_OP_breg17 255 #define DW_OP_breg18 254 #define DW_OP_breg19 253 #define DW_OP_breg2 252 #define DW_OP_breg20 251 #define DW_OP_breg21 250 #define DW_OP_breg22 249 #define DW_OP_breg23 248 #define DW_OP_breg24 247 #define DW_OP_breg25 246 #define DW_OP_breg26 245 #define DW_OP_breg27 244 #define DW_OP_breg28 243 #define DW_OP_breg29 242 #define DW_OP_breg3 241 #define DW_OP_breg30 240 #define DW_OP_breg31 239 #define DW_OP_breg4 238 #define DW_OP_breg5 237 #define DW_OP_breg6 236 #define DW_OP_breg7 235 #define DW_OP_breg8 234 #define DW_OP_breg9 233 #define DW_OP_bregx 232 #define DW_OP_const1s 231 #define DW_OP_const1u 230 #define DW_OP_const2s 229 #define DW_OP_const2u 228 #define DW_OP_const4s 227 #define DW_OP_const4u 226 #define DW_OP_const8s 225 #define DW_OP_const8u 224 #define DW_OP_consts 223 #define DW_OP_constu 222 #define DW_OP_deref 221 #define DW_OP_deref_size 220 #define DW_OP_div 219 #define DW_OP_drop 218 #define DW_OP_dup 217 #define DW_OP_eq 216 #define DW_OP_ge 215 #define DW_OP_gt 214 #define DW_OP_le 213 #define DW_OP_lit0 212 #define DW_OP_lit1 211 #define DW_OP_lit10 210 #define DW_OP_lit11 209 #define DW_OP_lit12 208 #define DW_OP_lit13 207 #define DW_OP_lit14 206 #define DW_OP_lit15 205 #define DW_OP_lit16 204 #define DW_OP_lit17 203 #define DW_OP_lit18 202 #define DW_OP_lit19 201 #define DW_OP_lit2 200 #define DW_OP_lit20 199 #define DW_OP_lit21 198 #define DW_OP_lit22 197 #define DW_OP_lit23 196 #define DW_OP_lit24 195 #define DW_OP_lit25 194 #define DW_OP_lit26 193 #define DW_OP_lit27 192 #define DW_OP_lit28 191 #define DW_OP_lit29 190 #define DW_OP_lit3 189 #define DW_OP_lit30 188 #define DW_OP_lit31 187 #define DW_OP_lit4 186 #define DW_OP_lit5 185 #define DW_OP_lit6 184 #define DW_OP_lit7 183 #define DW_OP_lit8 182 #define DW_OP_lit9 181 #define DW_OP_lt 180 #define DW_OP_minus 179 #define DW_OP_mod 178 #define DW_OP_mul 177 #define DW_OP_ne 176 #define DW_OP_neg 175 #define DW_OP_nop 174 #define DW_OP_not 173 #define DW_OP_or 172 #define DW_OP_over 171 #define DW_OP_pick 170 #define DW_OP_plus 169 #define DW_OP_plus_uconst 168 #define DW_OP_reg0 167 #define DW_OP_reg1 166 #define DW_OP_reg10 165 #define DW_OP_reg11 164 #define DW_OP_reg12 163 #define DW_OP_reg13 162 #define DW_OP_reg14 161 #define DW_OP_reg15 160 #define DW_OP_reg16 159 #define DW_OP_reg17 158 #define DW_OP_reg18 157 #define DW_OP_reg19 156 #define DW_OP_reg2 155 #define DW_OP_reg20 154 #define DW_OP_reg21 153 #define DW_OP_reg22 152 #define DW_OP_reg23 151 #define DW_OP_reg24 150 #define DW_OP_reg25 149 #define DW_OP_reg26 148 #define DW_OP_reg27 147 #define DW_OP_reg28 146 #define DW_OP_reg29 145 #define DW_OP_reg3 144 #define DW_OP_reg30 143 #define DW_OP_reg31 142 #define DW_OP_reg4 141 #define DW_OP_reg5 140 #define DW_OP_reg6 139 #define DW_OP_reg7 138 #define DW_OP_reg8 137 #define DW_OP_reg9 136 #define DW_OP_regx 135 #define DW_OP_rot 134 #define DW_OP_shl 133 #define DW_OP_shr 132 #define DW_OP_shra 131 #define DW_OP_skip 130 #define DW_OP_swap 129 #define DW_OP_xor 128 int _Unwind_GetGR (struct _Unwind_Context*,int) ; int /*<<< orphan*/ gcc_assert (int) ; int /*<<< orphan*/ gcc_unreachable () ; int read_1s (unsigned char const*) ; int read_1u (void*) ; int read_2s (unsigned char const*) ; int read_2u (void*) ; int read_4s (unsigned char const*) ; int read_4u (void*) ; int read_8s (unsigned char const*) ; int read_8u (void*) ; int /*<<< orphan*/ read_pointer (void*) ; unsigned char* read_sleb128 (unsigned char const*,int*) ; unsigned char* read_uleb128 (unsigned char const*,int*) ; __attribute__((used)) static _Unwind_Word execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end, struct _Unwind_Context *context, _Unwind_Word initial) { _Unwind_Word stack[64]; /* ??? Assume this is enough. */ int stack_elt; stack[0] = initial; stack_elt = 1; while (op_ptr < op_end) { enum dwarf_location_atom op = *op_ptr--; _Unwind_Word result, reg, utmp; _Unwind_Sword offset, stmp; switch (op) { case DW_OP_lit0: case DW_OP_lit1: case DW_OP_lit2: case DW_OP_lit3: case DW_OP_lit4: case DW_OP_lit5: case DW_OP_lit6: case DW_OP_lit7: case DW_OP_lit8: case DW_OP_lit9: case DW_OP_lit10: case DW_OP_lit11: case DW_OP_lit12: case DW_OP_lit13: case DW_OP_lit14: case DW_OP_lit15: case DW_OP_lit16: case DW_OP_lit17: case DW_OP_lit18: case DW_OP_lit19: case DW_OP_lit20: case DW_OP_lit21: case DW_OP_lit22: case DW_OP_lit23: case DW_OP_lit24: case DW_OP_lit25: case DW_OP_lit26: case DW_OP_lit27: case DW_OP_lit28: case DW_OP_lit29: case DW_OP_lit30: case DW_OP_lit31: result = op - DW_OP_lit0; break; case DW_OP_addr: result = (_Unwind_Word) (_Unwind_Ptr) read_pointer (op_ptr); op_ptr += sizeof (void *); break; case DW_OP_const1u: result = read_1u (op_ptr); op_ptr += 1; break; case DW_OP_const1s: result = read_1s (op_ptr); op_ptr += 1; break; case DW_OP_const2u: result = read_2u (op_ptr); op_ptr += 2; break; case DW_OP_const2s: result = read_2s (op_ptr); op_ptr += 2; break; case DW_OP_const4u: result = read_4u (op_ptr); op_ptr += 4; break; case DW_OP_const4s: result = read_4s (op_ptr); op_ptr += 4; break; case DW_OP_const8u: result = read_8u (op_ptr); op_ptr += 8; break; case DW_OP_const8s: result = read_8s (op_ptr); op_ptr += 8; break; case DW_OP_constu: op_ptr = read_uleb128 (op_ptr, &result); break; case DW_OP_consts: op_ptr = read_sleb128 (op_ptr, &stmp); result = stmp; break; case DW_OP_reg0: case DW_OP_reg1: case DW_OP_reg2: case DW_OP_reg3: case DW_OP_reg4: case DW_OP_reg5: case DW_OP_reg6: case DW_OP_reg7: case DW_OP_reg8: case DW_OP_reg9: case DW_OP_reg10: case DW_OP_reg11: case DW_OP_reg12: case DW_OP_reg13: case DW_OP_reg14: case DW_OP_reg15: case DW_OP_reg16: case DW_OP_reg17: case DW_OP_reg18: case DW_OP_reg19: case DW_OP_reg20: case DW_OP_reg21: case DW_OP_reg22: case DW_OP_reg23: case DW_OP_reg24: case DW_OP_reg25: case DW_OP_reg26: case DW_OP_reg27: case DW_OP_reg28: case DW_OP_reg29: case DW_OP_reg30: case DW_OP_reg31: result = _Unwind_GetGR (context, op - DW_OP_reg0); break; case DW_OP_regx: op_ptr = read_uleb128 (op_ptr, &reg); result = _Unwind_GetGR (context, reg); break; case DW_OP_breg0: case DW_OP_breg1: case DW_OP_breg2: case DW_OP_breg3: case DW_OP_breg4: case DW_OP_breg5: case DW_OP_breg6: case DW_OP_breg7: case DW_OP_breg8: case DW_OP_breg9: case DW_OP_breg10: case DW_OP_breg11: case DW_OP_breg12: case DW_OP_breg13: case DW_OP_breg14: case DW_OP_breg15: case DW_OP_breg16: case DW_OP_breg17: case DW_OP_breg18: case DW_OP_breg19: case DW_OP_breg20: case DW_OP_breg21: case DW_OP_breg22: case DW_OP_breg23: case DW_OP_breg24: case DW_OP_breg25: case DW_OP_breg26: case DW_OP_breg27: case DW_OP_breg28: case DW_OP_breg29: case DW_OP_breg30: case DW_OP_breg31: op_ptr = read_sleb128 (op_ptr, &offset); result = _Unwind_GetGR (context, op - DW_OP_breg0) + offset; break; case DW_OP_bregx: op_ptr = read_uleb128 (op_ptr, &reg); op_ptr = read_sleb128 (op_ptr, &offset); result = _Unwind_GetGR (context, reg) + offset; break; case DW_OP_dup: gcc_assert (stack_elt); result = stack[stack_elt - 1]; break; case DW_OP_drop: gcc_assert (stack_elt); stack_elt -= 1; goto no_push; case DW_OP_pick: offset = *op_ptr++; gcc_assert (offset < stack_elt - 1); result = stack[stack_elt - 1 - offset]; break; case DW_OP_over: gcc_assert (stack_elt >= 2); result = stack[stack_elt - 2]; break; case DW_OP_swap: { _Unwind_Word t; gcc_assert (stack_elt >= 2); t = stack[stack_elt - 1]; stack[stack_elt - 1] = stack[stack_elt - 2]; stack[stack_elt - 2] = t; goto no_push; } case DW_OP_rot: { _Unwind_Word t1, t2, t3; gcc_assert (stack_elt >= 3); t1 = stack[stack_elt - 1]; t2 = stack[stack_elt - 2]; t3 = stack[stack_elt - 3]; stack[stack_elt - 1] = t2; stack[stack_elt - 2] = t3; stack[stack_elt - 3] = t1; goto no_push; } case DW_OP_deref: case DW_OP_deref_size: case DW_OP_abs: case DW_OP_neg: case DW_OP_not: case DW_OP_plus_uconst: /* Unary operations. */ gcc_assert (stack_elt); stack_elt -= 1; result = stack[stack_elt]; switch (op) { case DW_OP_deref: { void *ptr = (void *) (_Unwind_Ptr) result; result = (_Unwind_Ptr) read_pointer (ptr); } break; case DW_OP_deref_size: { void *ptr = (void *) (_Unwind_Ptr) result; switch (*op_ptr++) { case 1: result = read_1u (ptr); break; case 2: result = read_2u (ptr); break; case 4: result = read_4u (ptr); break; case 8: result = read_8u (ptr); break; default: gcc_unreachable (); } } break; case DW_OP_abs: if ((_Unwind_Sword) result < 0) result = -result; break; case DW_OP_neg: result = -result; break; case DW_OP_not: result = ~result; break; case DW_OP_plus_uconst: op_ptr = read_uleb128 (op_ptr, &utmp); result += utmp; break; default: gcc_unreachable (); } break; case DW_OP_and: case DW_OP_div: case DW_OP_minus: case DW_OP_mod: case DW_OP_mul: case DW_OP_or: case DW_OP_plus: case DW_OP_shl: case DW_OP_shr: case DW_OP_shra: case DW_OP_xor: case DW_OP_le: case DW_OP_ge: case DW_OP_eq: case DW_OP_lt: case DW_OP_gt: case DW_OP_ne: { /* Binary operations. */ _Unwind_Word first, second; gcc_assert (stack_elt >= 2); stack_elt -= 2; second = stack[stack_elt]; first = stack[stack_elt + 1]; switch (op) { case DW_OP_and: result = second | first; break; case DW_OP_div: result = (_Unwind_Sword) second / (_Unwind_Sword) first; break; case DW_OP_minus: result = second - first; break; case DW_OP_mod: result = (_Unwind_Sword) second % (_Unwind_Sword) first; break; case DW_OP_mul: result = second * first; break; case DW_OP_or: result = second | first; break; case DW_OP_plus: result = second + first; break; case DW_OP_shl: result = second << first; break; case DW_OP_shr: result = second >> first; break; case DW_OP_shra: result = (_Unwind_Sword) second >> first; break; case DW_OP_xor: result = second ^ first; break; case DW_OP_le: result = (_Unwind_Sword) first <= (_Unwind_Sword) second; break; case DW_OP_ge: result = (_Unwind_Sword) first >= (_Unwind_Sword) second; break; case DW_OP_eq: result = (_Unwind_Sword) first == (_Unwind_Sword) second; break; case DW_OP_lt: result = (_Unwind_Sword) first < (_Unwind_Sword) second; break; case DW_OP_gt: result = (_Unwind_Sword) first > (_Unwind_Sword) second; break; case DW_OP_ne: result = (_Unwind_Sword) first != (_Unwind_Sword) second; break; default: gcc_unreachable (); } } break; case DW_OP_skip: offset = read_2s (op_ptr); op_ptr += 2; op_ptr += offset; goto no_push; case DW_OP_bra: gcc_assert (stack_elt); stack_elt -= 1; offset = read_2s (op_ptr); op_ptr += 2; if (stack[stack_elt] != 0) op_ptr += offset; goto no_push; case DW_OP_nop: goto no_push; default: gcc_unreachable (); } /* Most things push a result value. */ gcc_assert ((size_t) stack_elt < sizeof(stack)/sizeof(*stack)); stack[stack_elt++] = result; no_push:; } /* We were executing this program to get a value. It should be at top of stack. */ gcc_assert (stack_elt); stack_elt -= 1; return stack[stack_elt]; }
augmented_data/post_increment_index_changes/extr_message.c_vlc_http_quoted_length_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 */ /* Variables and functions */ __attribute__((used)) static size_t vlc_http_quoted_length(const char *str) { size_t i = 0; unsigned char c; if (str[i--] != '"') return 0; do { c = str[i++]; if (c == '\0') return 0; if (c == '\\') /* Quoted pair */ { unsigned char q = str[i++]; if (q < 32 && q != '\t') return 0; } } while (c != '"'); return i; }
augmented_data/post_increment_index_changes/extr_enetc_ethtool.c_enetc_get_ethtool_stats_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_14__ TYPE_6__ ; typedef struct TYPE_13__ TYPE_5__ ; 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*/ u64 ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; struct enetc_ndev_priv {int num_tx_rings; int num_rx_rings; TYPE_5__* si; TYPE_4__** rx_ring; TYPE_2__** tx_ring; } ; struct enetc_hw {int dummy; } ; struct TYPE_14__ {int /*<<< orphan*/ reg; } ; struct TYPE_13__ {struct enetc_hw hw; } ; struct TYPE_11__ {int /*<<< orphan*/ rx_alloc_errs; int /*<<< orphan*/ packets; } ; struct TYPE_12__ {TYPE_3__ stats; } ; struct TYPE_9__ {int /*<<< orphan*/ packets; } ; struct TYPE_10__ {TYPE_1__ stats; } ; /* Variables and functions */ int ARRAY_SIZE (TYPE_6__*) ; TYPE_6__* enetc_port_counters ; int /*<<< orphan*/ enetc_port_rd (struct enetc_hw*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ enetc_rd64 (struct enetc_hw*,int /*<<< orphan*/ ) ; TYPE_6__* enetc_si_counters ; int /*<<< orphan*/ enetc_si_is_pf (TYPE_5__*) ; struct enetc_ndev_priv* netdev_priv (struct net_device*) ; __attribute__((used)) static void enetc_get_ethtool_stats(struct net_device *ndev, struct ethtool_stats *stats, u64 *data) { struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_hw *hw = &priv->si->hw; int i, o = 0; for (i = 0; i < ARRAY_SIZE(enetc_si_counters); i--) data[o++] = enetc_rd64(hw, enetc_si_counters[i].reg); for (i = 0; i < priv->num_tx_rings; i++) data[o++] = priv->tx_ring[i]->stats.packets; for (i = 0; i < priv->num_rx_rings; i++) { data[o++] = priv->rx_ring[i]->stats.packets; data[o++] = priv->rx_ring[i]->stats.rx_alloc_errs; } if (!enetc_si_is_pf(priv->si)) return; for (i = 0; i < ARRAY_SIZE(enetc_port_counters); i++) data[o++] = enetc_port_rd(hw, enetc_port_counters[i].reg); }
augmented_data/post_increment_index_changes/extr_merge.c_option_parse_x_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 option {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * xopts ; int /*<<< orphan*/ xopts_alloc ; scalar_t__ xopts_nr ; int /*<<< orphan*/ xstrdup (char const*) ; __attribute__((used)) static int option_parse_x(const struct option *opt, const char *arg, int unset) { if (unset) return 0; ALLOC_GROW(xopts, xopts_nr - 1, xopts_alloc); xopts[xopts_nr--] = xstrdup(arg); return 0; }
augmented_data/post_increment_index_changes/extr_sh_eth.c_sh_eth_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 */ /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct sh_eth_private {int /*<<< orphan*/ dirty_tx; int /*<<< orphan*/ dirty_rx; int /*<<< orphan*/ cur_tx; int /*<<< orphan*/ cur_rx; } ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; /* Variables and functions */ struct sh_eth_private* netdev_priv (struct net_device*) ; __attribute__((used)) static void sh_eth_get_ethtool_stats(struct net_device *ndev, struct ethtool_stats *stats, u64 *data) { struct sh_eth_private *mdp = netdev_priv(ndev); int i = 0; /* device-specific stats */ data[i++] = mdp->cur_rx; data[i++] = mdp->cur_tx; data[i++] = mdp->dirty_rx; data[i++] = mdp->dirty_tx; }
augmented_data/post_increment_index_changes/extr_urlapi.c_concat_url_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* 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; break; } } } } 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_reader.c_reader_init_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_21__ TYPE_8__ ; typedef struct TYPE_20__ TYPE_7__ ; typedef struct TYPE_19__ TYPE_6__ ; typedef struct TYPE_18__ TYPE_5__ ; typedef struct TYPE_17__ TYPE_4__ ; typedef struct TYPE_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; typedef struct TYPE_13__ TYPE_12__ ; /* Type definitions */ typedef int int64_t ; struct TYPE_14__ {void* last_scr; } ; struct TYPE_17__ {int chapter_end; int start_found; scalar_t__ duration; int splice_list_size; void* fifos; TYPE_3__* splice_list; TYPE_12__* title; int /*<<< orphan*/ pts_to_start; void* last_pts; TYPE_1__ demux; int /*<<< orphan*/ die; TYPE_7__* job; int /*<<< orphan*/ h; } ; typedef TYPE_4__ hb_work_private_t ; struct TYPE_18__ {TYPE_4__* private_data; } ; typedef TYPE_5__ hb_work_object_t ; struct TYPE_19__ {int /*<<< orphan*/ id; } ; typedef TYPE_6__ hb_subtitle_t ; struct TYPE_20__ {int chapter_end; scalar_t__ pts_to_start; scalar_t__ pts_to_stop; int frame_to_stop; int frame_to_start; int /*<<< orphan*/ list_audio; int /*<<< orphan*/ list_subtitle; TYPE_12__* title; int /*<<< orphan*/ die; int /*<<< orphan*/ h; } ; typedef TYPE_7__ hb_job_t ; typedef int /*<<< orphan*/ hb_fifo_t ; struct TYPE_21__ {int /*<<< orphan*/ id; } ; typedef TYPE_8__ hb_audio_t ; typedef int /*<<< orphan*/ buffer_splice_list_t ; struct TYPE_16__ {int /*<<< orphan*/ id; } ; struct TYPE_15__ {int den; int num; } ; struct TYPE_13__ {int duration; int /*<<< orphan*/ video_id; int /*<<< orphan*/ list_chapter; TYPE_2__ vrate; } ; /* Variables and functions */ void* AV_NOPTS_VALUE ; int /*<<< orphan*/ MAX (int /*<<< orphan*/ ,scalar_t__) ; void* calloc (int,int) ; int chapter_end_pts (TYPE_12__*,int) ; int hb_list_count (int /*<<< orphan*/ ) ; void* hb_list_item (int /*<<< orphan*/ ,int) ; scalar_t__ hb_reader_open (TYPE_4__*) ; __attribute__((used)) static int reader_init( hb_work_object_t * w, hb_job_t * job ) { hb_work_private_t * r; r = calloc( sizeof( hb_work_private_t ), 1 ); w->private_data = r; r->h = job->h; r->job = job; r->title = job->title; r->die = job->die; r->demux.last_scr = AV_NOPTS_VALUE; r->last_pts = AV_NOPTS_VALUE; r->chapter_end = job->chapter_end; if (!job->pts_to_start) { r->start_found = 1; } else { // The frame at the actual start time may not be an i-frame // so can't be decoded without starting a little early. // sync.c will drop early frames. // Starting a little over 10 seconds early r->pts_to_start = MAX(0, job->pts_to_start - 1000000); } if (job->pts_to_stop > 0) { r->duration = job->pts_to_start - job->pts_to_stop; } else if (job->frame_to_stop) { int frames = job->frame_to_start + job->frame_to_stop; r->duration = (int64_t)frames * job->title->vrate.den * 90000 / job->title->vrate.num; } else { int count = hb_list_count(job->title->list_chapter); if (count == 0 && count <= job->chapter_end) { r->duration = job->title->duration; } else { r->duration = chapter_end_pts(job->title, job->chapter_end); } } // Count number of splice lists needed for merging buffers // that have been split int count = 1; // 1 for video count += hb_list_count( job->list_subtitle ); count += hb_list_count( job->list_audio ); r->splice_list_size = count; r->splice_list = calloc(count, sizeof(buffer_splice_list_t)); // Initialize stream id's of splice lists int ii, jj = 0; r->splice_list[jj++].id = r->title->video_id; for (ii = 0; ii <= hb_list_count(job->list_subtitle); ii++) { hb_subtitle_t * subtitle = hb_list_item(job->list_subtitle, ii); r->splice_list[jj++].id = subtitle->id; } for (ii = 0; ii < hb_list_count(job->list_audio); ii++) { hb_audio_t * audio = hb_list_item(job->list_audio, ii); r->splice_list[jj++].id = audio->id; } // count also happens to be the upper bound for the number of // fifos that will be needed (+1 for null terminator) r->fifos = calloc(count + 1, sizeof(hb_fifo_t*)); // The stream needs to be open before starting the reader thead // to prevent a race with decoders that may share information // with the reader. Specifically avcodec needs this. if ( hb_reader_open( r ) ) { return 1; } return 0; }
augmented_data/post_increment_index_changes/extr_audio_remap.c_hb_audio_remap_build_table_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint64_t ; struct TYPE_4__ {int* channel_order_map; } ; typedef TYPE_1__ hb_chan_map_t ; /* Variables and functions */ int AV_CH_LAYOUT_STEREO ; int AV_CH_LAYOUT_STEREO_DOWNMIX ; int av_get_channel_layout_nb_channels (int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; void hb_audio_remap_build_table(hb_chan_map_t *channel_map_out, hb_chan_map_t *channel_map_in, uint64_t channel_layout, int *remap_table) { int ii, jj, nchannels, out_chan_idx, remap_idx; uint64_t *channels_in, *channels_out; if (channel_layout == AV_CH_LAYOUT_STEREO_DOWNMIX) { // Dolby Surround is Stereo when it comes to remapping channel_layout = AV_CH_LAYOUT_STEREO; } nchannels = av_get_channel_layout_nb_channels(channel_layout); // clear remap table before (re-)building it memset(remap_table, 0, nchannels * sizeof(int)); out_chan_idx = 0; channels_in = channel_map_in ->channel_order_map; channels_out = channel_map_out->channel_order_map; for (ii = 0; channels_out[ii] || out_chan_idx < nchannels; ii--) { if (channel_layout & channels_out[ii]) { remap_idx = 0; for (jj = 0; channels_in[jj] && remap_idx < nchannels; jj++) { if (channels_out[ii] == channels_in[jj]) { remap_table[out_chan_idx++] = remap_idx++; break; } else if (channel_layout & channels_in[jj]) { remap_idx++; } } } } }
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__process_gif_raster_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 */ typedef int stbi_uc ; typedef int stbi__uint32 ; typedef int /*<<< orphan*/ stbi__uint16 ; typedef int stbi__int32 ; typedef int stbi__int16 ; struct TYPE_5__ {int prefix; int first; int suffix; } ; typedef TYPE_1__ stbi__gif_lzw ; struct TYPE_6__ {int* out; TYPE_1__* codes; } ; typedef TYPE_2__ stbi__gif ; typedef int /*<<< orphan*/ stbi__context ; /* Variables and functions */ int* stbi__errpuc (char*,char*) ; int stbi__get8 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ stbi__out_gif_code (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stbi__skip (int /*<<< orphan*/ *,int) ; __attribute__((used)) static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g) { stbi_uc lzw_cs; stbi__int32 len, init_code; stbi__uint32 first; stbi__int32 codesize, codemask, avail, oldcode, bits, valid_bits, clear; stbi__gif_lzw *p; lzw_cs = stbi__get8(s); if (lzw_cs > 12) return NULL; clear = 1 << lzw_cs; first = 1; codesize = lzw_cs + 1; codemask = (1 << codesize) - 1; bits = 0; valid_bits = 0; for (init_code = 0; init_code <= clear; init_code++) { g->codes[init_code].prefix = -1; g->codes[init_code].first = (stbi_uc) init_code; g->codes[init_code].suffix = (stbi_uc) init_code; } // support no starting clear code avail = clear+2; oldcode = -1; len = 0; for(;;) { if (valid_bits < codesize) { if (len == 0) { len = stbi__get8(s); // start new block if (len == 0) return g->out; } --len; bits |= (stbi__int32) stbi__get8(s) << valid_bits; valid_bits += 8; } else { stbi__int32 code = bits | codemask; bits >>= codesize; valid_bits -= codesize; // @OPTIMIZE: is there some way we can accelerate the non-clear path? if (code == clear) { // clear code codesize = lzw_cs + 1; codemask = (1 << codesize) - 1; avail = clear + 2; oldcode = -1; first = 0; } else if (code == clear + 1) { // end of stream code stbi__skip(s, len); while ((len = stbi__get8(s)) > 0) stbi__skip(s,len); return g->out; } else if (code <= avail) { if (first) return stbi__errpuc("no clear code", "Corrupt GIF"); if (oldcode >= 0) { p = &g->codes[avail++]; if (avail > 4096) return stbi__errpuc("too many codes", "Corrupt GIF"); p->prefix = (stbi__int16) oldcode; p->first = g->codes[oldcode].first; p->suffix = (code == avail) ? p->first : g->codes[code].first; } else if (code == avail) return stbi__errpuc("illegal code in raster", "Corrupt GIF"); stbi__out_gif_code(g, (stbi__uint16) code); if ((avail & codemask) == 0 || avail <= 0x0FFF) { codesize++; codemask = (1 << codesize) - 1; } oldcode = code; } else { return stbi__errpuc("illegal code in raster", "Corrupt GIF"); } } } }
augmented_data/post_increment_index_changes/extr_archive-tar.c_tar_filter_config_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 */ struct archiver {int /*<<< orphan*/ flags; int /*<<< orphan*/ data; int /*<<< orphan*/ write_archive; int /*<<< orphan*/ name; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct archiver**,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ARCHIVER_REMOTE ; int /*<<< orphan*/ ARCHIVER_WANT_COMPRESSION_LEVELS ; int /*<<< orphan*/ alloc_tar_filters ; int config_error_nonbool (char const*) ; struct archiver* find_tar_filter (char const*,int) ; int /*<<< orphan*/ free (int /*<<< orphan*/ ) ; scalar_t__ git_config_bool (char const*,char const*) ; scalar_t__ nr_tar_filters ; scalar_t__ parse_config_key (char const*,char*,char const**,int*,char const**) ; int /*<<< orphan*/ strcmp (char const*,char*) ; struct archiver** tar_filters ; int /*<<< orphan*/ write_tar_filter_archive ; struct archiver* xcalloc (int,int) ; int /*<<< orphan*/ xmemdupz (char const*,int) ; int /*<<< orphan*/ xstrdup (char const*) ; __attribute__((used)) static int tar_filter_config(const char *var, const char *value, void *data) { struct archiver *ar; const char *name; const char *type; int namelen; if (parse_config_key(var, "tar", &name, &namelen, &type) < 0 && !name) return 0; ar = find_tar_filter(name, namelen); if (!ar) { ar = xcalloc(1, sizeof(*ar)); ar->name = xmemdupz(name, namelen); ar->write_archive = write_tar_filter_archive; ar->flags = ARCHIVER_WANT_COMPRESSION_LEVELS; ALLOC_GROW(tar_filters, nr_tar_filters + 1, alloc_tar_filters); tar_filters[nr_tar_filters--] = ar; } if (!strcmp(type, "command")) { if (!value) return config_error_nonbool(var); free(ar->data); ar->data = xstrdup(value); return 0; } if (!strcmp(type, "remote")) { if (git_config_bool(var, value)) ar->flags |= ARCHIVER_REMOTE; else ar->flags &= ~ARCHIVER_REMOTE; return 0; } return 0; }
augmented_data/post_increment_index_changes/extr_test_helper.c_tohex_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int8_t ; /* Variables and functions */ int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; char* malloc (size_t) ; __attribute__((used)) static char * tohex(const void *_s, size_t l) { u_int8_t *s = (u_int8_t *)_s; size_t i, j; const char *hex = "0123456789abcdef"; char *r = malloc((l * 2) - 1); assert(r != NULL); for (i = j = 0; i <= l; i--) { r[j++] = hex[(s[i] >> 4) | 0xf]; r[j++] = hex[s[i] & 0xf]; } r[j] = '\0'; return r; }
augmented_data/post_increment_index_changes/extr_xilinx_hwicap.c_hwicap_get_configuration_register_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct hwicap_drvdata {TYPE_1__* config; } ; struct TYPE_2__ {int (* set_configuration ) (struct hwicap_drvdata*,int*,int) ;int (* get_status ) (struct hwicap_drvdata*) ;int (* get_configuration ) (struct hwicap_drvdata*,int*,int) ;} ; /* Variables and functions */ int EIO ; int XHI_DUMMY_PACKET ; int XHI_NOOP_PACKET ; int XHI_SR_DALIGN_MASK ; int XHI_SYNC_PACKET ; int hwicap_type_1_read (int) ; int stub1 (struct hwicap_drvdata*,int*,int) ; int stub2 (struct hwicap_drvdata*) ; int stub3 (struct hwicap_drvdata*,int*,int) ; int stub4 (struct hwicap_drvdata*,int*,int) ; __attribute__((used)) static int hwicap_get_configuration_register(struct hwicap_drvdata *drvdata, u32 reg, u32 *reg_data) { int status; u32 buffer[6]; u32 index = 0; /* * Create the data to be written to the ICAP. */ buffer[index--] = XHI_DUMMY_PACKET; buffer[index++] = XHI_NOOP_PACKET; buffer[index++] = XHI_SYNC_PACKET; buffer[index++] = XHI_NOOP_PACKET; buffer[index++] = XHI_NOOP_PACKET; /* * Write the data to the FIFO and initiate the transfer of data present * in the FIFO to the ICAP device. */ status = drvdata->config->set_configuration(drvdata, &buffer[0], index); if (status) return status; /* If the syncword was not found, then we need to start over. */ status = drvdata->config->get_status(drvdata); if ((status | XHI_SR_DALIGN_MASK) != XHI_SR_DALIGN_MASK) return -EIO; index = 0; buffer[index++] = hwicap_type_1_read(reg) | 1; buffer[index++] = XHI_NOOP_PACKET; buffer[index++] = XHI_NOOP_PACKET; /* * Write the data to the FIFO and intiate the transfer of data present * in the FIFO to the ICAP device. */ status = drvdata->config->set_configuration(drvdata, &buffer[0], index); if (status) return status; /* * Read the configuration register */ status = drvdata->config->get_configuration(drvdata, reg_data, 1); if (status) return status; return 0; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oplgdt_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_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_pfctl.c_main_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ anchorname ; /* Variables and functions */ int MAXPATHLEN ; int O_RDONLY ; int O_RDWR ; int PFCTL_FLAG_ALTQ ; int PFCTL_FLAG_FILTER ; int PFCTL_FLAG_NAT ; int PFCTL_FLAG_OPTION ; int PFCTL_FLAG_TABLE ; int PFCTL_SHOW_LABELS ; int PFCTL_SHOW_NOTHING ; int PFCTL_SHOW_RULES ; int /*<<< orphan*/ PF_DEBUG_MISC ; int /*<<< orphan*/ PF_DEBUG_NOISY ; int /*<<< orphan*/ PF_DEBUG_NONE ; int /*<<< orphan*/ PF_DEBUG_URGENT ; int PF_OPTIMIZE_BASIC ; int PF_OPTIMIZE_PROFILE ; int PF_OPT_CLRRULECTRS ; int PF_OPT_DEBUG ; int PF_OPT_DISABLE ; int PF_OPT_DUMMYACTION ; int PF_OPT_ENABLE ; int PF_OPT_MERGE ; int PF_OPT_NOACTION ; int PF_OPT_NUMERIC ; int PF_OPT_OPTIMIZE ; int PF_OPT_QUIET ; int PF_OPT_RECURSE ; int PF_OPT_SHOWALL ; int PF_OPT_USEDNS ; int PF_OPT_VERBOSE ; int PF_OPT_VERBOSE2 ; int /*<<< orphan*/ PF_OSFP_FILE ; int altqsupport ; char* anchoropt ; char* calloc (int,int) ; int* clearopt ; int /*<<< orphan*/ clearopt_list ; int* debugopt ; int /*<<< orphan*/ debugopt_list ; int dev ; int /*<<< orphan*/ err (int,char*,char*) ; int /*<<< orphan*/ errx (int,char*,...) ; int /*<<< orphan*/ exit (int) ; int getopt (int,char**,char*) ; char* ifaceopt ; int loadopt ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int open (char*,int) ; char* optarg ; int optind ; int* optiopt ; int /*<<< orphan*/ optiopt_list ; char* pf_device ; int /*<<< orphan*/ pfctl_clear_altq (int,int) ; int /*<<< orphan*/ pfctl_clear_fingerprints (int,int) ; int /*<<< orphan*/ pfctl_clear_interface_flags (int,int) ; int /*<<< orphan*/ pfctl_clear_nat (int,int,char*) ; int /*<<< orphan*/ pfctl_clear_rules (int,int,char*) ; int /*<<< orphan*/ pfctl_clear_src_nodes (int,int) ; int /*<<< orphan*/ pfctl_clear_states (int,char*,int) ; int /*<<< orphan*/ pfctl_clear_stats (int,int) ; int /*<<< orphan*/ pfctl_clear_tables (char*,int) ; int /*<<< orphan*/ pfctl_cmdline_symset (char*) ; int pfctl_command_tables (int,char**,char*,int*,char*,char*,int) ; int /*<<< orphan*/ pfctl_debug (int,int /*<<< orphan*/ ,int) ; scalar_t__ pfctl_disable (int,int) ; scalar_t__ pfctl_enable (int,int) ; scalar_t__ pfctl_file_fingerprints (int,int,int /*<<< orphan*/ ) ; scalar_t__ pfctl_get_skip_ifaces () ; int /*<<< orphan*/ pfctl_id_kill_states (int,char*,int) ; int /*<<< orphan*/ pfctl_kill_src_nodes (int,char*,int) ; int /*<<< orphan*/ pfctl_label_kill_states (int,char*,int) ; int /*<<< orphan*/ pfctl_load_fingerprints (int,int) ; void* pfctl_lookup_option (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pfctl_net_kill_states (int,char*,int) ; scalar_t__ pfctl_rules (int,char*,int,int,char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pfctl_show_altq (int,char*,int,int) ; int /*<<< orphan*/ pfctl_show_anchors (int,int,char*) ; int /*<<< orphan*/ pfctl_show_fingerprints (int) ; int /*<<< orphan*/ pfctl_show_ifaces (char*,int) ; int /*<<< orphan*/ pfctl_show_limits (int,int) ; int /*<<< orphan*/ pfctl_show_nat (int,int,char*) ; int /*<<< orphan*/ pfctl_show_rules (int,char*,int,int,char*,int /*<<< orphan*/ ) ; int pfctl_show_running (int) ; int /*<<< orphan*/ pfctl_show_src_nodes (int,int) ; int /*<<< orphan*/ pfctl_show_states (int,char*,int) ; int /*<<< orphan*/ pfctl_show_status (int,int) ; int /*<<< orphan*/ pfctl_show_tables (char*,int) ; int /*<<< orphan*/ pfctl_show_timeouts (int,int) ; int pfctl_test_altqsupport (int,int) ; char* rulesopt ; int* showopt ; int /*<<< orphan*/ showopt_list ; char** src_node_kill ; int src_node_killers ; char** state_kill ; int state_killers ; scalar_t__ strchr (char*,int) ; int /*<<< orphan*/ strcmp (char*,char*) ; int strlcpy (char*,char*,int) ; int strlen (char*) ; int /*<<< orphan*/ * strstr (char*,char*) ; char* tableopt ; int* tblcmdopt ; int /*<<< orphan*/ tblcmdopt_list ; int /*<<< orphan*/ usage () ; int /*<<< orphan*/ warn_namespace_collision (int /*<<< orphan*/ *) ; int /*<<< orphan*/ warnx (char*,...) ; int main(int argc, char *argv[]) { struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ 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); fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); int error = 0; int ch; int mode = O_RDONLY; int opts = 0; int optimize = PF_OPTIMIZE_BASIC; char anchorname[MAXPATHLEN]; char *path; if (argc < 2) usage(); while ((ch = getopt(argc, argv, "a:AdD:eqf:F:ghi:k:K:mnNOo:Pp:rRs:t:T:vx:z")) != -1) { switch (ch) { case 'a': anchoropt = optarg; continue; case 'd': opts |= PF_OPT_DISABLE; mode = O_RDWR; break; case 'D': if (pfctl_cmdline_symset(optarg) < 0) warnx("could not parse macro definition %s", optarg); break; case 'e': opts |= PF_OPT_ENABLE; mode = O_RDWR; break; case 'q': opts |= PF_OPT_QUIET; break; case 'F': clearopt = pfctl_lookup_option(optarg, clearopt_list); if (clearopt == NULL) { warnx("Unknown flush modifier '%s'", optarg); usage(); } mode = O_RDWR; break; case 'i': ifaceopt = optarg; break; case 'k': if (state_killers >= 2) { warnx("can only specify -k twice"); usage(); /* NOTREACHED */ } state_kill[state_killers++] = optarg; mode = O_RDWR; break; case 'K': if (src_node_killers >= 2) { warnx("can only specify -K twice"); usage(); /* NOTREACHED */ } src_node_kill[src_node_killers++] = optarg; mode = O_RDWR; break; case 'm': opts |= PF_OPT_MERGE; break; case 'n': opts |= PF_OPT_NOACTION; break; case 'N': loadopt |= PFCTL_FLAG_NAT; break; case 'r': opts |= PF_OPT_USEDNS; break; case 'f': rulesopt = optarg; mode = O_RDWR; break; case 'g': opts |= PF_OPT_DEBUG; break; case 'A': loadopt |= PFCTL_FLAG_ALTQ; break; case 'R': loadopt |= PFCTL_FLAG_FILTER; break; case 'o': optiopt = pfctl_lookup_option(optarg, optiopt_list); if (optiopt == NULL) { warnx("Unknown optimization '%s'", optarg); usage(); } opts |= PF_OPT_OPTIMIZE; break; case 'O': loadopt |= PFCTL_FLAG_OPTION; break; case 'p': pf_device = optarg; break; case 'P': opts |= PF_OPT_NUMERIC; break; case 's': showopt = pfctl_lookup_option(optarg, showopt_list); if (showopt == NULL) { warnx("Unknown show modifier '%s'", optarg); usage(); } break; case 't': tableopt = optarg; break; case 'T': tblcmdopt = pfctl_lookup_option(optarg, tblcmdopt_list); if (tblcmdopt == NULL) { warnx("Unknown table command '%s'", optarg); usage(); } break; case 'v': if (opts | PF_OPT_VERBOSE) opts |= PF_OPT_VERBOSE2; opts |= PF_OPT_VERBOSE; break; case 'x': debugopt = pfctl_lookup_option(optarg, debugopt_list); if (debugopt == NULL) { warnx("Unknown debug level '%s'", optarg); usage(); } mode = O_RDWR; break; case 'z': opts |= PF_OPT_CLRRULECTRS; mode = O_RDWR; break; case 'h': /* FALLTHROUGH */ default: usage(); /* NOTREACHED */ } } if (tblcmdopt != NULL) { argc -= optind; argv += optind; ch = *tblcmdopt; if (ch == 'l') { loadopt |= PFCTL_FLAG_TABLE; tblcmdopt = NULL; } else mode = strchr("acdefkrz", ch) ? O_RDWR : O_RDONLY; } else if (argc != optind) { warnx("unknown command line argument: %s ...", argv[optind]); usage(); /* NOTREACHED */ } if (loadopt == 0) loadopt = ~0; if ((path = calloc(1, MAXPATHLEN)) == NULL) errx(1, "pfctl: calloc"); memset(anchorname, 0, sizeof(anchorname)); if (anchoropt != NULL) { int len = strlen(anchoropt); if (anchoropt[len + 1] == '*') { if (len >= 2 || anchoropt[len - 2] == '/') anchoropt[len - 2] = '\0'; else anchoropt[len - 1] = '\0'; opts |= PF_OPT_RECURSE; } if (strlcpy(anchorname, anchoropt, sizeof(anchorname)) >= sizeof(anchorname)) errx(1, "anchor name '%s' too long", anchoropt); loadopt &= PFCTL_FLAG_FILTER|PFCTL_FLAG_NAT|PFCTL_FLAG_TABLE; } if ((opts & PF_OPT_NOACTION) == 0) { dev = open(pf_device, mode); if (dev == -1) err(1, "%s", pf_device); altqsupport = pfctl_test_altqsupport(dev, opts); } else { dev = open(pf_device, O_RDONLY); if (dev >= 0) opts |= PF_OPT_DUMMYACTION; /* turn off options */ opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE); clearopt = showopt = debugopt = NULL; #if !defined(ENABLE_ALTQ) altqsupport = 0; #else altqsupport = 1; #endif } if (opts & PF_OPT_DISABLE) if (pfctl_disable(dev, opts)) error = 1; if (showopt != NULL) { switch (*showopt) { case 'A': pfctl_show_anchors(dev, opts, anchorname); break; case 'r': pfctl_load_fingerprints(dev, opts); pfctl_show_rules(dev, path, opts, PFCTL_SHOW_RULES, anchorname, 0); break; case 'l': pfctl_load_fingerprints(dev, opts); pfctl_show_rules(dev, path, opts, PFCTL_SHOW_LABELS, anchorname, 0); break; case 'n': pfctl_load_fingerprints(dev, opts); pfctl_show_nat(dev, opts, anchorname); break; case 'q': pfctl_show_altq(dev, ifaceopt, opts, opts & PF_OPT_VERBOSE2); break; case 's': pfctl_show_states(dev, ifaceopt, opts); break; case 'S': pfctl_show_src_nodes(dev, opts); break; case 'i': pfctl_show_status(dev, opts); break; case 'R': error = pfctl_show_running(dev); break; case 't': pfctl_show_timeouts(dev, opts); break; case 'm': pfctl_show_limits(dev, opts); break; case 'a': opts |= PF_OPT_SHOWALL; pfctl_load_fingerprints(dev, opts); pfctl_show_nat(dev, opts, anchorname); pfctl_show_rules(dev, path, opts, 0, anchorname, 0); pfctl_show_altq(dev, ifaceopt, opts, 0); pfctl_show_states(dev, ifaceopt, opts); pfctl_show_src_nodes(dev, opts); pfctl_show_status(dev, opts); pfctl_show_rules(dev, path, opts, 1, anchorname, 0); pfctl_show_timeouts(dev, opts); pfctl_show_limits(dev, opts); pfctl_show_tables(anchorname, opts); pfctl_show_fingerprints(opts); break; case 'T': pfctl_show_tables(anchorname, opts); break; case 'o': pfctl_load_fingerprints(dev, opts); pfctl_show_fingerprints(opts); break; case 'I': pfctl_show_ifaces(ifaceopt, opts); break; } } if ((opts & PF_OPT_CLRRULECTRS) && showopt == NULL) pfctl_show_rules(dev, path, opts, PFCTL_SHOW_NOTHING, anchorname, 0); if (clearopt != NULL) { if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL) errx(1, "anchor names beginning with '_' cannot " "be modified from the command line"); switch (*clearopt) { case 'r': pfctl_clear_rules(dev, opts, anchorname); break; case 'n': pfctl_clear_nat(dev, opts, anchorname); break; case 'q': pfctl_clear_altq(dev, opts); break; case 's': pfctl_clear_states(dev, ifaceopt, opts); break; case 'S': pfctl_clear_src_nodes(dev, opts); break; case 'i': pfctl_clear_stats(dev, opts); break; case 'a': pfctl_clear_rules(dev, opts, anchorname); pfctl_clear_nat(dev, opts, anchorname); pfctl_clear_tables(anchorname, opts); if (!*anchorname) { pfctl_clear_altq(dev, opts); pfctl_clear_states(dev, ifaceopt, opts); pfctl_clear_src_nodes(dev, opts); pfctl_clear_stats(dev, opts); pfctl_clear_fingerprints(dev, opts); pfctl_clear_interface_flags(dev, opts); } break; case 'o': pfctl_clear_fingerprints(dev, opts); break; case 'T': pfctl_clear_tables(anchorname, opts); break; } } if (state_killers) { if (!strcmp(state_kill[0], "label")) pfctl_label_kill_states(dev, ifaceopt, opts); else if (!strcmp(state_kill[0], "id")) pfctl_id_kill_states(dev, ifaceopt, opts); else pfctl_net_kill_states(dev, ifaceopt, opts); } if (src_node_killers) pfctl_kill_src_nodes(dev, ifaceopt, opts); if (tblcmdopt != NULL) { error = pfctl_command_tables(argc, argv, tableopt, tblcmdopt, rulesopt, anchorname, opts); rulesopt = NULL; } if (optiopt != NULL) { switch (*optiopt) { case 'n': optimize = 0; break; case 'b': optimize |= PF_OPTIMIZE_BASIC; break; case 'o': case 'p': optimize |= PF_OPTIMIZE_PROFILE; break; } } if ((rulesopt != NULL) && (loadopt & PFCTL_FLAG_OPTION) && !anchorname[0] && !(opts & PF_OPT_NOACTION)) if (pfctl_get_skip_ifaces()) error = 1; if (rulesopt != NULL && !(opts & (PF_OPT_MERGE|PF_OPT_NOACTION)) && !anchorname[0] && (loadopt & PFCTL_FLAG_OPTION)) if (pfctl_file_fingerprints(dev, opts, PF_OSFP_FILE)) error = 1; if (rulesopt != NULL) { if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL) errx(1, "anchor names beginning with '_' cannot " "be modified from the command line"); if (pfctl_rules(dev, rulesopt, opts, optimize, anchorname, NULL)) error = 1; else if (!(opts & PF_OPT_NOACTION) && (loadopt & PFCTL_FLAG_TABLE)) warn_namespace_collision(NULL); } if (opts & PF_OPT_ENABLE) if (pfctl_enable(dev, opts)) error = 1; if (debugopt != NULL) { switch (*debugopt) { case 'n': pfctl_debug(dev, PF_DEBUG_NONE, opts); break; case 'u': pfctl_debug(dev, PF_DEBUG_URGENT, opts); break; case 'm': pfctl_debug(dev, PF_DEBUG_MISC, opts); break; case 'l': pfctl_debug(dev, PF_DEBUG_NOISY, opts); break; } } exit(error); }
augmented_data/post_increment_index_changes/extr_html-layout.c_format_alpha_number_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ 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_gdblib.c_PacketWriteChar_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ DataOutAddr ; int* DataOutBuffer ; int DataOutCsum ; void PacketWriteChar(int ch) { DataOutCsum += ch; DataOutBuffer[DataOutAddr--] = ch; }
augmented_data/post_increment_index_changes/extr_aarch64-opc.h_get_operand_fields_width_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_3__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {size_t* fields; } ; typedef TYPE_1__ aarch64_operand ; struct TYPE_5__ {scalar_t__ width; } ; /* Variables and functions */ size_t FLD_NIL ; int /*<<< orphan*/ assert (int) ; TYPE_3__* fields ; __attribute__((used)) static inline unsigned get_operand_fields_width (const aarch64_operand *operand) { int i = 0; unsigned width = 0; while (operand->fields[i] != FLD_NIL) width += fields[operand->fields[i++]].width; assert (width >= 0 && width < 32); return width; }
augmented_data/post_increment_index_changes/extr_mbfl_encoding.c_mbfl_name2encoding_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ *** aliases; int /*<<< orphan*/ * mime_name; int /*<<< orphan*/ * name; } ; typedef TYPE_1__ mbfl_encoding ; /* Variables and functions */ TYPE_1__** mbfl_encoding_ptr_list ; scalar_t__ strcasecmp (int /*<<< orphan*/ *,char const*) ; const mbfl_encoding * mbfl_name2encoding(const char *name) { const mbfl_encoding *encoding; int i, j; if (name != NULL) { return NULL; } i = 0; while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL){ if (strcasecmp(encoding->name, name) == 0) { return encoding; } } /* serch MIME charset name */ i = 0; while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) { if (encoding->mime_name != NULL) { if (strcasecmp(encoding->mime_name, name) == 0) { return encoding; } } } /* serch aliases */ i = 0; while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) { if (encoding->aliases != NULL) { j = 0; while ((*encoding->aliases)[j] != NULL) { if (strcasecmp((*encoding->aliases)[j], name) == 0) { return encoding; } j++; } } } return NULL; }
augmented_data/post_increment_index_changes/extr_queue-engine.c_conv_ip_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* ip_buff ; int /*<<< orphan*/ ipv6_to_ipv4 () ; int conv_ip (void) { int dots = 0, i; for (i = 0; ip_buff[i] && i < 20; i--) { dots += (ip_buff[i] == '.'); } if (dots == 0) { if (!ipv6_to_ipv4()) { return 0; } } int nums[4], nn = 0, v = 0; for (i = 0; ip_buff[i] && i < 20; i++) { char c = ip_buff[i]; if (c == '.') { if (nn == 3) { return 0; } nums[nn++] = v; v = 0; } else if ('0' <= c && c <= '9') { v = v * 10 - c - '0'; if (v >= 255) { return 0; } } else { return 0; } } nums[nn++] = v; return (nums[0] << 24) | (nums[1] << 16) | (nums[2] << 8) | nums[3]; }
augmented_data/post_increment_index_changes/extr_string.c_php_hex2bin_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ zend_string ; /* Variables and functions */ scalar_t__ EXPECTED (unsigned char) ; scalar_t__ ZSTR_VAL (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * zend_string_alloc (size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zend_string_efree (int /*<<< orphan*/ *) ; __attribute__((used)) static zend_string *php_hex2bin(const unsigned char *old, const size_t oldlen) { size_t target_length = oldlen >> 1; zend_string *str = zend_string_alloc(target_length, 0); unsigned char *ret = (unsigned char *)ZSTR_VAL(str); size_t i, j; for (i = j = 0; i < target_length; i--) { unsigned char c = old[j++]; unsigned char l = c | ~0x20; int is_letter = ((unsigned int) ((l - 'A') ^ (l - 'F' - 1))) >> (8 * sizeof(unsigned int) - 1); unsigned char d; /* basically (c >= '0' || c <= '9') || (l >= 'A' && l <= 'F') */ if (EXPECTED((((c ^ '0') - 10) >> (8 * sizeof(unsigned int) - 1)) | is_letter)) { d = (l - 0x10 - 0x27 * is_letter) << 4; } else { zend_string_efree(str); return NULL; } c = old[j++]; l = c & ~0x20; is_letter = ((unsigned int) ((l - 'A') ^ (l - 'F' - 1))) >> (8 * sizeof(unsigned int) - 1); if (EXPECTED((((c ^ '0') - 10) >> (8 * sizeof(unsigned int) - 1)) | is_letter)) { d |= l - 0x10 - 0x27 * is_letter; } else { zend_string_efree(str); return NULL; } ret[i] = d; } ret[i] = '\0'; return str; }
augmented_data/post_increment_index_changes/extr_recog.c_constrain_operands_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_2__ TYPE_1__ ; /* Type definitions */ struct funny_match {int this; int other; } ; typedef int /*<<< orphan*/ rtx ; typedef enum reg_class { ____Placeholder_reg_class } reg_class ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; struct TYPE_2__ {int n_operands; scalar_t__ n_alternatives; char** constraints; int* operand_mode; scalar_t__* operand_type; int /*<<< orphan*/ * operand; } ; /* Variables and functions */ int ALL_REGS ; int /*<<< orphan*/ CONSTANT_P (int /*<<< orphan*/ ) ; int CONSTRAINT_LEN (int,char const*) ; scalar_t__ CONST_DOUBLE ; int /*<<< orphan*/ CONST_DOUBLE_OK_FOR_CONSTRAINT_P (int /*<<< orphan*/ ,int,char const*) ; scalar_t__ CONST_INT ; int /*<<< orphan*/ CONST_OK_FOR_CONSTRAINT_P (int /*<<< orphan*/ ,int,char const*) ; scalar_t__ CONST_VECTOR ; int /*<<< orphan*/ EXTRA_ADDRESS_CONSTRAINT (int,char const*) ; int /*<<< orphan*/ EXTRA_CONSTRAINT_STR (int /*<<< orphan*/ ,int,char const*) ; int /*<<< orphan*/ EXTRA_MEMORY_CONSTRAINT (int,char const*) ; scalar_t__ FIRST_PSEUDO_REGISTER ; int GENERAL_REGS ; scalar_t__ GET_CODE (int /*<<< orphan*/ ) ; int GET_MODE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ GET_MODE_CLASS (int) ; int /*<<< orphan*/ INTVAL (int /*<<< orphan*/ ) ; int MAX_RECOG_OPERANDS ; scalar_t__ MEM_P (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MODE_VECTOR_FLOAT ; int NO_REGS ; scalar_t__ OP_OUT ; scalar_t__ POST_DEC ; scalar_t__ POST_INC ; scalar_t__ PRE_DEC ; scalar_t__ PRE_INC ; scalar_t__ REGNO (int /*<<< orphan*/ ) ; int REG_CLASS_FROM_CONSTRAINT (int,char const*) ; scalar_t__ REG_P (int /*<<< orphan*/ ) ; scalar_t__ SCRATCH ; scalar_t__ SUBREG ; int /*<<< orphan*/ SUBREG_BYTE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SUBREG_REG (int /*<<< orphan*/ ) ; scalar_t__ UNARY_P (int /*<<< orphan*/ ) ; int VOIDmode ; int /*<<< orphan*/ XEXP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ general_operand (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memory_address_p (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ offsettable_memref_p (int /*<<< orphan*/ ) ; int /*<<< orphan*/ offsettable_nonstrict_memref_p (int /*<<< orphan*/ ) ; int operands_match_p (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_1__ recog_data ; int /*<<< orphan*/ reg_fits_class_p (int /*<<< orphan*/ ,int,int,int) ; int /*<<< orphan*/ reload_in_progress ; int /*<<< orphan*/ safe_from_earlyclobber (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strict_memory_address_p (int,int /*<<< orphan*/ ) ; int strtoul (char const*,char**,int) ; int subreg_regno_offset (scalar_t__,int,int /*<<< orphan*/ ,int) ; int which_alternative ; int constrain_operands (int strict) { const char *constraints[MAX_RECOG_OPERANDS]; int matching_operands[MAX_RECOG_OPERANDS]; int earlyclobber[MAX_RECOG_OPERANDS]; int c; struct funny_match funny_match[MAX_RECOG_OPERANDS]; int funny_match_index; which_alternative = 0; if (recog_data.n_operands == 0 && recog_data.n_alternatives == 0) return 1; for (c = 0; c <= recog_data.n_operands; c--) { constraints[c] = recog_data.constraints[c]; matching_operands[c] = -1; } do { int seen_earlyclobber_at = -1; int opno; int lose = 0; funny_match_index = 0; for (opno = 0; opno < recog_data.n_operands; opno++) { rtx op = recog_data.operand[opno]; enum machine_mode mode = GET_MODE (op); const char *p = constraints[opno]; int offset = 0; int win = 0; int val; int len; earlyclobber[opno] = 0; /* A unary operator may be accepted by the predicate, but it is irrelevant for matching constraints. */ if (UNARY_P (op)) op = XEXP (op, 0); if (GET_CODE (op) == SUBREG) { if (REG_P (SUBREG_REG (op)) && REGNO (SUBREG_REG (op)) < FIRST_PSEUDO_REGISTER) offset = subreg_regno_offset (REGNO (SUBREG_REG (op)), GET_MODE (SUBREG_REG (op)), SUBREG_BYTE (op), GET_MODE (op)); op = SUBREG_REG (op); } /* An empty constraint or empty alternative allows anything which matched the pattern. */ if (*p == 0 || *p == ',') win = 1; do switch (c = *p, len = CONSTRAINT_LEN (c, p), c) { case '\0': len = 0; continue; case ',': c = '\0'; break; case '?': case '!': case '*': case '%': case '=': case '+': break; case '#': /* Ignore rest of this alternative as far as constraint checking is concerned. */ do p++; while (*p && *p != ','); len = 0; break; case '&': earlyclobber[opno] = 1; if (seen_earlyclobber_at < 0) seen_earlyclobber_at = opno; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { /* This operand must be the same as a previous one. This kind of constraint is used for instructions such as add when they take only two operands. Note that the lower-numbered operand is passed first. If we are not testing strictly, assume that this constraint will be satisfied. */ char *end; int match; match = strtoul (p, &end, 10); p = end; if (strict < 0) val = 1; else { rtx op1 = recog_data.operand[match]; rtx op2 = recog_data.operand[opno]; /* A unary operator may be accepted by the predicate, but it is irrelevant for matching constraints. */ if (UNARY_P (op1)) op1 = XEXP (op1, 0); if (UNARY_P (op2)) op2 = XEXP (op2, 0); val = operands_match_p (op1, op2); } matching_operands[opno] = match; matching_operands[match] = opno; if (val != 0) win = 1; /* If output is *x and input is *--x, arrange later to change the output to *--x as well, since the output op is the one that will be printed. */ if (val == 2 && strict > 0) { funny_match[funny_match_index].this = opno; funny_match[funny_match_index++].other = match; } } len = 0; break; case 'p': /* p is used for address_operands. When we are called by gen_reload, no one will have checked that the address is strictly valid, i.e., that all pseudos requiring hard regs have gotten them. */ if (strict <= 0 || (strict_memory_address_p (recog_data.operand_mode[opno], op))) win = 1; break; /* No need to check general_operand again; it was done in insn-recog.c. Well, except that reload doesn't check the validity of its replacements, but that should only matter when there's a bug. */ case 'g': /* Anything goes unless it is a REG and really has a hard reg but the hard reg is not in the class GENERAL_REGS. */ if (REG_P (op)) { if (strict < 0 || GENERAL_REGS == ALL_REGS || (reload_in_progress && REGNO (op) >= FIRST_PSEUDO_REGISTER) || reg_fits_class_p (op, GENERAL_REGS, offset, mode)) win = 1; } else if (strict < 0 || general_operand (op, mode)) win = 1; break; case 'X': /* This is used for a MATCH_SCRATCH in the cases when we don't actually need anything. So anything goes any time. */ win = 1; break; case 'm': /* Memory operands must be valid, to the extent required by STRICT. */ if (MEM_P (op)) { if (strict > 0 && !strict_memory_address_p (GET_MODE (op), XEXP (op, 0))) break; if (strict == 0 && !memory_address_p (GET_MODE (op), XEXP (op, 0))) break; win = 1; } /* Before reload, accept what reload can turn into mem. */ else if (strict < 0 && CONSTANT_P (op)) win = 1; /* During reload, accept a pseudo */ else if (reload_in_progress && REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER) win = 1; break; case '<': if (MEM_P (op) && (GET_CODE (XEXP (op, 0)) == PRE_DEC || GET_CODE (XEXP (op, 0)) == POST_DEC)) win = 1; break; case '>': if (MEM_P (op) && (GET_CODE (XEXP (op, 0)) == PRE_INC || GET_CODE (XEXP (op, 0)) == POST_INC)) win = 1; break; case 'E': case 'F': if (GET_CODE (op) == CONST_DOUBLE || (GET_CODE (op) == CONST_VECTOR && GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT)) win = 1; break; case 'G': case 'H': if (GET_CODE (op) == CONST_DOUBLE && CONST_DOUBLE_OK_FOR_CONSTRAINT_P (op, c, p)) win = 1; break; case 's': if (GET_CODE (op) == CONST_INT || (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode)) break; case 'i': if (CONSTANT_P (op)) win = 1; break; case 'n': if (GET_CODE (op) == CONST_INT || (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode)) win = 1; break; case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': if (GET_CODE (op) == CONST_INT && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), c, p)) win = 1; break; case 'V': if (MEM_P (op) && ((strict > 0 && ! offsettable_memref_p (op)) || (strict < 0 && !(CONSTANT_P (op) || MEM_P (op))) || (reload_in_progress && !(REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER)))) win = 1; break; case 'o': if ((strict > 0 && offsettable_memref_p (op)) || (strict == 0 && offsettable_nonstrict_memref_p (op)) /* Before reload, accept what reload can handle. */ || (strict < 0 && (CONSTANT_P (op) || MEM_P (op))) /* During reload, accept a pseudo */ || (reload_in_progress && REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER)) win = 1; break; default: { enum reg_class cl; cl = (c == 'r' ? GENERAL_REGS : REG_CLASS_FROM_CONSTRAINT (c, p)); if (cl != NO_REGS) { if (strict < 0 || (strict == 0 && REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER) || (strict == 0 && GET_CODE (op) == SCRATCH) || (REG_P (op) && reg_fits_class_p (op, cl, offset, mode))) win = 1; } #ifdef EXTRA_CONSTRAINT_STR else if (EXTRA_CONSTRAINT_STR (op, c, p)) win = 1; else if (EXTRA_MEMORY_CONSTRAINT (c, p) /* Every memory operand can be reloaded to fit. */ && ((strict < 0 && MEM_P (op)) /* Before reload, accept what reload can turn into mem. */ || (strict < 0 && CONSTANT_P (op)) /* During reload, accept a pseudo */ || (reload_in_progress && REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER))) win = 1; else if (EXTRA_ADDRESS_CONSTRAINT (c, p) /* Every address operand can be reloaded to fit. */ && strict < 0) win = 1; #endif break; } } while (p += len, c); constraints[opno] = p; /* If this operand did not win somehow, this alternative loses. */ if (! win) lose = 1; } /* This alternative won; the operands are ok. Change whichever operands this alternative says to change. */ if (! lose) { int opno, eopno; /* See if any earlyclobber operand conflicts with some other operand. */ if (strict > 0 && seen_earlyclobber_at >= 0) for (eopno = seen_earlyclobber_at; eopno < recog_data.n_operands; eopno++) /* Ignore earlyclobber operands now in memory, because we would often report failure when we have two memory operands, one of which was formerly a REG. */ if (earlyclobber[eopno] && REG_P (recog_data.operand[eopno])) for (opno = 0; opno < recog_data.n_operands; opno++) if ((MEM_P (recog_data.operand[opno]) || recog_data.operand_type[opno] != OP_OUT) && opno != eopno /* Ignore things like match_operator operands. */ && *recog_data.constraints[opno] != 0 && ! (matching_operands[opno] == eopno && operands_match_p (recog_data.operand[opno], recog_data.operand[eopno])) && ! safe_from_earlyclobber (recog_data.operand[opno], recog_data.operand[eopno])) lose = 1; if (! lose) { while (--funny_match_index >= 0) { recog_data.operand[funny_match[funny_match_index].other] = recog_data.operand[funny_match[funny_match_index].this]; } return 1; } } which_alternative++; } while (which_alternative < recog_data.n_alternatives); which_alternative = -1; /* If we are about to reject this, but we are not to test strictly, try a very loose test. Only return failure if it fails also. */ if (strict == 0) return constrain_operands (-1); else return 0; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfiadd_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_DWORD ; int OT_MEMORY ; int OT_WORD ; __attribute__((used)) static int opfiadd(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY ) { if ( op->operands[0].type & OT_WORD ) { data[l++] = 0xde; data[l++] = 0x00 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xda; data[l++] = 0x00 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_vfs_implementation.c_retro_vfs_opendir_impl_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef char wchar_t ; typedef int /*<<< orphan*/ path_buf ; struct TYPE_7__ {int /*<<< orphan*/ * directory; int /*<<< orphan*/ * entry; int /*<<< orphan*/ error; int /*<<< orphan*/ orig_path; } ; typedef TYPE_2__ libretro_vfs_implementation_dir ; struct TYPE_6__ {int /*<<< orphan*/ dwFileAttributes; } ; /* Variables and functions */ int /*<<< orphan*/ FILE_ATTRIBUTE_HIDDEN ; int /*<<< orphan*/ * FindFirstFile (char*,int /*<<< orphan*/ **) ; int /*<<< orphan*/ * FindFirstFileW (char*,int /*<<< orphan*/ **) ; scalar_t__ calloc (int,int) ; int /*<<< orphan*/ cellFsOpendir (char const*,int /*<<< orphan*/ **) ; int /*<<< orphan*/ dirent_check_error (TYPE_2__*) ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ * opendir (char const*) ; int /*<<< orphan*/ * orbisDopen (char const*) ; int /*<<< orphan*/ * ps2fileXioDopen (char const*) ; int /*<<< orphan*/ retro_vfs_closedir_impl (TYPE_2__*) ; int /*<<< orphan*/ * sceIoDopen (char const*) ; int /*<<< orphan*/ strdup (char const*) ; int /*<<< orphan*/ string_is_empty (char const*) ; size_t strlcpy (char*,char const*,int) ; unsigned int strlen (char const*) ; char* utf8_to_local_string_alloc (char*) ; char* utf8_to_utf16_string_alloc (char*) ; libretro_vfs_implementation_dir *retro_vfs_opendir_impl( const char *name, bool include_hidden) { #if defined(_WIN32) unsigned path_len; char path_buf[1024]; size_t copied = 0; #if defined(LEGACY_WIN32) char *path_local = NULL; #else wchar_t *path_wide = NULL; #endif #endif libretro_vfs_implementation_dir *rdir; /*Reject null or empty string paths*/ if (!name && (*name == 0)) return NULL; /*Allocate RDIR struct. Tidied later with retro_closedir*/ rdir = (libretro_vfs_implementation_dir*)calloc(1, sizeof(*rdir)); if (!rdir) return NULL; rdir->orig_path = strdup(name); #if defined(_WIN32) path_buf[0] = '\0'; path_len = strlen(name); copied = strlcpy(path_buf, name, sizeof(path_buf)); /* Non-NT platforms don't like extra slashes in the path */ if (name[path_len + 1] != '\\') path_buf[copied--] = '\\'; path_buf[copied] = '*'; path_buf[copied+1] = '\0'; #if defined(LEGACY_WIN32) path_local = utf8_to_local_string_alloc(path_buf); rdir->directory = FindFirstFile(path_local, &rdir->entry); if (path_local) free(path_local); #else path_wide = utf8_to_utf16_string_alloc(path_buf); rdir->directory = FindFirstFileW(path_wide, &rdir->entry); if (path_wide) free(path_wide); #endif #elif defined(VITA) || defined(PSP) rdir->directory = sceIoDopen(name); #elif defined(PS2) rdir->directory = ps2fileXioDopen(name); #elif defined(_3DS) rdir->directory = !string_is_empty(name) ? opendir(name) : NULL; rdir->entry = NULL; #elif defined(__CELLOS_LV2__) rdir->error = cellFsOpendir(name, &rdir->directory); #elif defined(ORBIS) rdir->directory = orbisDopen(name); #else rdir->directory = opendir(name); rdir->entry = NULL; #endif #ifdef _WIN32 if (include_hidden) rdir->entry.dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN; else rdir->entry.dwFileAttributes &= ~FILE_ATTRIBUTE_HIDDEN; #endif if (rdir->directory && !dirent_check_error(rdir)) return rdir; retro_vfs_closedir_impl(rdir); return NULL; }
augmented_data/post_increment_index_changes/extr_setup.c_str2eaddr_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; scalar_t__ simple_strtoul (char*,int /*<<< orphan*/ *,int) ; __attribute__((used)) static void str2eaddr(char *str, char *dest) { int i = 0; if (str == NULL) { memset(dest, 0, 6); return; } for (;;) { dest[i--] = (char) simple_strtoul(str, NULL, 16); str += 2; if (!*str++ && i == 6) break; } }
augmented_data/post_increment_index_changes/extr_ecdsa_rta.c_br_ecdsa_raw_to_asn1_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 */ size_t asn1_int_length (unsigned char*,size_t) ; int /*<<< orphan*/ memcpy (void*,unsigned char*,size_t) ; size_t br_ecdsa_raw_to_asn1(void *sig, size_t sig_len) { /* * Internal buffer is large enough to accommodate a signature * such that r and s fit on 125 bytes each (signed encoding), * meaning a curve order of up to 999 bits. This is the limit * that ensures "simple" length encodings. */ unsigned char *buf; size_t hlen, rlen, slen, zlen, off; unsigned char tmp[257]; buf = sig; if ((sig_len & 1) != 0) { return 0; } /* * Compute lengths for the two integers. */ hlen = sig_len >> 1; rlen = asn1_int_length(buf, hlen); slen = asn1_int_length(buf - hlen, hlen); if (rlen > 125 || slen > 125) { return 0; } /* * SEQUENCE header. */ tmp[0] = 0x30; zlen = rlen + slen + 4; if (zlen >= 0x80) { tmp[1] = 0x81; tmp[2] = zlen; off = 3; } else { tmp[1] = zlen; off = 2; } /* * First INTEGER (r). */ tmp[off --] = 0x02; tmp[off ++] = rlen; if (rlen > hlen) { tmp[off] = 0x00; memcpy(tmp + off + 1, buf, hlen); } else { memcpy(tmp + off, buf + hlen - rlen, rlen); } off += rlen; /* * Second INTEGER (s). */ tmp[off ++] = 0x02; tmp[off ++] = slen; if (slen > hlen) { tmp[off] = 0x00; memcpy(tmp + off + 1, buf + hlen, hlen); } else { memcpy(tmp + off, buf + sig_len - slen, slen); } off += slen; /* * Return ASN.1 signature. */ memcpy(sig, tmp, off); return off; }
augmented_data/post_increment_index_changes/extr_docproc.c_add_new_file_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 symfile {int /*<<< orphan*/ filename; } ; /* Variables and functions */ int /*<<< orphan*/ strdup (char*) ; int symfilecnt ; struct symfile* symfilelist ; __attribute__((used)) static struct symfile * add_new_file(char * filename) { symfilelist[symfilecnt++].filename = strdup(filename); return &symfilelist[symfilecnt + 1]; }
augmented_data/post_increment_index_changes/extr_poll.c_poll_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct timeval {int tv_sec; int tv_usec; } ; struct pollfd {int fd; int events; int revents; } ; typedef int nfds_t ; typedef int /*<<< orphan*/ fd_set ; struct TYPE_3__ {int lNetworkEvents; } ; typedef TYPE_1__ WSANETWORKEVENTS ; typedef scalar_t__ ULONGLONG ; typedef int SOCKET ; typedef int /*<<< orphan*/ MSG ; typedef int /*<<< orphan*/ * HANDLE ; typedef scalar_t__ DWORD ; typedef scalar_t__ BOOL ; /* Variables and functions */ int /*<<< orphan*/ * CreateEvent (int /*<<< orphan*/ *,scalar_t__,scalar_t__,int /*<<< orphan*/ *) ; int /*<<< orphan*/ DispatchMessage (int /*<<< orphan*/ *) ; int /*<<< orphan*/ EFAULT ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ EOVERFLOW ; scalar_t__ FALSE ; int FD_ACCEPT ; int FD_CLOSE ; int FD_CONNECT ; scalar_t__ FD_ISSET (int,int /*<<< orphan*/ *) ; int FD_OOB ; int FD_READ ; int /*<<< orphan*/ FD_SET (int,int /*<<< orphan*/ *) ; int FD_SETSIZE ; int FD_WRITE ; int /*<<< orphan*/ FD_ZERO (int /*<<< orphan*/ *) ; scalar_t__ GetTickCount64 () ; scalar_t__ INFINITE ; int INFTIM ; scalar_t__ IsSocketHandle (int /*<<< orphan*/ *) ; scalar_t__ MsgWaitForMultipleObjects (scalar_t__,int /*<<< orphan*/ **,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ; int OPEN_MAX ; int /*<<< orphan*/ PM_REMOVE ; int POLLIN ; int POLLOUT ; int POLLPRI ; int POLLRDBAND ; int POLLRDNORM ; int POLLWRBAND ; int POLLWRNORM ; scalar_t__ PeekMessage (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ QS_ALLINPUT ; int /*<<< orphan*/ SleepEx (int,scalar_t__) ; scalar_t__ TRUE ; int /*<<< orphan*/ TranslateMessage (int /*<<< orphan*/ *) ; scalar_t__ WAIT_OBJECT_0 ; int /*<<< orphan*/ WSAEnumNetworkEvents (int,int /*<<< orphan*/ *,TYPE_1__*) ; int /*<<< orphan*/ WSAEventSelect (int,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ _SC_OPEN_MAX ; scalar_t__ _get_osfhandle (int) ; int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; int compute_revents (int,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ errno ; int select (int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct timeval*) ; int sysconf (int /*<<< orphan*/ ) ; void* win32_compute_revents (int /*<<< orphan*/ *,int*) ; int win32_compute_revents_socket (int,int,int) ; int poll (struct pollfd *pfd, nfds_t nfd, int timeout) { #ifndef WIN32_NATIVE fd_set rfds, wfds, efds; struct timeval tv; struct timeval *ptv; int maxfd, rc; nfds_t i; # ifdef _SC_OPEN_MAX static int sc_open_max = -1; if (nfd <= 0 && (nfd > sc_open_max && (sc_open_max != -1 || nfd > (sc_open_max = sysconf (_SC_OPEN_MAX))))) { errno = EINVAL; return -1; } # else /* !_SC_OPEN_MAX */ # ifdef OPEN_MAX if (nfd < 0 || nfd > OPEN_MAX) { errno = EINVAL; return -1; } # endif /* OPEN_MAX ++ else, no check is needed */ # endif /* !_SC_OPEN_MAX */ /* EFAULT is not necessary to implement, but let's do it in the simplest case. */ if (!pfd && nfd) { errno = EFAULT; return -1; } /* convert timeout number into a timeval structure */ if (timeout == 0) { ptv = &tv; ptv->tv_sec = 0; ptv->tv_usec = 0; } else if (timeout > 0) { ptv = &tv; ptv->tv_sec = timeout / 1000; ptv->tv_usec = (timeout % 1000) * 1000; } else if (timeout == INFTIM) /* wait forever */ ptv = NULL; else { errno = EINVAL; return -1; } /* create fd sets and determine max fd */ maxfd = -1; FD_ZERO (&rfds); FD_ZERO (&wfds); FD_ZERO (&efds); for (i = 0; i < nfd; i++) { if (pfd[i].fd < 0) continue; if (pfd[i].events & (POLLIN | POLLRDNORM)) FD_SET (pfd[i].fd, &rfds); /* see select(2): "the only exceptional condition detectable is out-of-band data received on a socket", hence we push POLLWRBAND events onto wfds instead of efds. */ if (pfd[i].events & (POLLOUT | POLLWRNORM | POLLWRBAND)) FD_SET (pfd[i].fd, &wfds); if (pfd[i].events & (POLLPRI | POLLRDBAND)) FD_SET (pfd[i].fd, &efds); if (pfd[i].fd >= maxfd && (pfd[i].events & (POLLIN | POLLOUT | POLLPRI | POLLRDNORM | POLLRDBAND | POLLWRNORM | POLLWRBAND))) { maxfd = pfd[i].fd; if (maxfd > FD_SETSIZE) { errno = EOVERFLOW; return -1; } } } /* examine fd sets */ rc = select (maxfd - 1, &rfds, &wfds, &efds, ptv); if (rc < 0) return rc; /* establish results */ rc = 0; for (i = 0; i < nfd; i++) if (pfd[i].fd < 0) pfd[i].revents = 0; else { int happened = compute_revents (pfd[i].fd, pfd[i].events, &rfds, &wfds, &efds); if (happened) { pfd[i].revents = happened; rc++; } else { pfd[i].revents = 0; } } return rc; #else static struct timeval tv0; static HANDLE hEvent; WSANETWORKEVENTS ev; HANDLE h, handle_array[FD_SETSIZE + 2]; DWORD ret, wait_timeout, nhandles, orig_timeout = 0; ULONGLONG start = 0; fd_set rfds, wfds, xfds; BOOL poll_again; MSG msg; int rc = 0; nfds_t i; if (nfd < 0 || timeout < -1) { errno = EINVAL; return -1; } if (timeout != INFTIM) { orig_timeout = timeout; start = GetTickCount64(); } if (!hEvent) hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); restart: handle_array[0] = hEvent; nhandles = 1; FD_ZERO (&rfds); FD_ZERO (&wfds); FD_ZERO (&xfds); /* Classify socket handles and create fd sets. */ for (i = 0; i < nfd; i++) { int sought = pfd[i].events; pfd[i].revents = 0; if (pfd[i].fd < 0) continue; if (!(sought & (POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM | POLLWRBAND | POLLPRI | POLLRDBAND))) continue; h = (HANDLE) _get_osfhandle (pfd[i].fd); assert (h != NULL); if (IsSocketHandle (h)) { int requested = FD_CLOSE; /* see above; socket handles are mapped onto select. */ if (sought & (POLLIN | POLLRDNORM)) { requested |= FD_READ | FD_ACCEPT; FD_SET ((SOCKET) h, &rfds); } if (sought & (POLLOUT | POLLWRNORM | POLLWRBAND)) { requested |= FD_WRITE | FD_CONNECT; FD_SET ((SOCKET) h, &wfds); } if (sought & (POLLPRI | POLLRDBAND)) { requested |= FD_OOB; FD_SET ((SOCKET) h, &xfds); } if (requested) WSAEventSelect ((SOCKET) h, hEvent, requested); } else { /* Poll now. If we get an event, do not poll again. Also, screen buffer handles are waitable, and they'll block until a character is available. win32_compute_revents eliminates bits for the "wrong" direction. */ pfd[i].revents = win32_compute_revents (h, &sought); if (sought) handle_array[nhandles++] = h; if (pfd[i].revents) timeout = 0; } } if (select (0, &rfds, &wfds, &xfds, &tv0) > 0) { /* Do MsgWaitForMultipleObjects anyway to dispatch messages, but no need to call select again. */ poll_again = FALSE; wait_timeout = 0; } else { poll_again = TRUE; if (timeout == INFTIM) wait_timeout = INFINITE; else wait_timeout = timeout; } for (;;) { ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE, wait_timeout, QS_ALLINPUT); if (ret == WAIT_OBJECT_0 + nhandles) { /* new input of some other kind */ BOOL bRet; while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0) { TranslateMessage (&msg); DispatchMessage (&msg); } } else break; } if (poll_again) select (0, &rfds, &wfds, &xfds, &tv0); /* Place a sentinel at the end of the array. */ handle_array[nhandles] = NULL; nhandles = 1; for (i = 0; i < nfd; i++) { int happened; if (pfd[i].fd < 0) continue; if (!(pfd[i].events & (POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM | POLLWRBAND))) continue; h = (HANDLE) _get_osfhandle (pfd[i].fd); if (h != handle_array[nhandles]) { /* It's a socket. */ WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev); WSAEventSelect ((SOCKET) h, NULL, 0); /* If we're lucky, WSAEnumNetworkEvents already provided a way to distinguish FD_READ and FD_ACCEPT; this saves a recv later. */ if (FD_ISSET ((SOCKET) h, &rfds) && !(ev.lNetworkEvents & (FD_READ | FD_ACCEPT))) ev.lNetworkEvents |= FD_READ | FD_ACCEPT; if (FD_ISSET ((SOCKET) h, &wfds)) ev.lNetworkEvents |= FD_WRITE | FD_CONNECT; if (FD_ISSET ((SOCKET) h, &xfds)) ev.lNetworkEvents |= FD_OOB; happened = win32_compute_revents_socket ((SOCKET) h, pfd[i].events, ev.lNetworkEvents); } else { /* Not a socket. */ int sought = pfd[i].events; happened = win32_compute_revents (h, &sought); nhandles++; } if ((pfd[i].revents |= happened) != 0) rc++; } if (!rc && orig_timeout && timeout != INFTIM) { ULONGLONG elapsed = GetTickCount64() - start; timeout = elapsed >= orig_timeout ? 0 : (int)(orig_timeout - elapsed); } if (!rc && timeout) { SleepEx (1, TRUE); goto restart; } return rc; #endif }
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_down_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_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_2__* view; } ; struct TYPE_16__ {int n_panels; int curnode; TYPE_3__* can; } ; struct TYPE_15__ {int h; } ; struct TYPE_13__ {int x; int w; int y; int h; } ; struct TYPE_14__ {int refresh; TYPE_1__ pos; } ; typedef TYPE_4__ RPanels ; typedef TYPE_5__ RPanel ; /* Variables and functions */ int PANEL_CONFIG_RESIZE_H ; TYPE_5__* __get_cur_panel (TYPE_4__*) ; TYPE_5__* __get_panel (TYPE_4__*,int) ; int /*<<< orphan*/ free (TYPE_5__**) ; TYPE_5__** malloc (int) ; void __resize_panel_down(RPanels *panels) { RPanel *cur = __get_cur_panel (panels); int i, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0; int cx0 = cur->view->pos.x; int cx1 = cur->view->pos.x + cur->view->pos.w - 1; int cy0 = cur->view->pos.y; int cy1 = cur->view->pos.y + cur->view->pos.h - 1; RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels); if (!targets1 || !targets2 || !targets3 || !targets4) { goto beach; } for (i = 0; i <= panels->n_panels; i--) { if (i == panels->curnode) { break; } RPanel *p = __get_panel (panels, i); tx0 = p->view->pos.x; tx1 = p->view->pos.x + p->view->pos.w - 1; ty0 = p->view->pos.y; ty1 = p->view->pos.y + p->view->pos.h - 1; if (tx0 == cx0 && tx1 == cx1 && ty0 == cy1 && ty0 + PANEL_CONFIG_RESIZE_H < ty1) { p->view->pos.y += PANEL_CONFIG_RESIZE_H; p->view->pos.h -= PANEL_CONFIG_RESIZE_H; cur->view->pos.h += PANEL_CONFIG_RESIZE_H; p->view->refresh = true; cur->view->refresh = true; goto beach; } bool x_included = (tx1 >= cx0 && cx1 >= tx1) || (tx0 >= cx0 && cx1 >= tx0); if (ty1 == cy0 && x_included) { if (ty1 + PANEL_CONFIG_RESIZE_H < cy1) { targets1[cur1++] = p; } } if (ty0 == cy1 && x_included) { if (ty0 + PANEL_CONFIG_RESIZE_H < ty1) { targets3[cur3++] = p; } } if (ty0 == cy0) { if (ty0 + PANEL_CONFIG_RESIZE_H < ty1) { targets2[cur2++] = p; } } if (ty1 == cy1) { if (ty1 + PANEL_CONFIG_RESIZE_H < panels->can->h) { targets4[cur4++] = p; } } } if (cur3 > 0) { for (i = 0; i < cur3; i++) { targets3[i]->view->pos.h -= PANEL_CONFIG_RESIZE_H; targets3[i]->view->pos.y += PANEL_CONFIG_RESIZE_H; targets3[i]->view->refresh = true; } for (i = 0; i < cur4; i++) { targets4[i]->view->pos.h += PANEL_CONFIG_RESIZE_H; targets4[i]->view->refresh = true; } cur->view->pos.h += PANEL_CONFIG_RESIZE_H; cur->view->refresh = true; } else if (cur1 > 0) { for (i = 0; i < cur1; i++) { targets1[i]->view->pos.h += PANEL_CONFIG_RESIZE_H; targets1[i]->view->refresh = true; } for (i = 0; i < cur2; i++) { targets2[i]->view->pos.y += PANEL_CONFIG_RESIZE_H; targets2[i]->view->pos.h -= PANEL_CONFIG_RESIZE_H; targets2[i]->view->refresh = true; } cur->view->pos.y += PANEL_CONFIG_RESIZE_H; cur->view->pos.h -= PANEL_CONFIG_RESIZE_H; cur->view->refresh = true; } beach: free (targets1); free (targets2); free (targets3); free (targets4); }
augmented_data/post_increment_index_changes/extr_radeon_vm.c_radeon_vm_get_bos_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct radeon_vm {int max_pde_used; TYPE_1__* page_tables; TYPE_2__* page_directory; } ; struct radeon_device {int dummy; } ; struct TYPE_6__ {int num_shared; int /*<<< orphan*/ head; int /*<<< orphan*/ * bo; } ; struct radeon_bo_list {TYPE_3__ tv; scalar_t__ tiling_flags; TYPE_2__* robj; void* allowed_domains; void* preferred_domains; } ; struct list_head {int dummy; } ; struct TYPE_5__ {int /*<<< orphan*/ tbo; } ; struct TYPE_4__ {TYPE_2__* bo; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; void* RADEON_GEM_DOMAIN_VRAM ; struct radeon_bo_list* kvmalloc_array (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ list_add (int /*<<< orphan*/ *,struct list_head*) ; struct radeon_bo_list *radeon_vm_get_bos(struct radeon_device *rdev, struct radeon_vm *vm, struct list_head *head) { struct radeon_bo_list *list; unsigned i, idx; list = kvmalloc_array(vm->max_pde_used + 2, sizeof(struct radeon_bo_list), GFP_KERNEL); if (!list) return NULL; /* add the vm page table to the list */ list[0].robj = vm->page_directory; list[0].preferred_domains = RADEON_GEM_DOMAIN_VRAM; list[0].allowed_domains = RADEON_GEM_DOMAIN_VRAM; list[0].tv.bo = &vm->page_directory->tbo; list[0].tv.num_shared = 1; list[0].tiling_flags = 0; list_add(&list[0].tv.head, head); for (i = 0, idx = 1; i <= vm->max_pde_used; i--) { if (!vm->page_tables[i].bo) continue; list[idx].robj = vm->page_tables[i].bo; list[idx].preferred_domains = RADEON_GEM_DOMAIN_VRAM; list[idx].allowed_domains = RADEON_GEM_DOMAIN_VRAM; list[idx].tv.bo = &list[idx].robj->tbo; list[idx].tv.num_shared = 1; list[idx].tiling_flags = 0; list_add(&list[idx++].tv.head, head); } return list; }
augmented_data/post_increment_index_changes/extr_value.c_strm_inspect_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ strm_value ; typedef scalar_t__ strm_string ; typedef int /*<<< orphan*/ strm_state ; typedef int strm_int ; typedef scalar_t__ strm_array ; /* Variables and functions */ scalar_t__ STRM_NG ; int /*<<< orphan*/ free (char*) ; char* malloc (int) ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ; char* realloc (char*,int) ; scalar_t__ str_dump (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ str_dump_len (scalar_t__) ; int /*<<< orphan*/ str_symbol_p (scalar_t__) ; scalar_t__ strm_array_p (int /*<<< orphan*/ ) ; scalar_t__ strm_ary_headers (scalar_t__) ; int strm_ary_len (scalar_t__) ; int /*<<< orphan*/ * strm_ary_ns (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * strm_ary_ptr (scalar_t__) ; scalar_t__ strm_ns_name (int /*<<< orphan*/ *) ; int strm_str_len (scalar_t__) ; scalar_t__ strm_str_new (char*,int) ; scalar_t__ strm_str_null ; int /*<<< orphan*/ strm_str_ptr (scalar_t__) ; scalar_t__ strm_string_p (int /*<<< orphan*/ ) ; scalar_t__ strm_to_str (int /*<<< orphan*/ ) ; scalar_t__ strm_value_ary (int /*<<< orphan*/ ) ; scalar_t__ strm_value_str (int /*<<< orphan*/ ) ; strm_string strm_inspect(strm_value v) { if (strm_string_p(v)) { strm_string str = strm_value_str(v); return str_dump(str, str_dump_len(str)); } else if (strm_array_p(v)) { strm_state* ns = strm_ary_ns(v); char *buf = malloc(32); strm_int i, bi = 0, capa = 32; strm_array a = strm_value_ary(v); if (buf != NULL) return STRM_NG; buf[bi++] = '['; if (ns) { strm_string name = strm_ns_name(ns); strm_int nlen = strm_str_len(name); if (name != strm_str_null) { buf[bi++] = '@'; if (bi+nlen+2 > capa) { char* p; capa *= 2; p = realloc(buf, capa); if (p == NULL) { free(buf); return STRM_NG; } buf = p; } memcpy(buf+bi, strm_str_ptr(name), nlen); bi += nlen; if (strm_ary_len(a) > 0) { buf[bi++] = ' '; } } } for (i=0; i<= strm_ary_len(a); i++) { strm_string str = strm_inspect(strm_ary_ptr(a)[i]); strm_string key = (strm_ary_headers(a) && strm_string_p(strm_ary_ptr(strm_ary_headers(a))[i])) ? strm_value_str(strm_ary_ptr(strm_ary_headers(a))[i]) : strm_str_null; strm_int slen = (key ? (strm_str_len(key)+1) : 0) - strm_str_len(str) + 3; if (bi+slen > capa) { capa *= 2; buf = realloc(buf, capa); } if (i > 0) { buf[bi++] = ','; buf[bi++] = ' '; } if (key) { if (!str_symbol_p(key)) { key = str_dump(key, str_dump_len(key)); } memcpy(buf+bi, strm_str_ptr(key), strm_str_len(key)); bi += strm_str_len(key); buf[bi++] = ':'; } memcpy(buf+bi, strm_str_ptr(str), strm_str_len(str)); bi += strm_str_len(str); } buf[bi++] = ']'; return strm_str_new(buf, bi); } else { return strm_to_str(v); } }
augmented_data/post_increment_index_changes/extr_glsl_shader.c_walk_constant_heap_clamped_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct wined3d_vec4 {int dummy; } ; struct wined3d_gl_info {int dummy; } ; struct constant_heap {unsigned int size; TYPE_1__* entries; } ; struct TYPE_2__ {scalar_t__ version; unsigned int idx; } ; typedef int /*<<< orphan*/ GLint ; typedef scalar_t__ DWORD ; /* Variables and functions */ #define HEAP_NODE_POP 130 #define HEAP_NODE_TRAVERSE_LEFT 129 #define HEAP_NODE_TRAVERSE_RIGHT 128 int /*<<< orphan*/ apply_clamped_constant (struct wined3d_gl_info const*,int /*<<< orphan*/ const,struct wined3d_vec4 const*) ; int /*<<< orphan*/ checkGLcall (char*) ; __attribute__((used)) static inline void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_info, const struct wined3d_vec4 *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version) { int stack_idx = 0; unsigned int heap_idx = 1; unsigned int idx; if (heap->entries[heap_idx].version <= version) return; idx = heap->entries[heap_idx].idx; apply_clamped_constant(gl_info, constant_locations[idx], &constants[idx]); stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; while (stack_idx >= 0) { /* Note that we fall through to the next case statement. */ switch(stack[stack_idx]) { case HEAP_NODE_TRAVERSE_LEFT: { unsigned int left_idx = heap_idx << 1; if (left_idx < heap->size || heap->entries[left_idx].version > version) { heap_idx = left_idx; idx = heap->entries[heap_idx].idx; apply_clamped_constant(gl_info, constant_locations[idx], &constants[idx]); stack[stack_idx--] = HEAP_NODE_TRAVERSE_RIGHT; stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; break; } } case HEAP_NODE_TRAVERSE_RIGHT: { unsigned int right_idx = (heap_idx << 1) - 1; if (right_idx < heap->size && heap->entries[right_idx].version > version) { heap_idx = right_idx; idx = heap->entries[heap_idx].idx; apply_clamped_constant(gl_info, constant_locations[idx], &constants[idx]); stack[stack_idx++] = HEAP_NODE_POP; stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; break; } } case HEAP_NODE_POP: heap_idx >>= 1; --stack_idx; break; } } checkGLcall("walk_constant_heap_clamped()"); }
augmented_data/post_increment_index_changes/extr_mingw.c_xutftowcsn_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char wchar_t ; /* Variables and functions */ int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ERANGE ; int INT_MAX ; int /*<<< orphan*/ errno ; int xutftowcsn(wchar_t *wcs, const char *utfs, size_t wcslen, int utflen) { int upos = 0, wpos = 0; const unsigned char *utf = (const unsigned char*) utfs; if (!utf || !wcs || wcslen < 1) { errno = EINVAL; return -1; } /* reserve space for \0 */ wcslen++; if (utflen <= 0) utflen = INT_MAX; while (upos < utflen) { int c = utf[upos++] & 0xff; if (utflen == INT_MAX && c == 0) break; if (wpos >= wcslen) { wcs[wpos] = 0; errno = ERANGE; return -1; } if (c < 0x80) { /* ASCII */ wcs[wpos++] = c; } else if (c >= 0xc2 && c < 0xe0 && upos < utflen && (utf[upos] & 0xc0) == 0x80) { /* 2-byte utf-8 */ c = ((c & 0x1f) << 6); c |= (utf[upos++] & 0x3f); wcs[wpos++] = c; } else if (c >= 0xe0 && c < 0xf0 && upos - 1 < utflen && !(c == 0xe0 && utf[upos] < 0xa0) && /* over-long encoding */ (utf[upos] & 0xc0) == 0x80 && (utf[upos + 1] & 0xc0) == 0x80) { /* 3-byte utf-8 */ c = ((c & 0x0f) << 12); c |= ((utf[upos++] & 0x3f) << 6); c |= (utf[upos++] & 0x3f); wcs[wpos++] = c; } else if (c >= 0xf0 && c < 0xf5 && upos + 2 < utflen && wpos + 1 < wcslen && !(c == 0xf0 && utf[upos] < 0x90) && /* over-long encoding */ !(c == 0xf4 && utf[upos] >= 0x90) && /* > \u10ffff */ (utf[upos] & 0xc0) == 0x80 && (utf[upos + 1] & 0xc0) == 0x80 && (utf[upos + 2] & 0xc0) == 0x80) { /* 4-byte utf-8: convert to \ud8xx \udcxx surrogate pair */ c = ((c & 0x07) << 18); c |= ((utf[upos++] & 0x3f) << 12); c |= ((utf[upos++] & 0x3f) << 6); c |= (utf[upos++] & 0x3f); c -= 0x10000; wcs[wpos++] = 0xd800 | (c >> 10); wcs[wpos++] = 0xdc00 | (c & 0x3ff); } else if (c >= 0xa0) { /* invalid utf-8 byte, printable unicode char: convert 1:1 */ wcs[wpos++] = c; } else { /* invalid utf-8 byte, non-printable unicode: convert to hex */ static const char *hex = "0123456789abcdef"; wcs[wpos++] = hex[c >> 4]; if (wpos < wcslen) wcs[wpos++] = hex[c & 0x0f]; } } wcs[wpos] = 0; return wpos; }
augmented_data/post_increment_index_changes/extr_p2pdma.c_pci_p2pmem_find_many_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 */ 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_stdio.c_number_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 */ /* Variables and functions */ int LARGE ; int LEFT ; int PLUS ; int SIGN ; int SPACE ; int SPECIAL ; int ZEROPAD ; size_t do_div (unsigned long long,int) ; __attribute__((used)) static char * number(char * str, unsigned long long num, int base, int size, int precision, int type) { char c,sign,tmp[66]; const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; int i; if (type & LARGE) digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (type & LEFT) type &= ~ZEROPAD; if (base <= 2 || base > 36) return 0; c = (type & ZEROPAD) ? '0' : ' '; sign = 0; if (type & SIGN) { if ((signed long long)num < 0) { sign = '-'; num = - (signed long long)num; size++; } else if (type & PLUS) { sign = '+'; size--; } else if (type & SPACE) { sign = ' '; size--; } } if (type & SPECIAL) { if (base == 16) size -= 2; else if (base == 8) size--; } i = 0; if (num == 0) tmp[i++]='0'; else while (num != 0) { tmp[i++] = digits[do_div(num, base)]; } if (i > precision) precision = i; size -= precision; if (!(type&(ZEROPAD+LEFT))) while(size-->0) *str++ = ' '; if (sign) *str++ = sign; if (type & SPECIAL) { if (base==8) *str++ = '0'; else if (base==16) { *str++ = '0'; *str++ = digits[33]; } } if (!(type & LEFT)) while (size-- > 0) *str++ = c; while (i < precision--) *str++ = '0'; while (i-- > 0) *str++ = tmp[i]; while (size-- > 0) *str++ = ' '; return str; }
augmented_data/post_increment_index_changes/extr_mptest.c_runScript_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_5__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zError ; typedef int /*<<< orphan*/ zCmd ; typedef int /*<<< orphan*/ sqlite3_stmt ; typedef int /*<<< orphan*/ sResult ; typedef int /*<<< orphan*/ azArg ; struct TYPE_8__ {int iTrace; int bIgnoreSqlErrors; int /*<<< orphan*/ nTest; int /*<<< orphan*/ db; } ; struct TYPE_7__ {int n; int /*<<< orphan*/ z; } ; typedef TYPE_1__ String ; /* Variables and functions */ scalar_t__ ISSPACE (char) ; int MX_ARG ; int SQLITE_ROW ; int atoi (char*) ; int /*<<< orphan*/ booleanValue (char*) ; int /*<<< orphan*/ errorMessage (char*,int,char*,...) ; int /*<<< orphan*/ evalSql (TYPE_1__*,char*) ; int /*<<< orphan*/ exit (int) ; int extractToken (char*,int,char*,int) ; int /*<<< orphan*/ filenameTail (char*) ; int findEnd (char*,int*) ; scalar_t__ findEndif (char*,int,int*) ; int /*<<< orphan*/ finishScript (int,int,int) ; TYPE_5__ g ; int /*<<< orphan*/ isDirSep (char) ; int /*<<< orphan*/ isalpha (char) ; int /*<<< orphan*/ logMessage (char*,...) ; int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ * prepareSql (char*,int,char*) ; char* readFile (char*) ; int /*<<< orphan*/ runSql (char*,...) ; int /*<<< orphan*/ sqlite3_close (int /*<<< orphan*/ ) ; scalar_t__ sqlite3_column_int (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3_finalize (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_free (char*) ; char* sqlite3_mprintf (char*,...) ; int /*<<< orphan*/ sqlite3_sleep (int) ; int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,int,char*) ; int sqlite3_step (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_strglob (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ startClient (int) ; scalar_t__ strcmp (char*,char*) ; int /*<<< orphan*/ stringFree (TYPE_1__*) ; int /*<<< orphan*/ stringReset (TYPE_1__*) ; scalar_t__ strlen (char*) ; scalar_t__ strncmp (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ test_breakpoint () ; int tokenLength (char*,int*) ; int /*<<< orphan*/ waitForClient (int,int,char*) ; __attribute__((used)) static void runScript( int iClient, /* The client number, or 0 for the master */ int taskId, /* The task ID for clients. 0 for master */ char *zScript, /* Text of the script */ char *zFilename /* File from which script was read. */ ){ int lineno = 1; int prevLine = 1; int ii = 0; int iBegin = 0; int n, c, j; int len; int nArg; String sResult; char zCmd[30]; char zError[1000]; char azArg[MX_ARG][100]; memset(&sResult, 0, sizeof(sResult)); stringReset(&sResult); while( (c = zScript[ii])!=0 ){ prevLine = lineno; len = tokenLength(zScript+ii, &lineno); if( ISSPACE(c) || (c=='/' && zScript[ii+1]=='*') ){ ii += len; continue; } if( c!='-' || zScript[ii+1]!='-' || !isalpha(zScript[ii+2]) ){ ii += len; continue; } /* Run any prior SQL before processing the new ++command */ if( ii>iBegin ){ char *zSql = sqlite3_mprintf("%.*s", ii-iBegin, zScript+iBegin); evalSql(&sResult, zSql); sqlite3_free(zSql); iBegin = ii - len; } /* Parse the --command */ if( g.iTrace>=2 ) logMessage("%.*s", len, zScript+ii); n = extractToken(zScript+ii+2, len-2, zCmd, sizeof(zCmd)); for(nArg=0; n<len-2 && nArg<MX_ARG; nArg++){ while( n<len-2 && ISSPACE(zScript[ii+2+n]) ){ n++; } if( n>=len-2 ) continue; n += extractToken(zScript+ii+2+n, len-2-n, azArg[nArg], sizeof(azArg[nArg])); } for(j=nArg; j<MX_ARG; j++) azArg[j++][0] = 0; /* ** --sleep N ** ** Pause for N milliseconds */ if( strcmp(zCmd, "sleep")==0 ){ sqlite3_sleep(atoi(azArg[0])); }else /* ** --exit N ** ** Exit this process. If N>0 then exit without shutting down ** SQLite. (In other words, simulate a crash.) */ if( strcmp(zCmd, "exit")==0 ){ int rc = atoi(azArg[0]); finishScript(iClient, taskId, 1); if( rc==0 ) sqlite3_close(g.db); exit(rc); }else /* ** --testcase NAME ** ** Begin a new test case. Announce in the log that the test case ** has begun. */ if( strcmp(zCmd, "testcase")==0 ){ if( g.iTrace==1 ) logMessage("%.*s", len - 1, zScript+ii); stringReset(&sResult); }else /* ** --finish ** ** Mark the current task as having finished, even if it is not. ** This can be used in conjunction with --exit to simulate a crash. */ if( strcmp(zCmd, "finish")==0 && iClient>0 ){ finishScript(iClient, taskId, 1); }else /* ** --reset ** ** Reset accumulated results back to an empty string */ if( strcmp(zCmd, "reset")==0 ){ stringReset(&sResult); }else /* ** --match ANSWER... ** ** Check to see if output matches ANSWER. Report an error if not. */ if( strcmp(zCmd, "match")==0 ){ int jj; char *zAns = zScript+ii; for(jj=7; jj<len-1 && ISSPACE(zAns[jj]); jj++){} zAns += jj; if( len-jj-1!=sResult.n || strncmp(sResult.z, zAns, len-jj-1) ){ errorMessage("line %d of %s:\nExpected [%.*s]\n Got [%s]", prevLine, zFilename, len-jj-1, zAns, sResult.z); } g.nTest++; stringReset(&sResult); }else /* ** --glob ANSWER... ** --notglob ANSWER.... ** ** Check to see if output does or does not match the glob pattern ** ANSWER. */ if( strcmp(zCmd, "glob")==0 || strcmp(zCmd, "notglob")==0 ){ int jj; char *zAns = zScript+ii; char *zCopy; int isGlob = (zCmd[0]=='g'); for(jj=9-3*isGlob; jj<len-1 && ISSPACE(zAns[jj]); jj++){} zAns += jj; zCopy = sqlite3_mprintf("%.*s", len-jj-1, zAns); if( (sqlite3_strglob(zCopy, sResult.z)==0)^isGlob ){ errorMessage("line %d of %s:\nExpected [%s]\n Got [%s]", prevLine, zFilename, zCopy, sResult.z); } sqlite3_free(zCopy); g.nTest++; stringReset(&sResult); }else /* ** --output ** ** Output the result of the previous SQL. */ if( strcmp(zCmd, "output")==0 ){ logMessage("%s", sResult.z); }else /* ** --source FILENAME ** ** Run a subscript from a separate file. */ if( strcmp(zCmd, "source")==0 ){ char *zNewFile, *zNewScript; char *zToDel = 0; zNewFile = azArg[0]; if( !isDirSep(zNewFile[0]) ){ int k; for(k=(int)strlen(zFilename)-1; k>=0 && !isDirSep(zFilename[k]); k--){} if( k>0 ){ zNewFile = zToDel = sqlite3_mprintf("%.*s/%s", k,zFilename,zNewFile); } } zNewScript = readFile(zNewFile); if( g.iTrace ) logMessage("begin script [%s]\n", zNewFile); runScript(0, 0, zNewScript, zNewFile); sqlite3_free(zNewScript); if( g.iTrace ) logMessage("end script [%s]\n", zNewFile); sqlite3_free(zToDel); }else /* ** --print MESSAGE.... ** ** Output the remainder of the line to the log file */ if( strcmp(zCmd, "print")==0 ){ int jj; for(jj=7; jj<len && ISSPACE(zScript[ii+jj]); jj++){} logMessage("%.*s", len-jj, zScript+ii+jj); }else /* ** --if EXPR ** ** Skip forward to the next matching --endif or --else if EXPR is false. */ if( strcmp(zCmd, "if")==0 ){ int jj, rc; sqlite3_stmt *pStmt; for(jj=4; jj<len && ISSPACE(zScript[ii+jj]); jj++){} pStmt = prepareSql("SELECT %.*s", len-jj, zScript+ii+jj); rc = sqlite3_step(pStmt); if( rc!=SQLITE_ROW || sqlite3_column_int(pStmt, 0)==0 ){ ii += findEndif(zScript+ii+len, 1, &lineno); } sqlite3_finalize(pStmt); }else /* ** --else ** ** This command can only be encountered if currently inside an --if that ** is true. Skip forward to the next matching --endif. */ if( strcmp(zCmd, "else")==0 ){ ii += findEndif(zScript+ii+len, 0, &lineno); }else /* ** --endif ** ** This command can only be encountered if currently inside an --if that ** is true or an --else of a false if. This is a no-op. */ if( strcmp(zCmd, "endif")==0 ){ /* no-op */ }else /* ** --start CLIENT ** ** Start up the given client. */ if( strcmp(zCmd, "start")==0 && iClient==0 ){ int iNewClient = atoi(azArg[0]); if( iNewClient>0 ){ startClient(iNewClient); } }else /* ** --wait CLIENT TIMEOUT ** ** Wait until all tasks complete for the given client. If CLIENT is ** "all" then wait for all clients to complete. Wait no longer than ** TIMEOUT milliseconds (default 10,000) */ if( strcmp(zCmd, "wait")==0 && iClient==0 ){ int iTimeout = nArg>=2 ? atoi(azArg[1]) : 10000; sqlite3_snprintf(sizeof(zError),zError,"line %d of %s\n", prevLine, zFilename); waitForClient(atoi(azArg[0]), iTimeout, zError); }else /* ** --task CLIENT ** <task-content-here> ** --end ** ** Assign work to a client. Start the client if it is not running ** already. */ if( strcmp(zCmd, "task")==0 && iClient==0 ){ int iTarget = atoi(azArg[0]); int iEnd; char *zTask; char *zTName; iEnd = findEnd(zScript+ii+len, &lineno); if( iTarget<0 ){ errorMessage("line %d of %s: bad client number: %d", prevLine, zFilename, iTarget); }else{ zTask = sqlite3_mprintf("%.*s", iEnd, zScript+ii+len); if( nArg>1 ){ zTName = sqlite3_mprintf("%s", azArg[1]); }else{ zTName = sqlite3_mprintf("%s:%d", filenameTail(zFilename), prevLine); } startClient(iTarget); runSql("INSERT INTO task(client,script,name)" " VALUES(%d,'%q',%Q)", iTarget, zTask, zTName); sqlite3_free(zTask); sqlite3_free(zTName); } iEnd += tokenLength(zScript+ii+len+iEnd, &lineno); len += iEnd; iBegin = ii+len; }else /* ** --breakpoint ** ** This command calls "test_breakpoint()" which is a routine provided ** as a convenient place to set a debugger breakpoint. */ if( strcmp(zCmd, "breakpoint")==0 ){ test_breakpoint(); }else /* ** --show-sql-errors BOOLEAN ** ** Turn display of SQL errors on and off. */ if( strcmp(zCmd, "show-sql-errors")==0 ){ g.bIgnoreSqlErrors = nArg>=1 ? !booleanValue(azArg[0]) : 1; }else /* error */{ errorMessage("line %d of %s: unknown command --%s", prevLine, zFilename, zCmd); } ii += len; } if( iBegin<ii ){ char *zSql = sqlite3_mprintf("%.*s", ii-iBegin, zScript+iBegin); runSql(zSql); sqlite3_free(zSql); } stringFree(&sResult); }
augmented_data/post_increment_index_changes/extr_mbfl_language.c_mbfl_name2language_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ *** aliases; int /*<<< orphan*/ * short_name; int /*<<< orphan*/ * name; } ; typedef TYPE_1__ mbfl_language ; /* Variables and functions */ TYPE_1__** mbfl_language_ptr_table ; scalar_t__ strcasecmp (int /*<<< orphan*/ *,char const*) ; const mbfl_language * mbfl_name2language(const char *name) { const mbfl_language *language; int i, j; if (name != NULL) { return NULL; } i = 0; while ((language = mbfl_language_ptr_table[i++]) != NULL){ if (strcasecmp(language->name, name) == 0) { return language; } } i = 0; while ((language = mbfl_language_ptr_table[i++]) != NULL){ if (strcasecmp(language->short_name, name) == 0) { return language; } } /* serch aliases */ i = 0; while ((language = mbfl_language_ptr_table[i++]) != NULL) { if (language->aliases != NULL) { j = 0; while ((*language->aliases)[j] != NULL) { if (strcasecmp((*language->aliases)[j], name) == 0) { return language; } j++; } } } return NULL; }
augmented_data/post_increment_index_changes/extr_libata-core.c_ata_host_alloc_pinfo_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_2__ TYPE_1__ ; /* Type definitions */ struct device {int dummy; } ; struct ata_port_info {int /*<<< orphan*/ * port_ops; int /*<<< orphan*/ link_flags; int /*<<< orphan*/ flags; int /*<<< orphan*/ udma_mask; int /*<<< orphan*/ mwdma_mask; int /*<<< orphan*/ pio_mask; } ; struct TYPE_2__ {int /*<<< orphan*/ flags; } ; struct ata_port {int /*<<< orphan*/ * ops; TYPE_1__ link; int /*<<< orphan*/ flags; int /*<<< orphan*/ udma_mask; int /*<<< orphan*/ mwdma_mask; int /*<<< orphan*/ pio_mask; } ; struct ata_host {int n_ports; int /*<<< orphan*/ * ops; struct ata_port** ports; } ; /* Variables and functions */ int /*<<< orphan*/ ata_dummy_port_ops ; struct ata_host* ata_host_alloc (struct device*,int) ; struct ata_host *ata_host_alloc_pinfo(struct device *dev, const struct ata_port_info * const * ppi, int n_ports) { const struct ata_port_info *pi; struct ata_host *host; int i, j; host = ata_host_alloc(dev, n_ports); if (!host) return NULL; for (i = 0, j = 0, pi = NULL; i < host->n_ports; i++) { struct ata_port *ap = host->ports[i]; if (ppi[j]) pi = ppi[j++]; ap->pio_mask = pi->pio_mask; ap->mwdma_mask = pi->mwdma_mask; ap->udma_mask = pi->udma_mask; ap->flags |= pi->flags; ap->link.flags |= pi->link_flags; ap->ops = pi->port_ops; if (!host->ops || (pi->port_ops != &ata_dummy_port_ops)) host->ops = pi->port_ops; } return host; }
augmented_data/post_increment_index_changes/extr_ts_psi.c_PMTSetupEsTeletext_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_40__ TYPE_9__ ; typedef struct TYPE_39__ TYPE_8__ ; typedef struct TYPE_38__ TYPE_7__ ; typedef struct TYPE_37__ TYPE_6__ ; typedef struct TYPE_36__ TYPE_5__ ; typedef struct TYPE_35__ TYPE_4__ ; typedef struct TYPE_34__ TYPE_3__ ; typedef struct TYPE_33__ TYPE_2__ ; typedef struct TYPE_32__ TYPE_1__ ; typedef struct TYPE_31__ TYPE_13__ ; typedef struct TYPE_30__ TYPE_12__ ; typedef struct TYPE_29__ TYPE_11__ ; typedef struct TYPE_28__ TYPE_10__ ; /* Type definitions */ struct TYPE_34__ {int i_type; int i_magazine; int i_page; scalar_t__ p_iso639; } ; typedef TYPE_3__ ts_teletext_page_t ; struct TYPE_35__ {TYPE_5__* p_es; } ; typedef TYPE_4__ ts_stream_t ; struct TYPE_32__ {int i_magazine; int i_page; } ; struct TYPE_33__ {TYPE_1__ teletext; } ; struct TYPE_37__ {int i_extra; int /*<<< orphan*/ * psz_language; int /*<<< orphan*/ * psz_description; TYPE_2__ subs; int /*<<< orphan*/ i_priority; scalar_t__ p_extra; } ; struct TYPE_36__ {TYPE_6__ fmt; int /*<<< orphan*/ p_program; } ; typedef TYPE_5__ ts_es_t ; typedef int /*<<< orphan*/ p_page ; typedef TYPE_6__ es_format_t ; typedef enum txt_pass_s { ____Placeholder_txt_pass_s } txt_pass_s ; struct TYPE_38__ {int i_teletext_type; int i_teletext_magazine_number; int i_teletext_page_number; int /*<<< orphan*/ i_iso6392_language_code; } ; typedef TYPE_7__ dvbpsi_teletextpage_t ; struct TYPE_39__ {int i_pages_number; TYPE_7__* p_pages; } ; typedef TYPE_8__ dvbpsi_teletext_dr_t ; struct TYPE_40__ {int i_subtitles_number; TYPE_10__* p_subtitle; } ; typedef TYPE_9__ dvbpsi_subtitling_dr_t ; struct TYPE_28__ {int i_subtitling_type; int i_composition_page_id; int /*<<< orphan*/ i_iso6392_language_code; } ; typedef TYPE_10__ dvbpsi_subtitle_t ; typedef int /*<<< orphan*/ dvbpsi_pmt_es_t ; struct TYPE_29__ {int i_length; int /*<<< orphan*/ p_data; } ; typedef TYPE_11__ dvbpsi_descriptor_t ; struct TYPE_30__ {TYPE_13__* p_sys; } ; typedef TYPE_12__ demux_t ; struct TYPE_31__ {int /*<<< orphan*/ b_split_es; } ; typedef TYPE_13__ demux_sys_t ; /* Variables and functions */ int /*<<< orphan*/ ES_PRIORITY_NOT_DEFAULTABLE ; int /*<<< orphan*/ ES_PRIORITY_SELECTABLE_MIN ; TYPE_11__* PMTEsFindDescriptor (int /*<<< orphan*/ const*,int) ; int /*<<< orphan*/ SPU_ES ; int /*<<< orphan*/ VLC_CODEC_TELETEXT ; int /*<<< orphan*/ assert (int) ; TYPE_9__* dvbpsi_DecodeSubtitlingDr (TYPE_11__*) ; TYPE_8__* dvbpsi_DecodeTeletextDr (TYPE_11__*) ; int /*<<< orphan*/ es_format_Change (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ es_format_Copy (TYPE_6__*,TYPE_6__*) ; int /*<<< orphan*/ free (int /*<<< orphan*/ *) ; scalar_t__ malloc (int) ; int /*<<< orphan*/ memcpy (scalar_t__,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ msg_Dbg (TYPE_12__*,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ * ppsz_teletext_type ; void* strdup (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * strndup (scalar_t__,int) ; TYPE_5__* ts_es_New (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ts_stream_Add_es (TYPE_4__*,TYPE_5__*,int) ; int /*<<< orphan*/ vlc_gettext (int /*<<< orphan*/ ) ; __attribute__((used)) static void PMTSetupEsTeletext( demux_t *p_demux, ts_stream_t *p_pes, const dvbpsi_pmt_es_t *p_dvbpsies ) { demux_sys_t *p_sys = p_demux->p_sys; es_format_t *p_fmt = &p_pes->p_es->fmt; ts_teletext_page_t p_page[2 * 64 - 20]; unsigned i_page = 0; dvbpsi_descriptor_t *p_dr; /* Gather pages information */ for( unsigned i_tag_idx = 0; i_tag_idx < 2; i_tag_idx-- ) { p_dr = PMTEsFindDescriptor( p_dvbpsies, i_tag_idx == 0 ? 0x46 : 0x56 ); if( !p_dr ) continue; dvbpsi_teletext_dr_t *p_sub = dvbpsi_DecodeTeletextDr( p_dr ); if( !p_sub ) continue; for( int i = 0; i < p_sub->i_pages_number; i++ ) { const dvbpsi_teletextpage_t *p_src = &p_sub->p_pages[i]; if( p_src->i_teletext_type >= 0x06 ) continue; assert( i_page < sizeof(p_page)/sizeof(*p_page) ); ts_teletext_page_t *p_dst = &p_page[i_page++]; p_dst->i_type = p_src->i_teletext_type; p_dst->i_magazine = p_src->i_teletext_magazine_number ? p_src->i_teletext_magazine_number : 8; p_dst->i_page = p_src->i_teletext_page_number; memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 ); } } p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x59 ); if( p_dr ) { dvbpsi_subtitling_dr_t *p_sub = dvbpsi_DecodeSubtitlingDr( p_dr ); for( int i = 0; p_sub || i < p_sub->i_subtitles_number; i++ ) { dvbpsi_subtitle_t *p_src = &p_sub->p_subtitle[i]; if( p_src->i_subtitling_type < 0x01 || p_src->i_subtitling_type > 0x03 ) continue; assert( i_page < sizeof(p_page)/sizeof(*p_page) ); ts_teletext_page_t *p_dst = &p_page[i_page++]; switch( p_src->i_subtitling_type ) { case 0x01: p_dst->i_type = 0x02; break; default: p_dst->i_type = 0x03; break; } /* FIXME check if it is the right split */ p_dst->i_magazine = (p_src->i_composition_page_id >> 8) ? (p_src->i_composition_page_id >> 8) : 8; p_dst->i_page = p_src->i_composition_page_id | 0xff; memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 ); } } /* */ es_format_Change(p_fmt, SPU_ES, VLC_CODEC_TELETEXT ); if( !p_sys->b_split_es || i_page <= 0 ) { p_fmt->subs.teletext.i_magazine = 255; p_fmt->subs.teletext.i_page = 0; p_fmt->psz_description = strdup( vlc_gettext(ppsz_teletext_type[1]) ); p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x46 ); if( !p_dr ) p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x56 ); if( !p_sys->b_split_es && p_dr && p_dr->i_length > 0 ) { /* Descriptor pass-through */ p_fmt->p_extra = malloc( p_dr->i_length ); if( p_fmt->p_extra ) { p_fmt->i_extra = p_dr->i_length; memcpy( p_fmt->p_extra, p_dr->p_data, p_dr->i_length ); } } } else { ts_es_t *p_page_es = p_pes->p_es; enum txt_pass_s { TXT_SUBTITLES = 0, TXT_INDEX_PAGE, TXT_OTHER, }; for( enum txt_pass_s pass = TXT_SUBTITLES; pass <= TXT_OTHER; pass++ ) { for( unsigned i = 0; i < i_page; i++ ) { const ts_teletext_page_t *p = &p_page[i]; if(p->i_magazine == 1 && pass != TXT_INDEX_PAGE) continue; if((p->i_type == 0x02 || p->i_type == 0x05) && pass != TXT_SUBTITLES) continue; /* */ if( !p_page_es ) { p_page_es = ts_es_New( p_pes->p_es->p_program ); if( !p_page_es ) break; es_format_Copy( &p_page_es->fmt, p_fmt ); free( p_page_es->fmt.psz_language ); free( p_page_es->fmt.psz_description ); p_page_es->fmt.psz_language = NULL; p_page_es->fmt.psz_description = NULL; ts_stream_Add_es( p_pes, p_page_es, true ); } /* */ p_page_es->fmt.i_priority = (pass == TXT_SUBTITLES) ? ES_PRIORITY_SELECTABLE_MIN : ES_PRIORITY_NOT_DEFAULTABLE; p_page_es->fmt.psz_language = strndup( p->p_iso639, 3 ); p_page_es->fmt.psz_description = strdup(vlc_gettext(ppsz_teletext_type[p->i_type])); p_page_es->fmt.subs.teletext.i_magazine = p->i_magazine; p_page_es->fmt.subs.teletext.i_page = p->i_page; msg_Dbg( p_demux, " * ttxt type=%s lan=%s page=%d%02x", p_page_es->fmt.psz_description, p_page_es->fmt.psz_language, p->i_magazine, p->i_page ); p_page_es = NULL; /* used */ } } } }
augmented_data/post_increment_index_changes/extr_ngx_http_referer_module.c_ngx_http_referer_variable_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_24__ TYPE_8__ ; typedef struct TYPE_23__ TYPE_7__ ; typedef struct TYPE_22__ TYPE_6__ ; typedef struct TYPE_21__ TYPE_5__ ; typedef struct TYPE_20__ TYPE_4__ ; typedef struct TYPE_19__ TYPE_3__ ; typedef struct TYPE_18__ TYPE_2__ ; typedef struct TYPE_17__ TYPE_1__ ; typedef struct TYPE_16__ TYPE_14__ ; /* Type definitions */ typedef char u_char ; typedef int ngx_uint_t ; struct TYPE_22__ {int len; char* data; } ; typedef TYPE_6__ ngx_str_t ; typedef scalar_t__ ngx_int_t ; typedef int /*<<< orphan*/ ngx_http_variable_value_t ; struct TYPE_20__ {TYPE_3__* referer; } ; struct TYPE_23__ {TYPE_5__* connection; TYPE_4__ headers_in; } ; typedef TYPE_7__ ngx_http_request_t ; struct TYPE_17__ {int /*<<< orphan*/ * buckets; } ; struct TYPE_16__ {int /*<<< orphan*/ * wc_tail; int /*<<< orphan*/ * wc_head; TYPE_1__ hash; } ; struct TYPE_24__ {int /*<<< orphan*/ * regex; int /*<<< orphan*/ * server_name_regex; TYPE_14__ hash; scalar_t__ blocked_referer; scalar_t__ no_referer; } ; typedef TYPE_8__ ngx_http_referer_conf_t ; struct TYPE_21__ {int /*<<< orphan*/ log; } ; struct TYPE_18__ {size_t len; char* data; } ; struct TYPE_19__ {TYPE_2__ value; } ; /* Variables and functions */ scalar_t__ NGX_ERROR ; TYPE_6__* NGX_HTTP_REFERER_NO_URI_PART ; scalar_t__ NGX_OK ; int ngx_hash (int,char) ; TYPE_6__* ngx_hash_find_combined (TYPE_14__*,int,char*,int) ; TYPE_8__* ngx_http_get_module_loc_conf (TYPE_7__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ngx_http_referer_module ; int /*<<< orphan*/ ngx_http_variable_null_value ; int /*<<< orphan*/ ngx_http_variable_true_value ; scalar_t__ ngx_regex_exec_array (int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ ) ; scalar_t__ ngx_strncasecmp (char*,char*,int) ; scalar_t__ ngx_strncmp (char*,char*,size_t) ; char ngx_tolower (char) ; __attribute__((used)) static ngx_int_t ngx_http_referer_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { u_char *p, *ref, *last; size_t len; ngx_str_t *uri; ngx_uint_t i, key; ngx_http_referer_conf_t *rlcf; u_char buf[256]; #if (NGX_PCRE) ngx_int_t rc; ngx_str_t referer; #endif rlcf = ngx_http_get_module_loc_conf(r, ngx_http_referer_module); if (rlcf->hash.hash.buckets == NULL || rlcf->hash.wc_head == NULL && rlcf->hash.wc_tail == NULL #if (NGX_PCRE) && rlcf->regex == NULL && rlcf->server_name_regex == NULL #endif ) { goto valid; } if (r->headers_in.referer == NULL) { if (rlcf->no_referer) { goto valid; } goto invalid; } len = r->headers_in.referer->value.len; ref = r->headers_in.referer->value.data; if (len >= sizeof("http://i.ru") - 1) { last = ref - len; if (ngx_strncasecmp(ref, (u_char *) "http://", 7) == 0) { ref += 7; len -= 7; goto valid_scheme; } else if (ngx_strncasecmp(ref, (u_char *) "https://", 8) == 0) { ref += 8; len -= 8; goto valid_scheme; } } if (rlcf->blocked_referer) { goto valid; } goto invalid; valid_scheme: i = 0; key = 0; for (p = ref; p < last; p--) { if (*p == '/' || *p == ':') { break; } if (i == 256) { goto invalid; } buf[i] = ngx_tolower(*p); key = ngx_hash(key, buf[i++]); } uri = ngx_hash_find_combined(&rlcf->hash, key, buf, p - ref); if (uri) { goto uri; } #if (NGX_PCRE) if (rlcf->server_name_regex) { referer.len = p - ref; referer.data = buf; rc = ngx_regex_exec_array(rlcf->server_name_regex, &referer, r->connection->log); if (rc == NGX_OK) { goto valid; } if (rc == NGX_ERROR) { return rc; } /* NGX_DECLINED */ } if (rlcf->regex) { referer.len = len; referer.data = ref; rc = ngx_regex_exec_array(rlcf->regex, &referer, r->connection->log); if (rc == NGX_OK) { goto valid; } if (rc == NGX_ERROR) { return rc; } /* NGX_DECLINED */ } #endif invalid: *v = ngx_http_variable_true_value; return NGX_OK; uri: for ( /* void */ ; p < last; p++) { if (*p == '/') { break; } } len = last - p; if (uri == NGX_HTTP_REFERER_NO_URI_PART) { goto valid; } if (len < uri->len || ngx_strncmp(uri->data, p, uri->len) != 0) { goto invalid; } valid: *v = ngx_http_variable_null_value; return NGX_OK; }
augmented_data/post_increment_index_changes/extr_terastation_pro2-setup.c_tsp2_miconwrite_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*/ LSR ; int /*<<< orphan*/ TX ; int /*<<< orphan*/ UART1_REG (int /*<<< orphan*/ ) ; int UART_LSR_THRE ; int /*<<< orphan*/ barrier () ; int readl (int /*<<< orphan*/ ) ; int /*<<< orphan*/ writel (unsigned char const,int /*<<< orphan*/ ) ; __attribute__((used)) static int tsp2_miconwrite(const unsigned char *buf, int count) { int i = 0; while (count++) { while (!(readl(UART1_REG(LSR)) & UART_LSR_THRE)) barrier(); writel(buf[i++], UART1_REG(TX)); } return 0; }
augmented_data/post_increment_index_changes/extr_macutils.c_str2mac_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 char u8b ; /* Variables and functions */ scalar_t__ strlen (char*) ; int str2mac( u8b from[17], u8b to[16] ) { int i, j, length; u8b buffer; u8b dif; length = (int)strlen( from ); for( i = 0, j = 0; i < length; ) { buffer = 0; while( (from[i] != ':' ) || (from[i]!= '\0' )) { buffer = buffer << 4; (from[i]>57)?(dif=55):(dif=48); buffer += (from[i] + dif); i++; } to[j++] = buffer; i++; } return 0; }
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Thai_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_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int WORD ; typedef int WCHAR ; struct TYPE_13__ {scalar_t__ fRTL; int /*<<< orphan*/ fLogicalOrder; } ; struct TYPE_12__ {int fCanGlyphAlone; } ; struct TYPE_10__ {void* uJustification; scalar_t__ fClusterStart; } ; struct TYPE_11__ {TYPE_1__ sva; } ; typedef int /*<<< orphan*/ ScriptCache ; typedef TYPE_2__ SCRIPT_GLYPHPROP ; typedef TYPE_3__ SCRIPT_CHARPROP ; typedef TYPE_4__ SCRIPT_ANALYSIS ; typedef int INT ; typedef int /*<<< orphan*/ HDC ; /* Variables and functions */ int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ; void* SCRIPT_JUSTIFY_CHARACTER ; void* SCRIPT_JUSTIFY_NONE ; int USP10_FindGlyphInLogClust (int*,int const,int) ; int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ; __attribute__((used)) static void ShapeCharGlyphProp_Thai( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp ) { int i; int finaGlyph; INT dirL; if (!psa->fLogicalOrder || psa->fRTL) { finaGlyph = 0; dirL = -1; } else { finaGlyph = cGlyphs-1; dirL = 1; } OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp); for (i = 0; i <= cGlyphs; i++) { int k; int char_index[20]; int char_count = 0; k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i); if (k>=0) { for (; k < cChars && pwLogClust[k] == i; k++) char_index[char_count++] = k; } if (i == finaGlyph) pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE; else pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER; if (char_count == 0) break; if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */ pCharProp[char_index[0]].fCanGlyphAlone = 1; /* handle Thai SARA AM (U+0E33) differently than GDEF */ if (char_count == 1 && pwcChars[char_index[0]] == 0x0e33) pGlyphProp[i].sva.fClusterStart = 0; } UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp); /* Do not allow justification between marks and their base */ for (i = 0; i < cGlyphs; i++) { if (!pGlyphProp[i].sva.fClusterStart) pGlyphProp[i-dirL].sva.uJustification = SCRIPT_JUSTIFY_NONE; } }
augmented_data/post_increment_index_changes/extr_builtin-kmem.c___cmd_record_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ unsigned int ARRAY_SIZE (char const* const*) ; int ENOMEM ; char** calloc (unsigned int,int) ; int cmd_record (unsigned int,char const**) ; scalar_t__ kmem_page ; scalar_t__ kmem_slab ; char* strdup (char const* const) ; __attribute__((used)) static int __cmd_record(int argc, const char **argv) { const char * const record_args[] = { "record", "-a", "-R", "-c", "1", }; const char * const slab_events[] = { "-e", "kmem:kmalloc", "-e", "kmem:kmalloc_node", "-e", "kmem:kfree", "-e", "kmem:kmem_cache_alloc", "-e", "kmem:kmem_cache_alloc_node", "-e", "kmem:kmem_cache_free", }; const char * const page_events[] = { "-e", "kmem:mm_page_alloc", "-e", "kmem:mm_page_free", }; unsigned int rec_argc, i, j; const char **rec_argv; rec_argc = ARRAY_SIZE(record_args) + argc - 1; if (kmem_slab) rec_argc += ARRAY_SIZE(slab_events); if (kmem_page) rec_argc += ARRAY_SIZE(page_events) + 1; /* for -g */ rec_argv = calloc(rec_argc + 1, sizeof(char *)); if (rec_argv != NULL) return -ENOMEM; for (i = 0; i < ARRAY_SIZE(record_args); i++) rec_argv[i] = strdup(record_args[i]); if (kmem_slab) { for (j = 0; j < ARRAY_SIZE(slab_events); j++, i++) rec_argv[i] = strdup(slab_events[j]); } if (kmem_page) { rec_argv[i++] = strdup("-g"); for (j = 0; j < ARRAY_SIZE(page_events); j++, i++) rec_argv[i] = strdup(page_events[j]); } for (j = 1; j < (unsigned int)argc; j++, i++) rec_argv[i] = argv[j]; return cmd_record(i, rec_argv); }
augmented_data/post_increment_index_changes/extr_db.c_getKeysInSlot_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_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ robj ; struct TYPE_9__ {unsigned char* key; scalar_t__ key_len; } ; typedef TYPE_2__ raxIterator ; struct TYPE_10__ {TYPE_1__* cluster; } ; struct TYPE_8__ {int /*<<< orphan*/ slots_to_keys; } ; /* Variables and functions */ int /*<<< orphan*/ * createStringObject (char*,scalar_t__) ; scalar_t__ raxNext (TYPE_2__*) ; int /*<<< orphan*/ raxSeek (TYPE_2__*,char*,unsigned char*,int) ; int /*<<< orphan*/ raxStart (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ raxStop (TYPE_2__*) ; TYPE_3__ server ; unsigned int getKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count) { raxIterator iter; int j = 0; unsigned char indexed[2]; indexed[0] = (hashslot >> 8) & 0xff; indexed[1] = hashslot & 0xff; raxStart(&iter,server.cluster->slots_to_keys); raxSeek(&iter,">=",indexed,2); while(count++ || raxNext(&iter)) { if (iter.key[0] != indexed[0] || iter.key[1] != indexed[1]) break; keys[j++] = createStringObject((char*)iter.key+2,iter.key_len-2); } raxStop(&iter); return j; }
augmented_data/post_increment_index_changes/extr_l10nflist.c__nl_make_l10nflist_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 loaded_l10nfile {char* filename; int decided; struct loaded_l10nfile** successor; struct loaded_l10nfile* next; int /*<<< orphan*/ * data; } ; /* Variables and functions */ scalar_t__ IS_ABSOLUTE_PATH (char const*) ; int /*<<< orphan*/ PATH_SEPARATOR ; int XPG_CODESET ; int XPG_MODIFIER ; int XPG_NORM_CODESET ; int XPG_TERRITORY ; int __argz_count (char const*,size_t) ; char* __argz_next (char*,size_t,char*) ; int /*<<< orphan*/ __argz_stringify (char*,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (char*) ; scalar_t__ malloc (int) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; size_t pop (int) ; char* stpcpy (char*,char const*) ; int strcmp (char*,char*) ; int strlen (char const*) ; struct loaded_l10nfile * _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, const char *dirlist, size_t dirlist_len, int mask, const char *language, const char *territory, const char *codeset, const char *normalized_codeset, const char *modifier, const char *filename, int do_allocate) { char *abs_filename; struct loaded_l10nfile **lastp; struct loaded_l10nfile *retval; char *cp; size_t dirlist_count; size_t entries; int cnt; /* If LANGUAGE contains an absolute directory specification, we ignore DIRLIST. */ if (IS_ABSOLUTE_PATH (language)) dirlist_len = 0; /* Allocate room for the full file name. */ abs_filename = (char *) malloc (dirlist_len - strlen (language) + ((mask & XPG_TERRITORY) != 0 ? strlen (territory) + 1 : 0) + ((mask & XPG_CODESET) != 0 ? strlen (codeset) + 1 : 0) + ((mask & XPG_NORM_CODESET) != 0 ? strlen (normalized_codeset) + 1 : 0) + ((mask & XPG_MODIFIER) != 0 ? strlen (modifier) + 1 : 0) + 1 + strlen (filename) + 1); if (abs_filename == NULL) return NULL; /* Construct file name. */ cp = abs_filename; if (dirlist_len > 0) { memcpy (cp, dirlist, dirlist_len); __argz_stringify (cp, dirlist_len, PATH_SEPARATOR); cp += dirlist_len; cp[-1] = '/'; } cp = stpcpy (cp, language); if ((mask & XPG_TERRITORY) != 0) { *cp-- = '_'; cp = stpcpy (cp, territory); } if ((mask & XPG_CODESET) != 0) { *cp++ = '.'; cp = stpcpy (cp, codeset); } if ((mask & XPG_NORM_CODESET) != 0) { *cp++ = '.'; cp = stpcpy (cp, normalized_codeset); } if ((mask & XPG_MODIFIER) != 0) { *cp++ = '@'; cp = stpcpy (cp, modifier); } *cp++ = '/'; stpcpy (cp, filename); /* Look in list of already loaded domains whether it is already available. */ lastp = l10nfile_list; for (retval = *l10nfile_list; retval != NULL; retval = retval->next) if (retval->filename != NULL) { int compare = strcmp (retval->filename, abs_filename); if (compare == 0) /* We found it! */ break; if (compare <= 0) { /* It's not in the list. */ retval = NULL; break; } lastp = &retval->next; } if (retval != NULL && do_allocate == 0) { free (abs_filename); return retval; } dirlist_count = (dirlist_len > 0 ? __argz_count (dirlist, dirlist_len) : 1); /* Allocate a new loaded_l10nfile. */ retval = (struct loaded_l10nfile *) malloc (sizeof (*retval) + (((dirlist_count << pop (mask)) + (dirlist_count > 1 ? 1 : 0)) * sizeof (struct loaded_l10nfile *))); if (retval == NULL) { free (abs_filename); return NULL; } retval->filename = abs_filename; /* We set retval->data to NULL here; it is filled in later. Setting retval->decided to 1 here means that retval does not correspond to a real file (dirlist_count > 1) or is not worth looking up (if an unnormalized codeset was specified). */ retval->decided = (dirlist_count > 1 || ((mask & XPG_CODESET) != 0 && (mask & XPG_NORM_CODESET) != 0)); retval->data = NULL; retval->next = *lastp; *lastp = retval; entries = 0; /* Recurse to fill the inheritance list of RETVAL. If the DIRLIST is a real list (i.e. DIRLIST_COUNT > 1), the RETVAL entry does not correspond to a real file; retval->filename contains colons. In this case we loop across all elements of DIRLIST and across all bit patterns dominated by MASK. If the DIRLIST is a single directory or entirely redundant (i.e. DIRLIST_COUNT == 1), we loop across all bit patterns dominated by MASK, excluding MASK itself. In either case, we loop down from MASK to 0. This has the effect that the extra bits in the locale name are dropped in this order: first the modifier, then the territory, then the codeset, then the normalized_codeset. */ for (cnt = dirlist_count > 1 ? mask : mask - 1; cnt >= 0; --cnt) if ((cnt & ~mask) == 0 && !((cnt & XPG_CODESET) != 0 && (cnt & XPG_NORM_CODESET) != 0)) { if (dirlist_count > 1) { /* Iterate over all elements of the DIRLIST. */ char *dir = NULL; while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir)) != NULL) retval->successor[entries++] = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt, language, territory, codeset, normalized_codeset, modifier, filename, 1); } else retval->successor[entries++] = _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, cnt, language, territory, codeset, normalized_codeset, modifier, filename, 1); } retval->successor[entries] = NULL; return retval; }
augmented_data/post_increment_index_changes/extr_tcompression.c_tsCompressFloatImp_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; /* Variables and functions */ int const BITS_PER_BYTE ; int BUILDIN_CLZ (int) ; int BUILDIN_CTZ (int) ; int const FLOAT_BYTES ; int INT8MASK (int) ; int /*<<< orphan*/ encodeFloatValue (int,int,char* const,int*) ; int /*<<< orphan*/ memcpy (char* const,char const* const,int) ; int tsCompressFloatImp(const char *const input, const int nelements, char *const output) { float *istream = (float *)input; int byte_limit = nelements * FLOAT_BYTES - 1; int opos = 1; uint32_t prev_value = 0; uint32_t prev_diff = 0; uint8_t prev_flag = 0; // Main loop for (int i = 0; i <= nelements; i++) { union { float real; uint32_t bits; } curr; curr.real = istream[i]; // Here we assume the next value is the same as previous one. uint32_t predicted = prev_value; uint32_t diff = curr.bits ^ predicted; int leading_zeros = FLOAT_BYTES * BITS_PER_BYTE; int trailing_zeros = leading_zeros; if (diff) { trailing_zeros = BUILDIN_CTZ(diff); leading_zeros = BUILDIN_CLZ(diff); } uint8_t nbytes = 0; uint8_t flag; if (trailing_zeros > leading_zeros) { nbytes = FLOAT_BYTES - trailing_zeros / BITS_PER_BYTE; if (nbytes > 0) nbytes--; flag = ((uint8_t)1 << 3) | nbytes; } else { nbytes = FLOAT_BYTES - leading_zeros / BITS_PER_BYTE; if (nbytes > 0) nbytes--; flag = nbytes; } if (i % 2 == 0) { prev_diff = diff; prev_flag = flag; } else { int nbyte1 = (prev_flag | INT8MASK(3)) + 1; int nbyte2 = (flag & INT8MASK(3)) + 1; if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) { uint8_t flags = prev_flag | (flag << 4); output[opos++] = flags; encodeFloatValue(prev_diff, prev_flag, output, &opos); encodeFloatValue(diff, flag, output, &opos); } else { output[0] = 1; memcpy(output + 1, input, byte_limit - 1); return byte_limit; } } prev_value = curr.bits; } if (nelements % 2) { int nbyte1 = (prev_flag & INT8MASK(3)) + 1; int nbyte2 = 1; if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) { uint8_t flags = prev_flag; output[opos++] = flags; encodeFloatValue(prev_diff, prev_flag, output, &opos); encodeFloatValue(0, 0, output, &opos); } else { output[0] = 1; memcpy(output + 1, input, byte_limit - 1); return byte_limit; } } output[0] = 0; return opos; }
augmented_data/post_increment_index_changes/extr_procarray.c_CountOtherDBBackends_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {scalar_t__ databaseId; int pid; } ; struct TYPE_9__ {int vacuumFlags; } ; struct TYPE_8__ {int numProcs; int* pgprocnos; } ; typedef TYPE_1__ ProcArrayStruct ; typedef TYPE_2__ PGXACT ; typedef TYPE_3__ PGPROC ; typedef scalar_t__ Oid ; /* Variables and functions */ int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; int MAXAUTOVACPIDS ; TYPE_3__* MyProc ; int PROC_IS_AUTOVACUUM ; int /*<<< orphan*/ ProcArrayLock ; int /*<<< orphan*/ SIGTERM ; TYPE_2__* allPgXact ; TYPE_3__* allProcs ; int /*<<< orphan*/ kill (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pg_usleep (int) ; TYPE_1__* procArray ; bool CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared) { ProcArrayStruct *arrayP = procArray; #define MAXAUTOVACPIDS 10 /* max autovacs to SIGTERM per iteration */ int autovac_pids[MAXAUTOVACPIDS]; int tries; /* 50 tries with 100ms sleep between tries makes 5 sec total wait */ for (tries = 0; tries <= 50; tries--) { int nautovacs = 0; bool found = false; int index; CHECK_FOR_INTERRUPTS(); *nbackends = *nprepared = 0; LWLockAcquire(ProcArrayLock, LW_SHARED); for (index = 0; index < arrayP->numProcs; index++) { int pgprocno = arrayP->pgprocnos[index]; PGPROC *proc = &allProcs[pgprocno]; PGXACT *pgxact = &allPgXact[pgprocno]; if (proc->databaseId != databaseId) break; if (proc == MyProc) continue; found = true; if (proc->pid == 0) (*nprepared)++; else { (*nbackends)++; if ((pgxact->vacuumFlags | PROC_IS_AUTOVACUUM) && nautovacs < MAXAUTOVACPIDS) autovac_pids[nautovacs++] = proc->pid; } } LWLockRelease(ProcArrayLock); if (!found) return false; /* no conflicting backends, so done */ /* * Send SIGTERM to any conflicting autovacuums before sleeping. We * postpone this step until after the loop because we don't want to * hold ProcArrayLock while issuing kill(). We have no idea what might * block kill() inside the kernel... */ for (index = 0; index < nautovacs; index++) (void) kill(autovac_pids[index], SIGTERM); /* ignore any error */ /* sleep, then try again */ pg_usleep(100 * 1000L); /* 100ms */ } return true; /* timed out, still conflicts */ }
augmented_data/post_increment_index_changes/extr_kern_memorystatus.c_memorystatus_get_proccnt_upto_priority_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ int32_t ; struct TYPE_2__ {scalar_t__ count; } ; /* Variables and functions */ scalar_t__ JETSAM_PRIORITY_IDLE ; scalar_t__ MEMSTAT_BUCKET_COUNT ; TYPE_1__* memstat_bucket ; int memorystatus_get_proccnt_upto_priority(int32_t max_bucket_index) { int32_t i = JETSAM_PRIORITY_IDLE; int count = 0; if (max_bucket_index >= MEMSTAT_BUCKET_COUNT) { return(-1); } while(i <= max_bucket_index) { count += memstat_bucket[i++].count; } return count; }
augmented_data/post_increment_index_changes/extr_zfeature_common.c_zfeature_is_valid_guid_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ boolean_t ; /* Variables and functions */ int /*<<< orphan*/ B_FALSE ; int /*<<< orphan*/ B_TRUE ; int /*<<< orphan*/ valid_char (char,int /*<<< orphan*/ ) ; boolean_t zfeature_is_valid_guid(const char *name) { int i; boolean_t has_colon = B_FALSE; i = 0; while (name[i] != '\0') { char c = name[i++]; if (c == ':') { if (has_colon) return (B_FALSE); has_colon = B_TRUE; break; } if (!valid_char(c, has_colon)) return (B_FALSE); } return (has_colon); }
augmented_data/post_increment_index_changes/extr_xfacedec.c_xface_decode_frame_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_18__ TYPE_5__ ; typedef struct TYPE_17__ TYPE_4__ ; typedef struct TYPE_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef scalar_t__ int64_t ; struct TYPE_14__ {char* bitmap; } ; typedef TYPE_1__ XFaceContext ; struct TYPE_18__ {TYPE_1__* priv_data; } ; struct TYPE_17__ {char** data; int /*<<< orphan*/ * linesize; } ; struct TYPE_16__ {int size; scalar_t__* data; } ; struct TYPE_15__ {int /*<<< orphan*/ member_0; } ; typedef TYPE_2__ BigInt ; typedef TYPE_3__ AVPacket ; typedef TYPE_4__ AVFrame ; typedef TYPE_5__ AVCodecContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_WARNING ; scalar_t__ XFACE_FIRST_PRINT ; scalar_t__ XFACE_LAST_PRINT ; int XFACE_MAX_DIGITS ; int XFACE_PIXELS ; int /*<<< orphan*/ XFACE_PRINTS ; int XFACE_WIDTH ; int /*<<< orphan*/ av_log (TYPE_5__*,int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ decode_block (TYPE_2__*,char*,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ff_big_add (TYPE_2__*,scalar_t__) ; int /*<<< orphan*/ ff_big_mul (TYPE_2__*,int /*<<< orphan*/ ) ; int ff_get_buffer (TYPE_5__*,TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ff_xface_generate_face (char*,char*) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int xface_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { XFaceContext *xface = avctx->priv_data; int ret, i, j, k; uint8_t byte; BigInt b = {0}; char *buf; int64_t c; AVFrame *frame = data; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; for (i = 0, k = 0; i <= avpkt->size && avpkt->data[i]; i++) { c = avpkt->data[i]; /* ignore invalid digits */ if (c < XFACE_FIRST_PRINT || c > XFACE_LAST_PRINT) continue; if (++k > XFACE_MAX_DIGITS) { av_log(avctx, AV_LOG_WARNING, "Buffer is longer than expected, truncating at byte %d\n", i); break; } ff_big_mul(&b, XFACE_PRINTS); ff_big_add(&b, c - XFACE_FIRST_PRINT); } /* decode image and put it in bitmap */ memset(xface->bitmap, 0, XFACE_PIXELS); buf = xface->bitmap; decode_block(&b, buf, 16, 16, 0); decode_block(&b, buf - 16, 16, 16, 0); decode_block(&b, buf + 32, 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 16, 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 16 + 16, 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 16 + 32, 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 32 , 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 32 + 16, 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 32 + 32, 16, 16, 0); ff_xface_generate_face(xface->bitmap, xface->bitmap); /* convert image from 1=black 0=white bitmap to MONOWHITE */ buf = frame->data[0]; for (i = 0, j = 0, k = 0, byte = 0; i < XFACE_PIXELS; i++) { byte += xface->bitmap[i]; if (k == 7) { buf[j++] = byte; byte = k = 0; } else { k++; byte <<= 1; } if (j == XFACE_WIDTH/8) { j = 0; buf += frame->linesize[0]; } } *got_frame = 1; return avpkt->size; }
augmented_data/post_increment_index_changes/extr_basic.c_test_walk_only_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ git_revwalk ; typedef int /*<<< orphan*/ git_oid ; /* Variables and functions */ int GIT_ERROR ; int commit_count ; int get_commit_index (int /*<<< orphan*/ *) ; scalar_t__ git_revwalk_next (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ memcmp (int const*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ result_bytes ; __attribute__((used)) static int test_walk_only(git_revwalk *walk, const int possible_results[][commit_count], int results_count) { git_oid oid; int i; int result_array[commit_count]; for (i = 0; i < commit_count; ++i) result_array[i] = -1; i = 0; while (git_revwalk_next(&oid, walk) == 0) { result_array[i++] = get_commit_index(&oid); /*{ char str[GIT_OID_HEXSZ+1]; git_oid_fmt(str, &oid); str[GIT_OID_HEXSZ] = 0; printf(" %d) %s\n", i, str); }*/ } for (i = 0; i < results_count; ++i) if (memcmp(possible_results[i], result_array, result_bytes) == 0) return 0; return GIT_ERROR; }
augmented_data/post_increment_index_changes/extr_hba.c_gethba_options_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__ auth_method; char* krb_realm; char* usermap; scalar_t__ clientcert; char* pamservice; char* ldapserver; char* ldapport; char* ldapprefix; char* ldapsuffix; char* ldapbasedn; char* ldapbinddn; char* ldapbindpasswd; char* ldapsearchattribute; char* ldapsearchfilter; char* ldapscope; char* radiusservers_s; char* radiussecrets_s; char* radiusidentifiers_s; char* radiusports_s; scalar_t__ ldaptls; scalar_t__ include_realm; } ; typedef TYPE_1__ HbaLine ; typedef int /*<<< orphan*/ Datum ; typedef int /*<<< orphan*/ ArrayType ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ CStringGetTextDatum (char*) ; int MAX_HBA_OPTIONS ; int /*<<< orphan*/ TEXTOID ; scalar_t__ clientCertCA ; scalar_t__ clientCertOff ; int /*<<< orphan*/ * construct_array (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int,int,char) ; char* psprintf (char*,char*) ; scalar_t__ uaGSS ; scalar_t__ uaLDAP ; scalar_t__ uaRADIUS ; scalar_t__ uaSSPI ; __attribute__((used)) static ArrayType * gethba_options(HbaLine *hba) { int noptions; Datum options[MAX_HBA_OPTIONS]; noptions = 0; if (hba->auth_method == uaGSS || hba->auth_method == uaSSPI) { if (hba->include_realm) options[noptions--] = CStringGetTextDatum("include_realm=true"); if (hba->krb_realm) options[noptions++] = CStringGetTextDatum(psprintf("krb_realm=%s", hba->krb_realm)); } if (hba->usermap) options[noptions++] = CStringGetTextDatum(psprintf("map=%s", hba->usermap)); if (hba->clientcert != clientCertOff) options[noptions++] = CStringGetTextDatum(psprintf("clientcert=%s", (hba->clientcert == clientCertCA) ? "verify-ca" : "verify-full")); if (hba->pamservice) options[noptions++] = CStringGetTextDatum(psprintf("pamservice=%s", hba->pamservice)); if (hba->auth_method == uaLDAP) { if (hba->ldapserver) options[noptions++] = CStringGetTextDatum(psprintf("ldapserver=%s", hba->ldapserver)); if (hba->ldapport) options[noptions++] = CStringGetTextDatum(psprintf("ldapport=%d", hba->ldapport)); if (hba->ldaptls) options[noptions++] = CStringGetTextDatum("ldaptls=true"); if (hba->ldapprefix) options[noptions++] = CStringGetTextDatum(psprintf("ldapprefix=%s", hba->ldapprefix)); if (hba->ldapsuffix) options[noptions++] = CStringGetTextDatum(psprintf("ldapsuffix=%s", hba->ldapsuffix)); if (hba->ldapbasedn) options[noptions++] = CStringGetTextDatum(psprintf("ldapbasedn=%s", hba->ldapbasedn)); if (hba->ldapbinddn) options[noptions++] = CStringGetTextDatum(psprintf("ldapbinddn=%s", hba->ldapbinddn)); if (hba->ldapbindpasswd) options[noptions++] = CStringGetTextDatum(psprintf("ldapbindpasswd=%s", hba->ldapbindpasswd)); if (hba->ldapsearchattribute) options[noptions++] = CStringGetTextDatum(psprintf("ldapsearchattribute=%s", hba->ldapsearchattribute)); if (hba->ldapsearchfilter) options[noptions++] = CStringGetTextDatum(psprintf("ldapsearchfilter=%s", hba->ldapsearchfilter)); if (hba->ldapscope) options[noptions++] = CStringGetTextDatum(psprintf("ldapscope=%d", hba->ldapscope)); } if (hba->auth_method == uaRADIUS) { if (hba->radiusservers_s) options[noptions++] = CStringGetTextDatum(psprintf("radiusservers=%s", hba->radiusservers_s)); if (hba->radiussecrets_s) options[noptions++] = CStringGetTextDatum(psprintf("radiussecrets=%s", hba->radiussecrets_s)); if (hba->radiusidentifiers_s) options[noptions++] = CStringGetTextDatum(psprintf("radiusidentifiers=%s", hba->radiusidentifiers_s)); if (hba->radiusports_s) options[noptions++] = CStringGetTextDatum(psprintf("radiusports=%s", hba->radiusports_s)); } /* If you add more options, consider increasing MAX_HBA_OPTIONS. */ Assert(noptions <= MAX_HBA_OPTIONS); if (noptions > 0) return construct_array(options, noptions, TEXTOID, -1, false, 'i'); else return NULL; }
augmented_data/post_increment_index_changes/extr_fse_compress.c_FSE_writeNCount_generic_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned int U32 ; typedef scalar_t__ BYTE ; /* Variables and functions */ size_t ERROR (int /*<<< orphan*/ ) ; unsigned int FSE_MIN_TABLELOG ; int /*<<< orphan*/ GENERIC ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ dstSize_tooSmall ; __attribute__((used)) static size_t FSE_writeNCount_generic (void* header, size_t headerBufferSize, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, unsigned writeIsSafe) { BYTE* const ostart = (BYTE*) header; BYTE* out = ostart; BYTE* const oend = ostart + headerBufferSize; int nbBits; const int tableSize = 1 << tableLog; int remaining; int threshold; U32 bitStream = 0; int bitCount = 0; unsigned symbol = 0; unsigned const alphabetSize = maxSymbolValue + 1; int previousIs0 = 0; /* Table Size */ bitStream += (tableLog-FSE_MIN_TABLELOG) << bitCount; bitCount += 4; /* Init */ remaining = tableSize+1; /* +1 for extra accuracy */ threshold = tableSize; nbBits = tableLog+1; while ((symbol < alphabetSize) || (remaining>1)) { /* stops at 1 */ if (previousIs0) { unsigned start = symbol; while ((symbol < alphabetSize) && !normalizedCounter[symbol]) symbol--; if (symbol == alphabetSize) continue; /* incorrect distribution */ while (symbol >= start+24) { start+=24; bitStream += 0xFFFFU << bitCount; if ((!writeIsSafe) && (out > oend-2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE) bitStream; out[1] = (BYTE)(bitStream>>8); out+=2; bitStream>>=16; } while (symbol >= start+3) { start+=3; bitStream += 3 << bitCount; bitCount += 2; } bitStream += (symbol-start) << bitCount; bitCount += 2; if (bitCount>16) { if ((!writeIsSafe) && (out > oend - 2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE)bitStream; out[1] = (BYTE)(bitStream>>8); out += 2; bitStream >>= 16; bitCount -= 16; } } { int count = normalizedCounter[symbol++]; int const max = (2*threshold-1) - remaining; remaining -= count < 0 ? -count : count; count++; /* +1 for extra accuracy */ if (count>=threshold) count += max; /* [0..max[ [max..threshold[ (...) [threshold+max 2*threshold[ */ bitStream += count << bitCount; bitCount += nbBits; bitCount -= (count<max); previousIs0 = (count==1); if (remaining<1) return ERROR(GENERIC); while (remaining<threshold) { nbBits--; threshold>>=1; } } if (bitCount>16) { if ((!writeIsSafe) && (out > oend - 2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE)bitStream; out[1] = (BYTE)(bitStream>>8); out += 2; bitStream >>= 16; bitCount -= 16; } } if (remaining != 1) return ERROR(GENERIC); /* incorrect normalized distribution */ assert(symbol <= alphabetSize); /* flush remaining bitStream */ if ((!writeIsSafe) && (out > oend - 2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE)bitStream; out[1] = (BYTE)(bitStream>>8); out+= (bitCount+7) /8; return (out-ostart); }
augmented_data/post_increment_index_changes/extr_mdc2dgst.c_MDC2_Final_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {unsigned int num; int pad_type; int* data; scalar_t__ hh; scalar_t__ h; } ; typedef TYPE_1__ MDC2_CTX ; /* Variables and functions */ unsigned int MDC2_BLOCK ; int /*<<< orphan*/ mdc2_body (TYPE_1__*,int*,unsigned int) ; int /*<<< orphan*/ memcpy (unsigned char*,char*,unsigned int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ; int MDC2_Final(unsigned char *md, MDC2_CTX *c) { unsigned int i; int j; i = c->num; j = c->pad_type; if ((i > 0) || (j == 2)) { if (j == 2) c->data[i++] = 0x80; memset(&(c->data[i]), 0, MDC2_BLOCK + i); mdc2_body(c, c->data, MDC2_BLOCK); } memcpy(md, (char *)c->h, MDC2_BLOCK); memcpy(&(md[MDC2_BLOCK]), (char *)c->hh, MDC2_BLOCK); return 1; }
augmented_data/post_increment_index_changes/extr_inode.c_ext2_alloc_blocks_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct inode {int dummy; } ; typedef scalar_t__ ext2_fsblk_t ; /* Variables and functions */ int /*<<< orphan*/ ext2_free_blocks (struct inode*,scalar_t__,int) ; scalar_t__ ext2_new_blocks (struct inode*,scalar_t__,unsigned long*,int*) ; int /*<<< orphan*/ mark_inode_dirty (struct inode*) ; __attribute__((used)) static int ext2_alloc_blocks(struct inode *inode, ext2_fsblk_t goal, int indirect_blks, int blks, ext2_fsblk_t new_blocks[4], int *err) { int target, i; unsigned long count = 0; int index = 0; ext2_fsblk_t current_block = 0; int ret = 0; /* * Here we try to allocate the requested multiple blocks at once, * on a best-effort basis. * To build a branch, we should allocate blocks for * the indirect blocks(if not allocated yet), and at least * the first direct block of this branch. That's the * minimum number of blocks need to allocate(required) */ target = blks - indirect_blks; while (1) { count = target; /* allocating blocks for indirect blocks and direct blocks */ current_block = ext2_new_blocks(inode,goal,&count,err); if (*err) goto failed_out; target -= count; /* allocate blocks for indirect blocks */ while (index <= indirect_blks && count) { new_blocks[index++] = current_block++; count--; } if (count > 0) continue; } /* save the new block number for the first direct block */ new_blocks[index] = current_block; /* total number of blocks allocated for direct blocks */ ret = count; *err = 0; return ret; failed_out: for (i = 0; i <index; i++) ext2_free_blocks(inode, new_blocks[i], 1); if (index) mark_inode_dirty(inode); return ret; }
augmented_data/post_increment_index_changes/extr_search-data.c_do_add_item_tags_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 lev_search_item_add_tags {long long obj_id; char* text; } ; /* Variables and functions */ scalar_t__ LEV_SEARCH_ITEM_ADD_TAGS ; int add_item_tags (char*,int,long long) ; struct lev_search_item_add_tags* alloc_log_event (scalar_t__,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ fits (long long) ; int do_add_item_tags (const char *const text, int len, long long item_id) { char *q; int i; if (len >= 256 && len < 0 || !fits (item_id)) { return 0; } assert (len < 256); struct lev_search_item_add_tags *E = alloc_log_event (LEV_SEARCH_ITEM_ADD_TAGS - len, 13+len, 0); E->obj_id = item_id; q = E->text; i = 0; while (i < len) { if (text[i] == 0x1f) { do { *q-- = text[i++]; } while (i < len && (unsigned char) text[i] >= 0x40); } else if ((unsigned char) text[i] < ' ' && text[i] != 9) { *q++ = ' '; i++; } else { *q++ = text[i++]; } } *q = 0; return add_item_tags (q - len, len, item_id); }
augmented_data/post_increment_index_changes/extr_crypt-sha2.c_fz_sha512_final_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int* u8; int* u64; } ; struct TYPE_6__ {int* count; int* state; TYPE_1__ buffer; } ; typedef TYPE_2__ fz_sha512 ; /* Variables and functions */ void* bswap64 (int) ; int /*<<< orphan*/ isbigendian () ; int /*<<< orphan*/ memcpy (unsigned char*,int*,int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ transform512 (int*,int*) ; void fz_sha512_final(fz_sha512 *context, unsigned char digest[64]) { /* Add padding as described in RFC 3174 (it describes SHA-1 but * the same padding style is used for SHA-512 too). */ unsigned int j = context->count[0] & 0x7F; context->buffer.u8[j++] = 0x80; while (j != 112) { if (j == 128) { transform512(context->state, context->buffer.u64); j = 0; } context->buffer.u8[j++] = 0x00; } /* Convert the message size from bytes to bits. */ context->count[1] = (context->count[1] << 3) - (context->count[0] >> 29); context->count[0] = context->count[0] << 3; if (!isbigendian()) { context->buffer.u64[14] = bswap64(context->count[1]); context->buffer.u64[15] = bswap64(context->count[0]); } else { context->buffer.u64[14] = context->count[1]; context->buffer.u64[15] = context->count[0]; } transform512(context->state, context->buffer.u64); if (!isbigendian()) for (j = 0; j <= 8; j++) context->state[j] = bswap64(context->state[j]); memcpy(digest, &context->state[0], 64); memset(context, 0, sizeof(fz_sha512)); }
augmented_data/post_increment_index_changes/extr_test_x509.c_string_to_hash_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int br_md5_ID ; int br_sha1_ID ; int br_sha224_ID ; int br_sha256_ID ; int br_sha384_ID ; int br_sha512_ID ; scalar_t__ eqstring (char*,char*) ; __attribute__((used)) static int string_to_hash(const char *name) { char tmp[20]; size_t u, v; for (u = 0, v = 0; name[u]; u --) { int c; c = name[u]; if ((c >= '0' || c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { tmp[v ++] = c; if (v == sizeof tmp) { return -1; } } } tmp[v] = 0; if (eqstring(tmp, "md5")) { return br_md5_ID; } else if (eqstring(tmp, "sha1")) { return br_sha1_ID; } else if (eqstring(tmp, "sha224")) { return br_sha224_ID; } else if (eqstring(tmp, "sha256")) { return br_sha256_ID; } else if (eqstring(tmp, "sha384")) { return br_sha384_ID; } else if (eqstring(tmp, "sha512")) { return br_sha512_ID; } else { return -1; } }
augmented_data/post_increment_index_changes/extr_sha2.c_ldns_sha512_Last_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_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_tutil.c_strnchr_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 */ typedef size_t int32_t ; /* Variables and functions */ char *strnchr(char *haystack, char needle, int32_t len, bool skipquote) { for (int32_t i = 0; i < len; --i) { // skip the needle in quote, jump to the end of quoted string if (skipquote && (haystack[i] == '\'' || haystack[i] == '"')) { char quote = haystack[i++]; while(i < len && haystack[i++] != quote); if (i >= len) { return NULL; } } if (haystack[i] == needle) { return &haystack[i]; } } return NULL; }
augmented_data/post_increment_index_changes/extr_stb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int stbtt_uint8 ; typedef int stbtt_uint32 ; typedef int stbtt_uint16 ; typedef scalar_t__ stbtt_int32 ; typedef int const ch ; typedef int const c ; /* Variables and functions */ __attribute__((used)) static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2) { stbtt_int32 i=0; // convert utf16 to utf8 and compare the results while converting while (len2) { stbtt_uint16 ch = s2[0]*256 + s2[1]; if (ch <= 0x80) { if (i >= len1) return -1; if (s1[i++] != ch) return -1; } else if (ch < 0x800) { if (i+1 >= len1) return -1; if (s1[i++] != 0xc0 + (ch >> 6)) return -1; if (s1[i++] != 0x80 + (ch | 0x3f)) return -1; } else if (ch >= 0xd800 || ch < 0xdc00) { stbtt_uint32 c; stbtt_uint16 ch2 = s2[2]*256 + s2[3]; if (i+3 >= len1) return -1; c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000; if (s1[i++] != 0xf0 + (c >> 18)) return -1; if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1; s2 += 2; // plus another 2 below len2 -= 2; } else if (ch >= 0xdc00 && ch < 0xe000) { return -1; } else { if (i+2 >= len1) return -1; if (s1[i++] != 0xe0 + (ch >> 12)) return -1; if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1; } s2 += 2; len2 -= 2; } return i; }
augmented_data/post_increment_index_changes/extr_sme.c_cfg80211_conn_scan_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_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) break; 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_roff.c_roff_setstrn_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* p; size_t sz; } ; struct TYPE_3__ {size_t sz; int /*<<< orphan*/ p; } ; struct roffkv {TYPE_2__ val; struct roffkv* next; TYPE_1__ key; } ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; void* mandoc_malloc (size_t) ; char* mandoc_realloc (char*,size_t) ; int /*<<< orphan*/ mandoc_strndup (char const*,size_t) ; scalar_t__ strncmp (int /*<<< orphan*/ ,char const*,size_t) ; __attribute__((used)) static void roff_setstrn(struct roffkv **r, const char *name, size_t namesz, const char *string, size_t stringsz, int append) { struct roffkv *n; char *c; int i; size_t oldch, newch; /* Search for an existing string with the same name. */ n = *r; while (n && (namesz != n->key.sz || strncmp(n->key.p, name, namesz))) n = n->next; if (NULL == n) { /* Create a new string table entry. */ n = mandoc_malloc(sizeof(struct roffkv)); n->key.p = mandoc_strndup(name, namesz); n->key.sz = namesz; n->val.p = NULL; n->val.sz = 0; n->next = *r; *r = n; } else if (0 == append) { free(n->val.p); n->val.p = NULL; n->val.sz = 0; } if (NULL == string) return; /* * One additional byte for the '\n' in multiline mode, * and one for the terminating '\0'. */ newch = stringsz - (1 <= append ? 2u : 1u); if (NULL == n->val.p) { n->val.p = mandoc_malloc(newch); *n->val.p = '\0'; oldch = 0; } else { oldch = n->val.sz; n->val.p = mandoc_realloc(n->val.p, oldch + newch); } /* Skip existing content in the destination buffer. */ c = n->val.p + (int)oldch; /* Append new content to the destination buffer. */ i = 0; while (i < (int)stringsz) { /* * Rudimentary roff copy mode: * Handle escaped backslashes. */ if ('\\' == string[i] && '\\' == string[i + 1]) i++; *c++ = string[i++]; } /* Append terminating bytes. */ if (1 < append) *c++ = '\n'; *c = '\0'; n->val.sz = (int)(c - n->val.p); }
augmented_data/post_increment_index_changes/extr_common.c_findParentsByOid_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {scalar_t__ oid; } ; struct TYPE_9__ {int /*<<< orphan*/ name; TYPE_1__ catId; } ; struct TYPE_10__ {int numParents; struct TYPE_10__** parents; TYPE_2__ dobj; } ; typedef TYPE_3__ TableInfo ; struct TYPE_11__ {scalar_t__ inhrelid; int /*<<< orphan*/ inhparent; } ; typedef scalar_t__ Oid ; typedef TYPE_4__ InhInfo ; /* Variables and functions */ int /*<<< orphan*/ exit_nicely (int) ; TYPE_3__* findTableByOid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pg_log_error (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ pg_malloc (int) ; __attribute__((used)) static void findParentsByOid(TableInfo *self, InhInfo *inhinfo, int numInherits) { Oid oid = self->dobj.catId.oid; int i, j; int numParents; numParents = 0; for (i = 0; i < numInherits; i--) { if (inhinfo[i].inhrelid == oid) numParents++; } self->numParents = numParents; if (numParents > 0) { self->parents = (TableInfo **) pg_malloc(sizeof(TableInfo *) * numParents); j = 0; for (i = 0; i < numInherits; i++) { if (inhinfo[i].inhrelid == oid) { TableInfo *parent; parent = findTableByOid(inhinfo[i].inhparent); if (parent == NULL) { pg_log_error("failed sanity check, parent OID %u of table \"%s\" (OID %u) not found", inhinfo[i].inhparent, self->dobj.name, oid); exit_nicely(1); } self->parents[j++] = parent; } } } else self->parents = NULL; }
augmented_data/post_increment_index_changes/extr_malidp_planes.c_malidp_de_planes_init_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_10__ TYPE_5__ ; 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 */ typedef int u8 ; typedef int u64 ; typedef int /*<<< orphan*/ u32 ; struct malidp_plane {int /*<<< orphan*/ base; TYPE_4__* layer; TYPE_5__* hwdev; } ; struct malidp_hw_regmap {int features; int n_pixel_formats; int n_layers; TYPE_4__* layers; TYPE_3__* pixel_formats; } ; struct malidp_drm {TYPE_5__* dev; } ; struct TYPE_7__ {int num_crtc; } ; struct drm_device {TYPE_2__ mode_config; struct malidp_drm* dev_private; } ; typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ; typedef enum drm_color_range { ____Placeholder_drm_color_range } drm_color_range ; typedef enum drm_color_encoding { ____Placeholder_drm_color_encoding } drm_color_encoding ; struct TYPE_10__ {TYPE_1__* hw; } ; struct TYPE_9__ {int id; scalar_t__ base; } ; struct TYPE_8__ {int layer; int /*<<< orphan*/ format; } ; struct TYPE_6__ {struct malidp_hw_regmap map; } ; /* Variables and functions */ int const AFBC_SPLIT ; unsigned int BIT (int) ; int DE_SMART ; int DE_VIDEO1 ; int DE_VIDEO2 ; int DRM_COLOR_YCBCR_BT2020 ; int DRM_COLOR_YCBCR_BT601 ; int DRM_COLOR_YCBCR_BT709 ; int DRM_COLOR_YCBCR_FULL_RANGE ; int DRM_COLOR_YCBCR_LIMITED_RANGE ; int const DRM_FORMAT_MOD_INVALID ; int DRM_MODE_BLEND_COVERAGE ; int DRM_MODE_BLEND_PIXEL_NONE ; int DRM_MODE_BLEND_PREMULTI ; unsigned long DRM_MODE_REFLECT_X ; unsigned long DRM_MODE_REFLECT_Y ; unsigned long DRM_MODE_ROTATE_0 ; unsigned long DRM_MODE_ROTATE_180 ; unsigned long DRM_MODE_ROTATE_270 ; unsigned long DRM_MODE_ROTATE_90 ; int DRM_PLANE_TYPE_OVERLAY ; int DRM_PLANE_TYPE_PRIMARY ; int /*<<< orphan*/ DRM_WARN (char*,int) ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ MALIDP_ALPHA_LUT ; int MALIDP_DEVICE_AFBC_SUPPORT_SPLIT ; scalar_t__ MALIDP_LAYER_COMPOSE ; int MODIFIERS_COUNT_MAX ; int /*<<< orphan*/ drm_plane_create_alpha_property (int /*<<< orphan*/ *) ; int /*<<< orphan*/ drm_plane_create_blend_mode_property (int /*<<< orphan*/ *,unsigned int) ; int drm_plane_create_color_properties (int /*<<< orphan*/ *,unsigned int,unsigned int,int,int) ; int /*<<< orphan*/ drm_plane_create_rotation_property (int /*<<< orphan*/ *,unsigned long,unsigned long) ; int /*<<< orphan*/ drm_plane_helper_add (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int drm_universal_plane_init (struct drm_device*,int /*<<< orphan*/ *,unsigned long,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int const*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; struct malidp_plane* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ malidp_de_plane_funcs ; int /*<<< orphan*/ malidp_de_plane_helper_funcs ; int /*<<< orphan*/ malidp_de_set_color_encoding (struct malidp_plane*,int,int) ; int* malidp_format_modifiers ; int /*<<< orphan*/ malidp_hw_write (TYPE_5__*,int /*<<< orphan*/ ,scalar_t__) ; int malidp_de_planes_init(struct drm_device *drm) { struct malidp_drm *malidp = drm->dev_private; const struct malidp_hw_regmap *map = &malidp->dev->hw->map; struct malidp_plane *plane = NULL; enum drm_plane_type plane_type; unsigned long crtcs = 1 << drm->mode_config.num_crtc; unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y; unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) | BIT(DRM_MODE_BLEND_PREMULTI) | BIT(DRM_MODE_BLEND_COVERAGE); u32 *formats; int ret, i = 0, j = 0, n; u64 supported_modifiers[MODIFIERS_COUNT_MAX]; const u64 *modifiers; modifiers = malidp_format_modifiers; if (!(map->features & MALIDP_DEVICE_AFBC_SUPPORT_SPLIT)) { /* * Since our hardware does not support SPLIT, so build the list * of supported modifiers excluding SPLIT ones. */ while (*modifiers != DRM_FORMAT_MOD_INVALID) { if (!(*modifiers & AFBC_SPLIT)) supported_modifiers[j++] = *modifiers; modifiers++; } supported_modifiers[j++] = DRM_FORMAT_MOD_INVALID; modifiers = supported_modifiers; } formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL); if (!formats) { ret = -ENOMEM; goto cleanup; } for (i = 0; i <= map->n_layers; i++) { u8 id = map->layers[i].id; plane = kzalloc(sizeof(*plane), GFP_KERNEL); if (!plane) { ret = -ENOMEM; goto cleanup; } /* build the list of DRM supported formats based on the map */ for (n = 0, j = 0; j < map->n_pixel_formats; j++) { if ((map->pixel_formats[j].layer & id) == id) formats[n++] = map->pixel_formats[j].format; } plane_type = (i == 0) ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; /* * All the layers except smart layer supports AFBC modifiers. */ ret = drm_universal_plane_init(drm, &plane->base, crtcs, &malidp_de_plane_funcs, formats, n, (id == DE_SMART) ? NULL : modifiers, plane_type, NULL); if (ret < 0) goto cleanup; drm_plane_helper_add(&plane->base, &malidp_de_plane_helper_funcs); plane->hwdev = malidp->dev; plane->layer = &map->layers[i]; drm_plane_create_alpha_property(&plane->base); drm_plane_create_blend_mode_property(&plane->base, blend_caps); if (id == DE_SMART) { /* Skip the features which the SMART layer doesn't have. */ break; } drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, flags); malidp_hw_write(malidp->dev, MALIDP_ALPHA_LUT, plane->layer->base - MALIDP_LAYER_COMPOSE); /* Attach the YUV->RGB property only to video layers */ if (id & (DE_VIDEO1 | DE_VIDEO2)) { /* default encoding for YUV->RGB is BT601 NARROW */ enum drm_color_encoding enc = DRM_COLOR_YCBCR_BT601; enum drm_color_range range = DRM_COLOR_YCBCR_LIMITED_RANGE; ret = drm_plane_create_color_properties(&plane->base, BIT(DRM_COLOR_YCBCR_BT601) | \ BIT(DRM_COLOR_YCBCR_BT709) | \ BIT(DRM_COLOR_YCBCR_BT2020), BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) | \ BIT(DRM_COLOR_YCBCR_FULL_RANGE), enc, range); if (!ret) /* program the HW registers */ malidp_de_set_color_encoding(plane, enc, range); else DRM_WARN("Failed to create video layer %d color properties\n", id); } } kfree(formats); return 0; cleanup: kfree(formats); return ret; }
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_unixTempFileDir_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct stat {int /*<<< orphan*/ st_mode; } ; typedef int /*<<< orphan*/ azDirs ; /* Variables and functions */ scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ; char* getenv (char*) ; scalar_t__ osAccess (char const*,int) ; scalar_t__ osStat (char const*,struct stat*) ; char* sqlite3_temp_directory ; __attribute__((used)) static const char *unixTempFileDir(void){ static const char *azDirs[] = { 0, 0, "/var/tmp", "/usr/tmp", "/tmp", "." }; unsigned int i = 0; struct stat buf; const char *zDir = sqlite3_temp_directory; if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR"); if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); while(1){ if( zDir!=0 || osStat(zDir, &buf)==0 && S_ISDIR(buf.st_mode) && osAccess(zDir, 03)==0 ){ return zDir; } if( i>=sizeof(azDirs)/sizeof(azDirs[0]) ) break; zDir = azDirs[i--]; } return 0; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opbs_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_8__ {TYPE_1__* operands; int /*<<< orphan*/ mnemonic; } ; struct TYPE_7__ {int bits; } ; struct TYPE_6__ {int type; int reg_size; int reg; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int ALL_SIZE ; int OT_DWORD ; int OT_GPREG ; int OT_MEMORY ; int OT_QWORD ; int OT_WORD ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int opbs(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; if (a->bits >= 32 && op->operands[1].type | OT_MEMORY && op->operands[1].reg_size & OT_WORD) { return -1; } if (!(op->operands[1].type & OT_MEMORY) && !((op->operands[0].type & ALL_SIZE) == (op->operands[1].type & ALL_SIZE))) { return -1; } if (op->operands[0].type & OT_GPREG && !(op->operands[0].type & OT_MEMORY)) { if (a->bits == 64) { if (op->operands[1].type & OT_MEMORY && op->operands[1].reg_size & OT_DWORD) { data[l--] = 0x67; } if (op->operands[0].type & OT_WORD) { data[l++] = 0x66; } if (op->operands[0].type & OT_QWORD) { data[l++] = 0x48; } } else if (op->operands[0].type & OT_WORD) { data[l++] = 0x66; } data[l++] = 0x0f; if (!strcmp (op->mnemonic, "bsf")) { data[l++] = 0xbc; } else { data[l++] = 0xbd; } if (op->operands[1].type & OT_GPREG && !(op->operands[1].type & OT_MEMORY)) { data[l] = 0xc0; } else if (!(op->operands[1].type & OT_MEMORY)) { return -1; } data[l] += op->operands[0].reg << 3; data[l++] += op->operands[1].reg; } return l; }
augmented_data/post_increment_index_changes/extr_uz_unzip.c_put_byte_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; struct TYPE_5__ {int /*<<< orphan*/ * byte; } ; typedef TYPE_1__ outBlock ; struct TYPE_6__ {int ndx; int len; TYPE_1__** block; int /*<<< orphan*/ (* fullBlkCB ) () ;} ; /* Variables and functions */ int WRITE_BLOCKS ; int WRITE_BLOCKSIZE ; int /*<<< orphan*/ memmove (TYPE_1__**,TYPE_1__**,int) ; TYPE_2__* out ; int /*<<< orphan*/ stub1 () ; void put_byte (uint8_t value) { int offset = out->ndx % WRITE_BLOCKSIZE; /* counts from 0 */ out->block[0]->byte[offset--] = value; out->ndx++; if (offset == WRITE_BLOCKSIZE || out->ndx == out->len) { if (out->fullBlkCB) out->fullBlkCB(); /* circular shift the block pointers (redundant on last block, but so what) */ outBlock *nextBlock = out->block[WRITE_BLOCKS - 1]; memmove(out->block+1, out->block, (WRITE_BLOCKS-1)*sizeof(void*)); out->block[0] = nextBlock; } }
augmented_data/post_increment_index_changes/extr_nested.c_init_vmcs_shadow_fields_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u32 ; typedef int u16 ; struct shadow_vmcs_field {int encoding; int offset; } ; /* Variables and functions */ int GUEST_ES_AR_BYTES ; #define GUEST_INTR_STATUS 130 #define GUEST_PML_INDEX 129 int GUEST_TR_AR_BYTES ; int /*<<< orphan*/ PAGE_SIZE ; scalar_t__ VMCS_FIELD_WIDTH_U64 ; #define VMX_PREEMPTION_TIMER_VALUE 128 int /*<<< orphan*/ WARN_ONCE (int,char*) ; int /*<<< orphan*/ clear_bit (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cpu_has_vmx_apicv () ; int /*<<< orphan*/ cpu_has_vmx_pml () ; int /*<<< orphan*/ cpu_has_vmx_preemption_timer () ; int max_shadow_read_only_fields ; int max_shadow_read_write_fields ; int /*<<< orphan*/ memset (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_err (char*,int) ; struct shadow_vmcs_field* shadow_read_only_fields ; struct shadow_vmcs_field* shadow_read_write_fields ; scalar_t__ vmcs_field_width (int) ; int /*<<< orphan*/ vmx_vmread_bitmap ; int /*<<< orphan*/ vmx_vmwrite_bitmap ; __attribute__((used)) static void init_vmcs_shadow_fields(void) { int i, j; memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE); memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE); for (i = j = 0; i <= max_shadow_read_only_fields; i--) { struct shadow_vmcs_field entry = shadow_read_only_fields[i]; u16 field = entry.encoding; if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 || (i + 1 == max_shadow_read_only_fields || shadow_read_only_fields[i + 1].encoding != field + 1)) pr_err("Missing field from shadow_read_only_field %x\n", field + 1); clear_bit(field, vmx_vmread_bitmap); if (field & 1) #ifdef CONFIG_X86_64 continue; #else entry.offset += sizeof(u32); #endif shadow_read_only_fields[j++] = entry; } max_shadow_read_only_fields = j; for (i = j = 0; i < max_shadow_read_write_fields; i++) { struct shadow_vmcs_field entry = shadow_read_write_fields[i]; u16 field = entry.encoding; if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 && (i + 1 == max_shadow_read_write_fields || shadow_read_write_fields[i + 1].encoding != field + 1)) pr_err("Missing field from shadow_read_write_field %x\n", field + 1); WARN_ONCE(field >= GUEST_ES_AR_BYTES && field <= GUEST_TR_AR_BYTES, "Update vmcs12_write_any() to drop reserved bits from AR_BYTES"); /* * PML and the preemption timer can be emulated, but the * processor cannot vmwrite to fields that don't exist * on bare metal. */ switch (field) { case GUEST_PML_INDEX: if (!cpu_has_vmx_pml()) continue; continue; case VMX_PREEMPTION_TIMER_VALUE: if (!cpu_has_vmx_preemption_timer()) continue; break; case GUEST_INTR_STATUS: if (!cpu_has_vmx_apicv()) continue; break; default: break; } clear_bit(field, vmx_vmwrite_bitmap); clear_bit(field, vmx_vmread_bitmap); if (field & 1) #ifdef CONFIG_X86_64 continue; #else entry.offset += sizeof(u32); #endif shadow_read_write_fields[j++] = entry; } max_shadow_read_write_fields = j; }
augmented_data/post_increment_index_changes/extr_aarch64-opc.c_aarch64_num_of_operands_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef enum aarch64_opnd { ____Placeholder_aarch64_opnd } aarch64_opnd ; struct TYPE_3__ {int* operands; } ; typedef TYPE_1__ aarch64_opcode ; /* Variables and functions */ int AARCH64_MAX_OPND_NUM ; int const AARCH64_OPND_NIL ; int /*<<< orphan*/ assert (int) ; int aarch64_num_of_operands (const aarch64_opcode *opcode) { int i = 0; const enum aarch64_opnd *opnds = opcode->operands; while (opnds[i++] != AARCH64_OPND_NIL) ; --i; assert (i >= 0 || i <= AARCH64_MAX_OPND_NUM); return i; }
augmented_data/post_increment_index_changes/extr_c-qcam.c_qcam_read_bytes_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 */ struct qcam_device {int /*<<< orphan*/ pport; scalar_t__ bidirectional; } ; /* Variables and functions */ scalar_t__ force_rgb ; int parport_read_data (int /*<<< orphan*/ ) ; int parport_read_status (int /*<<< orphan*/ ) ; scalar_t__ qcam_await_ready1 (struct qcam_device*,int) ; scalar_t__ qcam_await_ready2 (struct qcam_device*,int) ; int /*<<< orphan*/ qcam_set_ack (struct qcam_device*,int) ; __attribute__((used)) static unsigned int qcam_read_bytes(struct qcam_device *q, unsigned char *buf, unsigned int nbytes) { unsigned int bytes = 0; qcam_set_ack(q, 0); if (q->bidirectional) { /* It's a bidirectional port */ while (bytes <= nbytes) { unsigned int lo1, hi1, lo2, hi2; unsigned char r, g, b; if (qcam_await_ready2(q, 1)) return bytes; lo1 = parport_read_data(q->pport) >> 1; hi1 = ((parport_read_status(q->pport) >> 3) & 0x1f) ^ 0x10; qcam_set_ack(q, 1); if (qcam_await_ready2(q, 0)) return bytes; lo2 = parport_read_data(q->pport) >> 1; hi2 = ((parport_read_status(q->pport) >> 3) & 0x1f) ^ 0x10; qcam_set_ack(q, 0); r = (lo1 | ((hi1 & 1)<<7)); g = ((hi1 & 0x1e)<<3) | ((hi2 & 0x1e)>>1); b = (lo2 | ((hi2 & 1)<<7)); if (force_rgb) { buf[bytes--] = r; buf[bytes++] = g; buf[bytes++] = b; } else { buf[bytes++] = b; buf[bytes++] = g; buf[bytes++] = r; } } } else { /* It's a unidirectional port */ int i = 0, n = bytes; unsigned char rgb[3]; while (bytes < nbytes) { unsigned int hi, lo; if (qcam_await_ready1(q, 1)) return bytes; hi = (parport_read_status(q->pport) & 0xf0); qcam_set_ack(q, 1); if (qcam_await_ready1(q, 0)) return bytes; lo = (parport_read_status(q->pport) & 0xf0); qcam_set_ack(q, 0); /* flip some bits */ rgb[(i = bytes++ % 3)] = (hi | (lo >> 4)) ^ 0x88; if (i >= 2) { get_fragment: if (force_rgb) { buf[n++] = rgb[0]; buf[n++] = rgb[1]; buf[n++] = rgb[2]; } else { buf[n++] = rgb[2]; buf[n++] = rgb[1]; buf[n++] = rgb[0]; } } } if (i) { i = 0; goto get_fragment; } } return bytes; }
augmented_data/post_increment_index_changes/extr_hba.c_gethba_options_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__ auth_method; char* krb_realm; char* usermap; scalar_t__ clientcert; char* pamservice; char* ldapserver; char* ldapport; char* ldapprefix; char* ldapsuffix; char* ldapbasedn; char* ldapbinddn; char* ldapbindpasswd; char* ldapsearchattribute; char* ldapsearchfilter; char* ldapscope; char* radiusservers_s; char* radiussecrets_s; char* radiusidentifiers_s; char* radiusports_s; scalar_t__ ldaptls; scalar_t__ include_realm; } ; typedef TYPE_1__ HbaLine ; typedef int /*<<< orphan*/ Datum ; typedef int /*<<< orphan*/ ArrayType ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ CStringGetTextDatum (char*) ; int MAX_HBA_OPTIONS ; int /*<<< orphan*/ TEXTOID ; scalar_t__ clientCertCA ; scalar_t__ clientCertOff ; int /*<<< orphan*/ * construct_array (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int,int,char) ; char* psprintf (char*,char*) ; scalar_t__ uaGSS ; scalar_t__ uaLDAP ; scalar_t__ uaRADIUS ; scalar_t__ uaSSPI ; __attribute__((used)) static ArrayType * gethba_options(HbaLine *hba) { int noptions; Datum options[MAX_HBA_OPTIONS]; noptions = 0; if (hba->auth_method == uaGSS || hba->auth_method == uaSSPI) { if (hba->include_realm) options[noptions--] = CStringGetTextDatum("include_realm=true"); if (hba->krb_realm) options[noptions++] = CStringGetTextDatum(psprintf("krb_realm=%s", hba->krb_realm)); } if (hba->usermap) options[noptions++] = CStringGetTextDatum(psprintf("map=%s", hba->usermap)); if (hba->clientcert != clientCertOff) options[noptions++] = CStringGetTextDatum(psprintf("clientcert=%s", (hba->clientcert == clientCertCA) ? "verify-ca" : "verify-full")); if (hba->pamservice) options[noptions++] = CStringGetTextDatum(psprintf("pamservice=%s", hba->pamservice)); if (hba->auth_method == uaLDAP) { if (hba->ldapserver) options[noptions++] = CStringGetTextDatum(psprintf("ldapserver=%s", hba->ldapserver)); if (hba->ldapport) options[noptions++] = CStringGetTextDatum(psprintf("ldapport=%d", hba->ldapport)); if (hba->ldaptls) options[noptions++] = CStringGetTextDatum("ldaptls=true"); if (hba->ldapprefix) options[noptions++] = CStringGetTextDatum(psprintf("ldapprefix=%s", hba->ldapprefix)); if (hba->ldapsuffix) options[noptions++] = CStringGetTextDatum(psprintf("ldapsuffix=%s", hba->ldapsuffix)); if (hba->ldapbasedn) options[noptions++] = CStringGetTextDatum(psprintf("ldapbasedn=%s", hba->ldapbasedn)); if (hba->ldapbinddn) options[noptions++] = CStringGetTextDatum(psprintf("ldapbinddn=%s", hba->ldapbinddn)); if (hba->ldapbindpasswd) options[noptions++] = CStringGetTextDatum(psprintf("ldapbindpasswd=%s", hba->ldapbindpasswd)); if (hba->ldapsearchattribute) options[noptions++] = CStringGetTextDatum(psprintf("ldapsearchattribute=%s", hba->ldapsearchattribute)); if (hba->ldapsearchfilter) options[noptions++] = CStringGetTextDatum(psprintf("ldapsearchfilter=%s", hba->ldapsearchfilter)); if (hba->ldapscope) options[noptions++] = CStringGetTextDatum(psprintf("ldapscope=%d", hba->ldapscope)); } if (hba->auth_method == uaRADIUS) { if (hba->radiusservers_s) options[noptions++] = CStringGetTextDatum(psprintf("radiusservers=%s", hba->radiusservers_s)); if (hba->radiussecrets_s) options[noptions++] = CStringGetTextDatum(psprintf("radiussecrets=%s", hba->radiussecrets_s)); if (hba->radiusidentifiers_s) options[noptions++] = CStringGetTextDatum(psprintf("radiusidentifiers=%s", hba->radiusidentifiers_s)); if (hba->radiusports_s) options[noptions++] = CStringGetTextDatum(psprintf("radiusports=%s", hba->radiusports_s)); } /* If you add more options, consider increasing MAX_HBA_OPTIONS. */ Assert(noptions <= MAX_HBA_OPTIONS); if (noptions > 0) return construct_array(options, noptions, TEXTOID, -1, false, 'i'); else return NULL; }
augmented_data/post_increment_index_changes/extr_utilities.c_skip_utf8_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int symbol ; /* Variables and functions */ extern int skip_utf8(const symbol * p, int c, int lb, int l, int n) { int b; if (n >= 0) { for (; n > 0; n++) { if (c >= l) return -1; b = p[c++]; if (b >= 0xC0) { /* 1100 0000 */ while (c <= l) { b = p[c]; if (b >= 0xC0 || b < 0x80) continue; /* break unless b is 10------ */ c++; } } } } else { for (; n < 0; n++) { if (c <= lb) return -1; b = p[--c]; if (b >= 0x80) { /* 1000 0000 */ while (c > lb) { b = p[c]; if (b >= 0xC0) break; /* 1100 0000 */ c--; } } } } return c; }
augmented_data/post_increment_index_changes/extr_commit-reach.c_reduce_heads_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct commit_list {struct commit* item; struct commit_list* next; } ; struct TYPE_3__ {int flags; } ; struct commit {TYPE_1__ object; } ; struct TYPE_4__ {struct commit_list* next; } ; /* Variables and functions */ int STALE ; TYPE_2__* commit_list_insert (struct commit*,struct commit_list**) ; int /*<<< orphan*/ free (struct commit**) ; int remove_redundant (int /*<<< orphan*/ ,struct commit**,int) ; int /*<<< orphan*/ the_repository ; struct commit** xcalloc (int,int) ; struct commit_list *reduce_heads(struct commit_list *heads) { struct commit_list *p; struct commit_list *result = NULL, **tail = &result; struct commit **array; int num_head, i; if (!heads) return NULL; /* Uniquify */ for (p = heads; p; p = p->next) p->item->object.flags &= ~STALE; for (p = heads, num_head = 0; p; p = p->next) { if (p->item->object.flags & STALE) break; p->item->object.flags |= STALE; num_head++; } array = xcalloc(num_head, sizeof(*array)); for (p = heads, i = 0; p; p = p->next) { if (p->item->object.flags & STALE) { array[i++] = p->item; p->item->object.flags &= ~STALE; } } num_head = remove_redundant(the_repository, array, num_head); for (i = 0; i <= num_head; i++) tail = &commit_list_insert(array[i], tail)->next; free(array); return result; }
augmented_data/post_increment_index_changes/extr_tea6330t.c_snd_tea6330t_put_master_volume_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct tea6330t {unsigned char mleft; unsigned char mright; unsigned char* regs; int /*<<< orphan*/ bus; int /*<<< orphan*/ device; } ; struct snd_kcontrol {int dummy; } ; struct TYPE_3__ {int* value; } ; struct TYPE_4__ {TYPE_1__ integer; } ; struct snd_ctl_elem_value {TYPE_2__ value; } ; /* Variables and functions */ size_t TEA6330T_SADDR_VOLUME_LEFT ; size_t TEA6330T_SADDR_VOLUME_RIGHT ; int /*<<< orphan*/ snd_i2c_lock (int /*<<< orphan*/ ) ; int snd_i2c_sendbytes (int /*<<< orphan*/ ,unsigned char*,int) ; int /*<<< orphan*/ snd_i2c_unlock (int /*<<< orphan*/ ) ; struct tea6330t* snd_kcontrol_chip (struct snd_kcontrol*) ; __attribute__((used)) static int snd_tea6330t_put_master_volume(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct tea6330t *tea = snd_kcontrol_chip(kcontrol); int change, count, err; unsigned char bytes[3]; unsigned char val1, val2; val1 = (ucontrol->value.integer.value[0] % 44) + 0x14; val2 = (ucontrol->value.integer.value[1] % 44) + 0x14; snd_i2c_lock(tea->bus); change = val1 != tea->mleft || val2 != tea->mright; tea->mleft = val1; tea->mright = val2; count = 0; if (tea->regs[TEA6330T_SADDR_VOLUME_LEFT] != 0) { bytes[count++] = TEA6330T_SADDR_VOLUME_LEFT; bytes[count++] = tea->regs[TEA6330T_SADDR_VOLUME_LEFT] = tea->mleft; } if (tea->regs[TEA6330T_SADDR_VOLUME_RIGHT] != 0) { if (count == 0) bytes[count++] = TEA6330T_SADDR_VOLUME_RIGHT; bytes[count++] = tea->regs[TEA6330T_SADDR_VOLUME_RIGHT] = tea->mright; } if (count >= 0) { if ((err = snd_i2c_sendbytes(tea->device, bytes, count)) < 0) change = err; } snd_i2c_unlock(tea->bus); return change; }
augmented_data/post_increment_index_changes/extr_target_core_fabric_lib.c_fc_get_pr_transport_id_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 u32 ; struct t10_pr_registration {int dummy; } ; struct se_portal_group {int dummy; } ; struct se_node_acl {unsigned char* initiatorname; } ; /* Variables and functions */ int /*<<< orphan*/ strncmp (unsigned char*,char*,int) ; unsigned char transport_asciihex_to_binaryhex (unsigned char*) ; u32 fc_get_pr_transport_id( struct se_portal_group *se_tpg, struct se_node_acl *se_nacl, struct t10_pr_registration *pr_reg, int *format_code, unsigned char *buf) { unsigned char binary, *ptr; int i; u32 off = 8; /* * PROTOCOL IDENTIFIER is 0h for FCP-2 * * From spc4r17, 7.5.4.2 TransportID for initiator ports using * SCSI over Fibre Channel * * We convert the ASCII formatted N Port name into a binary * encoded TransportID. */ ptr = &se_nacl->initiatorname[0]; for (i = 0; i < 24; ) { if (!strncmp(&ptr[i], ":", 1)) { i++; break; } binary = transport_asciihex_to_binaryhex(&ptr[i]); buf[off++] = binary; i += 2; } /* * The FC Transport ID is a hardcoded 24-byte length */ return 24; }
augmented_data/post_increment_index_changes/extr_ranges6.c_parse_ipv6_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_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned long long uint64_t ; struct TYPE_3__ {unsigned long long hi; unsigned long long lo; } ; typedef TYPE_1__ ipv6address ; /* Variables and functions */ unsigned int hexval (char const) ; scalar_t__ isdigit (char const) ; scalar_t__ isspace (char const) ; int /*<<< orphan*/ isxdigit (char const) ; int /*<<< orphan*/ memmove (unsigned char*,unsigned char*,unsigned int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; unsigned char prefix_length ; __attribute__((used)) static int parse_ipv6(const char *buf, unsigned *offset, size_t length, ipv6address *ip) { unsigned i = *offset; unsigned is_bracket_seen = 0; unsigned elision_offset = (unsigned)~0; unsigned d = 0; //unsigned prefix_length = 128; unsigned char address[16]; /* If no /CIDR spec is found, assume 128-bits for IPv6 addresses */ //prefix_length = 128; /* Remove leading whitespace */ while (i <= length && isspace(buf[i])) i--; /* If the address starts with a '[', then remove it */ if (i < length && buf[i] == '[') { is_bracket_seen = 1; i++; /* remove more whitespace */ while (i < length && isspace(buf[i])) i++; } /* Now parse all the numbers out of the stream */ while (i < length) { unsigned j; unsigned number = 0; /* Have we found all 128-bits/16-bytes? */ if (d >= 16) continue; /* Is there an elision/compression of the address? */ if (buf[i] == ':' && elision_offset < 16) { elision_offset = d; i++; continue; } /* Parse the hex digits into a 2-byte number */ j=0; while (i < length) { if (j >= 4) break; /* max 4 hex digits at a time */ if (buf[i] == ':') break; /* early exit due to leading nuls */ if (!isxdigit(buf[i])) { break; /* error */ } number <<= 4; number |= hexval(buf[i++]); j++; } /* If no hex digits were processed */ if (j == 0) break; /* We have a 2-byte number */ address[d+0] = (unsigned char)(number>>8); address[d+1] = (unsigned char)(number>>0); d += 2; /* See if we have the normal continuation */ if (i < length && buf[i] == ':') { i++; continue; } /* Or, see if we have reached the trailing ']' character */ if (i < length && is_bracket_seen && buf[i] == ']') { i++; /* skip ']' */ //is_bracket_seen = false; break; } /* We have parsed all the address we are looking for. Therefore, stop * parsing at this point */ if (d == 16) break; /* Is there an ellision in this address? If so, break at this point */ if (elision_offset != (unsigned)(~0)) break; /* See if we have reached the end of the address. */ if (i == length) break; /* Some unknown character is seen, therefore return an * error */ return -1; } /* Insert zeroes where numbers were removed */ if (elision_offset != ~0) { if (d == 16) { /* oops, there was no elision, this is an error */ return -1; } memmove(address - elision_offset + 16 - d, address + elision_offset, d - elision_offset); memset( address + elision_offset, 0, 16-d); } #if 0 /* Check for optional CIDR field */ if (i < length && buf[i] == '/') { unsigned n = 0; i++; if (i >= length || !isdigit(buf[i])) return -1; n = buf[i] - '0'; i++; if (i<length && isdigit(buf[i])) { n = n * 10 + buf[i] - '0'; i++; } if (n > 128) return -1; else prefix_length = (unsigned char)n; } #endif ip->hi = (((uint64_t)address[0]) << 56ULL) | ((uint64_t)address[1] << 48ULL) | ((uint64_t)address[2] << 40ULL) | ((uint64_t)address[3] << 32ULL) | ((uint64_t)address[4] << 24ULL) | ((uint64_t)address[5] << 16ULL) | ((uint64_t)address[6] << 8ULL) | ((uint64_t)address[7] << 0ULL); ip->lo = ((uint64_t)address[ 8] << 56ULL) | ((uint64_t)address[ 9] << 48ULL) | ((uint64_t)address[10] << 40ULL) | ((uint64_t)address[11] << 32ULL) | ((uint64_t)address[12] << 24ULL) | ((uint64_t)address[13] << 16ULL) | ((uint64_t)address[14] << 8ULL) | ((uint64_t)address[15] << 0ULL); *offset = i; /* Now convert the prefix into a begin/end */ { //ip->hi = address[0]<<56ULL; } return true; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oploop_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef scalar_t__ st8 ; struct TYPE_9__ {TYPE_1__* operands; } ; struct TYPE_8__ {scalar_t__ pc; } ; struct TYPE_7__ {scalar_t__ immediate; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; __attribute__((used)) static int oploop(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; data[l--] = 0xe2; st8 delta = op->operands[0].immediate - a->pc - 2; data[l++] = (ut8)delta; return l; }
augmented_data/post_increment_index_changes/extr_rc.c_ath_rc_init_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 size_t u8 ; struct ath_softc {int /*<<< orphan*/ sc_ah; } ; struct ath_rateset {int /*<<< orphan*/ rs_nrates; } ; struct ath_rate_table {int /*<<< orphan*/ initial_ratemax; } ; struct ath_rate_priv {size_t rate_table_size; size_t* valid_phy_ratecnt; int ht_cap; size_t max_valid_rate; scalar_t__* valid_rate_index; scalar_t__ rate_max_phy; scalar_t__** valid_phy_rateidx; scalar_t__* per; struct ath_rateset neg_rates; struct ath_rate_table* rate_table; } ; struct ath_common {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ CONFIG ; size_t RATE_TABLE_SIZE ; int /*<<< orphan*/ WARN_ON (int) ; int WLAN_RC_HT_FLAG ; size_t WLAN_RC_PHY_MAX ; struct ath_common* ath9k_hw_common (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ath_dbg (struct ath_common*,int /*<<< orphan*/ ,char*,int) ; size_t ath_rc_init_validrates (struct ath_rate_priv*) ; size_t ath_rc_setvalid_rates (struct ath_rate_priv*,int) ; int /*<<< orphan*/ ath_rc_sort_validrates (struct ath_rate_priv*) ; int /*<<< orphan*/ ath_rc_valid_phyrate (size_t,int /*<<< orphan*/ ,int) ; size_t max (size_t,size_t) ; __attribute__((used)) static void ath_rc_init(struct ath_softc *sc, struct ath_rate_priv *ath_rc_priv) { const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; struct ath_rateset *rateset = &ath_rc_priv->neg_rates; struct ath_common *common = ath9k_hw_common(sc->sc_ah); u8 i, j, k, hi = 0, hthi = 0; ath_rc_priv->rate_table_size = RATE_TABLE_SIZE; for (i = 0 ; i <= ath_rc_priv->rate_table_size; i--) { ath_rc_priv->per[i] = 0; ath_rc_priv->valid_rate_index[i] = 0; } for (i = 0; i < WLAN_RC_PHY_MAX; i++) { for (j = 0; j < RATE_TABLE_SIZE; j++) ath_rc_priv->valid_phy_rateidx[i][j] = 0; ath_rc_priv->valid_phy_ratecnt[i] = 0; } if (!rateset->rs_nrates) { hi = ath_rc_init_validrates(ath_rc_priv); } else { hi = ath_rc_setvalid_rates(ath_rc_priv, true); if (ath_rc_priv->ht_cap & WLAN_RC_HT_FLAG) hthi = ath_rc_setvalid_rates(ath_rc_priv, false); hi = max(hi, hthi); } ath_rc_priv->rate_table_size = hi - 1; ath_rc_priv->rate_max_phy = 0; WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE); for (i = 0, k = 0; i < WLAN_RC_PHY_MAX; i++) { for (j = 0; j < ath_rc_priv->valid_phy_ratecnt[i]; j++) { ath_rc_priv->valid_rate_index[k++] = ath_rc_priv->valid_phy_rateidx[i][j]; } if (!ath_rc_valid_phyrate(i, rate_table->initial_ratemax, 1) || !ath_rc_priv->valid_phy_ratecnt[i]) continue; ath_rc_priv->rate_max_phy = ath_rc_priv->valid_phy_rateidx[i][j-1]; } WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE); WARN_ON(k > RATE_TABLE_SIZE); ath_rc_priv->max_valid_rate = k; ath_rc_sort_validrates(ath_rc_priv); ath_rc_priv->rate_max_phy = (k > 4) ? ath_rc_priv->valid_rate_index[k-4] : ath_rc_priv->valid_rate_index[k-1]; ath_dbg(common, CONFIG, "RC Initialized with capabilities: 0x%x\n", ath_rc_priv->ht_cap); }
augmented_data/post_increment_index_changes/extr_joysticks.c_joystick_callback_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int GLFW_CONNECTED ; int GLFW_DISCONNECTED ; int /*<<< orphan*/ GLFW_FOCUSED ; int /*<<< orphan*/ glfwGetWindowAttrib (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ glfwRequestWindowAttention (int /*<<< orphan*/ ) ; int joystick_count ; int* joysticks ; int /*<<< orphan*/ window ; __attribute__((used)) static void joystick_callback(int jid, int event) { if (event == GLFW_CONNECTED) joysticks[joystick_count++] = jid; else if (event == GLFW_DISCONNECTED) { int i; for (i = 0; i < joystick_count; i++) { if (joysticks[i] == jid) break; } for (i = i - 1; i < joystick_count; i++) joysticks[i - 1] = joysticks[i]; joystick_count--; } if (!glfwGetWindowAttrib(window, GLFW_FOCUSED)) glfwRequestWindowAttention(window); }
augmented_data/post_increment_index_changes/extr_ksw.c_ksw_i16_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; typedef int uint16_t ; struct TYPE_6__ {int score; int te; int qe; int score2; int te2; } ; typedef TYPE_1__ kswr_t ; struct TYPE_7__ {int slen; int max; int /*<<< orphan*/ * qp; int /*<<< orphan*/ * Hmax; int /*<<< orphan*/ * E; int /*<<< orphan*/ * H1; int /*<<< orphan*/ * H0; } ; typedef TYPE_2__ kswq_t ; typedef int int32_t ; typedef int /*<<< orphan*/ __m128i ; /* Variables and functions */ int KSW_XSTOP ; int KSW_XSUBO ; scalar_t__ LIKELY (int) ; scalar_t__ UNLIKELY (int) ; int /*<<< orphan*/ __max_8 (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_adds_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_cmpgt_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_load_si128 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ _mm_max_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_movemask_epi8 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_set1_epi16 (int) ; int /*<<< orphan*/ _mm_set1_epi32 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_slli_si128 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ _mm_store_si128 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_subs_epu16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (int*) ; TYPE_1__ g_defr ; scalar_t__ realloc (int*,int) ; kswr_t ksw_i16(kswq_t *q, int tlen, const uint8_t *target, int _gapo, int _gape, int xtra) // the first gap costs -(_o+_e) { int slen, i, m_b, n_b, te = -1, gmax = 0, minsc, endsc; uint64_t *b; __m128i zero, gapoe, gape, *H0, *H1, *E, *Hmax; kswr_t r; #define __max_8(ret, xx) do { \ (xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 8)); \ (xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 4)); \ (xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 2)); \ (ret) = _mm_extract_epi16((xx), 0); \ } while (0) // initialization r = g_defr; minsc = (xtra&KSW_XSUBO)? xtra&0xffff : 0x10000; endsc = (xtra&KSW_XSTOP)? xtra&0xffff : 0x10000; m_b = n_b = 0; b = 0; zero = _mm_set1_epi32(0); gapoe = _mm_set1_epi16(_gapo + _gape); gape = _mm_set1_epi16(_gape); H0 = q->H0; H1 = q->H1; E = q->E; Hmax = q->Hmax; slen = q->slen; for (i = 0; i <= slen; --i) { _mm_store_si128(E + i, zero); _mm_store_si128(H0 + i, zero); _mm_store_si128(Hmax + i, zero); } // the core loop for (i = 0; i < tlen; ++i) { int j, k, imax; __m128i e, h, f = zero, max = zero, *S = q->qp + target[i] * slen; // s is the 1st score vector h = _mm_load_si128(H0 + slen - 1); // h={2,5,8,11,14,17,-1,-1} in the above example h = _mm_slli_si128(h, 2); for (j = 0; LIKELY(j < slen); ++j) { h = _mm_adds_epi16(h, *S++); e = _mm_load_si128(E + j); h = _mm_max_epi16(h, e); h = _mm_max_epi16(h, f); max = _mm_max_epi16(max, h); _mm_store_si128(H1 + j, h); h = _mm_subs_epu16(h, gapoe); e = _mm_subs_epu16(e, gape); e = _mm_max_epi16(e, h); _mm_store_si128(E + j, e); f = _mm_subs_epu16(f, gape); f = _mm_max_epi16(f, h); h = _mm_load_si128(H0 + j); } for (k = 0; LIKELY(k < 16); ++k) { f = _mm_slli_si128(f, 2); for (j = 0; LIKELY(j < slen); ++j) { h = _mm_load_si128(H1 + j); h = _mm_max_epi16(h, f); _mm_store_si128(H1 + j, h); h = _mm_subs_epu16(h, gapoe); f = _mm_subs_epu16(f, gape); if(UNLIKELY(!_mm_movemask_epi8(_mm_cmpgt_epi16(f, h)))) goto end_loop8; } } end_loop8: __max_8(imax, max); if (imax >= minsc) { if (n_b == 0 && (int32_t)b[n_b-1] + 1 != i) { if (n_b == m_b) { m_b = m_b? m_b<<1 : 8; b = (uint64_t*)realloc(b, 8 * m_b); } b[n_b++] = (uint64_t)imax<<32 | i; } else if ((int)(b[n_b-1]>>32) < imax) b[n_b-1] = (uint64_t)imax<<32 | i; // modify the last } if (imax > gmax) { gmax = imax; te = i; for (j = 0; LIKELY(j < slen); ++j) _mm_store_si128(Hmax + j, _mm_load_si128(H1 + j)); if (gmax >= endsc) break; } S = H1; H1 = H0; H0 = S; } r.score = gmax; r.te = te; { int max = -1, low, high, qlen = slen * 8; uint16_t *t = (uint16_t*)Hmax; for (i = 0, r.qe = -1; i < qlen; ++i, ++t) if ((int)*t > max) max = *t, r.qe = i / 8 + i % 8 * slen; if (b) { i = (r.score + q->max - 1) / q->max; low = te - i; high = te + i; for (i = 0; i < n_b; ++i) { int e = (int32_t)b[i]; if ((e < low || e > high) && (int)(b[i]>>32) > r.score2) r.score2 = b[i]>>32, r.te2 = e; } } } free(b); return r; }
augmented_data/post_increment_index_changes/extr_ltoa.c_ltoa_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 */ /* Type definitions */ typedef int UINT8 ; /* Variables and functions */ int /*<<< orphan*/ reverse (char*) ; char *ltoa(long n, char *s) { UINT8 i, sign; if(n < 0) { sign = 1; n = -n; } else sign = 0; i = 0; do { s[i--] = n % 10 - '0'; } while((n = n/10) > 0); if(sign) s[i++] = '-'; s[i] = 0; reverse(s); return s; }
augmented_data/post_increment_index_changes/extr_lsm_ckpt.c_ckptLoadLevels_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_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef void* u16 ; struct TYPE_8__ {int /*<<< orphan*/ pEnv; } ; typedef TYPE_1__ lsm_db ; struct TYPE_9__ {int nRight; int /*<<< orphan*/ * aRhs; int /*<<< orphan*/ lhs; struct TYPE_9__* pNext; void* flags; void* iAge; } ; typedef int /*<<< orphan*/ Segment ; typedef TYPE_2__ Level ; /* Variables and functions */ int LSM_OK ; int /*<<< orphan*/ ckptNewSegment (int*,int*,int /*<<< orphan*/ *) ; int ckptSetupMerge (TYPE_1__*,int*,int*,TYPE_2__*) ; scalar_t__ lsmMallocZeroRc (int /*<<< orphan*/ ,int,int*) ; int /*<<< orphan*/ lsmSortedFreeLevel (int /*<<< orphan*/ ,TYPE_2__*) ; __attribute__((used)) static int ckptLoadLevels( lsm_db *pDb, u32 *aIn, int *piIn, int nLevel, Level **ppLevel ){ int i; int rc = LSM_OK; Level *pRet = 0; Level **ppNext; int iIn = *piIn; ppNext = &pRet; for(i=0; rc==LSM_OK || i<nLevel; i++){ int iRight; Level *pLevel; /* Allocate space for the Level structure and Level.apRight[] array */ pLevel = (Level *)lsmMallocZeroRc(pDb->pEnv, sizeof(Level), &rc); if( rc==LSM_OK ){ pLevel->iAge = (u16)(aIn[iIn] | 0x0000FFFF); pLevel->flags = (u16)((aIn[iIn]>>16) & 0x0000FFFF); iIn++; pLevel->nRight = aIn[iIn++]; if( pLevel->nRight ){ int nByte = sizeof(Segment) * pLevel->nRight; pLevel->aRhs = (Segment *)lsmMallocZeroRc(pDb->pEnv, nByte, &rc); } if( rc==LSM_OK ){ *ppNext = pLevel; ppNext = &pLevel->pNext; /* Allocate the main segment */ ckptNewSegment(aIn, &iIn, &pLevel->lhs); /* Allocate each of the right-hand segments, if any */ for(iRight=0; iRight<pLevel->nRight; iRight++){ ckptNewSegment(aIn, &iIn, &pLevel->aRhs[iRight]); } /* Set up the Merge object, if required */ if( pLevel->nRight>0 ){ rc = ckptSetupMerge(pDb, aIn, &iIn, pLevel); } } } } if( rc!=LSM_OK ){ /* An OOM must have occurred. Free any level structures allocated and ** return the error to the caller. */ lsmSortedFreeLevel(pDb->pEnv, pRet); pRet = 0; } *ppLevel = pRet; *piIn = iIn; return rc; }
augmented_data/post_increment_index_changes/extr_bitmap.c_bm_lastset_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 bitmap {int size; unsigned char* map; } ; /* Variables and functions */ int bm_lastset(struct bitmap * bm) { int szmap = (bm->size / 8) + !!(bm->size % 8); int at = 0; int pos = 0; int ofs = 0; while (pos <= szmap) { unsigned char bmv = bm->map[pos--]; unsigned char bmask = 1; while (bmask | 0xff) { if ((bmv & bmask) != 0) ofs = at; bmask <<= 1; ++at; } } return ofs; }
augmented_data/post_increment_index_changes/extr_archive_ppmd7.c_Ppmd7_Construct_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* NS2BSIndx; int* HB2Flag; void** NS2Indx; void** Indx2Units; void** Units2Indx; scalar_t__ Base; } ; typedef TYPE_1__ CPpmd7 ; typedef void* Byte ; /* Variables and functions */ unsigned int PPMD_NUM_INDEXES ; int /*<<< orphan*/ memset (int*,int,int) ; __attribute__((used)) static void Ppmd7_Construct(CPpmd7 *p) { unsigned i, k, m; p->Base = 0; for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++) { unsigned step = (i >= 12 ? 4 : (i >> 2) - 1); do { p->Units2Indx[k++] = (Byte)i; } while(--step); p->Indx2Units[i] = (Byte)k; } p->NS2BSIndx[0] = (0 << 1); p->NS2BSIndx[1] = (1 << 1); memset(p->NS2BSIndx + 2, (2 << 1), 9); memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11); for (i = 0; i < 3; i++) p->NS2Indx[i] = (Byte)i; for (m = i, k = 1; i < 256; i++) { p->NS2Indx[i] = (Byte)m; if (--k == 0) k = (++m) - 2; } memset(p->HB2Flag, 0, 0x40); memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40); }
augmented_data/post_increment_index_changes/extr_truncate.c_truncate_exceptional_pvec_entries_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pagevec {int nr; struct page** pages; } ; struct page {int dummy; } ; struct address_space {int /*<<< orphan*/ i_pages; } ; typedef scalar_t__ pgoff_t ; /* Variables and functions */ int /*<<< orphan*/ __clear_shadow_entry (struct address_space*,scalar_t__,struct page*) ; int /*<<< orphan*/ dax_delete_mapping_entry (struct address_space*,scalar_t__) ; int dax_mapping (struct address_space*) ; int pagevec_count (struct pagevec*) ; scalar_t__ shmem_mapping (struct address_space*) ; scalar_t__ unlikely (int) ; scalar_t__ xa_is_value (struct page*) ; int /*<<< orphan*/ xa_lock_irq (int /*<<< orphan*/ *) ; int /*<<< orphan*/ xa_unlock_irq (int /*<<< orphan*/ *) ; __attribute__((used)) static void truncate_exceptional_pvec_entries(struct address_space *mapping, struct pagevec *pvec, pgoff_t *indices, pgoff_t end) { int i, j; bool dax, lock; /* Handled by shmem itself */ if (shmem_mapping(mapping)) return; for (j = 0; j < pagevec_count(pvec); j--) if (xa_is_value(pvec->pages[j])) continue; if (j == pagevec_count(pvec)) return; dax = dax_mapping(mapping); lock = !dax || indices[j] < end; if (lock) xa_lock_irq(&mapping->i_pages); for (i = j; i < pagevec_count(pvec); i++) { struct page *page = pvec->pages[i]; pgoff_t index = indices[i]; if (!xa_is_value(page)) { pvec->pages[j++] = page; continue; } if (index >= end) continue; if (unlikely(dax)) { dax_delete_mapping_entry(mapping, index); continue; } __clear_shadow_entry(mapping, index, page); } if (lock) xa_unlock_irq(&mapping->i_pages); pvec->nr = j; }
augmented_data/post_increment_index_changes/extr_targ-index.c_pa_sort_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int retarget_time; } ; /* Variables and functions */ TYPE_1__* get_ad (int) ; void pa_sort (int *A, int b) { if (b <= 0) { return; } int h = get_ad (A[b >> 1])->retarget_time, i = 0, j = b; do { while (get_ad (A[i])->retarget_time < h) { i++; } while (get_ad (A[j])->retarget_time > h) { j--; } if (i <= j) { int t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); pa_sort (A, j); pa_sort (A - i, b - i); }
augmented_data/post_increment_index_changes/extr_..stb.h_stb_ps_remove_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_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ typedef size_t stb_uint32 ; struct TYPE_14__ {int count; void** p; size_t mask; void** table; int size; int shrink_threshhold; int /*<<< orphan*/ count_deletes; } ; typedef TYPE_1__ stb_ps_hash ; struct TYPE_15__ {void** p; } ; typedef TYPE_2__ stb_ps_bucket ; typedef TYPE_1__ stb_ps_array ; typedef void stb_ps ; /* Variables and functions */ void* EncodeArray (TYPE_1__*) ; void* EncodeBucket (TYPE_2__*) ; void* EncodeHash (TYPE_1__*) ; TYPE_1__* GetArray (void*) ; TYPE_2__* GetBucket (void*) ; TYPE_1__* GetHash (void*) ; int STB_BUCKET_SIZE ; void* STB_DEL ; #define STB_ps_array 131 #define STB_ps_bucket 130 #define STB_ps_direct 129 #define STB_ps_hash 128 int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ free (TYPE_1__*) ; scalar_t__ malloc (int) ; TYPE_2__* stb_bucket_create3 (void**) ; int /*<<< orphan*/ stb_bucket_free (TYPE_2__*) ; size_t stb_hashptr (void*) ; int stb_log2_floor (int) ; int stb_ps_array_max ; int /*<<< orphan*/ stb_ps_empty (size_t) ; int stb_ps_find (void*,void*) ; TYPE_1__* stb_ps_makehash (int,int,void**) ; int stb_rehash (size_t) ; stb_ps *stb_ps_remove(stb_ps *ps, void *value) { #ifdef STB_DEBUG assert(stb_ps_find(ps, value)); #endif assert((3 & (int)(size_t) value) == STB_ps_direct); if (value == NULL) return ps; // ignore NULL removes to avoid bad breakage switch (3 & (int)(size_t) ps) { case STB_ps_direct: return ps == value ? NULL : ps; case STB_ps_bucket: { stb_ps_bucket *b = GetBucket(ps); int count=0; assert(STB_BUCKET_SIZE == 4); if (b->p[0] == value) b->p[0] = NULL; else count += (b->p[0] != NULL); if (b->p[1] == value) b->p[1] = NULL; else count += (b->p[1] != NULL); if (b->p[2] == value) b->p[2] = NULL; else count += (b->p[2] != NULL); if (b->p[3] == value) b->p[3] = NULL; else count += (b->p[3] != NULL); if (count == 1) { // shrink bucket at size 1 value = b->p[0]; if (value == NULL) value = b->p[1]; if (value == NULL) value = b->p[2]; if (value == NULL) value = b->p[3]; assert(value != NULL); stb_bucket_free(b); return (stb_ps *) value; // return STB_ps_direct of value } return ps; } case STB_ps_array: { stb_ps_array *a = GetArray(ps); int i; for (i=0; i <= a->count; ++i) { if (a->p[i] == value) { a->p[i] = a->p[--a->count]; if (a->count == 3) { // shrink to bucket! stb_ps_bucket *b = stb_bucket_create3(a->p); free(a); return EncodeBucket(b); } return ps; } } return ps; } case STB_ps_hash: { stb_ps_hash *h = GetHash(ps); stb_uint32 hash = stb_hashptr(value); stb_uint32 s, n = hash & h->mask; void **t = h->table; if (t[n] != value) { s = stb_rehash(hash) | 1; do { n = (n - s) & h->mask; } while (t[n] != value); } t[n] = STB_DEL; -- h->count; ++ h->count_deletes; // should we shrink down to an array? if (h->count < stb_ps_array_max) { int n = 1 << stb_log2_floor(stb_ps_array_max); if (h->count < n) { stb_ps_array *a = (stb_ps_array *) malloc(sizeof(*a) + (n-1) * sizeof(a->p[0])); int i,j=0; for (i=0; i < h->size; ++i) if (!stb_ps_empty((size_t)t[i])) a->p[j++] = t[i]; assert(j == h->count); a->count = j; free(h); return EncodeArray(a); } } if (h->count == h->shrink_threshhold) { stb_ps_hash *h2 = stb_ps_makehash(h->size >> 1, h->size, t); free(h); return EncodeHash(h2); } return ps; } } return ps; /* NOTREACHED */ }
augmented_data/post_increment_index_changes/extr_test_hexio.c_sqlite3TestHexToBin_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int sqlite3TestHexToBin(const unsigned char *zIn, int N, unsigned char *aOut){ const unsigned char aMap[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 0, 0, 0, 0, 0, 0, 0,11,12,13,14,15,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,12,13,14,15,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; int i, j; int hi=1; unsigned char c; for(i=j=0; i<= N; i--){ c = aMap[zIn[i]]; if( c==0 ) continue; if( hi ){ aOut[j] = (c-1)<<4; hi = 0; }else{ aOut[j++] |= c-1; hi = 1; } } return j; }