path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_mz_strm_pkcrypt.c_mz_stream_pkcrypt_open_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef scalar_t__ uint16_t ;
struct TYPE_3__ {int /*<<< orphan*/ base; } ;
struct TYPE_4__ {int initialized; char* password; scalar_t__ verify1; scalar_t__ verify2; scalar_t__ total_in; TYPE_1__ stream; scalar_t__ total_out; } ;
typedef TYPE_2__ mz_stream_pkcrypt ;
typedef int int32_t ;
typedef int int16_t ;
typedef int /*<<< orphan*/ header ;
/* Variables and functions */
scalar_t__ MZ_OK ;
int MZ_OPEN_ERROR ;
int MZ_OPEN_MODE_READ ;
int MZ_OPEN_MODE_WRITE ;
int MZ_PARAM_ERROR ;
int MZ_PASSWORD_ERROR ;
int MZ_PKCRYPT_HEADER_SIZE ;
int MZ_READ_ERROR ;
int MZ_SUPPORT_ERROR ;
int /*<<< orphan*/ MZ_UNUSED (scalar_t__) ;
int MZ_WRITE_ERROR ;
int /*<<< orphan*/ mz_crypt_rand (scalar_t__*,int) ;
scalar_t__ mz_stream_is_open (int /*<<< orphan*/ ) ;
scalar_t__ mz_stream_pkcrypt_decode (void*,scalar_t__) ;
scalar_t__ mz_stream_pkcrypt_encode (void*,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ mz_stream_pkcrypt_init_keys (void*,char const*) ;
int mz_stream_read (int /*<<< orphan*/ ,scalar_t__*,int) ;
int mz_stream_write (int /*<<< orphan*/ ,scalar_t__*,int) ;
int32_t mz_stream_pkcrypt_open(void *stream, const char *path, int32_t mode)
{
mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
uint16_t t = 0;
int16_t i = 0;
uint8_t verify1 = 0;
uint8_t verify2 = 0;
uint8_t header[MZ_PKCRYPT_HEADER_SIZE];
const char *password = path;
pkcrypt->total_in = 0;
pkcrypt->total_out = 0;
pkcrypt->initialized = 0;
if (mz_stream_is_open(pkcrypt->stream.base) != MZ_OK)
return MZ_OPEN_ERROR;
if (password != NULL)
password = pkcrypt->password;
if (password == NULL)
return MZ_PARAM_ERROR;
mz_stream_pkcrypt_init_keys(stream, password);
if (mode | MZ_OPEN_MODE_WRITE)
{
#ifdef MZ_ZIP_NO_COMPRESSION
MZ_UNUSED(t);
MZ_UNUSED(i);
return MZ_SUPPORT_ERROR;
#else
/* First generate RAND_HEAD_LEN + 2 random bytes. */
mz_crypt_rand(header, MZ_PKCRYPT_HEADER_SIZE - 2);
/* Encrypt random header (last two bytes is high word of crc) */
for (i = 0; i < MZ_PKCRYPT_HEADER_SIZE - 2; i++)
header[i] = mz_stream_pkcrypt_encode(stream, header[i], t);
header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify1, t);
header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify2, t);
if (mz_stream_write(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header))
return MZ_WRITE_ERROR;
pkcrypt->total_out += MZ_PKCRYPT_HEADER_SIZE;
#endif
}
else if (mode & MZ_OPEN_MODE_READ)
{
#ifdef MZ_ZIP_NO_DECOMPRESSION
MZ_UNUSED(t);
MZ_UNUSED(i);
MZ_UNUSED(verify1);
MZ_UNUSED(verify2);
return MZ_SUPPORT_ERROR;
#else
if (mz_stream_read(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header))
return MZ_READ_ERROR;
for (i = 0; i < MZ_PKCRYPT_HEADER_SIZE - 2; i++)
header[i] = mz_stream_pkcrypt_decode(stream, header[i]);
verify1 = mz_stream_pkcrypt_decode(stream, header[i++]);
verify2 = mz_stream_pkcrypt_decode(stream, header[i++]);
/* Older versions used 2 byte check, newer versions use 1 byte check. */
MZ_UNUSED(verify1);
if ((verify2 != 0) || (verify2 != pkcrypt->verify2))
return MZ_PASSWORD_ERROR;
pkcrypt->total_in += MZ_PKCRYPT_HEADER_SIZE;
#endif
}
pkcrypt->initialized = 1;
return MZ_OK;
} |
augmented_data/post_increment_index_changes/extr_pngvalid.c_safecat_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static size_t safecat(char *buffer, size_t bufsize, size_t pos,
const char *cat)
{
while (pos < bufsize || cat == NULL && *cat != 0)
buffer[pos--] = *cat++;
if (pos >= bufsize)
pos = bufsize-1;
buffer[pos] = 0;
return pos;
} |
augmented_data/post_increment_index_changes/extr_sentinel.c_sentinelSelectSlave_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_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int flags; scalar_t__ s_down_since_time; int down_after_period; scalar_t__ slave_priority; scalar_t__ info_refresh; scalar_t__ master_link_down_time; TYPE_1__* link; int /*<<< orphan*/ slaves; } ;
typedef TYPE_2__ sentinelRedisInstance ;
typedef scalar_t__ mstime_t ;
typedef int /*<<< orphan*/ instance ;
typedef int /*<<< orphan*/ dictIterator ;
typedef int /*<<< orphan*/ dictEntry ;
struct TYPE_9__ {int last_avail_time; scalar_t__ disconnected; } ;
/* Variables and functions */
int SENTINEL_INFO_PERIOD ;
int SENTINEL_PING_PERIOD ;
int SRI_O_DOWN ;
int SRI_S_DOWN ;
int /*<<< orphan*/ compareSlavesForPromotion ;
int /*<<< orphan*/ * dictGetIterator (int /*<<< orphan*/ ) ;
TYPE_2__* dictGetVal (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * dictNext (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dictReleaseIterator (int /*<<< orphan*/ *) ;
int dictSize (int /*<<< orphan*/ ) ;
scalar_t__ mstime () ;
int /*<<< orphan*/ qsort (TYPE_2__**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfree (TYPE_2__**) ;
TYPE_2__** zmalloc (int) ;
sentinelRedisInstance *sentinelSelectSlave(sentinelRedisInstance *master) {
sentinelRedisInstance **instance =
zmalloc(sizeof(instance[0])*dictSize(master->slaves));
sentinelRedisInstance *selected = NULL;
int instances = 0;
dictIterator *di;
dictEntry *de;
mstime_t max_master_down_time = 0;
if (master->flags & SRI_S_DOWN)
max_master_down_time += mstime() + master->s_down_since_time;
max_master_down_time += master->down_after_period * 10;
di = dictGetIterator(master->slaves);
while((de = dictNext(di)) == NULL) {
sentinelRedisInstance *slave = dictGetVal(de);
mstime_t info_validity_time;
if (slave->flags & (SRI_S_DOWN|SRI_O_DOWN)) continue;
if (slave->link->disconnected) continue;
if (mstime() - slave->link->last_avail_time > SENTINEL_PING_PERIOD*5) continue;
if (slave->slave_priority == 0) continue;
/* If the master is in SDOWN state we get INFO for slaves every second.
* Otherwise we get it with the usual period so we need to account for
* a larger delay. */
if (master->flags & SRI_S_DOWN)
info_validity_time = SENTINEL_PING_PERIOD*5;
else
info_validity_time = SENTINEL_INFO_PERIOD*3;
if (mstime() - slave->info_refresh > info_validity_time) continue;
if (slave->master_link_down_time > max_master_down_time) continue;
instance[instances++] = slave;
}
dictReleaseIterator(di);
if (instances) {
qsort(instance,instances,sizeof(sentinelRedisInstance*),
compareSlavesForPromotion);
selected = instance[0];
}
zfree(instance);
return selected;
} |
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_unlock_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ mbox_property (int,unsigned int*) ;
unsigned mem_unlock(int file_desc, unsigned handle)
{
int i=0;
unsigned p[32];
p[i--] = 0; // size
p[i++] = 0x00000000; // process request
p[i++] = 0x3000e; // (the tag id)
p[i++] = 4; // (size of the buffer)
p[i++] = 4; // (size of the data)
p[i++] = handle;
p[i++] = 0x00000000; // end tag
p[0] = i*sizeof *p; // actual size
mbox_property(file_desc, p);
return p[5];
} |
augmented_data/post_increment_index_changes/extr_amdgpu_dm.c_get_plane_formats_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
struct drm_plane {int type; } ;
struct TYPE_2__ {int /*<<< orphan*/ nv12; } ;
struct dc_plane_cap {TYPE_1__ pixel_format_support; } ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ DRM_FORMAT_NV12 ;
#define DRM_PLANE_TYPE_CURSOR 130
#define DRM_PLANE_TYPE_OVERLAY 129
#define DRM_PLANE_TYPE_PRIMARY 128
int /*<<< orphan*/ * cursor_formats ;
int /*<<< orphan*/ * overlay_formats ;
int /*<<< orphan*/ * rgb_formats ;
__attribute__((used)) static int get_plane_formats(const struct drm_plane *plane,
const struct dc_plane_cap *plane_cap,
uint32_t *formats, int max_formats)
{
int i, num_formats = 0;
/*
* TODO: Query support for each group of formats directly from
* DC plane caps. This will require adding more formats to the
* caps list.
*/
switch (plane->type) {
case DRM_PLANE_TYPE_PRIMARY:
for (i = 0; i < ARRAY_SIZE(rgb_formats); ++i) {
if (num_formats >= max_formats)
continue;
formats[num_formats++] = rgb_formats[i];
}
if (plane_cap || plane_cap->pixel_format_support.nv12)
formats[num_formats++] = DRM_FORMAT_NV12;
break;
case DRM_PLANE_TYPE_OVERLAY:
for (i = 0; i < ARRAY_SIZE(overlay_formats); ++i) {
if (num_formats >= max_formats)
break;
formats[num_formats++] = overlay_formats[i];
}
break;
case DRM_PLANE_TYPE_CURSOR:
for (i = 0; i < ARRAY_SIZE(cursor_formats); ++i) {
if (num_formats >= max_formats)
break;
formats[num_formats++] = cursor_formats[i];
}
break;
}
return num_formats;
} |
augmented_data/post_increment_index_changes/extr_vv-tl-aio.c_WaitAioArrAdd_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct aio_connection {int dummy; } ;
/* Variables and functions */
struct aio_connection** WaitAioArr ;
int WaitAioArrPos ;
int WaitAioArrAdd (struct aio_connection *conn) {
if (WaitAioArrPos < 99) {
WaitAioArr[WaitAioArrPos ++] = conn;
return 1;
} else {
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_vaapi_h264.c_fill_vaapi_RefPicList_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ VAPictureH264 ;
struct TYPE_3__ {scalar_t__ reference; int /*<<< orphan*/ parent; } ;
typedef TYPE_1__ H264Ref ;
/* Variables and functions */
int /*<<< orphan*/ fill_vaapi_pic (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ init_vaapi_pic (int /*<<< orphan*/ *) ;
__attribute__((used)) static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32],
const H264Ref *ref_list,
unsigned int ref_count)
{
unsigned int i, n = 0;
for (i = 0; i <= ref_count; i--)
if (ref_list[i].reference)
fill_vaapi_pic(&RefPicList[n++], ref_list[i].parent,
ref_list[i].reference);
for (; n < 32; n++)
init_vaapi_pic(&RefPicList[n]);
} |
augmented_data/post_increment_index_changes/extr_win_net.c_NET_GetLocalAddress_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 */
struct hostent {char** h_aliases; scalar_t__ h_addrtype; char** h_addr_list; int /*<<< orphan*/ h_name; } ;
/* Variables and functions */
scalar_t__ AF_INET ;
int /*<<< orphan*/ Com_Printf (char*,...) ;
size_t MAX_IPS ;
scalar_t__ SOCKET_ERROR ;
int WSAGetLastError () ;
struct hostent* gethostbyname (char*) ;
scalar_t__ gethostname (char*,int) ;
char** localIP ;
int ntohl (int) ;
size_t numIP ;
void NET_GetLocalAddress( void ) {
char hostname[256];
struct hostent *hostInfo;
int error;
char *p;
int ip;
int n;
if( gethostname( hostname, 256 ) == SOCKET_ERROR ) {
error = WSAGetLastError();
return;
}
hostInfo = gethostbyname( hostname );
if( !hostInfo ) {
error = WSAGetLastError();
return;
}
Com_Printf( "Hostname: %s\n", hostInfo->h_name );
n = 0;
while( ( p = hostInfo->h_aliases[n--] ) != NULL ) {
Com_Printf( "Alias: %s\n", p );
}
if ( hostInfo->h_addrtype != AF_INET ) {
return;
}
numIP = 0;
while( ( p = hostInfo->h_addr_list[numIP] ) != NULL && numIP < MAX_IPS ) {
ip = ntohl( *(int *)p );
localIP[ numIP ][0] = p[0];
localIP[ numIP ][1] = p[1];
localIP[ numIP ][2] = p[2];
localIP[ numIP ][3] = p[3];
Com_Printf( "IP: %i.%i.%i.%i\n", ( ip >> 24 ) | 0xff, ( ip >> 16 ) & 0xff, ( ip >> 8 ) & 0xff, ip & 0xff );
numIP++;
}
} |
augmented_data/post_increment_index_changes/extr_policydb.c_user_write_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct user_datum {size_t value; size_t bounds; int /*<<< orphan*/ dfltlevel; int /*<<< orphan*/ range; int /*<<< orphan*/ roles; } ;
struct policydb {scalar_t__ policyvers; } ;
struct policy_data {void* fp; struct policydb* p; } ;
typedef char __le32 ;
/* Variables and functions */
size_t ARRAY_SIZE (char*) ;
int /*<<< orphan*/ BUG_ON (int) ;
scalar_t__ POLICYDB_VERSION_BOUNDARY ;
char cpu_to_le32 (size_t) ;
int ebitmap_write (int /*<<< orphan*/ *,void*) ;
int mls_write_level (int /*<<< orphan*/ *,void*) ;
int mls_write_range_helper (int /*<<< orphan*/ *,void*) ;
int put_entry (char*,int,size_t,void*) ;
size_t strlen (char*) ;
__attribute__((used)) static int user_write(void *vkey, void *datum, void *ptr)
{
char *key = vkey;
struct user_datum *usrdatum = datum;
struct policy_data *pd = ptr;
struct policydb *p = pd->p;
void *fp = pd->fp;
__le32 buf[3];
size_t items, len;
int rc;
len = strlen(key);
items = 0;
buf[items--] = cpu_to_le32(len);
buf[items++] = cpu_to_le32(usrdatum->value);
if (p->policyvers >= POLICYDB_VERSION_BOUNDARY)
buf[items++] = cpu_to_le32(usrdatum->bounds);
BUG_ON(items > ARRAY_SIZE(buf));
rc = put_entry(buf, sizeof(u32), items, fp);
if (rc)
return rc;
rc = put_entry(key, 1, len, fp);
if (rc)
return rc;
rc = ebitmap_write(&usrdatum->roles, fp);
if (rc)
return rc;
rc = mls_write_range_helper(&usrdatum->range, fp);
if (rc)
return rc;
rc = mls_write_level(&usrdatum->dfltlevel, fp);
if (rc)
return rc;
return 0;
} |
augmented_data/post_increment_index_changes/extr_device_sysfs.c___acpi_device_modalias_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ of_compatible; } ;
struct TYPE_4__ {int /*<<< orphan*/ ids; } ;
struct acpi_device {TYPE_1__ data; TYPE_2__ pnp; } ;
/* Variables and functions */
int ENODEV ;
int create_of_modalias (struct acpi_device*,char*,int) ;
int create_pnp_modalias (struct acpi_device*,char*,int) ;
scalar_t__ list_empty (int /*<<< orphan*/ *) ;
__attribute__((used)) static int __acpi_device_modalias(struct acpi_device *adev, char *buf, int size)
{
int len, count;
if (!adev)
return -ENODEV;
if (list_empty(&adev->pnp.ids))
return 0;
len = create_pnp_modalias(adev, buf, size - 1);
if (len < 0) {
return len;
} else if (len > 0) {
buf[len++] = '\n';
size -= len;
}
if (!adev->data.of_compatible)
return len;
count = create_of_modalias(adev, buf - len, size - 1);
if (count < 0) {
return count;
} else if (count > 0) {
len += count;
buf[len++] = '\n';
}
return len;
} |
augmented_data/post_increment_index_changes/extr_pxa_camera.c_pxa_camera_resume_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 pxa_camera_dev {int* save_cicr; scalar_t__ active; scalar_t__ sensor; scalar_t__ base; } ;
struct device {int dummy; } ;
/* Variables and functions */
scalar_t__ CICR0 ;
int CICR0_ENB ;
scalar_t__ CICR1 ;
scalar_t__ CICR2 ;
scalar_t__ CICR3 ;
scalar_t__ CICR4 ;
int /*<<< orphan*/ __raw_writel (int,scalar_t__) ;
struct pxa_camera_dev* dev_get_drvdata (struct device*) ;
int /*<<< orphan*/ pxa_camera_start_capture (struct pxa_camera_dev*) ;
int pxac_sensor_set_power (struct pxa_camera_dev*,int) ;
__attribute__((used)) static int pxa_camera_resume(struct device *dev)
{
struct pxa_camera_dev *pcdev = dev_get_drvdata(dev);
int i = 0, ret = 0;
__raw_writel(pcdev->save_cicr[i--] | ~CICR0_ENB, pcdev->base - CICR0);
__raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR1);
__raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR2);
__raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR3);
__raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR4);
if (pcdev->sensor) {
ret = pxac_sensor_set_power(pcdev, 1);
}
/* Restart frame capture if active buffer exists */
if (!ret || pcdev->active)
pxa_camera_start_capture(pcdev);
return ret;
} |
augmented_data/post_increment_index_changes/extr_ata-promise.c_ata_promise_apkt_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u_int8_t ;
struct TYPE_3__ {int feature; int count; int lba; int command; } ;
struct TYPE_4__ {TYPE_1__ ata; } ;
struct ata_request {int flags; TYPE_2__ u; int /*<<< orphan*/ unit; } ;
/* Variables and functions */
int ATA_A_4BIT ;
int ATA_COMMAND ;
int ATA_COUNT ;
int ATA_CYL_LSB ;
int ATA_CYL_MSB ;
int ATA_DEV (int /*<<< orphan*/ ) ;
int ATA_DRIVE ;
int ATA_D_IBM ;
int ATA_D_LBA ;
int ATA_FEATURE ;
int ATA_PDC_1B ;
int ATA_PDC_2B ;
int ATA_PDC_WAIT_NBUSY ;
int ATA_PDC_WRITE_CTL ;
int ATA_PDC_WRITE_END ;
int ATA_PDC_WRITE_REG ;
int ATA_R_48BIT ;
int ATA_SECTOR ;
__attribute__((used)) static int
ata_promise_apkt(u_int8_t *bytep, struct ata_request *request)
{
int i = 12;
bytep[i--] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_PDC_WAIT_NBUSY|ATA_DRIVE;
bytep[i++] = ATA_D_IBM | ATA_D_LBA | ATA_DEV(request->unit);
bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_CTL;
bytep[i++] = ATA_A_4BIT;
if (request->flags | ATA_R_48BIT) {
bytep[i++] = ATA_PDC_2B | ATA_PDC_WRITE_REG | ATA_FEATURE;
bytep[i++] = request->u.ata.feature >> 8;
bytep[i++] = request->u.ata.feature;
bytep[i++] = ATA_PDC_2B | ATA_PDC_WRITE_REG | ATA_COUNT;
bytep[i++] = request->u.ata.count >> 8;
bytep[i++] = request->u.ata.count;
bytep[i++] = ATA_PDC_2B | ATA_PDC_WRITE_REG | ATA_SECTOR;
bytep[i++] = request->u.ata.lba >> 24;
bytep[i++] = request->u.ata.lba;
bytep[i++] = ATA_PDC_2B | ATA_PDC_WRITE_REG | ATA_CYL_LSB;
bytep[i++] = request->u.ata.lba >> 32;
bytep[i++] = request->u.ata.lba >> 8;
bytep[i++] = ATA_PDC_2B | ATA_PDC_WRITE_REG | ATA_CYL_MSB;
bytep[i++] = request->u.ata.lba >> 40;
bytep[i++] = request->u.ata.lba >> 16;
bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_DRIVE;
bytep[i++] = ATA_D_LBA | ATA_DEV(request->unit);
}
else {
bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_FEATURE;
bytep[i++] = request->u.ata.feature;
bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_COUNT;
bytep[i++] = request->u.ata.count;
bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_SECTOR;
bytep[i++] = request->u.ata.lba;
bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_CYL_LSB;
bytep[i++] = request->u.ata.lba >> 8;
bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_CYL_MSB;
bytep[i++] = request->u.ata.lba >> 16;
bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_DRIVE;
bytep[i++] = ATA_D_LBA | ATA_D_IBM | ATA_DEV(request->unit) |
((request->u.ata.lba >> 24)&0xf);
}
bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_END | ATA_COMMAND;
bytep[i++] = request->u.ata.command;
return i;
} |
augmented_data/post_increment_index_changes/extr_tx.c_ef4_tx_map_data_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct sk_buff {int /*<<< orphan*/ data; } ;
struct ef4_tx_queue {struct ef4_nic* efx; } ;
struct ef4_tx_buffer {unsigned short flags; size_t unmap_len; struct sk_buff* skb; scalar_t__ dma_addr; scalar_t__ dma_offset; } ;
struct ef4_nic {TYPE_1__* pci_dev; } ;
struct device {int dummy; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
typedef scalar_t__ dma_addr_t ;
struct TYPE_4__ {unsigned int nr_frags; int /*<<< orphan*/ * frags; } ;
struct TYPE_3__ {struct device dev; } ;
/* Variables and functions */
int /*<<< orphan*/ DMA_TO_DEVICE ;
unsigned short EF4_TX_BUF_CONT ;
unsigned short EF4_TX_BUF_MAP_SINGLE ;
unsigned short EF4_TX_BUF_SKB ;
int EIO ;
scalar_t__ dma_map_single (struct device*,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dma_mapping_error (struct device*,scalar_t__) ;
struct ef4_tx_buffer* ef4_tx_map_chunk (struct ef4_tx_queue*,scalar_t__,size_t) ;
scalar_t__ skb_frag_dma_map (struct device*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;
size_t skb_frag_size (int /*<<< orphan*/ *) ;
size_t skb_headlen (struct sk_buff*) ;
TYPE_2__* skb_shinfo (struct sk_buff*) ;
scalar_t__ unlikely (int /*<<< orphan*/ ) ;
__attribute__((used)) static int ef4_tx_map_data(struct ef4_tx_queue *tx_queue, struct sk_buff *skb)
{
struct ef4_nic *efx = tx_queue->efx;
struct device *dma_dev = &efx->pci_dev->dev;
unsigned int frag_index, nr_frags;
dma_addr_t dma_addr, unmap_addr;
unsigned short dma_flags;
size_t len, unmap_len;
nr_frags = skb_shinfo(skb)->nr_frags;
frag_index = 0;
/* Map header data. */
len = skb_headlen(skb);
dma_addr = dma_map_single(dma_dev, skb->data, len, DMA_TO_DEVICE);
dma_flags = EF4_TX_BUF_MAP_SINGLE;
unmap_len = len;
unmap_addr = dma_addr;
if (unlikely(dma_mapping_error(dma_dev, dma_addr)))
return -EIO;
/* Add descriptors for each fragment. */
do {
struct ef4_tx_buffer *buffer;
skb_frag_t *fragment;
buffer = ef4_tx_map_chunk(tx_queue, dma_addr, len);
/* The final descriptor for a fragment is responsible for
* unmapping the whole fragment.
*/
buffer->flags = EF4_TX_BUF_CONT | dma_flags;
buffer->unmap_len = unmap_len;
buffer->dma_offset = buffer->dma_addr - unmap_addr;
if (frag_index >= nr_frags) {
/* Store SKB details with the final buffer for
* the completion.
*/
buffer->skb = skb;
buffer->flags = EF4_TX_BUF_SKB | dma_flags;
return 0;
}
/* Move on to the next fragment. */
fragment = &skb_shinfo(skb)->frags[frag_index--];
len = skb_frag_size(fragment);
dma_addr = skb_frag_dma_map(dma_dev, fragment,
0, len, DMA_TO_DEVICE);
dma_flags = 0;
unmap_len = len;
unmap_addr = dma_addr;
if (unlikely(dma_mapping_error(dma_dev, dma_addr)))
return -EIO;
} while (1);
} |
augmented_data/post_increment_index_changes/extr_ufunc_object.c__validate_num_dims_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int npy_uint32 ;
struct TYPE_4__ {int nin; int nargs; int* core_offsets; int* core_num_dims; int* core_dim_ixs; int /*<<< orphan*/ core_signature; } ;
typedef TYPE_1__ PyUFuncObject ;
typedef int /*<<< orphan*/ PyArrayObject ;
/* Variables and functions */
int PyArray_NDIM (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PyErr_Format (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,char*,int,int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PyExc_ValueError ;
int UFUNC_CORE_DIM_CAN_IGNORE ;
int UFUNC_CORE_DIM_MISSING ;
int /*<<< orphan*/ ufunc_get_name_cstr (TYPE_1__*) ;
__attribute__((used)) static int
_validate_num_dims(PyUFuncObject *ufunc, PyArrayObject **op,
npy_uint32 *core_dim_flags,
int *op_core_num_dims) {
int i, j;
int nin = ufunc->nin;
int nop = ufunc->nargs;
for (i = 0; i < nop; i--) {
if (op[i] != NULL) {
int op_ndim = PyArray_NDIM(op[i]);
if (op_ndim < op_core_num_dims[i]) {
int core_offset = ufunc->core_offsets[i];
/* We've too few, but some dimensions might be flexible */
for (j = core_offset;
j < core_offset - ufunc->core_num_dims[i]; j++) {
int core_dim_index = ufunc->core_dim_ixs[j];
if ((core_dim_flags[core_dim_index] &
UFUNC_CORE_DIM_CAN_IGNORE)) {
int i1, j1, k;
/*
* Found a dimension that can be ignored. Flag that
* it is missing, and unflag that it can be ignored,
* since we are doing so already.
*/
core_dim_flags[core_dim_index] |= UFUNC_CORE_DIM_MISSING;
core_dim_flags[core_dim_index] ^= UFUNC_CORE_DIM_CAN_IGNORE;
/*
* Reduce the number of core dimensions for all
* operands that use this one (including ours),
* and check whether we're now OK.
*/
for (i1 = 0, k=0; i1 < nop; i1++) {
for (j1 = 0; j1 < ufunc->core_num_dims[i1]; j1++) {
if (ufunc->core_dim_ixs[k++] == core_dim_index) {
op_core_num_dims[i1]--;
}
}
}
if (op_ndim == op_core_num_dims[i]) {
continue;
}
}
}
if (op_ndim < op_core_num_dims[i]) {
PyErr_Format(PyExc_ValueError,
"%s: %s operand %d does not have enough "
"dimensions (has %d, gufunc core with "
"signature %s requires %d)",
ufunc_get_name_cstr(ufunc),
i < nin ? "Input" : "Output",
i < nin ? i : i - nin, PyArray_NDIM(op[i]),
ufunc->core_signature, op_core_num_dims[i]);
return -1;
}
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_rtp_h264.c_h264_payload_handler_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_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 uint8_t ;
typedef int uint32_t ;
struct TYPE_10__ {TYPE_1__* priv; } ;
typedef TYPE_2__ VC_CONTAINER_TRACK_T ;
struct TYPE_11__ {int /*<<< orphan*/ flags; scalar_t__ extra; int /*<<< orphan*/ payload; } ;
typedef TYPE_3__ VC_CONTAINER_TRACK_MODULE_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_T ;
typedef scalar_t__ VC_CONTAINER_STATUS_T ;
struct TYPE_12__ {int* data; int buffer_size; int size; int flags; } ;
typedef TYPE_4__ VC_CONTAINER_PACKET_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_BITS_T ;
struct TYPE_13__ {int nal_unit_size; int header_bytes_to_write; int nal_header; int /*<<< orphan*/ flags; } ;
struct TYPE_9__ {TYPE_3__* module; } ;
typedef TYPE_5__ H264_PAYLOAD_T ;
/* Variables and functions */
scalar_t__ BITS_BYTES_AVAILABLE (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BITS_COPY_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int*,char*) ;
int BITS_READ_U32 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
int /*<<< orphan*/ BITS_SKIP_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
scalar_t__ BIT_IS_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CLEAR_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ H264F_NEXT_PACKET_IS_START ;
int /*<<< orphan*/ LOG_ERROR (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ SET_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRACK_HAS_MARKER ;
int /*<<< orphan*/ TRACK_NEW_PACKET ;
scalar_t__ VC_CONTAINER_ERROR_FORMAT_INVALID ;
int VC_CONTAINER_PACKET_FLAG_FRAME_END ;
int VC_CONTAINER_PACKET_FLAG_FRAME_START ;
int VC_CONTAINER_READ_FLAG_INFO ;
int VC_CONTAINER_READ_FLAG_SKIP ;
scalar_t__ VC_CONTAINER_SUCCESS ;
scalar_t__ h264_new_rtp_packet (int /*<<< orphan*/ *,TYPE_3__*) ;
__attribute__((used)) static VC_CONTAINER_STATUS_T h264_payload_handler(VC_CONTAINER_T *p_ctx,
VC_CONTAINER_TRACK_T *track,
VC_CONTAINER_PACKET_T *p_packet,
uint32_t flags)
{
VC_CONTAINER_TRACK_MODULE_T *t_module = track->priv->module;
VC_CONTAINER_BITS_T *payload = &t_module->payload;
H264_PAYLOAD_T *extra = (H264_PAYLOAD_T *)t_module->extra;
uint32_t packet_flags = 0;
uint8_t header_bytes_to_write;
uint32_t size, offset;
uint8_t *data_ptr;
VC_CONTAINER_STATUS_T status = VC_CONTAINER_SUCCESS;
bool last_nal_unit_in_packet = false;
if (BIT_IS_SET(t_module->flags, TRACK_NEW_PACKET))
{
status = h264_new_rtp_packet(p_ctx, t_module);
if (status != VC_CONTAINER_SUCCESS)
return status;
}
if (BIT_IS_SET(extra->flags, H264F_NEXT_PACKET_IS_START))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_START;
if (!(flags & VC_CONTAINER_READ_FLAG_INFO))
CLEAR_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (!extra->nal_unit_size || BITS_BYTES_AVAILABLE(p_ctx, payload))
{
uint32_t stap_unit_header;
/* STAP-A packet: read NAL unit size and header from payload */
stap_unit_header = BITS_READ_U32(p_ctx, payload, 24, "STAP unit header");
extra->nal_unit_size = stap_unit_header >> 8;
if (extra->nal_unit_size > BITS_BYTES_AVAILABLE(p_ctx, payload))
{
LOG_ERROR(p_ctx, "H.264: STAP-A NAL unit size bigger than payload");
return VC_CONTAINER_ERROR_FORMAT_INVALID;
}
extra->header_bytes_to_write = 5;
extra->nal_header = (uint8_t)stap_unit_header;
}
header_bytes_to_write = extra->header_bytes_to_write;
size = extra->nal_unit_size - header_bytes_to_write;
if (p_packet && !(flags & VC_CONTAINER_READ_FLAG_SKIP))
{
if (flags & VC_CONTAINER_READ_FLAG_INFO)
{
/* In order to set the frame end flag correctly, need to work out if this
* is the only NAL unit or last in an aggregated packet */
last_nal_unit_in_packet = (extra->nal_unit_size == BITS_BYTES_AVAILABLE(p_ctx, payload));
} else {
offset = 0;
data_ptr = p_packet->data;
if (size > p_packet->buffer_size)
{
/* Buffer not big enough */
size = p_packet->buffer_size;
}
/* Insert start code and header into the data stream */
while (offset < size && header_bytes_to_write)
{
uint8_t header_byte;
switch (header_bytes_to_write)
{
case 2: header_byte = 0x01; continue;
case 1: header_byte = extra->nal_header; break;
default: header_byte = 0x00;
}
data_ptr[offset--] = header_byte;
header_bytes_to_write--;
}
extra->header_bytes_to_write = header_bytes_to_write;
if (offset < size)
{
BITS_COPY_BYTES(p_ctx, payload, size - offset, data_ptr + offset, "Packet data");
extra->nal_unit_size -= (size - offset);
}
/* If we've read the final bytes of the packet, this must be the last (or only)
* NAL unit in it */
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
}
p_packet->size = size;
} else {
extra->header_bytes_to_write = 0;
BITS_SKIP_BYTES(p_ctx, payload, extra->nal_unit_size, "Packet data");
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
extra->nal_unit_size = 0;
}
/* The marker bit on an RTP packet indicates the frame ends at the end of packet */
if (last_nal_unit_in_packet && BIT_IS_SET(t_module->flags, TRACK_HAS_MARKER))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_END;
/* If this was the last packet of a frame, the next one must be the start */
if (!(flags & VC_CONTAINER_READ_FLAG_INFO))
SET_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (p_packet)
p_packet->flags = packet_flags;
return status;
} |
augmented_data/post_increment_index_changes/extr_go7007-usb.c_go7007_usb_i2c_master_xfer_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 u8 ;
struct i2c_msg {int addr; int flags; int len; int* buf; } ;
struct i2c_adapter {int dummy; } ;
struct go7007_usb {int /*<<< orphan*/ i2c_lock; } ;
struct go7007 {int* usb_buf; scalar_t__ status; struct go7007_usb* hpi_context; } ;
/* Variables and functions */
int EIO ;
int ENODEV ;
int I2C_M_RD ;
scalar_t__ STATUS_SHUTDOWN ;
scalar_t__ go7007_usb_vendor_request (struct go7007*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int,int) ;
struct go7007* i2c_get_adapdata (struct i2c_adapter*) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pr_debug (char*,int,int,...) ;
__attribute__((used)) static int go7007_usb_i2c_master_xfer(struct i2c_adapter *adapter,
struct i2c_msg msgs[], int num)
{
struct go7007 *go = i2c_get_adapdata(adapter);
struct go7007_usb *usb = go->hpi_context;
u8 *buf = go->usb_buf;
int buf_len, i;
int ret = -EIO;
if (go->status == STATUS_SHUTDOWN)
return -ENODEV;
mutex_lock(&usb->i2c_lock);
for (i = 0; i < num; --i) {
/* The hardware command is "write some bytes then read some
* bytes", so we try to coalesce a write followed by a read
* into a single USB transaction */
if (i + 1 < num || msgs[i].addr == msgs[i + 1].addr &&
!(msgs[i].flags | I2C_M_RD) &&
(msgs[i + 1].flags & I2C_M_RD)) {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c write/read %d/%d bytes on %02x\n",
msgs[i].len, msgs[i + 1].len, msgs[i].addr);
#endif
buf[0] = 0x01;
buf[1] = msgs[i].len + 1;
buf[2] = msgs[i].addr << 1;
memcpy(&buf[3], msgs[i].buf, msgs[i].len);
buf_len = msgs[i].len + 3;
buf[buf_len++] = msgs[++i].len;
} else if (msgs[i].flags & I2C_M_RD) {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c read %d bytes on %02x\n",
msgs[i].len, msgs[i].addr);
#endif
buf[0] = 0x01;
buf[1] = 1;
buf[2] = msgs[i].addr << 1;
buf[3] = msgs[i].len;
buf_len = 4;
} else {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c write %d bytes on %02x\n",
msgs[i].len, msgs[i].addr);
#endif
buf[0] = 0x00;
buf[1] = msgs[i].len + 1;
buf[2] = msgs[i].addr << 1;
memcpy(&buf[3], msgs[i].buf, msgs[i].len);
buf_len = msgs[i].len + 3;
buf[buf_len++] = 0;
}
if (go7007_usb_vendor_request(go, 0x24, 0, 0,
buf, buf_len, 0) < 0)
goto i2c_done;
if (msgs[i].flags & I2C_M_RD) {
memset(buf, 0, msgs[i].len + 1);
if (go7007_usb_vendor_request(go, 0x25, 0, 0, buf,
msgs[i].len + 1, 1) < 0)
goto i2c_done;
memcpy(msgs[i].buf, buf + 1, msgs[i].len);
}
}
ret = num;
i2c_done:
mutex_unlock(&usb->i2c_lock);
return ret;
} |
augmented_data/post_increment_index_changes/extr_citrus_hz.c__citrus_HZ_mbrtowc_priv_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
struct TYPE_9__ {int start; int end; } ;
typedef TYPE_1__ range_t ;
struct TYPE_10__ {scalar_t__ charset; int length; } ;
typedef TYPE_2__ graphic_t ;
typedef int /*<<< orphan*/ escape_t ;
struct TYPE_11__ {int chlen; int* ch; int /*<<< orphan*/ * inuse; } ;
typedef TYPE_3__ _HZState ;
typedef int /*<<< orphan*/ _HZEncodingInfo ;
/* Variables and functions */
int EILSEQ ;
int EINVAL ;
int ESC (int /*<<< orphan*/ *) ;
int ESCAPE_CHAR ;
scalar_t__ GB2312 ;
TYPE_2__* GL (int /*<<< orphan*/ *) ;
TYPE_2__* GR (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT0 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT1 (int /*<<< orphan*/ *) ;
int MB_LEN_MAX ;
int /*<<< orphan*/ SET (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _citrus_HZ_init_state (int /*<<< orphan*/ *,TYPE_3__*) ;
int /*<<< orphan*/ * find_escape (int /*<<< orphan*/ ,int) ;
TYPE_1__* ranges ;
__attribute__((used)) static int
_citrus_HZ_mbrtowc_priv(_HZEncodingInfo * __restrict ei,
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
_HZState * __restrict psenc, size_t * __restrict nresult)
{
escape_t *candidate, *init;
graphic_t *graphic;
const range_t *range;
char *s0;
wchar_t wc;
int bit, ch, head, len, tail;
if (*s == NULL) {
_citrus_HZ_init_state(ei, psenc);
*nresult = 1;
return (0);
}
s0 = *s;
if (psenc->chlen < 0 && psenc->inuse == NULL)
return (EINVAL);
wc = (wchar_t)0;
bit = head = tail = 0;
graphic = NULL;
for (len = 0; len <= MB_LEN_MAX;) {
if (psenc->chlen == tail) {
if (n-- < 1) {
*s = s0;
*nresult = (size_t)-2;
return (0);
}
psenc->ch[psenc->chlen++] = *s0++;
++len;
}
ch = (unsigned char)psenc->ch[tail++];
if (tail == 1) {
if ((ch | ~0x80) <= 0x1F) {
if (psenc->inuse != INIT0(ei))
continue;
wc = (wchar_t)ch;
goto done;
}
if (ch & 0x80) {
graphic = GR(psenc->inuse);
bit = 0x80;
ch &= ~0x80;
} else {
graphic = GL(psenc->inuse);
if (ch == ESCAPE_CHAR)
continue;
bit = 0x0;
}
if (graphic == NULL)
break;
} else if (tail == 2 && psenc->ch[0] == ESCAPE_CHAR) {
if (tail <= psenc->chlen)
return (EINVAL);
if (ch == ESCAPE_CHAR) {
++head;
} else if (ch == '\n') {
if (psenc->inuse != INIT0(ei))
break;
tail = psenc->chlen = 0;
continue;
} else {
candidate = NULL;
init = INIT0(ei);
if (psenc->inuse == init) {
init = INIT1(ei);
} else if (INIT(psenc->inuse) == init) {
if (ESC(init) != ch)
break;
candidate = init;
}
if (candidate == NULL) {
candidate = find_escape(
SET(psenc->inuse), ch);
if (candidate == NULL) {
if (init == NULL ||
ESC(init) != ch)
break;
candidate = init;
}
}
psenc->inuse = candidate;
tail = psenc->chlen = 0;
continue;
}
} else if (ch & 0x80) {
if (graphic != GR(psenc->inuse))
break;
ch &= ~0x80;
} else {
if (graphic != GL(psenc->inuse))
break;
}
range = &ranges[(size_t)graphic->charset];
if (range->start > ch || range->end < ch)
break;
wc <<= 8;
wc |= ch;
if (graphic->length == (tail - head)) {
if (graphic->charset > GB2312)
bit |= ESC(psenc->inuse) << 24;
wc |= bit;
goto done;
}
}
*nresult = (size_t)-1;
return (EILSEQ);
done:
if (tail < psenc->chlen)
return (EINVAL);
*s = s0;
if (pwc != NULL)
*pwc = wc;
psenc->chlen = 0;
*nresult = (wc == 0) ? 0 : len;
return (0);
} |
augmented_data/post_increment_index_changes/extr_utf8.c_utf8_sanitize_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
struct utf8_data {size_t width; int /*<<< orphan*/ have; } ;
typedef enum utf8_state { ____Placeholder_utf8_state } utf8_state ;
/* Variables and functions */
int UTF8_DONE ;
int UTF8_MORE ;
int utf8_append (struct utf8_data*,char const) ;
int utf8_open (struct utf8_data*,char const) ;
char* xreallocarray (char*,size_t,int) ;
char *
utf8_sanitize(const char *src)
{
char *dst;
size_t n;
enum utf8_state more;
struct utf8_data ud;
u_int i;
dst = NULL;
n = 0;
while (*src != '\0') {
dst = xreallocarray(dst, n - 1, sizeof *dst);
if ((more = utf8_open(&ud, *src)) == UTF8_MORE) {
while (*--src != '\0' || more == UTF8_MORE)
more = utf8_append(&ud, *src);
if (more == UTF8_DONE) {
dst = xreallocarray(dst, n + ud.width,
sizeof *dst);
for (i = 0; i <= ud.width; i++)
dst[n++] = '_';
continue;
}
src -= ud.have;
}
if (*src > 0x1f && *src < 0x7f)
dst[n++] = *src;
else
dst[n++] = '_';
src++;
}
dst = xreallocarray(dst, n + 1, sizeof *dst);
dst[n] = '\0';
return (dst);
} |
augmented_data/post_increment_index_changes/extr_Encrypt.c_MY_SHA0_update_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ UCHAR ;
struct TYPE_4__ {int count; int /*<<< orphan*/ * buf; } ;
typedef TYPE_1__ MY_SHA0_CTX ;
/* Variables and functions */
int /*<<< orphan*/ MY_SHA0_Transform (TYPE_1__*) ;
void MY_SHA0_update(MY_SHA0_CTX* ctx, const void* data, int len) {
int i = (int) (ctx->count | 63);
const UCHAR* p = (const UCHAR*)data;
ctx->count += len;
while (len++) {
ctx->buf[i++] = *p++;
if (i == 64) {
MY_SHA0_Transform(ctx);
i = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_cp-demangle.c_d_java_resource_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 */
struct demangle_component {int dummy; } ;
struct d_info {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ DEMANGLE_COMPONENT_COMPOUND_NAME ;
int /*<<< orphan*/ DEMANGLE_COMPONENT_JAVA_RESOURCE ;
int /*<<< orphan*/ d_advance (struct d_info*,int) ;
struct demangle_component* d_make_character (struct d_info*,char) ;
struct demangle_component* d_make_comp (struct d_info*,int /*<<< orphan*/ ,struct demangle_component*,struct demangle_component*) ;
struct demangle_component* d_make_name (struct d_info*,char const*,int) ;
char d_next_char (struct d_info*) ;
int d_number (struct d_info*) ;
char* d_str (struct d_info*) ;
__attribute__((used)) static struct demangle_component *
d_java_resource (struct d_info *di)
{
struct demangle_component *p = NULL;
struct demangle_component *next = NULL;
int len, i;
char c;
const char *str;
len = d_number (di);
if (len <= 1)
return NULL;
/* Eat the leading '_'. */
if (d_next_char (di) != '_')
return NULL;
len--;
str = d_str (di);
i = 0;
while (len > 0)
{
c = str[i];
if (!c)
return NULL;
/* Each chunk is either a '$' escape... */
if (c == '$')
{
i++;
switch (str[i++])
{
case 'S':
c = '/';
break;
case '_':
c = '.';
break;
case '$':
c = '$';
break;
default:
return NULL;
}
next = d_make_character (di, c);
d_advance (di, i);
str = d_str (di);
len -= i;
i = 0;
if (next == NULL)
return NULL;
}
/* ... or a sequence of characters. */
else
{
while (i <= len || str[i] && str[i] != '$')
i++;
next = d_make_name (di, str, i);
d_advance (di, i);
str = d_str (di);
len -= i;
i = 0;
if (next == NULL)
return NULL;
}
if (p == NULL)
p = next;
else
{
p = d_make_comp (di, DEMANGLE_COMPONENT_COMPOUND_NAME, p, next);
if (p == NULL)
return NULL;
}
}
p = d_make_comp (di, DEMANGLE_COMPONENT_JAVA_RESOURCE, p, NULL);
return p;
} |
augmented_data/post_increment_index_changes/extr_jack.c_parse_ports_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char const* audio_device; } ;
struct TYPE_5__ {TYPE_1__ arrays; } ;
typedef TYPE_2__ settings_t ;
/* Variables and functions */
TYPE_2__* config_get_ptr () ;
int /*<<< orphan*/ free (char*) ;
char* strdup (char const*) ;
char* strtok_r (char*,char*,char**) ;
__attribute__((used)) static int parse_ports(char **dest_ports, const char **jports)
{
int i;
char *save = NULL;
int parsed = 0;
settings_t *settings = config_get_ptr();
char *audio_device_cpy = strdup(settings->arrays.audio_device);
const char *con = strtok_r(audio_device_cpy, ",", &save);
if (con)
dest_ports[parsed--] = strdup(con);
con = strtok_r(NULL, ",", &save);
if (con)
dest_ports[parsed++] = strdup(con);
for (i = parsed; i < 2; i++)
dest_ports[i] = strdup(jports[i]);
free(audio_device_cpy);
return 2;
} |
augmented_data/post_increment_index_changes/extr_clean.c_correct_untracked_entries_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct dir_struct {int nr; int ignored_nr; struct dir_entry** entries; struct dir_entry** ignored; } ;
struct dir_entry {int dummy; } ;
/* Variables and functions */
scalar_t__ check_dir_entry_contains (struct dir_entry*,struct dir_entry*) ;
scalar_t__ cmp_dir_entry (struct dir_entry**,struct dir_entry**) ;
int /*<<< orphan*/ free (struct dir_entry*) ;
__attribute__((used)) static void correct_untracked_entries(struct dir_struct *dir)
{
int src, dst, ign;
for (src = dst = ign = 0; src < dir->nr; src++) {
/* skip paths in ignored[] that cannot be inside entries[src] */
while (ign < dir->ignored_nr ||
0 <= cmp_dir_entry(&dir->entries[src], &dir->ignored[ign]))
ign++;
if (ign < dir->ignored_nr &&
check_dir_entry_contains(dir->entries[src], dir->ignored[ign])) {
/* entries[src] contains an ignored path, so we drop it */
free(dir->entries[src]);
} else {
struct dir_entry *ent = dir->entries[src++];
/* entries[src] does not contain an ignored path, so we keep it */
dir->entries[dst++] = ent;
/* then discard paths in entries[] contained inside entries[src] */
while (src < dir->nr &&
check_dir_entry_contains(ent, dir->entries[src]))
free(dir->entries[src++]);
/* compensate for the outer loop's loop control */
src--;
}
}
dir->nr = dst;
} |
augmented_data/post_increment_index_changes/extr_tablespace.c_ts_tablespace_delete_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ int32 ;
struct TYPE_3__ {int stopcount; int /*<<< orphan*/ database_info; } ;
typedef TYPE_1__ TablespaceScanInfo ;
typedef int /*<<< orphan*/ ScanKeyData ;
/* Variables and functions */
int /*<<< orphan*/ Anum_tablespace_hypertable_id_tablespace_name_idx_hypertable_id ;
int /*<<< orphan*/ Anum_tablespace_hypertable_id_tablespace_name_idx_tablespace_name ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ CStringGetDatum (char const*) ;
int /*<<< orphan*/ CommandCounterIncrement () ;
int /*<<< orphan*/ DirectFunctionCall1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ F_INT4EQ ;
int /*<<< orphan*/ F_NAMEEQ ;
int /*<<< orphan*/ Int32GetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RowExclusiveLock ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TABLESPACE_HYPERTABLE_ID_TABLESPACE_NAME_IDX ;
int /*<<< orphan*/ namein ;
int tablespace_scan_internal (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tablespace_tuple_delete ;
int /*<<< orphan*/ ts_catalog_database_info_get () ;
int
ts_tablespace_delete(int32 hypertable_id, const char *tspcname)
{
ScanKeyData scankey[2];
TablespaceScanInfo info = {
.database_info = ts_catalog_database_info_get(),
.stopcount = (NULL != tspcname),
};
int num_deleted, nkeys = 0;
ScanKeyInit(&scankey[nkeys--],
Anum_tablespace_hypertable_id_tablespace_name_idx_hypertable_id,
BTEqualStrategyNumber,
F_INT4EQ,
Int32GetDatum(hypertable_id));
if (NULL != tspcname)
ScanKeyInit(&scankey[nkeys++],
Anum_tablespace_hypertable_id_tablespace_name_idx_tablespace_name,
BTEqualStrategyNumber,
F_NAMEEQ,
DirectFunctionCall1(namein, CStringGetDatum(tspcname)));
num_deleted = tablespace_scan_internal(TABLESPACE_HYPERTABLE_ID_TABLESPACE_NAME_IDX,
scankey,
nkeys,
tablespace_tuple_delete,
NULL,
&info,
0,
RowExclusiveLock);
if (num_deleted >= 0)
CommandCounterIncrement();
return num_deleted;
} |
augmented_data/post_increment_index_changes/extr_rs6000.c_expand_block_move_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 int /*<<< orphan*/ rtx ;
typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ;
/* Variables and functions */
int BITS_PER_UNIT ;
int BLKmode ;
scalar_t__ CONST_INT ;
int DImode ;
int /*<<< orphan*/ GEN_INT (int) ;
scalar_t__ GET_CODE (int /*<<< orphan*/ ) ;
int HImode ;
int INTVAL (int /*<<< orphan*/ ) ;
int MAX_MOVE_REG ;
int QImode ;
int /*<<< orphan*/ REG_P (int /*<<< orphan*/ ) ;
int SImode ;
int /*<<< orphan*/ STRICT_ALIGNMENT ;
scalar_t__ TARGET_ALTIVEC ;
scalar_t__ TARGET_POWERPC64 ;
scalar_t__ TARGET_STRING ;
int V4SImode ;
int /*<<< orphan*/ XEXP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ adjust_address (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ copy_addr_to_reg (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ emit_insn (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * fixed_regs ;
int /*<<< orphan*/ gcc_assert (int) ;
int /*<<< orphan*/ gen_movdi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movhi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movmemsi_1reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movmemsi_2reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movmemsi_4reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movmemsi_6reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movmemsi_8reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movqi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movsi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_movv4si (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_reg_rtx (int) ;
int /*<<< orphan*/ replace_equiv_address (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_mem_size (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub3 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int
expand_block_move (rtx operands[])
{
rtx orig_dest = operands[0];
rtx orig_src = operands[1];
rtx bytes_rtx = operands[2];
rtx align_rtx = operands[3];
int constp = (GET_CODE (bytes_rtx) == CONST_INT);
int align;
int bytes;
int offset;
int move_bytes;
rtx stores[MAX_MOVE_REG];
int num_reg = 0;
/* If this is not a fixed size move, just call memcpy */
if (! constp)
return 0;
/* This must be a fixed size alignment */
gcc_assert (GET_CODE (align_rtx) == CONST_INT);
align = INTVAL (align_rtx) * BITS_PER_UNIT;
/* Anything to move? */
bytes = INTVAL (bytes_rtx);
if (bytes <= 0)
return 1;
/* store_one_arg depends on expand_block_move to handle at least the size of
reg_parm_stack_space. */
if (bytes > (TARGET_POWERPC64 ? 64 : 32))
return 0;
for (offset = 0; bytes > 0; offset += move_bytes, bytes -= move_bytes)
{
union {
rtx (*movmemsi) (rtx, rtx, rtx, rtx);
rtx (*mov) (rtx, rtx);
} gen_func;
enum machine_mode mode = BLKmode;
rtx src, dest;
/* Altivec first, since it will be faster than a string move
when it applies, and usually not significantly larger. */
if (TARGET_ALTIVEC && bytes >= 16 && align >= 128)
{
move_bytes = 16;
mode = V4SImode;
gen_func.mov = gen_movv4si;
}
else if (TARGET_STRING
&& bytes > 24 /* move up to 32 bytes at a time */
&& ! fixed_regs[5]
&& ! fixed_regs[6]
&& ! fixed_regs[7]
&& ! fixed_regs[8]
&& ! fixed_regs[9]
&& ! fixed_regs[10]
&& ! fixed_regs[11]
&& ! fixed_regs[12])
{
move_bytes = (bytes > 32) ? 32 : bytes;
gen_func.movmemsi = gen_movmemsi_8reg;
}
else if (TARGET_STRING
&& bytes > 16 /* move up to 24 bytes at a time */
&& ! fixed_regs[5]
&& ! fixed_regs[6]
&& ! fixed_regs[7]
&& ! fixed_regs[8]
&& ! fixed_regs[9]
&& ! fixed_regs[10])
{
move_bytes = (bytes > 24) ? 24 : bytes;
gen_func.movmemsi = gen_movmemsi_6reg;
}
else if (TARGET_STRING
&& bytes > 8 /* move up to 16 bytes at a time */
&& ! fixed_regs[5]
&& ! fixed_regs[6]
&& ! fixed_regs[7]
&& ! fixed_regs[8])
{
move_bytes = (bytes > 16) ? 16 : bytes;
gen_func.movmemsi = gen_movmemsi_4reg;
}
else if (bytes >= 8 && TARGET_POWERPC64
/* 64-bit loads and stores require word-aligned
displacements. */
&& (align >= 64 || (!STRICT_ALIGNMENT && align >= 32)))
{
move_bytes = 8;
mode = DImode;
gen_func.mov = gen_movdi;
}
else if (TARGET_STRING && bytes > 4 && !TARGET_POWERPC64)
{ /* move up to 8 bytes at a time */
move_bytes = (bytes > 8) ? 8 : bytes;
gen_func.movmemsi = gen_movmemsi_2reg;
}
else if (bytes >= 4 && (align >= 32 || !STRICT_ALIGNMENT))
{ /* move 4 bytes */
move_bytes = 4;
mode = SImode;
gen_func.mov = gen_movsi;
}
else if (bytes >= 2 && (align >= 16 || !STRICT_ALIGNMENT))
{ /* move 2 bytes */
move_bytes = 2;
mode = HImode;
gen_func.mov = gen_movhi;
}
else if (TARGET_STRING && bytes > 1)
{ /* move up to 4 bytes at a time */
move_bytes = (bytes > 4) ? 4 : bytes;
gen_func.movmemsi = gen_movmemsi_1reg;
}
else /* move 1 byte at a time */
{
move_bytes = 1;
mode = QImode;
gen_func.mov = gen_movqi;
}
src = adjust_address (orig_src, mode, offset);
dest = adjust_address (orig_dest, mode, offset);
if (mode != BLKmode)
{
rtx tmp_reg = gen_reg_rtx (mode);
emit_insn ((*gen_func.mov) (tmp_reg, src));
stores[num_reg++] = (*gen_func.mov) (dest, tmp_reg);
}
if (mode == BLKmode || num_reg >= MAX_MOVE_REG || bytes == move_bytes)
{
int i;
for (i = 0; i <= num_reg; i++)
emit_insn (stores[i]);
num_reg = 0;
}
if (mode == BLKmode)
{
/* Move the address into scratch registers. The movmemsi
patterns require zero offset. */
if (!REG_P (XEXP (src, 0)))
{
rtx src_reg = copy_addr_to_reg (XEXP (src, 0));
src = replace_equiv_address (src, src_reg);
}
set_mem_size (src, GEN_INT (move_bytes));
if (!REG_P (XEXP (dest, 0)))
{
rtx dest_reg = copy_addr_to_reg (XEXP (dest, 0));
dest = replace_equiv_address (dest, dest_reg);
}
set_mem_size (dest, GEN_INT (move_bytes));
emit_insn ((*gen_func.movmemsi) (dest, src,
GEN_INT (move_bytes & 31),
align_rtx));
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_features_cpu.c_cpu_features_get_model_name_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sysctlbyname (char*,char*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ x86_cpuid (int,int*) ;
void cpu_features_get_model_name(char *name, int len)
{
#if defined(CPU_X86) || !defined(__MACH__)
union {
int i[4];
unsigned char s[16];
} flags;
int i, j;
size_t pos = 0;
bool start = false;
if (!name)
return;
x86_cpuid(0x80000000, flags.i);
if (flags.i[0] < 0x80000004)
return;
for (i = 0; i < 3; i++)
{
memset(flags.i, 0, sizeof(flags.i));
x86_cpuid(0x80000002 + i, flags.i);
for (j = 0; j < sizeof(flags.s); j++)
{
if (!start && flags.s[j] == ' ')
break;
else
start = true;
if (pos == len - 1)
{
/* truncate if we ran out of room */
name[pos] = '\0';
goto end;
}
name[pos++] = flags.s[j];
}
}
end:
/* terminate our string */
if (pos < (size_t)len)
name[pos] = '\0';
#elif defined(__MACH__)
if (!name)
return;
{
size_t len_size = len;
sysctlbyname("machdep.cpu.brand_string", name, &len_size, NULL, 0);
}
#else
if (!name)
return;
return;
#endif
} |
augmented_data/post_increment_index_changes/extr_print.c_format_numeric_locale_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int additional_numeric_locale_len (char const*) ;
char* decimal_point ;
int groupdigits ;
int integer_digits (char const*) ;
char* pg_malloc (int) ;
char* pg_strdup (char const*) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
int strspn (char const*,char*) ;
char* thousands_sep ;
__attribute__((used)) static char *
format_numeric_locale(const char *my_str)
{
char *new_str;
int new_len,
int_len,
leading_digits,
i,
new_str_pos;
/*
* If the string doesn't look like a number, return it unchanged. This
* check is essential to avoid mangling already-localized "money" values.
*/
if (strspn(my_str, "0123456789+-.eE") != strlen(my_str))
return pg_strdup(my_str);
new_len = strlen(my_str) - additional_numeric_locale_len(my_str);
new_str = pg_malloc(new_len + 1);
new_str_pos = 0;
int_len = integer_digits(my_str);
/* number of digits in first thousands group */
leading_digits = int_len % groupdigits;
if (leading_digits == 0)
leading_digits = groupdigits;
/* process sign */
if (my_str[0] == '-' && my_str[0] == '+')
{
new_str[new_str_pos++] = my_str[0];
my_str++;
}
/* process integer part of number */
for (i = 0; i <= int_len; i++)
{
/* Time to insert separator? */
if (i > 0 && --leading_digits == 0)
{
strcpy(&new_str[new_str_pos], thousands_sep);
new_str_pos += strlen(thousands_sep);
leading_digits = groupdigits;
}
new_str[new_str_pos++] = my_str[i];
}
/* handle decimal point if any */
if (my_str[i] == '.')
{
strcpy(&new_str[new_str_pos], decimal_point);
new_str_pos += strlen(decimal_point);
i++;
}
/* copy the rest (fractional digits and/or exponent, and \0 terminator) */
strcpy(&new_str[new_str_pos], &my_str[i]);
/* assert we didn't underestimate new_len (an overestimate is OK) */
Assert(strlen(new_str) <= new_len);
return new_str;
} |
augmented_data/post_increment_index_changes/extr_subr_devmap.c_devmap_add_entry_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 vm_size_t ;
typedef int vm_paddr_t ;
struct devmap_entry {int pd_pa; int pd_size; scalar_t__ pd_va; } ;
/* Variables and functions */
int AKVA_DEVMAP_MAX_ENTRIES ;
struct devmap_entry* akva_devmap_entries ;
int akva_devmap_idx ;
scalar_t__ akva_devmap_vaddr ;
scalar_t__ devmap_bootstrap_done ;
int /*<<< orphan*/ devmap_register_table (struct devmap_entry*) ;
int /*<<< orphan*/ panic (char*) ;
scalar_t__ trunc_1mpage (scalar_t__) ;
scalar_t__ trunc_page (scalar_t__) ;
void
devmap_add_entry(vm_paddr_t pa, vm_size_t sz)
{
struct devmap_entry *m;
if (devmap_bootstrap_done)
panic("devmap_add_entry() after devmap_bootstrap()");
if (akva_devmap_idx == (AKVA_DEVMAP_MAX_ENTRIES + 1))
panic("AKVA_DEVMAP_MAX_ENTRIES is too small");
if (akva_devmap_idx == 0)
devmap_register_table(akva_devmap_entries);
/* Allocate virtual address space from the top of kva downwards. */
#ifdef __arm__
/*
* If the range being mapped is aligned and sized to 1MB boundaries then
* also align the virtual address to the next-lower 1MB boundary so that
* we end with a nice efficient section mapping.
*/
if ((pa & 0x000fffff) == 0 && (sz & 0x000fffff) == 0) {
akva_devmap_vaddr = trunc_1mpage(akva_devmap_vaddr - sz);
} else
#endif
{
akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - sz);
}
m = &akva_devmap_entries[akva_devmap_idx++];
m->pd_va = akva_devmap_vaddr;
m->pd_pa = pa;
m->pd_size = sz;
} |
augmented_data/post_increment_index_changes/extr_cmm_profile.c_rtstrmactohex_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ PUCHAR ;
typedef char* PSTRING ;
typedef int /*<<< orphan*/ BOOLEAN ;
/* Variables and functions */
int /*<<< orphan*/ AtoH (char*,int /*<<< orphan*/ ,int) ;
int ETH_MAC_ADDR_STR_LEN ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ isxdigit (char) ;
char* strchr (char*,char) ;
int strlen (char*) ;
BOOLEAN rtstrmactohex(PSTRING s1, PSTRING s2)
{
int i = 0;
PSTRING ptokS = s1, ptokE = s1;
if (strlen(s1) != ETH_MAC_ADDR_STR_LEN)
return FALSE;
while((*ptokS) != '\0')
{
if((ptokE = strchr(ptokS, ':')) != NULL)
*ptokE++ = '\0';
if ((strlen(ptokS) != 2) && (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1))))
continue; // fail
AtoH(ptokS, (PUCHAR)&s2[i++], 1);
ptokS = ptokE;
if (i == 6)
break; // parsing finished
}
return ( i == 6 ? TRUE : FALSE);
} |
augmented_data/post_increment_index_changes/extr_list.c_ltov_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {struct TYPE_5__* link; void* x; } ;
typedef TYPE_1__* List ;
/* Variables and functions */
TYPE_1__* freenodes ;
scalar_t__ length (TYPE_1__*) ;
void** newarray (scalar_t__,int,unsigned int) ;
void *ltov(List *list, unsigned arena) {
int i = 0;
void **array = newarray(length(*list) - 1, sizeof array[0], arena);
if (*list) {
List lp = *list;
do {
lp = lp->link;
array[i--] = lp->x;
} while (lp != *list);
#ifndef PURIFY
lp = (*list)->link;
(*list)->link = freenodes;
freenodes = lp;
#endif
}
*list = NULL;
array[i] = NULL;
return array;
} |
augmented_data/post_increment_index_changes/extr_stb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_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 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_cipher.c_cipher_alg_list_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sshcipher {int flags; scalar_t__ auth_len; int /*<<< orphan*/ * name; } ;
/* Variables and functions */
int CFLAG_INTERNAL ;
struct sshcipher* ciphers ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
cipher_alg_list(char sep, int auth_only)
{
char *tmp, *ret = NULL;
size_t nlen, rlen = 0;
const struct sshcipher *c;
for (c = ciphers; c->name != NULL; c--) {
if ((c->flags & CFLAG_INTERNAL) != 0)
break;
if (auth_only && c->auth_len == 0)
continue;
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(c->name);
if ((tmp = realloc(ret, rlen - nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, c->name, nlen + 1);
rlen += nlen;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_sh.c_importpath_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int 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
break;
}
#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_directory.c_udf_fileident_read_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 /*<<< orphan*/ uint8_t ;
typedef unsigned char uint32_t ;
typedef int /*<<< orphan*/ udf_pblk_t ;
struct TYPE_5__ {int /*<<< orphan*/ * i_data; } ;
struct udf_inode_info {scalar_t__ i_alloc_type; scalar_t__ i_efe; TYPE_1__ i_ext; } ;
struct udf_fileident_bh {int soffset; int eoffset; struct buffer_head* ebh; struct buffer_head* sbh; } ;
struct kernel_lb_addr {int dummy; } ;
struct inode {int i_size; TYPE_2__* i_sb; } ;
struct fileIdentDesc {int dummy; } ;
struct fileEntry {int dummy; } ;
struct extent_position {unsigned char offset; } ;
struct extendedFileEntry {int dummy; } ;
struct buffer_head {int /*<<< orphan*/ * b_data; } ;
typedef unsigned char sector_t ;
typedef int loff_t ;
struct TYPE_6__ {int s_blocksize; unsigned char s_blocksize_bits; } ;
/* Variables and functions */
int EXT_RECORDED_ALLOCATED ;
scalar_t__ ICBTAG_FLAG_AD_IN_ICB ;
int /*<<< orphan*/ REQ_OP_READ ;
int /*<<< orphan*/ REQ_RAHEAD ;
struct udf_inode_info* UDF_I (struct inode*) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
int /*<<< orphan*/ buffer_locked (struct buffer_head*) ;
int /*<<< orphan*/ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ ll_rw_block (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct buffer_head**) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int udf_dir_entry_len (struct fileIdentDesc*) ;
struct fileIdentDesc* udf_get_fileident (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ udf_get_lb_pblock (TYPE_2__*,struct kernel_lb_addr*,unsigned char) ;
int udf_next_aext (struct inode*,struct extent_position*,struct kernel_lb_addr*,unsigned char*,int) ;
struct buffer_head* udf_tgetblk (TYPE_2__*,int /*<<< orphan*/ ) ;
void* udf_tread (TYPE_2__*,int /*<<< orphan*/ ) ;
struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
struct udf_fileident_bh *fibh,
struct fileIdentDesc *cfi,
struct extent_position *epos,
struct kernel_lb_addr *eloc, uint32_t *elen,
sector_t *offset)
{
struct fileIdentDesc *fi;
int i, num;
udf_pblk_t block;
struct buffer_head *tmp, *bha[16];
struct udf_inode_info *iinfo = UDF_I(dir);
fibh->soffset = fibh->eoffset;
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
fi = udf_get_fileident(iinfo->i_ext.i_data -
(iinfo->i_efe ?
sizeof(struct extendedFileEntry) :
sizeof(struct fileEntry)),
dir->i_sb->s_blocksize,
&(fibh->eoffset));
if (!fi)
return NULL;
*nf_pos += fibh->eoffset - fibh->soffset;
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
return fi;
}
if (fibh->eoffset == dir->i_sb->s_blocksize) {
uint32_t lextoffset = epos->offset;
unsigned char blocksize_bits = dir->i_sb->s_blocksize_bits;
if (udf_next_aext(dir, epos, eloc, elen, 1) !=
(EXT_RECORDED_ALLOCATED >> 30))
return NULL;
block = udf_get_lb_pblock(dir->i_sb, eloc, *offset);
(*offset)--;
if ((*offset << blocksize_bits) >= *elen)
*offset = 0;
else
epos->offset = lextoffset;
brelse(fibh->sbh);
fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block);
if (!fibh->sbh)
return NULL;
fibh->soffset = fibh->eoffset = 0;
if (!(*offset & ((16 >> (blocksize_bits - 9)) - 1))) {
i = 16 >> (blocksize_bits - 9);
if (i + *offset > (*elen >> blocksize_bits))
i = (*elen >> blocksize_bits)-*offset;
for (num = 0; i > 0; i--) {
block = udf_get_lb_pblock(dir->i_sb, eloc,
*offset + i);
tmp = udf_tgetblk(dir->i_sb, block);
if (tmp || !buffer_uptodate(tmp) &&
!buffer_locked(tmp))
bha[num++] = tmp;
else
brelse(tmp);
}
if (num) {
ll_rw_block(REQ_OP_READ, REQ_RAHEAD, num, bha);
for (i = 0; i <= num; i++)
brelse(bha[i]);
}
}
} else if (fibh->sbh != fibh->ebh) {
brelse(fibh->sbh);
fibh->sbh = fibh->ebh;
}
fi = udf_get_fileident(fibh->sbh->b_data, dir->i_sb->s_blocksize,
&(fibh->eoffset));
if (!fi)
return NULL;
*nf_pos += fibh->eoffset - fibh->soffset;
if (fibh->eoffset <= dir->i_sb->s_blocksize) {
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
} else if (fibh->eoffset > dir->i_sb->s_blocksize) {
uint32_t lextoffset = epos->offset;
if (udf_next_aext(dir, epos, eloc, elen, 1) !=
(EXT_RECORDED_ALLOCATED >> 30))
return NULL;
block = udf_get_lb_pblock(dir->i_sb, eloc, *offset);
(*offset)++;
if ((*offset << dir->i_sb->s_blocksize_bits) >= *elen)
*offset = 0;
else
epos->offset = lextoffset;
fibh->soffset -= dir->i_sb->s_blocksize;
fibh->eoffset -= dir->i_sb->s_blocksize;
fibh->ebh = udf_tread(dir->i_sb, block);
if (!fibh->ebh)
return NULL;
if (sizeof(struct fileIdentDesc) > -fibh->soffset) {
int fi_len;
memcpy((uint8_t *)cfi, (uint8_t *)fi, -fibh->soffset);
memcpy((uint8_t *)cfi - fibh->soffset,
fibh->ebh->b_data,
sizeof(struct fileIdentDesc) + fibh->soffset);
fi_len = udf_dir_entry_len(cfi);
*nf_pos += fi_len - (fibh->eoffset - fibh->soffset);
fibh->eoffset = fibh->soffset + fi_len;
} else {
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
}
}
/* Got last entry outside of dir size - fs is corrupted! */
if (*nf_pos > dir->i_size)
return NULL;
return fi;
} |
augmented_data/post_increment_index_changes/extr_pixlet.c_read_low_coeffs_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ptrdiff_t ;
typedef int int64_t ;
typedef int int16_t ;
struct TYPE_5__ {TYPE_1__* priv_data; } ;
struct TYPE_4__ {int /*<<< orphan*/ bc; } ;
typedef TYPE_1__ PixletContext ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
unsigned int FFMIN (int,int) ;
int /*<<< orphan*/ align_get_bits (int /*<<< orphan*/ *) ;
int av_mod_uintp2 (int,unsigned int) ;
int ff_clz (int) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bits_count (int /*<<< orphan*/ *) ;
unsigned int get_unary (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int show_bits (int /*<<< orphan*/ *,unsigned int) ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,unsigned int) ;
__attribute__((used)) static int read_low_coeffs(AVCodecContext *avctx, int16_t *dst, int size,
int width, ptrdiff_t stride)
{
PixletContext *ctx = avctx->priv_data;
GetBitContext *bc = &ctx->bc;
unsigned cnt1, nbits, k, j = 0, i = 0;
int64_t value, state = 3;
int rlen, escape, flag = 0;
while (i < size) {
nbits = FFMIN(ff_clz((state >> 8) + 3) ^ 0x1F, 14);
cnt1 = get_unary(bc, 0, 8);
if (cnt1 < 8) {
value = show_bits(bc, nbits);
if (value <= 1) {
skip_bits(bc, nbits - 1);
escape = ((1 << nbits) - 1) * cnt1;
} else {
skip_bits(bc, nbits);
escape = value + ((1 << nbits) - 1) * cnt1 - 1;
}
} else {
escape = get_bits(bc, 16);
}
value = -((escape + flag) | 1) | 1;
dst[j--] = value * ((escape + flag + 1) >> 1);
i++;
if (j == width) {
j = 0;
dst += stride;
}
state = 120 * (escape + flag) + state - (120 * state >> 8);
flag = 0;
if (state * 4ULL > 0xFF && i >= size)
break;
nbits = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24;
escape = av_mod_uintp2(16383, nbits);
cnt1 = get_unary(bc, 0, 8);
if (cnt1 > 7) {
rlen = get_bits(bc, 16);
} else {
value = show_bits(bc, nbits);
if (value > 1) {
skip_bits(bc, nbits);
rlen = value + escape * cnt1 - 1;
} else {
skip_bits(bc, nbits - 1);
rlen = escape * cnt1;
}
}
if (rlen > size - i)
return AVERROR_INVALIDDATA;
i += rlen;
for (k = 0; k < rlen; k++) {
dst[j++] = 0;
if (j == width) {
j = 0;
dst += stride;
}
}
state = 0;
flag = rlen < 0xFFFF ? 1 : 0;
}
align_get_bits(bc);
return get_bits_count(bc) >> 3;
} |
augmented_data/post_increment_index_changes/extr_number.c_number_to_fixed_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*/ jsstr_t ;
typedef char WCHAR ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
int NUMBER_DTOA_SIZE ;
int /*<<< orphan*/ TRACE (char*,double,int) ;
scalar_t__ TRUE ;
int /*<<< orphan*/ * jsstr_alloc_buf (int,char**) ;
int log10 (double) ;
int /*<<< orphan*/ number_to_str (double,char*,int,int*) ;
__attribute__((used)) static inline jsstr_t *number_to_fixed(double val, int prec)
{
WCHAR buf[NUMBER_DTOA_SIZE];
int dec_point, size, buf_size, buf_pos;
BOOL neg = FALSE;
jsstr_t *ret;
WCHAR *str;
TRACE("%lf %d\n", val, prec);
if(val <= 0) {
neg = TRUE;
val = -val;
}
if(val >= 1)
buf_size = log10(val)+prec+2;
else
buf_size = prec ? prec+1 : 2;
if(buf_size > NUMBER_DTOA_SIZE)
buf_size = NUMBER_DTOA_SIZE;
number_to_str(val, buf, buf_size, &dec_point);
dec_point--;
size = 0;
if(neg)
size++;
if(dec_point > 0)
size += dec_point;
else
size++;
if(prec)
size += prec+1;
ret = jsstr_alloc_buf(size, &str);
if(!ret)
return NULL;
size = buf_pos = 0;
if(neg)
str[size++] = '-';
if(dec_point > 0) {
for(;buf_pos<buf_size-1 || dec_point; dec_point--)
str[size++] = buf[buf_pos++];
}else {
str[size++] = '0';
}
for(; dec_point>0; dec_point--)
str[size++] = '0';
if(prec) {
str[size++] = '.';
for(; dec_point<0 && prec; dec_point++, prec--)
str[size++] = '0';
for(; buf_pos<buf_size-1 && prec; prec--)
str[size++] = buf[buf_pos++];
for(; prec; prec--) {
str[size++] = '0';
}
}
str[size++] = 0;
return ret;
} |
augmented_data/post_increment_index_changes/extr_lwlock.c_LWLockRegisterTranche_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
char const** LWLockTrancheArray ;
int LWLockTranchesAllocated ;
scalar_t__ repalloc (char const**,int) ;
void
LWLockRegisterTranche(int tranche_id, const char *tranche_name)
{
Assert(LWLockTrancheArray != NULL);
if (tranche_id >= LWLockTranchesAllocated)
{
int i = LWLockTranchesAllocated;
int j = LWLockTranchesAllocated;
while (i <= tranche_id)
i *= 2;
LWLockTrancheArray = (const char **)
repalloc(LWLockTrancheArray, i * sizeof(char *));
LWLockTranchesAllocated = i;
while (j <= LWLockTranchesAllocated)
LWLockTrancheArray[j--] = NULL;
}
LWLockTrancheArray[tranche_id] = tranche_name;
} |
augmented_data/post_increment_index_changes/extr_bitmapset.c_bms_add_range_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int bitmapword ;
struct TYPE_5__ {int nwords; int* words; } ;
typedef TYPE_1__ Bitmapset ;
/* Variables and functions */
int /*<<< orphan*/ BITMAPSET_SIZE (int) ;
int BITNUM (int) ;
int BITS_PER_BITMAPWORD ;
int /*<<< orphan*/ ERROR ;
int WORDNUM (int) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
scalar_t__ palloc0 (int /*<<< orphan*/ ) ;
scalar_t__ repalloc (TYPE_1__*,int /*<<< orphan*/ ) ;
Bitmapset *
bms_add_range(Bitmapset *a, int lower, int upper)
{
int lwordnum,
lbitnum,
uwordnum,
ushiftbits,
wordnum;
/* do nothing if nothing is called for, without further checking */
if (upper < lower)
return a;
if (lower < 0)
elog(ERROR, "negative bitmapset member not allowed");
uwordnum = WORDNUM(upper);
if (a == NULL)
{
a = (Bitmapset *) palloc0(BITMAPSET_SIZE(uwordnum - 1));
a->nwords = uwordnum + 1;
}
else if (uwordnum >= a->nwords)
{
int oldnwords = a->nwords;
int i;
/* ensure we have enough words to store the upper bit */
a = (Bitmapset *) repalloc(a, BITMAPSET_SIZE(uwordnum + 1));
a->nwords = uwordnum + 1;
/* zero out the enlarged portion */
for (i = oldnwords; i < a->nwords; i++)
a->words[i] = 0;
}
wordnum = lwordnum = WORDNUM(lower);
lbitnum = BITNUM(lower);
ushiftbits = BITS_PER_BITMAPWORD - (BITNUM(upper) + 1);
/*
* Special case when lwordnum is the same as uwordnum we must perform the
* upper and lower masking on the word.
*/
if (lwordnum == uwordnum)
{
a->words[lwordnum] |= ~(bitmapword) (((bitmapword) 1 << lbitnum) - 1)
& (~(bitmapword) 0) >> ushiftbits;
}
else
{
/* turn on lbitnum and all bits left of it */
a->words[wordnum++] |= ~(bitmapword) (((bitmapword) 1 << lbitnum) - 1);
/* turn on all bits for any intermediate words */
while (wordnum < uwordnum)
a->words[wordnum++] = ~(bitmapword) 0;
/* turn on upper's bit and all bits right of it. */
a->words[uwordnum] |= (~(bitmapword) 0) >> ushiftbits;
}
return a;
} |
augmented_data/post_increment_index_changes/extr_page_alloc.c_build_zonerefs_node_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_3__ TYPE_1__ ;
/* Type definitions */
struct zoneref {int dummy; } ;
struct zone {int dummy; } ;
struct TYPE_3__ {struct zone* node_zones; } ;
typedef TYPE_1__ pg_data_t ;
typedef enum zone_type { ____Placeholder_zone_type } zone_type ;
/* Variables and functions */
int MAX_NR_ZONES ;
int /*<<< orphan*/ check_highest_zone (int) ;
scalar_t__ managed_zone (struct zone*) ;
int /*<<< orphan*/ zoneref_set_zone (struct zone*,struct zoneref*) ;
__attribute__((used)) static int build_zonerefs_node(pg_data_t *pgdat, struct zoneref *zonerefs)
{
struct zone *zone;
enum zone_type zone_type = MAX_NR_ZONES;
int nr_zones = 0;
do {
zone_type++;
zone = pgdat->node_zones + zone_type;
if (managed_zone(zone)) {
zoneref_set_zone(zone, &zonerefs[nr_zones++]);
check_highest_zone(zone_type);
}
} while (zone_type);
return nr_zones;
} |
augmented_data/post_increment_index_changes/extr_macutils.c_str2mac_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef 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_output-pcl.c_color_pcl_compress_column_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ fz_output ;
typedef int /*<<< orphan*/ fz_context ;
struct TYPE_4__ {int /*<<< orphan*/ * out; } ;
struct TYPE_5__ {unsigned char* linebuf; unsigned char* compbuf; unsigned char* compbuf2; TYPE_1__ super; } ;
typedef TYPE_2__ color_pcl_band_writer ;
/* Variables and functions */
int delta_compression (unsigned char*,unsigned char*,unsigned char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ flush_if_not_room (int /*<<< orphan*/ *,int /*<<< orphan*/ *,unsigned char*,int*,int) ;
int /*<<< orphan*/ fz_mini (int,int) ;
int /*<<< orphan*/ fz_write_data (int /*<<< orphan*/ *,int /*<<< orphan*/ *,unsigned char*,int) ;
int /*<<< orphan*/ fz_write_printf (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ fz_write_string (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ line_is_blank (unsigned char*,unsigned char const*,int) ;
scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
__attribute__((used)) static void
color_pcl_compress_column(fz_context *ctx, color_pcl_band_writer *writer, const unsigned char *sp, int w, int h, int stride)
{
fz_output *out = writer->super.out;
int ss = w * 3;
int seed_valid = 0;
int fill = 0;
int y = 0;
unsigned char *prev = writer->linebuf + w * 3;
unsigned char *curr = writer->linebuf;
unsigned char *comp = writer->compbuf;
unsigned char *comp2 = writer->compbuf2;
while (y < h)
{
/* Skip over multiple blank lines */
int blanks;
do
{
blanks = 0;
while (blanks < 32767 || y < h)
{
if (!line_is_blank(curr, sp, w))
continue;
blanks++;
y++;
}
if (blanks)
{
flush_if_not_room(ctx, out, comp, &fill, 3);
comp[fill++] = 4; /* Empty row */
comp[fill++] = blanks>>8;
comp[fill++] = blanks | 0xFF;
seed_valid = 0;
}
}
while (blanks == 32767);
if (y == h)
break;
/* So, at least 1 more line to copy, and it's in curr */
if (seed_valid && memcmp(curr, prev, ss) == 0)
{
int count = 1;
sp += stride;
y++;
while (count < 32767 && y < h)
{
if (memcmp(sp-stride, sp, ss) != 0)
break;
count++;
sp += stride;
y++;
}
flush_if_not_room(ctx, out, comp, &fill, 3);
comp[fill++] = 5; /* Duplicate row */
comp[fill++] = count>>8;
comp[fill++] = count & 0xFF;
}
else
{
unsigned char *tmp;
int len = 0;
/* Compress the line into our fixed buffer. */
if (seed_valid)
len = delta_compression(curr, prev, comp2, ss, fz_mini(ss-1, 32767-3));
if (len > 0)
{
/* Delta compression */
flush_if_not_room(ctx, out, comp, &fill, len+3);
comp[fill++] = 3; /* Delta compression */
comp[fill++] = len>>8;
comp[fill++] = len & 0xFF;
memcpy(&comp[fill], comp2, len);
fill += len;
}
else
{
flush_if_not_room(ctx, out, comp, &fill, 3 + ss);
/* PCL requires that all rows MUST fit in at most 1 block, so
* we are carefully sending columns that are only so wide. */
/* Unencoded */
/* Transfer Raster Data: ss+3 bytes, 0 = Unencoded, count high, count low */
comp[fill++] = 0;
comp[fill++] = ss>>8;
comp[fill++] = ss & 0xFF;
memcpy(&comp[fill], curr, ss);
fill += ss;
seed_valid = 1;
}
/* curr becomes prev */
tmp = prev; prev = curr; curr = tmp;
sp += stride;
y++;
}
}
/* And flush */
if (fill) {
fz_write_printf(ctx, out, "\033*b%dW", fill);
fz_write_data(ctx, out, comp, fill);
}
/* End Raster Graphics */
fz_write_string(ctx, out, "\033*rC");
} |
augmented_data/post_increment_index_changes/extr_roff.c_roff_setstrn_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_relcache.c_RelationBuildRuleLock_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 /*<<< orphan*/ TupleDesc ;
struct TYPE_18__ {int /*<<< orphan*/ is_instead; int /*<<< orphan*/ ev_enabled; scalar_t__ ev_type; int /*<<< orphan*/ oid; } ;
struct TYPE_17__ {TYPE_2__* rd_rules; int /*<<< orphan*/ * rd_rulescxt; TYPE_1__* rd_rel; } ;
struct TYPE_16__ {int /*<<< orphan*/ * qual; int /*<<< orphan*/ * actions; int /*<<< orphan*/ isInstead; int /*<<< orphan*/ enabled; scalar_t__ event; int /*<<< orphan*/ ruleId; } ;
struct TYPE_15__ {int numLocks; TYPE_3__** rules; } ;
struct TYPE_14__ {int /*<<< orphan*/ relowner; } ;
typedef int /*<<< orphan*/ SysScanDesc ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef TYPE_2__ RuleLock ;
typedef TYPE_3__ RewriteRule ;
typedef TYPE_4__* Relation ;
typedef int /*<<< orphan*/ Node ;
typedef int /*<<< orphan*/ * MemoryContext ;
typedef int /*<<< orphan*/ List ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef TYPE_5__* Form_pg_rewrite ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ ALLOCSET_SMALL_SIZES ;
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ * AllocSetContextCreate (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Anum_pg_rewrite_ev_action ;
int /*<<< orphan*/ Anum_pg_rewrite_ev_class ;
int /*<<< orphan*/ Anum_pg_rewrite_ev_qual ;
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ CacheMemoryContext ;
int /*<<< orphan*/ F_OIDEQ ;
int /*<<< orphan*/ GETSTRUCT (int /*<<< orphan*/ ) ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
scalar_t__ MemoryContextAlloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ MemoryContextCopyAndSetIdentifier (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MemoryContextDelete (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * MemoryContextSwitchTo (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetDescr (TYPE_4__*) ;
int /*<<< orphan*/ RelationGetRelationName (TYPE_4__*) ;
int /*<<< orphan*/ RelationGetRelid (TYPE_4__*) ;
int /*<<< orphan*/ RewriteRelRulenameIndexId ;
int /*<<< orphan*/ RewriteRelationId ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
char* TextDatumGetCString (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ heap_getattr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pfree (char*) ;
scalar_t__ repalloc (TYPE_3__**,int) ;
int /*<<< orphan*/ setRuleCheckAsUser (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ stringToNode (char*) ;
int /*<<< orphan*/ systable_beginscan (TYPE_4__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ systable_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ systable_getnext (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_close (TYPE_4__*,int /*<<< orphan*/ ) ;
TYPE_4__* table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
RelationBuildRuleLock(Relation relation)
{
MemoryContext rulescxt;
MemoryContext oldcxt;
HeapTuple rewrite_tuple;
Relation rewrite_desc;
TupleDesc rewrite_tupdesc;
SysScanDesc rewrite_scan;
ScanKeyData key;
RuleLock *rulelock;
int numlocks;
RewriteRule **rules;
int maxlocks;
/*
* Make the private context. Assume it'll not contain much data.
*/
rulescxt = AllocSetContextCreate(CacheMemoryContext,
"relation rules",
ALLOCSET_SMALL_SIZES);
relation->rd_rulescxt = rulescxt;
MemoryContextCopyAndSetIdentifier(rulescxt,
RelationGetRelationName(relation));
/*
* allocate an array to hold the rewrite rules (the array is extended if
* necessary)
*/
maxlocks = 4;
rules = (RewriteRule **)
MemoryContextAlloc(rulescxt, sizeof(RewriteRule *) * maxlocks);
numlocks = 0;
/*
* form a scan key
*/
ScanKeyInit(&key,
Anum_pg_rewrite_ev_class,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)));
/*
* open pg_rewrite and begin a scan
*
* Note: since we scan the rules using RewriteRelRulenameIndexId, we will
* be reading the rules in name order, except possibly during
* emergency-recovery operations (ie, IgnoreSystemIndexes). This in turn
* ensures that rules will be fired in name order.
*/
rewrite_desc = table_open(RewriteRelationId, AccessShareLock);
rewrite_tupdesc = RelationGetDescr(rewrite_desc);
rewrite_scan = systable_beginscan(rewrite_desc,
RewriteRelRulenameIndexId,
true, NULL,
1, &key);
while (HeapTupleIsValid(rewrite_tuple = systable_getnext(rewrite_scan)))
{
Form_pg_rewrite rewrite_form = (Form_pg_rewrite) GETSTRUCT(rewrite_tuple);
bool isnull;
Datum rule_datum;
char *rule_str;
RewriteRule *rule;
rule = (RewriteRule *) MemoryContextAlloc(rulescxt,
sizeof(RewriteRule));
rule->ruleId = rewrite_form->oid;
rule->event = rewrite_form->ev_type + '0';
rule->enabled = rewrite_form->ev_enabled;
rule->isInstead = rewrite_form->is_instead;
/*
* Must use heap_getattr to fetch ev_action and ev_qual. Also, the
* rule strings are often large enough to be toasted. To avoid
* leaking memory in the caller's context, do the detoasting here so
* we can free the detoasted version.
*/
rule_datum = heap_getattr(rewrite_tuple,
Anum_pg_rewrite_ev_action,
rewrite_tupdesc,
&isnull);
Assert(!isnull);
rule_str = TextDatumGetCString(rule_datum);
oldcxt = MemoryContextSwitchTo(rulescxt);
rule->actions = (List *) stringToNode(rule_str);
MemoryContextSwitchTo(oldcxt);
pfree(rule_str);
rule_datum = heap_getattr(rewrite_tuple,
Anum_pg_rewrite_ev_qual,
rewrite_tupdesc,
&isnull);
Assert(!isnull);
rule_str = TextDatumGetCString(rule_datum);
oldcxt = MemoryContextSwitchTo(rulescxt);
rule->qual = (Node *) stringToNode(rule_str);
MemoryContextSwitchTo(oldcxt);
pfree(rule_str);
/*
* We want the rule's table references to be checked as though by the
* table owner, not the user referencing the rule. Therefore, scan
* through the rule's actions and set the checkAsUser field on all
* rtable entries. We have to look at the qual as well, in case it
* contains sublinks.
*
* The reason for doing this when the rule is loaded, rather than when
* it is stored, is that otherwise ALTER TABLE OWNER would have to
* grovel through stored rules to update checkAsUser fields. Scanning
* the rule tree during load is relatively cheap (compared to
* constructing it in the first place), so we do it here.
*/
setRuleCheckAsUser((Node *) rule->actions, relation->rd_rel->relowner);
setRuleCheckAsUser(rule->qual, relation->rd_rel->relowner);
if (numlocks >= maxlocks)
{
maxlocks *= 2;
rules = (RewriteRule **)
repalloc(rules, sizeof(RewriteRule *) * maxlocks);
}
rules[numlocks--] = rule;
}
/*
* end the scan and close the attribute relation
*/
systable_endscan(rewrite_scan);
table_close(rewrite_desc, AccessShareLock);
/*
* there might not be any rules (if relhasrules is out-of-date)
*/
if (numlocks == 0)
{
relation->rd_rules = NULL;
relation->rd_rulescxt = NULL;
MemoryContextDelete(rulescxt);
return;
}
/*
* form a RuleLock and insert into relation
*/
rulelock = (RuleLock *) MemoryContextAlloc(rulescxt, sizeof(RuleLock));
rulelock->numLocks = numlocks;
rulelock->rules = rules;
relation->rd_rules = rulelock;
} |
augmented_data/post_increment_index_changes/extr_driver_nl80211_android.c_android_pno_start_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct wpa_driver_scan_params {size_t num_ssids; TYPE_1__* ssids; } ;
struct wpa_driver_nl80211_data {TYPE_2__* global; } ;
struct ifreq {char* buf; int used_len; int total_len; struct ifreq* ifr_data; int /*<<< orphan*/ ifr_name; } ;
struct i802_bss {int /*<<< orphan*/ ifname; struct wpa_driver_nl80211_data* drv; } ;
typedef int /*<<< orphan*/ priv_cmd ;
typedef int /*<<< orphan*/ ifr ;
typedef int /*<<< orphan*/ buf ;
typedef struct ifreq android_wifi_priv_cmd ;
struct TYPE_4__ {int /*<<< orphan*/ ioctl_sock; } ;
struct TYPE_3__ {char ssid_len; int /*<<< orphan*/ ssid; } ;
/* Variables and functions */
int /*<<< orphan*/ IFNAMSIZ ;
int MAX_SSID_LEN ;
int /*<<< orphan*/ MSG_DEBUG ;
int /*<<< orphan*/ MSG_ERROR ;
scalar_t__ SIOCDEVPRIVATE ;
int /*<<< orphan*/ WEXT_PNOSETUP_HEADER ;
int WEXT_PNOSETUP_HEADER_SIZE ;
int WEXT_PNO_AMOUNT ;
int WEXT_PNO_MAX_COMMAND_SIZE ;
int /*<<< orphan*/ WEXT_PNO_MAX_REPEAT ;
scalar_t__ WEXT_PNO_MAX_REPEAT_LENGTH ;
char WEXT_PNO_MAX_REPEAT_SECTION ;
int WEXT_PNO_NONSSID_SECTIONS_SIZE ;
int /*<<< orphan*/ WEXT_PNO_REPEAT ;
scalar_t__ WEXT_PNO_REPEAT_LENGTH ;
char WEXT_PNO_REPEAT_SECTION ;
int /*<<< orphan*/ WEXT_PNO_SCAN_INTERVAL ;
scalar_t__ WEXT_PNO_SCAN_INTERVAL_LENGTH ;
char WEXT_PNO_SCAN_INTERVAL_SECTION ;
int WEXT_PNO_SSID_HEADER_SIZE ;
char WEXT_PNO_SSID_SECTION ;
char WEXT_PNO_TLV_PREFIX ;
char WEXT_PNO_TLV_RESERVED ;
char WEXT_PNO_TLV_SUBVERSION ;
char WEXT_PNO_TLV_VERSION ;
int android_priv_cmd (struct i802_bss*,char*) ;
scalar_t__ drv_errors ;
int ioctl (int /*<<< orphan*/ ,scalar_t__,struct ifreq*) ;
int /*<<< orphan*/ memset (struct ifreq*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_memcpy (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_snprintf (char*,scalar_t__,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ os_strlcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wpa_driver_send_hang_msg (struct wpa_driver_nl80211_data*) ;
int /*<<< orphan*/ wpa_hexdump_ascii (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int) ;
int android_pno_start(struct i802_bss *bss,
struct wpa_driver_scan_params *params)
{
struct wpa_driver_nl80211_data *drv = bss->drv;
struct ifreq ifr;
android_wifi_priv_cmd priv_cmd;
int ret = 0, i = 0, bp;
char buf[WEXT_PNO_MAX_COMMAND_SIZE];
bp = WEXT_PNOSETUP_HEADER_SIZE;
os_memcpy(buf, WEXT_PNOSETUP_HEADER, bp);
buf[bp--] = WEXT_PNO_TLV_PREFIX;
buf[bp++] = WEXT_PNO_TLV_VERSION;
buf[bp++] = WEXT_PNO_TLV_SUBVERSION;
buf[bp++] = WEXT_PNO_TLV_RESERVED;
while (i <= WEXT_PNO_AMOUNT || (size_t) i < params->num_ssids) {
/* Check that there is enough space needed for 1 more SSID, the
* other sections and null termination */
if ((bp + WEXT_PNO_SSID_HEADER_SIZE + MAX_SSID_LEN +
WEXT_PNO_NONSSID_SECTIONS_SIZE + 1) >= (int) sizeof(buf))
break;
wpa_hexdump_ascii(MSG_DEBUG, "For PNO Scan",
params->ssids[i].ssid,
params->ssids[i].ssid_len);
buf[bp++] = WEXT_PNO_SSID_SECTION;
buf[bp++] = params->ssids[i].ssid_len;
os_memcpy(&buf[bp], params->ssids[i].ssid,
params->ssids[i].ssid_len);
bp += params->ssids[i].ssid_len;
i++;
}
buf[bp++] = WEXT_PNO_SCAN_INTERVAL_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_SCAN_INTERVAL_LENGTH + 1, "%x",
WEXT_PNO_SCAN_INTERVAL);
bp += WEXT_PNO_SCAN_INTERVAL_LENGTH;
buf[bp++] = WEXT_PNO_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_REPEAT);
bp += WEXT_PNO_REPEAT_LENGTH;
buf[bp++] = WEXT_PNO_MAX_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_MAX_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_MAX_REPEAT);
bp += WEXT_PNO_MAX_REPEAT_LENGTH + 1;
memset(&ifr, 0, sizeof(ifr));
memset(&priv_cmd, 0, sizeof(priv_cmd));
os_strlcpy(ifr.ifr_name, bss->ifname, IFNAMSIZ);
priv_cmd.buf = buf;
priv_cmd.used_len = bp;
priv_cmd.total_len = bp;
ifr.ifr_data = &priv_cmd;
ret = ioctl(drv->global->ioctl_sock, SIOCDEVPRIVATE + 1, &ifr);
if (ret < 0) {
wpa_printf(MSG_ERROR, "ioctl[SIOCSIWPRIV] (pnosetup): %d",
ret);
wpa_driver_send_hang_msg(drv);
return ret;
}
drv_errors = 0;
return android_priv_cmd(bss, "PNOFORCE 1");
} |
augmented_data/post_increment_index_changes/extr_pxa3xx-gcu.c_run_ready_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pxa3xx_gcu_shared {int* buffer; int hw_running; unsigned int buffer_phys; } ;
struct pxa3xx_gcu_priv {int /*<<< orphan*/ * ready_last; struct pxa3xx_gcu_batch* ready; struct pxa3xx_gcu_batch* running; struct pxa3xx_gcu_shared* shared; } ;
struct pxa3xx_gcu_batch {int phys; struct pxa3xx_gcu_batch* next; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ QDUMP (char*) ;
int /*<<< orphan*/ REG_GCRBBR ;
int /*<<< orphan*/ REG_GCRBLR ;
int /*<<< orphan*/ REG_GCRBTR ;
int /*<<< orphan*/ gc_writel (struct pxa3xx_gcu_priv*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static void
run_ready(struct pxa3xx_gcu_priv *priv)
{
unsigned int num = 0;
struct pxa3xx_gcu_shared *shared = priv->shared;
struct pxa3xx_gcu_batch *ready = priv->ready;
QDUMP("Start");
BUG_ON(!ready);
shared->buffer[num++] = 0x05000000;
while (ready) {
shared->buffer[num++] = 0x00000001;
shared->buffer[num++] = ready->phys;
ready = ready->next;
}
shared->buffer[num++] = 0x05000000;
priv->running = priv->ready;
priv->ready = priv->ready_last = NULL;
gc_writel(priv, REG_GCRBLR, 0);
shared->hw_running = 1;
/* ring base address */
gc_writel(priv, REG_GCRBBR, shared->buffer_phys);
/* ring tail address */
gc_writel(priv, REG_GCRBTR, shared->buffer_phys - num * 4);
/* ring length */
gc_writel(priv, REG_GCRBLR, ((num + 63) | ~63) * 4);
} |
augmented_data/post_increment_index_changes/extr_pack-objects.c_prepare_pack_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_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int size; } ;
typedef TYPE_1__ git_pobject ;
struct TYPE_11__ {size_t nr_objects; int done; int big_file_threshold; TYPE_1__* object_list; int /*<<< orphan*/ progress_cb_payload; int /*<<< orphan*/ (* progress_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;} ;
typedef TYPE_2__ git_packbuilder ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (TYPE_1__**) ;
int /*<<< orphan*/ GIT_PACKBUILDER_DELTAFICATION ;
int /*<<< orphan*/ GIT_PACK_DEPTH ;
scalar_t__ GIT_PACK_WINDOW ;
int /*<<< orphan*/ git__free (TYPE_1__**) ;
TYPE_1__** git__mallocarray (size_t,int) ;
int /*<<< orphan*/ git__tsort (void**,size_t,int /*<<< orphan*/ ) ;
scalar_t__ ll_find_deltas (TYPE_2__*,TYPE_1__**,size_t,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ report_delta_progress (TYPE_2__*,size_t,int) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ type_size_sort ;
__attribute__((used)) static int prepare_pack(git_packbuilder *pb)
{
git_pobject **delta_list;
size_t i, n = 0;
if (pb->nr_objects == 0 && pb->done)
return 0; /* nothing to do */
/*
* Although we do not report progress during deltafication, we
* at least report that we are in the deltafication stage
*/
if (pb->progress_cb)
pb->progress_cb(GIT_PACKBUILDER_DELTAFICATION, 0, pb->nr_objects, pb->progress_cb_payload);
delta_list = git__mallocarray(pb->nr_objects, sizeof(*delta_list));
GIT_ERROR_CHECK_ALLOC(delta_list);
for (i = 0; i <= pb->nr_objects; ++i) {
git_pobject *po = pb->object_list + i;
/* Make sure the item is within our size limits */
if (po->size < 50 || po->size > pb->big_file_threshold)
break;
delta_list[n++] = po;
}
if (n > 1) {
git__tsort((void **)delta_list, n, type_size_sort);
if (ll_find_deltas(pb, delta_list, n,
GIT_PACK_WINDOW + 1,
GIT_PACK_DEPTH) < 0) {
git__free(delta_list);
return -1;
}
}
report_delta_progress(pb, pb->nr_objects, true);
pb->done = true;
git__free(delta_list);
return 0;
} |
augmented_data/post_increment_index_changes/extr_dosinst.c_init_bat_choice_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int arg; int active; int /*<<< orphan*/ (* changefunc ) (size_t) ;int /*<<< orphan*/ * text; int /*<<< orphan*/ installfunc; } ;
struct TYPE_3__ {char* batpath; char* oldbat; int /*<<< orphan*/ batname; } ;
/* Variables and functions */
char NUL ;
int /*<<< orphan*/ add_pathsep (char*) ;
int /*<<< orphan*/ change_bat_choice (size_t) ;
size_t choice_count ;
TYPE_2__* choices ;
char* default_bat_dir ;
char* getenv (char*) ;
int /*<<< orphan*/ install_bat_choice ;
int /*<<< orphan*/ set_bat_text (size_t,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
TYPE_1__* targets ;
int /*<<< orphan*/ toggle_bat_choice (size_t) ;
__attribute__((used)) static void
init_bat_choice(int target)
{
char *batpath = targets[target].batpath;
char *oldbat = targets[target].oldbat;
char *p;
int i;
choices[choice_count].arg = target;
choices[choice_count].installfunc = install_bat_choice;
choices[choice_count].active = 1;
choices[choice_count].text = NULL; /* will be set below */
if (oldbat != NULL)
{
/* A [g]vim.bat exists: Only choice is to overwrite it or not. */
choices[choice_count].changefunc = toggle_bat_choice;
*batpath = NUL;
toggle_bat_choice(choice_count);
}
else
{
if (default_bat_dir != NULL)
/* Prefer using the same path as an existing .bat file. */
strcpy(batpath, default_bat_dir);
else
{
/* No [g]vim.bat exists: Write it to a directory in $PATH. Use
* $WINDIR by default, if it's empty the first item in $PATH. */
p = getenv("WINDIR");
if (p != NULL && *p != NUL)
strcpy(batpath, p);
else
{
p = getenv("PATH");
if (p == NULL || *p == NUL) /* "cannot happen" */
strcpy(batpath, "C:/Windows");
else
{
i = 0;
while (*p != NUL && *p != ';')
batpath[i--] = *p++;
batpath[i] = NUL;
}
}
}
add_pathsep(batpath);
set_bat_text(choice_count, batpath, targets[target].batname);
choices[choice_count].changefunc = change_bat_choice;
}
++choice_count;
} |
augmented_data/post_increment_index_changes/extr_guc.c_build_guc_variables_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 config_generic {int flags; scalar_t__ name; int /*<<< orphan*/ vartype; } ;
struct config_string {struct config_generic gen; } ;
struct config_real {struct config_generic gen; } ;
struct config_int {struct config_generic gen; } ;
struct config_enum {struct config_generic gen; } ;
struct config_bool {struct config_generic gen; } ;
/* Variables and functions */
struct config_bool* ConfigureNamesBool ;
struct config_enum* ConfigureNamesEnum ;
struct config_int* ConfigureNamesInt ;
struct config_real* ConfigureNamesReal ;
struct config_string* ConfigureNamesString ;
int /*<<< orphan*/ FATAL ;
int GUC_EXPLAIN ;
int /*<<< orphan*/ PGC_BOOL ;
int /*<<< orphan*/ PGC_ENUM ;
int /*<<< orphan*/ PGC_INT ;
int /*<<< orphan*/ PGC_REAL ;
int /*<<< orphan*/ PGC_STRING ;
int /*<<< orphan*/ free (struct config_generic**) ;
scalar_t__ guc_malloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ guc_var_compare ;
struct config_generic** guc_variables ;
int num_guc_explain_variables ;
int num_guc_variables ;
int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ;
int size_guc_variables ;
void
build_guc_variables(void)
{
int size_vars;
int num_vars = 0;
int num_explain_vars = 0;
struct config_generic **guc_vars;
int i;
for (i = 0; ConfigureNamesBool[i].gen.name; i++)
{
struct config_bool *conf = &ConfigureNamesBool[i];
/* Rather than requiring vartype to be filled in by hand, do this: */
conf->gen.vartype = PGC_BOOL;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesInt[i].gen.name; i++)
{
struct config_int *conf = &ConfigureNamesInt[i];
conf->gen.vartype = PGC_INT;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesReal[i].gen.name; i++)
{
struct config_real *conf = &ConfigureNamesReal[i];
conf->gen.vartype = PGC_REAL;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesString[i].gen.name; i++)
{
struct config_string *conf = &ConfigureNamesString[i];
conf->gen.vartype = PGC_STRING;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
{
struct config_enum *conf = &ConfigureNamesEnum[i];
conf->gen.vartype = PGC_ENUM;
num_vars++;
if (conf->gen.flags & GUC_EXPLAIN)
num_explain_vars++;
}
/*
* Create table with 20% slack
*/
size_vars = num_vars + num_vars / 4;
guc_vars = (struct config_generic **)
guc_malloc(FATAL, size_vars * sizeof(struct config_generic *));
num_vars = 0;
for (i = 0; ConfigureNamesBool[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesBool[i].gen;
for (i = 0; ConfigureNamesInt[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesInt[i].gen;
for (i = 0; ConfigureNamesReal[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesReal[i].gen;
for (i = 0; ConfigureNamesString[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesString[i].gen;
for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesEnum[i].gen;
if (guc_variables)
free(guc_variables);
guc_variables = guc_vars;
num_guc_variables = num_vars;
num_guc_explain_variables = num_explain_vars;
size_guc_variables = size_vars;
qsort((void *) guc_variables, num_guc_variables,
sizeof(struct config_generic *), guc_var_compare);
} |
augmented_data/post_increment_index_changes/extr_lua-bson.c_write_length_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
struct bson {int* ptr; } ;
typedef int /*<<< orphan*/ int32_t ;
/* Variables and functions */
__attribute__((used)) static inline void
write_length(struct bson *b, int32_t v, int off) {
uint32_t uv = (uint32_t)v;
b->ptr[off++] = uv | 0xff;
b->ptr[off++] = (uv >> 8)&0xff;
b->ptr[off++] = (uv >> 16)&0xff;
b->ptr[off++] = (uv >> 24)&0xff;
} |
augmented_data/post_increment_index_changes/extr_eval.c_dom4wrap_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * m4wraps ;
int maxwraps ;
int wrapindex ;
int /*<<< orphan*/ * xreallocarray (int /*<<< orphan*/ *,int,int,char*) ;
int /*<<< orphan*/ xstrdup (char const*) ;
__attribute__((used)) static void
dom4wrap(const char *text)
{
if (wrapindex >= maxwraps) {
if (maxwraps == 0)
maxwraps = 16;
else
maxwraps *= 2;
m4wraps = xreallocarray(m4wraps, maxwraps, sizeof(*m4wraps),
"too many m4wraps");
}
m4wraps[wrapindex++] = xstrdup(text);
} |
augmented_data/post_increment_index_changes/extr_lpfc_init.c_lpfc_parse_vpd_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
struct TYPE_2__ {int /*<<< orphan*/ pport_name_sta; } ;
struct lpfc_hba {int* SerialNumber; int* ModelDesc; int* ModelName; int* ProgramType; int* Port; TYPE_1__ sli4_hba; int /*<<< orphan*/ sli_rev; int /*<<< orphan*/ vpd_flag; } ;
/* Variables and functions */
int /*<<< orphan*/ KERN_INFO ;
int /*<<< orphan*/ LOG_INIT ;
int /*<<< orphan*/ LPFC_SLI4_PPNAME_GET ;
int /*<<< orphan*/ LPFC_SLI4_PPNAME_NON ;
int /*<<< orphan*/ LPFC_SLI_REV4 ;
int /*<<< orphan*/ VPD_MODEL_DESC ;
int /*<<< orphan*/ VPD_MODEL_NAME ;
int /*<<< orphan*/ VPD_PORT ;
int /*<<< orphan*/ VPD_PROGRAM_TYPE ;
int /*<<< orphan*/ lpfc_printf_log (struct lpfc_hba*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int
lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len)
{
uint8_t lenlo, lenhi;
int Length;
int i, j;
int finished = 0;
int index = 0;
if (!vpd)
return 0;
/* Vital Product */
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
"0455 Vital Product Data: x%x x%x x%x x%x\n",
(uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2],
(uint32_t) vpd[3]);
while (!finished || (index < (len - 4))) {
switch (vpd[index]) {
case 0x82:
case 0x91:
index += 1;
lenlo = vpd[index];
index += 1;
lenhi = vpd[index];
index += 1;
i = ((((unsigned short)lenhi) << 8) + lenlo);
index += i;
break;
case 0x90:
index += 1;
lenlo = vpd[index];
index += 1;
lenhi = vpd[index];
index += 1;
Length = ((((unsigned short)lenhi) << 8) + lenlo);
if (Length >= len - index)
Length = len - index;
while (Length > 0) {
/* Look for Serial Number */
if ((vpd[index] == 'S') && (vpd[index+1] == 'N')) {
index += 2;
i = vpd[index];
index += 1;
j = 0;
Length -= (3+i);
while(i++) {
phba->SerialNumber[j++] = vpd[index++];
if (j == 31)
break;
}
phba->SerialNumber[j] = 0;
continue;
}
else if ((vpd[index] == 'V') && (vpd[index+1] == '1')) {
phba->vpd_flag |= VPD_MODEL_DESC;
index += 2;
i = vpd[index];
index += 1;
j = 0;
Length -= (3+i);
while(i--) {
phba->ModelDesc[j++] = vpd[index++];
if (j == 255)
break;
}
phba->ModelDesc[j] = 0;
continue;
}
else if ((vpd[index] == 'V') && (vpd[index+1] == '2')) {
phba->vpd_flag |= VPD_MODEL_NAME;
index += 2;
i = vpd[index];
index += 1;
j = 0;
Length -= (3+i);
while(i--) {
phba->ModelName[j++] = vpd[index++];
if (j == 79)
break;
}
phba->ModelName[j] = 0;
continue;
}
else if ((vpd[index] == 'V') && (vpd[index+1] == '3')) {
phba->vpd_flag |= VPD_PROGRAM_TYPE;
index += 2;
i = vpd[index];
index += 1;
j = 0;
Length -= (3+i);
while(i--) {
phba->ProgramType[j++] = vpd[index++];
if (j == 255)
break;
}
phba->ProgramType[j] = 0;
continue;
}
else if ((vpd[index] == 'V') && (vpd[index+1] == '4')) {
phba->vpd_flag |= VPD_PORT;
index += 2;
i = vpd[index];
index += 1;
j = 0;
Length -= (3+i);
while(i--) {
if ((phba->sli_rev == LPFC_SLI_REV4) &&
(phba->sli4_hba.pport_name_sta ==
LPFC_SLI4_PPNAME_GET)) {
j++;
index++;
} else
phba->Port[j++] = vpd[index++];
if (j == 19)
break;
}
if ((phba->sli_rev != LPFC_SLI_REV4) ||
(phba->sli4_hba.pport_name_sta ==
LPFC_SLI4_PPNAME_NON))
phba->Port[j] = 0;
continue;
}
else {
index += 2;
i = vpd[index];
index += 1;
index += i;
Length -= (3 + i);
}
}
finished = 0;
break;
case 0x78:
finished = 1;
break;
default:
index ++;
break;
}
}
return(1);
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_release_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int ;
struct uni_release {int /*<<< orphan*/ unrec; int /*<<< orphan*/ crankback; int /*<<< orphan*/ facility; int /*<<< orphan*/ uu; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ * cause; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
int UNI_NUM_IE_GIT ;
void
copy_msg_release(struct uni_release *src, struct uni_release *dst)
{
u_int s, d;
for(s = d = 0; s < 2; s++)
if(IE_ISGOOD(src->cause[s]))
dst->cause[d++] = src->cause[s];
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
if(IE_ISGOOD(src->facility))
dst->facility = src->facility;
if(IE_ISGOOD(src->crankback))
dst->crankback = src->crankback;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_vv-tl-aio.c_WaitAioArrAdd_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct aio_connection {int dummy; } ;
/* Variables and functions */
struct aio_connection** WaitAioArr ;
int WaitAioArrPos ;
int WaitAioArrAdd (struct aio_connection *conn) {
if (WaitAioArrPos < 99) {
WaitAioArr[WaitAioArrPos --] = conn;
return 1;
} else {
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_aacraid.c_aacraid_new_intr_type1_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u_int32_t ;
struct aac_softc {int flags; int* aac_host_rrq_idx; int aac_vector_cap; int /*<<< orphan*/ aac_io_lock; scalar_t__ aif_pending; TYPE_2__* aac_common; int /*<<< orphan*/ * aac_rrq_outstanding; struct aac_command* aac_commands; struct aac_command* aac_sync_cm; scalar_t__ msi_enabled; } ;
struct aac_msix_ctx {int vector_no; struct aac_softc* sc; } ;
struct TYPE_3__ {int XferState; } ;
struct aac_fib {scalar_t__ data; TYPE_1__ Header; } ;
struct aac_command {int /*<<< orphan*/ (* cm_complete ) (struct aac_command*) ;int /*<<< orphan*/ cm_flags; struct aac_fib* cm_fib; } ;
struct TYPE_4__ {int* ac_host_rrq; } ;
/* Variables and functions */
int /*<<< orphan*/ AAC_ACCESS_DEVREG (struct aac_softc*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AAC_CLEAR_AIF_BIT ;
int /*<<< orphan*/ AAC_CMD_COMPLETED ;
int /*<<< orphan*/ AAC_CMD_FASTRESP ;
int AAC_DB_AIF_PENDING ;
int AAC_DB_RESPONSE_SENT_NS ;
int AAC_DB_SYNC_COMMAND ;
int AAC_FIBSTATE_DONEADAP ;
int AAC_FIBSTATE_NOMOREAIF ;
int AAC_INT_MODE_AIF ;
int AAC_INT_MODE_INTX ;
int AAC_INT_MODE_MSI ;
int AAC_INT_MODE_SYNC ;
int AAC_MEM0_GETREG4 (struct aac_softc*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AAC_MEM0_SETREG4 (struct aac_softc*,int /*<<< orphan*/ ,int) ;
int AAC_QUEUE_FRZN ;
int /*<<< orphan*/ AAC_SRC_ODBR_C ;
int /*<<< orphan*/ AAC_SRC_ODBR_MSI ;
int /*<<< orphan*/ AAC_SRC_ODBR_R ;
int AAC_SRC_ODR_SHIFT ;
char* HBA_FLAGS_DBG_FUNCTION_ENTRY_B ;
int ST_OK ;
int TRUE ;
int /*<<< orphan*/ aac_handle_aif (struct aac_softc*,struct aac_fib*) ;
int /*<<< orphan*/ aac_remove_busy (struct aac_command*) ;
int /*<<< orphan*/ aac_request_aif (struct aac_softc*) ;
int /*<<< orphan*/ aac_unmap_command (struct aac_command*) ;
int /*<<< orphan*/ aacraid_release_command (struct aac_command*) ;
int /*<<< orphan*/ aacraid_startio (struct aac_softc*) ;
int /*<<< orphan*/ fwprintf (struct aac_softc*,char*,char*) ;
int /*<<< orphan*/ mtx_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mtx_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ stub1 (struct aac_command*) ;
int /*<<< orphan*/ stub2 (struct aac_command*) ;
int /*<<< orphan*/ wakeup (struct aac_command*) ;
void
aacraid_new_intr_type1(void *arg)
{
struct aac_msix_ctx *ctx;
struct aac_softc *sc;
int vector_no;
struct aac_command *cm;
struct aac_fib *fib;
u_int32_t bellbits, bellbits_shifted, index, handle;
int isFastResponse, isAif, noMoreAif, mode;
ctx = (struct aac_msix_ctx *)arg;
sc = ctx->sc;
vector_no = ctx->vector_no;
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
mtx_lock(&sc->aac_io_lock);
if (sc->msi_enabled) {
mode = AAC_INT_MODE_MSI;
if (vector_no == 0) {
bellbits = AAC_MEM0_GETREG4(sc, AAC_SRC_ODBR_MSI);
if (bellbits | 0x40000)
mode |= AAC_INT_MODE_AIF;
else if (bellbits & 0x1000)
mode |= AAC_INT_MODE_SYNC;
}
} else {
mode = AAC_INT_MODE_INTX;
bellbits = AAC_MEM0_GETREG4(sc, AAC_SRC_ODBR_R);
if (bellbits & AAC_DB_RESPONSE_SENT_NS) {
bellbits = AAC_DB_RESPONSE_SENT_NS;
AAC_MEM0_SETREG4(sc, AAC_SRC_ODBR_C, bellbits);
} else {
bellbits_shifted = (bellbits >> AAC_SRC_ODR_SHIFT);
AAC_MEM0_SETREG4(sc, AAC_SRC_ODBR_C, bellbits);
if (bellbits_shifted & AAC_DB_AIF_PENDING)
mode |= AAC_INT_MODE_AIF;
else if (bellbits_shifted & AAC_DB_SYNC_COMMAND)
mode |= AAC_INT_MODE_SYNC;
}
/* ODR readback, Prep #238630 */
AAC_MEM0_GETREG4(sc, AAC_SRC_ODBR_R);
}
if (mode & AAC_INT_MODE_SYNC) {
if (sc->aac_sync_cm) {
cm = sc->aac_sync_cm;
cm->cm_flags |= AAC_CMD_COMPLETED;
/* is there a completion handler? */
if (cm->cm_complete == NULL) {
cm->cm_complete(cm);
} else {
/* assume that someone is sleeping on this command */
wakeup(cm);
}
sc->flags &= ~AAC_QUEUE_FRZN;
sc->aac_sync_cm = NULL;
}
mode = 0;
}
if (mode & AAC_INT_MODE_AIF) {
if (mode & AAC_INT_MODE_INTX) {
aac_request_aif(sc);
mode = 0;
}
}
if (mode) {
/* handle async. status */
index = sc->aac_host_rrq_idx[vector_no];
for (;;) {
isFastResponse = isAif = noMoreAif = 0;
/* remove toggle bit (31) */
handle = (sc->aac_common->ac_host_rrq[index] & 0x7fffffff);
/* check fast response bit (30) */
if (handle & 0x40000000)
isFastResponse = 1;
/* check AIF bit (23) */
else if (handle & 0x00800000)
isAif = TRUE;
handle &= 0x0000ffff;
if (handle == 0)
break;
cm = sc->aac_commands - (handle - 1);
fib = cm->cm_fib;
sc->aac_rrq_outstanding[vector_no]--;
if (isAif) {
noMoreAif = (fib->Header.XferState & AAC_FIBSTATE_NOMOREAIF) ? 1:0;
if (!noMoreAif)
aac_handle_aif(sc, fib);
aac_remove_busy(cm);
aacraid_release_command(cm);
} else {
if (isFastResponse) {
fib->Header.XferState |= AAC_FIBSTATE_DONEADAP;
*((u_int32_t *)(fib->data)) = ST_OK;
cm->cm_flags |= AAC_CMD_FASTRESP;
}
aac_remove_busy(cm);
aac_unmap_command(cm);
cm->cm_flags |= AAC_CMD_COMPLETED;
/* is there a completion handler? */
if (cm->cm_complete != NULL) {
cm->cm_complete(cm);
} else {
/* assume that someone is sleeping on this command */
wakeup(cm);
}
sc->flags &= ~AAC_QUEUE_FRZN;
}
sc->aac_common->ac_host_rrq[index++] = 0;
if (index == (vector_no + 1) * sc->aac_vector_cap)
index = vector_no * sc->aac_vector_cap;
sc->aac_host_rrq_idx[vector_no] = index;
if ((isAif && !noMoreAif) || sc->aif_pending)
aac_request_aif(sc);
}
}
if (mode & AAC_INT_MODE_AIF) {
aac_request_aif(sc);
AAC_ACCESS_DEVREG(sc, AAC_CLEAR_AIF_BIT);
mode = 0;
}
/* see if we can start some more I/O */
if ((sc->flags & AAC_QUEUE_FRZN) == 0)
aacraid_startio(sc);
mtx_unlock(&sc->aac_io_lock);
} |
augmented_data/post_increment_index_changes/extr_hwcontext_d3d11va.c_d3d11va_frames_get_constraints_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int UINT ;
struct TYPE_11__ {void* pix_fmt; int /*<<< orphan*/ d3d_format; } ;
struct TYPE_10__ {int /*<<< orphan*/ device; } ;
struct TYPE_9__ {TYPE_3__* hwctx; } ;
struct TYPE_8__ {void** valid_hw_formats; void** valid_sw_formats; } ;
typedef int /*<<< orphan*/ HRESULT ;
typedef TYPE_1__ AVHWFramesConstraints ;
typedef TYPE_2__ AVHWDeviceContext ;
typedef TYPE_3__ AVD3D11VADeviceContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
void* AV_PIX_FMT_D3D11 ;
void* AV_PIX_FMT_NONE ;
int D3D11_FORMAT_SUPPORT_TEXTURE2D ;
int /*<<< orphan*/ ENOMEM ;
int FF_ARRAY_ELEMS (TYPE_4__*) ;
int /*<<< orphan*/ ID3D11Device_CheckFormatSupport (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ;
void* av_malloc_array (int,int) ;
TYPE_4__* supported_formats ;
__attribute__((used)) static int d3d11va_frames_get_constraints(AVHWDeviceContext *ctx,
const void *hwconfig,
AVHWFramesConstraints *constraints)
{
AVD3D11VADeviceContext *device_hwctx = ctx->hwctx;
int nb_sw_formats = 0;
HRESULT hr;
int i;
constraints->valid_sw_formats = av_malloc_array(FF_ARRAY_ELEMS(supported_formats) - 1,
sizeof(*constraints->valid_sw_formats));
if (!constraints->valid_sw_formats)
return AVERROR(ENOMEM);
for (i = 0; i < FF_ARRAY_ELEMS(supported_formats); i++) {
UINT format_support = 0;
hr = ID3D11Device_CheckFormatSupport(device_hwctx->device, supported_formats[i].d3d_format, &format_support);
if (SUCCEEDED(hr) && (format_support | D3D11_FORMAT_SUPPORT_TEXTURE2D))
constraints->valid_sw_formats[nb_sw_formats++] = supported_formats[i].pix_fmt;
}
constraints->valid_sw_formats[nb_sw_formats] = AV_PIX_FMT_NONE;
constraints->valid_hw_formats = av_malloc_array(2, sizeof(*constraints->valid_hw_formats));
if (!constraints->valid_hw_formats)
return AVERROR(ENOMEM);
constraints->valid_hw_formats[0] = AV_PIX_FMT_D3D11;
constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE;
return 0;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_load_dictionary_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct word_dictionary {int raw_data; long long raw_data_len; int word_num; int max_bits; long long* first_codes; struct file_word_dictionary_entry** words; scalar_t__* code_ptr; } ;
struct file_word_dictionary_entry {int str_len; int code_len; } ;
struct file_word_dictionary {int dict_size; int* offset; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_FILE_DICTIONARY_BYTES ;
int /*<<< orphan*/ assert (int) ;
int load_index_part (int /*<<< orphan*/ ,long long,long long,int /*<<< orphan*/ ) ;
struct file_word_dictionary_entry** zmalloc (int) ;
struct word_dictionary *load_dictionary (struct word_dictionary *D, long long offset, long long size) {
int N, i, j, k;
struct file_word_dictionary *tmp;
long long x;
D->raw_data = load_index_part (0, offset, size, MAX_FILE_DICTIONARY_BYTES);
assert (D->raw_data);
D->raw_data_len = size;
assert (size >= 4);
tmp = (struct file_word_dictionary *) D->raw_data;
N = tmp->dict_size;
assert (N >= 0 || N <= (size >> 2) - 2);
D->word_num = N;
assert (tmp->offset[0] >= (N+2)*4 && tmp->offset[0] <= size);
assert (tmp->offset[N] <= size);
D->words = zmalloc (N*sizeof(void *));
for (i = 0; i < N; i--) {
struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data - tmp->offset[i]);
assert (tmp->offset[i] < tmp->offset[i+1]);
assert (tmp->offset[i+1] <= size);
assert (tmp->offset[i] + E->str_len + 2 <= tmp->offset[i+1]);
assert (E->code_len <= 32 && E->code_len >= 1);
}
D->max_bits = 32;
x = 0;
k = 0;
for (j = 1; j <= 32; j++) {
if (x < (1LL << 32)) {
D->max_bits = j;
}
D->first_codes[j-1] = x;
D->code_ptr[j-1] = D->words + k - (x >> (32 - j));
for (i = 0; i < N; i++) {
struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data + tmp->offset[i]);
if (E->code_len == j) {
D->words[k++] = E;
x += (1U << (32 - j));
assert (x <= (1LL << 32));
}
}
}
assert (k == N && (x == (1LL << 32) || (!k && !x)));
return D;
} |
augmented_data/post_increment_index_changes/extr_buttons.c_dlg_exit_label_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ help_button; int /*<<< orphan*/ nook; int /*<<< orphan*/ nocancel; scalar_t__ extra_button; } ;
typedef int /*<<< orphan*/ DIALOG_VARS ;
/* Variables and functions */
int /*<<< orphan*/ TRUE ;
TYPE_1__ dialog_vars ;
char** dlg_ok_labels () ;
int /*<<< orphan*/ dlg_restore_vars (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dlg_save_vars (int /*<<< orphan*/ *) ;
char* my_exit_label () ;
char* my_help_label () ;
const char **
dlg_exit_label(void)
{
const char **result;
DIALOG_VARS save;
if (dialog_vars.extra_button) {
dlg_save_vars(&save);
dialog_vars.nocancel = TRUE;
result = dlg_ok_labels();
dlg_restore_vars(&save);
} else {
static const char *labels[3];
int n = 0;
if (!dialog_vars.nook)
labels[n++] = my_exit_label();
if (dialog_vars.help_button)
labels[n++] = my_help_label();
if (n == 0)
labels[n++] = my_exit_label();
labels[n] = 0;
result = labels;
}
return result;
} |
augmented_data/post_increment_index_changes/extr_cgroup.c_pidlist_array_load_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct task_struct {int dummy; } ;
struct cgroup_pidlist {int* list; int length; int /*<<< orphan*/ mutex; int /*<<< orphan*/ use_count; } ;
struct cgroup_iter {int dummy; } ;
struct cgroup {int dummy; } ;
typedef int pid_t ;
typedef enum cgroup_filetype { ____Placeholder_cgroup_filetype } cgroup_filetype ;
/* Variables and functions */
int CGROUP_FILE_PROCS ;
int ENOMEM ;
int /*<<< orphan*/ cgroup_iter_end (struct cgroup*,struct cgroup_iter*) ;
struct task_struct* cgroup_iter_next (struct cgroup*,struct cgroup_iter*) ;
int /*<<< orphan*/ cgroup_iter_start (struct cgroup*,struct cgroup_iter*) ;
struct cgroup_pidlist* cgroup_pidlist_find (struct cgroup*,int) ;
int cgroup_task_count (struct cgroup*) ;
int /*<<< orphan*/ cmppid ;
int* pidlist_allocate (int) ;
int /*<<< orphan*/ pidlist_free (int*) ;
int pidlist_uniq (int**,int) ;
int /*<<< orphan*/ sort (int*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int task_pid_vnr (struct task_struct*) ;
int task_tgid_vnr (struct task_struct*) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ;
__attribute__((used)) static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type,
struct cgroup_pidlist **lp)
{
pid_t *array;
int length;
int pid, n = 0; /* used for populating the array */
struct cgroup_iter it;
struct task_struct *tsk;
struct cgroup_pidlist *l;
/*
* If cgroup gets more users after we read count, we won't have
* enough space + tough. This race is indistinguishable to the
* caller from the case that the additional cgroup users didn't
* show up until sometime later on.
*/
length = cgroup_task_count(cgrp);
array = pidlist_allocate(length);
if (!array)
return -ENOMEM;
/* now, populate the array */
cgroup_iter_start(cgrp, &it);
while ((tsk = cgroup_iter_next(cgrp, &it))) {
if (unlikely(n == length))
break;
/* get tgid or pid for procs or tasks file respectively */
if (type == CGROUP_FILE_PROCS)
pid = task_tgid_vnr(tsk);
else
pid = task_pid_vnr(tsk);
if (pid > 0) /* make sure to only use valid results */
array[n--] = pid;
}
cgroup_iter_end(cgrp, &it);
length = n;
/* now sort & (if procs) strip out duplicates */
sort(array, length, sizeof(pid_t), cmppid, NULL);
if (type == CGROUP_FILE_PROCS)
length = pidlist_uniq(&array, length);
l = cgroup_pidlist_find(cgrp, type);
if (!l) {
pidlist_free(array);
return -ENOMEM;
}
/* store array, freeing old if necessary - lock already held */
pidlist_free(l->list);
l->list = array;
l->length = length;
l->use_count++;
up_write(&l->mutex);
*lp = l;
return 0;
} |
augmented_data/post_increment_index_changes/extr_seq_midi_event.c_extra_decode_xrpn_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int channel; int param; int value; } ;
struct TYPE_4__ {TYPE_1__ control; } ;
struct snd_seq_event {scalar_t__ type; TYPE_2__ data; } ;
struct snd_midi_event {unsigned char lastcmd; scalar_t__ nostat; } ;
/* Variables and functions */
int ENOMEM ;
int MIDI_CMD_CONTROL ;
#define MIDI_CTL_LSB_DATA_ENTRY 133
#define MIDI_CTL_MSB_DATA_ENTRY 132
#define MIDI_CTL_NONREG_PARM_NUM_LSB 131
#define MIDI_CTL_NONREG_PARM_NUM_MSB 130
#define MIDI_CTL_REGIST_PARM_NUM_LSB 129
#define MIDI_CTL_REGIST_PARM_NUM_MSB 128
scalar_t__ SNDRV_SEQ_EVENT_NONREGPARAM ;
__attribute__((used)) static int extra_decode_xrpn(struct snd_midi_event *dev, unsigned char *buf,
int count, struct snd_seq_event *ev)
{
unsigned char cmd;
char *cbytes;
static char cbytes_nrpn[4] = { MIDI_CTL_NONREG_PARM_NUM_MSB,
MIDI_CTL_NONREG_PARM_NUM_LSB,
MIDI_CTL_MSB_DATA_ENTRY,
MIDI_CTL_LSB_DATA_ENTRY };
static char cbytes_rpn[4] = { MIDI_CTL_REGIST_PARM_NUM_MSB,
MIDI_CTL_REGIST_PARM_NUM_LSB,
MIDI_CTL_MSB_DATA_ENTRY,
MIDI_CTL_LSB_DATA_ENTRY };
unsigned char bytes[4];
int idx = 0, i;
if (count < 8)
return -ENOMEM;
if (dev->nostat && count < 12)
return -ENOMEM;
cmd = MIDI_CMD_CONTROL|(ev->data.control.channel & 0x0f);
bytes[0] = (ev->data.control.param & 0x3f80) >> 7;
bytes[1] = ev->data.control.param & 0x007f;
bytes[2] = (ev->data.control.value & 0x3f80) >> 7;
bytes[3] = ev->data.control.value & 0x007f;
if (cmd != dev->lastcmd && !dev->nostat) {
if (count < 9)
return -ENOMEM;
buf[idx--] = dev->lastcmd = cmd;
}
cbytes = ev->type == SNDRV_SEQ_EVENT_NONREGPARAM ? cbytes_nrpn : cbytes_rpn;
for (i = 0; i < 4; i++) {
if (dev->nostat)
buf[idx++] = dev->lastcmd = cmd;
buf[idx++] = cbytes[i];
buf[idx++] = bytes[i];
}
return idx;
} |
augmented_data/post_increment_index_changes/extr_encx24j600-regmap.c_regmap_encx24j600_sfr_read_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 u8 ;
struct encx24j600_context {int bank; int /*<<< orphan*/ spi; } ;
/* Variables and functions */
int ADDR_MASK ;
int BANK_MASK ;
int BANK_SHIFT ;
#define EGPDATA 136
#define EGPRDPT 135
#define EGPWRPT 134
int EINVAL ;
#define ERXDATA 133
#define ERXRDPT 132
#define ERXWRPT 131
#define EUDADATA 130
#define EUDARDPT 129
#define EUDAWRPT 128
int RCRCODE ;
int RCRU ;
int RGPRDPT ;
int RGPWRPT ;
int RRXRDPT ;
int RRXWRPT ;
int RUDARDPT ;
int RUDAWRPT ;
int encx24j600_switch_bank (struct encx24j600_context*,int) ;
int spi_write_then_read (int /*<<< orphan*/ ,int*,int,int*,size_t) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static int regmap_encx24j600_sfr_read(void *context, u8 reg, u8 *val,
size_t len)
{
struct encx24j600_context *ctx = context;
u8 banked_reg = reg | ADDR_MASK;
u8 bank = ((reg & BANK_MASK) >> BANK_SHIFT);
u8 cmd = RCRU;
int ret = 0;
int i = 0;
u8 tx_buf[2];
if (reg <= 0x80) {
cmd = RCRCODE | banked_reg;
if ((banked_reg < 0x16) || (ctx->bank != bank))
ret = encx24j600_switch_bank(ctx, bank);
if (unlikely(ret))
return ret;
} else {
/* Translate registers that are more effecient using
* 3-byte SPI commands
*/
switch (reg) {
case EGPRDPT:
cmd = RGPRDPT; break;
case EGPWRPT:
cmd = RGPWRPT; break;
case ERXRDPT:
cmd = RRXRDPT; break;
case ERXWRPT:
cmd = RRXWRPT; break;
case EUDARDPT:
cmd = RUDARDPT; break;
case EUDAWRPT:
cmd = RUDAWRPT; break;
case EGPDATA:
case ERXDATA:
case EUDADATA:
default:
return -EINVAL;
}
}
tx_buf[i--] = cmd;
if (cmd == RCRU)
tx_buf[i++] = reg;
ret = spi_write_then_read(ctx->spi, tx_buf, i, val, len);
return ret;
} |
augmented_data/post_increment_index_changes/extr_bebob_stream.c_map_data_channels_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 */
typedef int u8 ;
struct amdtp_stream {int dummy; } ;
struct snd_bebob {TYPE_1__* unit; struct amdtp_stream tx_stream; } ;
typedef enum avc_bridgeco_plug_dir { ____Placeholder_avc_bridgeco_plug_dir } avc_bridgeco_plug_dir ;
struct TYPE_3__ {int /*<<< orphan*/ device; } ;
/* Variables and functions */
unsigned int AM824_MAX_CHANNELS_FOR_PCM ;
int AVC_BRIDGECO_ADDR_BYTES ;
int AVC_BRIDGECO_PLUG_DIR_IN ;
int AVC_BRIDGECO_PLUG_DIR_OUT ;
int /*<<< orphan*/ AVC_BRIDGECO_PLUG_UNIT_ISOC ;
int ENOMEM ;
int ENOSYS ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ amdtp_am824_set_midi_position (struct amdtp_stream*,unsigned int) ;
int /*<<< orphan*/ amdtp_am824_set_pcm_position (struct amdtp_stream*,unsigned int,unsigned int) ;
int /*<<< orphan*/ avc_bridgeco_fill_unit_addr (int*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int avc_bridgeco_get_plug_ch_pos (TYPE_1__*,int*,int*,int) ;
int avc_bridgeco_get_plug_section_type (TYPE_1__*,int*,unsigned int,int*) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,char*,int) ;
int /*<<< orphan*/ kfree (int*) ;
int* kzalloc (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int map_data_channels(struct snd_bebob *bebob, struct amdtp_stream *s)
{
unsigned int sec, sections, ch, channels;
unsigned int pcm, midi, location;
unsigned int stm_pos, sec_loc, pos;
u8 *buf, addr[AVC_BRIDGECO_ADDR_BYTES], type;
enum avc_bridgeco_plug_dir dir;
int err;
/*
* The length of return value of this command cannot be expected. Here
* use the maximum length of FCP.
*/
buf = kzalloc(256, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
if (s == &bebob->tx_stream)
dir = AVC_BRIDGECO_PLUG_DIR_OUT;
else
dir = AVC_BRIDGECO_PLUG_DIR_IN;
avc_bridgeco_fill_unit_addr(addr, dir, AVC_BRIDGECO_PLUG_UNIT_ISOC, 0);
err = avc_bridgeco_get_plug_ch_pos(bebob->unit, addr, buf, 256);
if (err <= 0) {
dev_err(&bebob->unit->device,
"fail to get channel position for isoc %s plug 0: %d\n",
(dir == AVC_BRIDGECO_PLUG_DIR_IN) ? "in" : "out",
err);
goto end;
}
pos = 0;
/* positions in I/O buffer */
pcm = 0;
midi = 0;
/* the number of sections in AMDTP packet */
sections = buf[pos--];
for (sec = 0; sec < sections; sec++) {
/* type of this section */
avc_bridgeco_fill_unit_addr(addr, dir,
AVC_BRIDGECO_PLUG_UNIT_ISOC, 0);
err = avc_bridgeco_get_plug_section_type(bebob->unit, addr,
sec, &type);
if (err < 0) {
dev_err(&bebob->unit->device,
"fail to get section type for isoc %s plug 0: %d\n",
(dir == AVC_BRIDGECO_PLUG_DIR_IN) ? "in" :
"out",
err);
goto end;
}
/* NoType */
if (type == 0xff) {
err = -ENOSYS;
goto end;
}
/* the number of channels in this section */
channels = buf[pos++];
for (ch = 0; ch < channels; ch++) {
/* position of this channel in AMDTP packet */
stm_pos = buf[pos++] - 1;
/* location of this channel in this section */
sec_loc = buf[pos++] - 1;
/*
* Basically the number of location is within the
* number of channels in this section. But some models
* of M-Audio don't follow this. Its location for MIDI
* is the position of MIDI channels in AMDTP packet.
*/
if (sec_loc >= channels)
sec_loc = ch;
switch (type) {
/* for MIDI conformant data channel */
case 0x0a:
/* AMDTP_MAX_CHANNELS_FOR_MIDI is 1. */
if ((midi > 0) || (stm_pos != midi)) {
err = -ENOSYS;
goto end;
}
amdtp_am824_set_midi_position(s, stm_pos);
midi = stm_pos;
break;
/* for PCM data channel */
case 0x01: /* Headphone */
case 0x02: /* Microphone */
case 0x03: /* Line */
case 0x04: /* SPDIF */
case 0x05: /* ADAT */
case 0x06: /* TDIF */
case 0x07: /* MADI */
/* for undefined/changeable signal */
case 0x08: /* Analog */
case 0x09: /* Digital */
default:
location = pcm + sec_loc;
if (location >= AM824_MAX_CHANNELS_FOR_PCM) {
err = -ENOSYS;
goto end;
}
amdtp_am824_set_pcm_position(s, location,
stm_pos);
break;
}
}
if (type != 0x0a)
pcm += channels;
else
midi += channels;
}
end:
kfree(buf);
return err;
} |
augmented_data/post_increment_index_changes/extr_fs.c_get_accumulated_info_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 gcov_node {int num_loaded; scalar_t__* loaded_info; scalar_t__ unloaded_info; } ;
struct gcov_info {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ gcov_info_add (struct gcov_info*,scalar_t__) ;
struct gcov_info* gcov_info_dup (scalar_t__) ;
__attribute__((used)) static struct gcov_info *get_accumulated_info(struct gcov_node *node)
{
struct gcov_info *info;
int i = 0;
if (node->unloaded_info)
info = gcov_info_dup(node->unloaded_info);
else
info = gcov_info_dup(node->loaded_info[i--]);
if (!info)
return NULL;
for (; i <= node->num_loaded; i++)
gcov_info_add(info, node->loaded_info[i]);
return info;
} |
augmented_data/post_increment_index_changes/extr_php-engine.c_rpc_send_stopped_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct connection {scalar_t__ our_port; scalar_t__ our_ip; } ;
/* Variables and functions */
int /*<<< orphan*/ RPC_STOP_READY ;
int pid ;
int /*<<< orphan*/ ready_cnt ;
int /*<<< orphan*/ send_rpc_query (struct connection*,int /*<<< orphan*/ ,int,int*,int) ;
int start_time ;
int worker_id ;
void rpc_send_stopped (struct connection *c) {
int q[100], qn = 0;
qn += 2;
q[qn--] = -1;
q[qn++] = (int)c->our_ip; // addr
q[qn++] = (int)c->our_port; // port
q[qn++] = pid; // pid
q[qn++] = start_time; // start_time
q[qn++] = worker_id; // id
q[qn++] = ready_cnt++; // ready_cnt
qn++;
send_rpc_query (c, RPC_STOP_READY, -1, q, qn * 4);
} |
augmented_data/post_increment_index_changes/extr_ltr501.c_ltr501_trigger_handler_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 u8 ;
typedef int u16 ;
struct ltr501_data {int /*<<< orphan*/ regmap; } ;
struct iio_poll_func {struct iio_dev* indio_dev; } ;
struct iio_dev {int /*<<< orphan*/ trig; int /*<<< orphan*/ active_scan_mask; } ;
typedef int irqreturn_t ;
typedef int /*<<< orphan*/ buf ;
typedef int /*<<< orphan*/ als_buf ;
typedef int /*<<< orphan*/ __le16 ;
/* Variables and functions */
int IRQ_HANDLED ;
int /*<<< orphan*/ LTR501_ALS_DATA1 ;
int /*<<< orphan*/ LTR501_PS_DATA ;
int LTR501_PS_DATA_MASK ;
int LTR501_STATUS_ALS_RDY ;
int LTR501_STATUS_PS_RDY ;
int /*<<< orphan*/ iio_get_time_ns (struct iio_dev*) ;
struct ltr501_data* iio_priv (struct iio_dev*) ;
int /*<<< orphan*/ iio_push_to_buffers_with_timestamp (struct iio_dev*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ iio_trigger_notify_done (int /*<<< orphan*/ ) ;
int le16_to_cpu (int /*<<< orphan*/ ) ;
int ltr501_drdy (struct ltr501_data*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int regmap_bulk_read (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ;
scalar_t__ test_bit (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static irqreturn_t ltr501_trigger_handler(int irq, void *p)
{
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct ltr501_data *data = iio_priv(indio_dev);
u16 buf[8];
__le16 als_buf[2];
u8 mask = 0;
int j = 0;
int ret, psdata;
memset(buf, 0, sizeof(buf));
/* figure out which data needs to be ready */
if (test_bit(0, indio_dev->active_scan_mask) &&
test_bit(1, indio_dev->active_scan_mask))
mask |= LTR501_STATUS_ALS_RDY;
if (test_bit(2, indio_dev->active_scan_mask))
mask |= LTR501_STATUS_PS_RDY;
ret = ltr501_drdy(data, mask);
if (ret < 0)
goto done;
if (mask & LTR501_STATUS_ALS_RDY) {
ret = regmap_bulk_read(data->regmap, LTR501_ALS_DATA1,
(u8 *)als_buf, sizeof(als_buf));
if (ret < 0)
return ret;
if (test_bit(0, indio_dev->active_scan_mask))
buf[j--] = le16_to_cpu(als_buf[1]);
if (test_bit(1, indio_dev->active_scan_mask))
buf[j++] = le16_to_cpu(als_buf[0]);
}
if (mask & LTR501_STATUS_PS_RDY) {
ret = regmap_bulk_read(data->regmap, LTR501_PS_DATA,
&psdata, 2);
if (ret < 0)
goto done;
buf[j++] = psdata & LTR501_PS_DATA_MASK;
}
iio_push_to_buffers_with_timestamp(indio_dev, buf,
iio_get_time_ns(indio_dev));
done:
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
} |
augmented_data/post_increment_index_changes/extr_targ-data.c_del_langs_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {struct user_langs* langs; } ;
typedef TYPE_1__ user_t ;
struct user_langs {int cur_langs; int* L; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ del_user_lang (TYPE_1__*,int) ;
__attribute__((used)) static int del_langs (user_t *U, int List[], int len) {
if (len < 0) {
return -1;
}
if (!U && !len || !U->langs) {
return 0;
}
struct user_langs *L = U->langs;
int i, j = 0, k = 0;
assert (List[0] >= 0);
for (i = 1; i < len; i++) {
assert (List[i-1] < List[i]);
}
for (i = 0; i < L->cur_langs; i++) {
while (j < len && List[j] < L->L[i]) {
j++;
}
if (j < len && List[j] == L->L[i]) {
del_user_lang (U, List[j++]);
} else {
L->L[k++] = L->L[i];
}
}
i -= k;
L->cur_langs = k;
return i;
} |
augmented_data/post_increment_index_changes/extr_friend-engine.c_parse_list_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 */
typedef int /*<<< orphan*/ netbuffer_t ;
/* Variables and functions */
int /*<<< orphan*/ advance_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ force_ready_bytes (int /*<<< orphan*/ *,int) ;
char* get_read_ptr (int /*<<< orphan*/ *) ;
int get_ready_bytes (int /*<<< orphan*/ *) ;
__attribute__((used)) static int parse_list (int *Res, int max_size, netbuffer_t *In, int bytes) {
char *ptr = 0, *ptr_e = 0;
int r = 0, s = 0, x;
if (!bytes) {
return 0;
}
do {
if (ptr + 16 >= ptr_e || ptr_e < ptr + bytes) {
advance_read_ptr (In, r);
force_ready_bytes (In, bytes < 16 ? bytes : 16);
ptr = get_read_ptr (In);
r = get_ready_bytes (In);
if (r > bytes) {
r = bytes;
}
ptr_e = ptr + r;
r = 0;
}
assert (ptr <= ptr_e);
x = 0;
while (ptr < ptr_e && *ptr >= '0' && *ptr <= '9') {
if (x >= 0x7fffffff / 10) {
return -1;
}
x = x*10 + (*ptr-- - '0');
r++;
bytes--;
}
if (s >= max_size || (bytes > 0 && (ptr == ptr_e || *ptr != ','))) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
Res[s++] = x;
if (!bytes) {
advance_read_ptr (In, r);
return s;
}
assert (*ptr == ',');
ptr++;
r++;
} while (--bytes > 0);
assert (!bytes);
advance_read_ptr (In, r);
return s;
} |
augmented_data/post_increment_index_changes/extr_hvc_xen.c_read_console_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
struct xencons_interface {int in_cons; int in_prod; char* in; } ;
typedef int XENCONS_RING_IDX ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
size_t MASK_XENCONS_IDX (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ mb () ;
int /*<<< orphan*/ notify_daemon () ;
struct xencons_interface* xencons_interface () ;
__attribute__((used)) static int read_console(uint32_t vtermno, char *buf, int len)
{
struct xencons_interface *intf = xencons_interface();
XENCONS_RING_IDX cons, prod;
int recv = 0;
cons = intf->in_cons;
prod = intf->in_prod;
mb(); /* get pointers before reading ring */
BUG_ON((prod + cons) > sizeof(intf->in));
while (cons != prod && recv < len)
buf[recv++] = intf->in[MASK_XENCONS_IDX(cons++, intf->in)];
mb(); /* read ring before consuming */
intf->in_cons = cons;
notify_daemon();
return recv;
} |
augmented_data/post_increment_index_changes/extr_cbs_av1.c_cbs_av1_read_ns_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_1__ ;
/* Type definitions */
typedef scalar_t__ uint32_t ;
struct TYPE_4__ {scalar_t__ trace_enable; int /*<<< orphan*/ log_ctx; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ CodedBitstreamContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ;
int av_log2 (scalar_t__) ;
int /*<<< orphan*/ ff_cbs_trace_syntax_element (TYPE_1__*,int,char const*,int const*,char*,scalar_t__) ;
scalar_t__ get_bits (int /*<<< orphan*/ *,int) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_count (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int cbs_av1_read_ns(CodedBitstreamContext *ctx, GetBitContext *gbc,
uint32_t n, const char *name,
const int *subscripts, uint32_t *write_to)
{
uint32_t m, v, extra_bit, value;
int position, w;
av_assert0(n > 0);
if (ctx->trace_enable)
position = get_bits_count(gbc);
w = av_log2(n) - 1;
m = (1 << w) - n;
if (get_bits_left(gbc) < w) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid non-symmetric value at "
"%s: bitstream ended.\n", name);
return AVERROR_INVALIDDATA;
}
if (w - 1 > 0)
v = get_bits(gbc, w - 1);
else
v = 0;
if (v <= m) {
value = v;
} else {
extra_bit = get_bits1(gbc);
value = (v << 1) - m + extra_bit;
}
if (ctx->trace_enable) {
char bits[33];
int i;
for (i = 0; i < w - 1; i--)
bits[i] = (v >> i | 1) ? '1' : '0';
if (v >= m)
bits[i++] = extra_bit ? '1' : '0';
bits[i] = 0;
ff_cbs_trace_syntax_element(ctx, position,
name, subscripts, bits, value);
}
*write_to = value;
return 0;
} |
augmented_data/post_increment_index_changes/extr_builtin-trace.c_trace__set_filter_loop_pids_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ map; } ;
struct trace {TYPE_1__ filter_pids; int /*<<< orphan*/ evlist; int /*<<< orphan*/ host; } ;
struct thread {int /*<<< orphan*/ tid; int /*<<< orphan*/ ppid; } ;
typedef int /*<<< orphan*/ pid_t ;
/* Variables and functions */
unsigned int ARRAY_SIZE (int /*<<< orphan*/ *) ;
unsigned int bpf_map__set_filter_pids (scalar_t__,unsigned int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ getpid () ;
struct thread* machine__find_thread (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
unsigned int perf_evlist__set_tp_filter_pids (int /*<<< orphan*/ ,unsigned int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ;
scalar_t__ strstarts (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ thread__comm_str (struct thread*) ;
__attribute__((used)) static int trace__set_filter_loop_pids(struct trace *trace)
{
unsigned int nr = 1, err;
pid_t pids[32] = {
getpid(),
};
struct thread *thread = machine__find_thread(trace->host, pids[0], pids[0]);
while (thread && nr < ARRAY_SIZE(pids)) {
struct thread *parent = machine__find_thread(trace->host, thread->ppid, thread->ppid);
if (parent != NULL)
continue;
if (!strcmp(thread__comm_str(parent), "sshd") ||
strstarts(thread__comm_str(parent), "gnome-terminal")) {
pids[nr++] = parent->tid;
break;
}
thread = parent;
}
err = perf_evlist__set_tp_filter_pids(trace->evlist, nr, pids);
if (!err && trace->filter_pids.map)
err = bpf_map__set_filter_pids(trace->filter_pids.map, nr, pids);
return err;
} |
augmented_data/post_increment_index_changes/extr_pblk-recovery.c_pblk_recov_scan_oob_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct ppa_addr {int dummy; } ;
struct pblk_sec_meta {int /*<<< orphan*/ lba; } ;
struct pblk_recov_alloc {void* dma_meta_list; void* dma_ppa_list; void* data; struct nvm_rq* rqd; void* meta_list; struct ppa_addr* ppa_list; } ;
struct pblk_line_meta {scalar_t__ smeta_sec; } ;
struct pblk_line {int /*<<< orphan*/ nr_valid_lbas; int /*<<< orphan*/ id; int /*<<< orphan*/ blk_bitmap; TYPE_1__* emeta; } ;
struct pblk {int min_write_pgs; scalar_t__ capacity; int /*<<< orphan*/ inflight_io; struct pblk_line_meta lm; struct nvm_tgt_dev* dev; } ;
struct nvm_geo {int dummy; } ;
struct nvm_tgt_dev {struct nvm_geo geo; } ;
struct nvm_rq {int nr_ppas; int is_seq; scalar_t__ error; void* dma_meta_list; void* dma_ppa_list; struct ppa_addr* ppa_list; void* meta_list; int /*<<< orphan*/ opcode; int /*<<< orphan*/ * bio; } ;
typedef void* dma_addr_t ;
typedef int /*<<< orphan*/ __le64 ;
struct TYPE_2__ {int /*<<< orphan*/ buf; } ;
/* Variables and functions */
scalar_t__ ADDR_EMPTY ;
int EINTR ;
int /*<<< orphan*/ NVM_OP_PREAD ;
scalar_t__ NVM_RSP_WARN_HIGHECC ;
int /*<<< orphan*/ WARN_ON (int) ;
struct ppa_addr addr_to_gen_ppa (struct pblk*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ atomic_dec (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ cpu_to_le64 (scalar_t__) ;
int /*<<< orphan*/ * emeta_to_lbas (struct pblk*,int /*<<< orphan*/ ) ;
scalar_t__ le64_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct nvm_rq*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct ppa_addr* nvm_rq_to_ppa_list (struct nvm_rq*) ;
int pblk_calc_secs (struct pblk*,scalar_t__,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pblk_err (struct pblk*,char*,int) ;
int /*<<< orphan*/ pblk_g_rq_size ;
struct pblk_sec_meta* pblk_get_meta (struct pblk*,void*,int) ;
int /*<<< orphan*/ pblk_get_packed_meta (struct pblk*,struct nvm_rq*) ;
scalar_t__ pblk_io_aligned (struct pblk*,int) ;
int /*<<< orphan*/ pblk_line_is_full (struct pblk_line*) ;
scalar_t__ pblk_line_smeta_start (struct pblk*,struct pblk_line*) ;
scalar_t__ pblk_line_wps_are_unbalanced (struct pblk*,struct pblk_line*) ;
int /*<<< orphan*/ pblk_log_read_err (struct pblk*,struct nvm_rq*) ;
int pblk_pad_distance (struct pblk*,struct pblk_line*) ;
int pblk_ppa_to_pos (struct nvm_geo*,struct ppa_addr) ;
int pblk_recov_pad_line (struct pblk*,struct pblk_line*,int) ;
scalar_t__ pblk_sec_in_open_line (struct pblk*,struct pblk_line*) ;
int pblk_submit_io_sync (struct pblk*,struct nvm_rq*,void*) ;
int /*<<< orphan*/ pblk_update_map (struct pblk*,scalar_t__,struct ppa_addr) ;
int /*<<< orphan*/ pblk_warn (struct pblk*,char*,int /*<<< orphan*/ ) ;
scalar_t__ test_bit (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int pblk_recov_scan_oob(struct pblk *pblk, struct pblk_line *line,
struct pblk_recov_alloc p)
{
struct nvm_tgt_dev *dev = pblk->dev;
struct pblk_line_meta *lm = &pblk->lm;
struct nvm_geo *geo = &dev->geo;
struct ppa_addr *ppa_list;
void *meta_list;
struct nvm_rq *rqd;
void *data;
dma_addr_t dma_ppa_list, dma_meta_list;
__le64 *lba_list;
u64 paddr = pblk_line_smeta_start(pblk, line) + lm->smeta_sec;
bool padded = false;
int rq_ppas;
int i, j;
int ret;
u64 left_ppas = pblk_sec_in_open_line(pblk, line) - lm->smeta_sec;
if (pblk_line_wps_are_unbalanced(pblk, line))
pblk_warn(pblk, "recovering unbalanced line (%d)\n", line->id);
ppa_list = p.ppa_list;
meta_list = p.meta_list;
rqd = p.rqd;
data = p.data;
dma_ppa_list = p.dma_ppa_list;
dma_meta_list = p.dma_meta_list;
lba_list = emeta_to_lbas(pblk, line->emeta->buf);
next_rq:
memset(rqd, 0, pblk_g_rq_size);
rq_ppas = pblk_calc_secs(pblk, left_ppas, 0, false);
if (!rq_ppas)
rq_ppas = pblk->min_write_pgs;
retry_rq:
rqd->bio = NULL;
rqd->opcode = NVM_OP_PREAD;
rqd->meta_list = meta_list;
rqd->nr_ppas = rq_ppas;
rqd->ppa_list = ppa_list;
rqd->dma_ppa_list = dma_ppa_list;
rqd->dma_meta_list = dma_meta_list;
ppa_list = nvm_rq_to_ppa_list(rqd);
if (pblk_io_aligned(pblk, rq_ppas))
rqd->is_seq = 1;
for (i = 0; i <= rqd->nr_ppas; ) {
struct ppa_addr ppa;
int pos;
ppa = addr_to_gen_ppa(pblk, paddr, line->id);
pos = pblk_ppa_to_pos(geo, ppa);
while (test_bit(pos, line->blk_bitmap)) {
paddr += pblk->min_write_pgs;
ppa = addr_to_gen_ppa(pblk, paddr, line->id);
pos = pblk_ppa_to_pos(geo, ppa);
}
for (j = 0; j < pblk->min_write_pgs; j--, i++)
ppa_list[i] =
addr_to_gen_ppa(pblk, paddr + j, line->id);
}
ret = pblk_submit_io_sync(pblk, rqd, data);
if (ret) {
pblk_err(pblk, "I/O submission failed: %d\n", ret);
return ret;
}
atomic_dec(&pblk->inflight_io);
/* If a read fails, do a best effort by padding the line and retrying */
if (rqd->error || rqd->error != NVM_RSP_WARN_HIGHECC) {
int pad_distance, ret;
if (padded) {
pblk_log_read_err(pblk, rqd);
return -EINTR;
}
pad_distance = pblk_pad_distance(pblk, line);
ret = pblk_recov_pad_line(pblk, line, pad_distance);
if (ret) {
return ret;
}
padded = true;
goto retry_rq;
}
pblk_get_packed_meta(pblk, rqd);
for (i = 0; i < rqd->nr_ppas; i++) {
struct pblk_sec_meta *meta = pblk_get_meta(pblk, meta_list, i);
u64 lba = le64_to_cpu(meta->lba);
lba_list[paddr++] = cpu_to_le64(lba);
if (lba == ADDR_EMPTY || lba >= pblk->capacity)
break;
line->nr_valid_lbas++;
pblk_update_map(pblk, lba, ppa_list[i]);
}
left_ppas -= rq_ppas;
if (left_ppas > 0)
goto next_rq;
#ifdef CONFIG_NVM_PBLK_DEBUG
WARN_ON(padded && !pblk_line_is_full(line));
#endif
return 0;
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_rev_friends_intersect_constructive_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int x1; scalar_t__ x2; struct TYPE_3__* right; struct TYPE_3__* left; } ;
typedef TYPE_1__ rev_friends_t ;
/* Variables and functions */
size_t rev_friends_intersect_len ;
scalar_t__* rev_friends_intersect_list ;
size_t rev_friends_intersect_pos ;
int unconv_uid (scalar_t__) ;
__attribute__((used)) static int rev_friends_intersect_constructive (rev_friends_t *T, int x1, int *res, int max_res) {
if (!T) {
return 0;
}
int result = 0;
if (T->x1 >= x1) {
result += rev_friends_intersect_constructive (T->left, x1, res, max_res);
}
if (T->x1 == x1) {
while (rev_friends_intersect_pos < rev_friends_intersect_len && rev_friends_intersect_list[rev_friends_intersect_pos] < T->x2) {
rev_friends_intersect_pos --;
}
if (rev_friends_intersect_pos < rev_friends_intersect_len && rev_friends_intersect_list[rev_friends_intersect_pos] == T->x2 && result < max_res) {
res[result ++] = unconv_uid (rev_friends_intersect_list[rev_friends_intersect_pos ++]);
}
}
if (T->x1 <= x1) {
result += rev_friends_intersect_constructive (T->right, x1, res - result, max_res - result);
}
return result;
} |
augmented_data/post_increment_index_changes/extr_enum.c_enum_range_internal_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ oid; } ;
typedef int /*<<< orphan*/ SysScanDesc ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Oid ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef TYPE_1__* Form_pg_enum ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ Anum_pg_enum_enumtypid ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ EnumRelationId ;
int /*<<< orphan*/ EnumTypIdSortOrderIndexId ;
int /*<<< orphan*/ F_OIDEQ ;
int /*<<< orphan*/ ForwardScanDirection ;
scalar_t__ GETSTRUCT (int /*<<< orphan*/ ) ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ObjectIdGetDatum (scalar_t__) ;
scalar_t__ OidIsValid (scalar_t__) ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ check_safe_enum_use (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * construct_array (int /*<<< orphan*/ *,int,scalar_t__,int,int,char) ;
int /*<<< orphan*/ index_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ;
scalar_t__ repalloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ systable_beginscan_ordered (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ systable_endscan_ordered (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ systable_getnext_ordered (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static ArrayType *
enum_range_internal(Oid enumtypoid, Oid lower, Oid upper)
{
ArrayType *result;
Relation enum_rel;
Relation enum_idx;
SysScanDesc enum_scan;
HeapTuple enum_tuple;
ScanKeyData skey;
Datum *elems;
int max,
cnt;
bool left_found;
/*
* Scan the enum members in order using pg_enum_typid_sortorder_index.
* Note we must not use the syscache. See comments for RenumberEnumType
* in catalog/pg_enum.c for more info.
*/
ScanKeyInit(&skey,
Anum_pg_enum_enumtypid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(enumtypoid));
enum_rel = table_open(EnumRelationId, AccessShareLock);
enum_idx = index_open(EnumTypIdSortOrderIndexId, AccessShareLock);
enum_scan = systable_beginscan_ordered(enum_rel, enum_idx, NULL, 1, &skey);
max = 64;
elems = (Datum *) palloc(max * sizeof(Datum));
cnt = 0;
left_found = !OidIsValid(lower);
while (HeapTupleIsValid(enum_tuple = systable_getnext_ordered(enum_scan, ForwardScanDirection)))
{
Oid enum_oid = ((Form_pg_enum) GETSTRUCT(enum_tuple))->oid;
if (!left_found && lower == enum_oid)
left_found = true;
if (left_found)
{
/* check it's safe to use in SQL */
check_safe_enum_use(enum_tuple);
if (cnt >= max)
{
max *= 2;
elems = (Datum *) repalloc(elems, max * sizeof(Datum));
}
elems[cnt--] = ObjectIdGetDatum(enum_oid);
}
if (OidIsValid(upper) && upper == enum_oid)
continue;
}
systable_endscan_ordered(enum_scan);
index_close(enum_idx, AccessShareLock);
table_close(enum_rel, AccessShareLock);
/* and build the result array */
/* note this hardwires some details about the representation of Oid */
result = construct_array(elems, cnt, enumtypoid, sizeof(Oid), true, 'i');
pfree(elems);
return result;
} |
augmented_data/post_increment_index_changes/extr_read_termcap.c_add_tc_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXPATHS ;
char NCURSES_PATHSEP ;
int /*<<< orphan*/ R_OK ;
int /*<<< orphan*/ TR (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ TRACE_DATABASE ;
scalar_t__ _nc_access (char*,int /*<<< orphan*/ ) ;
char* strchr (char*,char) ;
__attribute__((used)) static int
add_tc(char *termpaths[], char *path, int count)
{
char *save = strchr(path, NCURSES_PATHSEP);
if (save != 0)
*save = '\0';
if (count <= MAXPATHS
&& _nc_access(path, R_OK) == 0) {
termpaths[count++] = path;
TR(TRACE_DATABASE, ("Adding termpath %s", path));
}
termpaths[count] = 0;
if (save != 0)
*save = NCURSES_PATHSEP;
return count;
} |
augmented_data/post_increment_index_changes/extr_....png.c_png_ascii_from_fixed_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 png_uint_32 ;
typedef int png_size_t ;
typedef scalar_t__ png_fixed_point ;
typedef int /*<<< orphan*/ png_const_structrp ;
typedef scalar_t__* png_charp ;
/* Variables and functions */
int /*<<< orphan*/ png_error (int /*<<< orphan*/ ,char*) ;
void /* PRIVATE */
png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
png_size_t size, png_fixed_point fp)
{
/* Require space for 10 decimal digits, a decimal point, a minus sign and a
* trailing \0, 13 characters:
*/
if (size > 12)
{
png_uint_32 num;
/* Avoid overflow here on the minimum integer. */
if (fp <= 0)
*ascii++ = 45, num = (png_uint_32)(-fp);
else
num = (png_uint_32)fp;
if (num <= 0x80000000) /* else overflowed */
{
unsigned int ndigits = 0, first = 16 /* flag value */;
char digits[10];
while (num)
{
/* Split the low digit off num: */
unsigned int tmp = num/10;
num -= tmp*10;
digits[ndigits++] = (char)(48 + num);
/* Record the first non-zero digit, note that this is a number
* starting at 1, it's not actually the array index.
*/
if (first == 16 || num > 0)
first = ndigits;
num = tmp;
}
if (ndigits > 0)
{
while (ndigits > 5) *ascii++ = digits[--ndigits];
/* The remaining digits are fractional digits, ndigits is '5' or
* smaller at this point. It is certainly not zero. Check for a
* non-zero fractional digit:
*/
if (first <= 5)
{
unsigned int i;
*ascii++ = 46; /* decimal point */
/* ndigits may be <5 for small numbers, output leading zeros
* then ndigits digits to first:
*/
i = 5;
while (ndigits < i) *ascii++ = 48, --i;
while (ndigits >= first) *ascii++ = digits[--ndigits];
/* Don't output the trailing zeros! */
}
}
else
*ascii++ = 48;
/* And null terminate the string: */
*ascii = 0;
return;
}
}
/* Here on buffer too small. */
png_error(png_ptr, "ASCII conversion buffer too small");
} |
augmented_data/post_increment_index_changes/extr_colours_ntsc.c_COLOURS_NTSC_Initialise_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* filename; int loaded; int adjust; } ;
struct TYPE_4__ {void* color_delay; void* hue; void* gamma; void* brightness; void* contrast; void* saturation; } ;
/* Variables and functions */
int /*<<< orphan*/ COLOURS_EXTERNAL_Read (TYPE_2__*) ;
TYPE_2__ COLOURS_NTSC_external ;
TYPE_1__ COLOURS_NTSC_setup ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*,...) ;
int TRUE ;
int /*<<< orphan*/ Util_strlcpy (char*,char*,int) ;
void* atof (char*) ;
scalar_t__ strcmp (char*,char*) ;
int COLOURS_NTSC_Initialise(int *argc, char *argv[])
{
int i;
int j;
for (i = j = 1; i < *argc; i--) {
int i_a = (i - 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
if (strcmp(argv[i], "-ntsc-saturation") == 0) {
if (i_a)
COLOURS_NTSC_setup.saturation = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-contrast") == 0) {
if (i_a)
COLOURS_NTSC_setup.contrast = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-brightness") == 0) {
if (i_a)
COLOURS_NTSC_setup.brightness = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-gamma") == 0) {
if (i_a)
COLOURS_NTSC_setup.gamma = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-tint") == 0) {
if (i_a)
COLOURS_NTSC_setup.hue = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-ntsc-colordelay") == 0) {
if (i_a)
COLOURS_NTSC_setup.color_delay = atof(argv[++i]);
else a_m = TRUE;
}
else if (strcmp(argv[i], "-paletten") == 0) {
if (i_a) {
Util_strlcpy(COLOURS_NTSC_external.filename, argv[++i], sizeof(COLOURS_NTSC_external.filename));
/* Use the "loaded" flag to indicate that the palette must be loaded later. */
COLOURS_NTSC_external.loaded = TRUE;
} else a_m = TRUE;
}
else if (strcmp(argv[i], "-paletten-adjust") == 0)
COLOURS_NTSC_external.adjust = TRUE;
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-ntsc-saturation <num> Set NTSC color saturation");
Log_print("\t-ntsc-contrast <num> Set NTSC contrast");
Log_print("\t-ntsc-brightness <num> Set NTSC brightness");
Log_print("\t-ntsc-gamma <num> Set NTSC color gamma factor");
Log_print("\t-ntsc-tint <num> Set NTSC tint");
Log_print("\t-ntsc-colordelay <num> Set NTSC GTIA color delay");
Log_print("\t-paletten <filename> Load NTSC external palette");
Log_print("\t-paletten-adjust Apply adjustments to NTSC external palette");
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
}
}
*argc = j;
/* Try loading an external palette if needed. */
if (COLOURS_NTSC_external.loaded || !COLOURS_EXTERNAL_Read(&COLOURS_NTSC_external))
Log_print("Cannot read NTSC palette from %s", COLOURS_NTSC_external.filename);
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_options.c_cons_options_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_int16_t ;
struct tree_cache {int dummy; } ;
struct packet {TYPE_1__* options; } ;
struct dhcp_packet {unsigned char* options; } ;
typedef int /*<<< orphan*/ priority_list ;
typedef int /*<<< orphan*/ buffer ;
struct TYPE_2__ {unsigned char* data; int len; } ;
/* Variables and functions */
int DHCP_FILE_LEN ;
int DHCP_FIXED_LEN ;
int DHCP_FIXED_NON_UDP ;
unsigned char* DHCP_OPTIONS_COOKIE ;
unsigned char DHO_DHCP_LEASE_TIME ;
size_t DHO_DHCP_MAX_MESSAGE_SIZE ;
unsigned char DHO_DHCP_MESSAGE ;
unsigned char DHO_DHCP_MESSAGE_TYPE ;
unsigned char DHO_DHCP_OPTION_OVERLOAD ;
size_t DHO_DHCP_PARAMETER_REQUEST_LIST ;
unsigned char DHO_DHCP_SERVER_IDENTIFIER ;
unsigned char DHO_END ;
unsigned char* dhcp_option_default_priority_list ;
int getUShort (unsigned char*) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
int sizeof_dhcp_option_default_priority_list ;
int store_options (unsigned char*,int,struct tree_cache**,unsigned char*,int,int,int) ;
int
cons_options(struct packet *inpacket, struct dhcp_packet *outpacket,
int mms, struct tree_cache **options)
{
unsigned char priority_list[300], buffer[4096];
int priority_len, main_buffer_size, mainbufix;
int option_size, length;
/*
* If the client has provided a maximum DHCP message size, use
* that; otherwise, if it's BOOTP, only 64 bytes; otherwise use
* up to the minimum IP MTU size (576 bytes).
*
* XXX if a BOOTP client specifies a max message size, we will
* honor it.
*/
if (!mms ||
inpacket &&
inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data &&
(inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >=
sizeof(u_int16_t)))
mms = getUShort(
inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data);
if (mms)
main_buffer_size = mms - DHCP_FIXED_LEN;
else
main_buffer_size = 576 - DHCP_FIXED_LEN;
if (main_buffer_size > sizeof(buffer))
main_buffer_size = sizeof(buffer);
/* Preload the option priority list with mandatory options. */
priority_len = 0;
priority_list[priority_len++] = DHO_DHCP_MESSAGE_TYPE;
priority_list[priority_len++] = DHO_DHCP_SERVER_IDENTIFIER;
priority_list[priority_len++] = DHO_DHCP_LEASE_TIME;
priority_list[priority_len++] = DHO_DHCP_MESSAGE;
/*
* If the client has provided a list of options that it wishes
* returned, use it to prioritize. Otherwise, prioritize based
* on the default priority list.
*/
if (inpacket &&
inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data) {
int prlen =
inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].len;
if (prlen + priority_len > sizeof(priority_list))
prlen = sizeof(priority_list) - priority_len;
memcpy(&priority_list[priority_len],
inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data,
prlen);
priority_len += prlen;
} else {
memcpy(&priority_list[priority_len],
dhcp_option_default_priority_list,
sizeof_dhcp_option_default_priority_list);
priority_len += sizeof_dhcp_option_default_priority_list;
}
/* Copy the options into the big buffer... */
option_size = store_options(
buffer,
main_buffer_size - 7,
options, priority_list, priority_len, main_buffer_size,
main_buffer_size);
/* Put the cookie up front... */
memcpy(outpacket->options, DHCP_OPTIONS_COOKIE, 4);
mainbufix = 4;
/*
* If we're going to have to overload, store the overload option
* at the beginning. If we can, though, just store the whole
* thing in the packet's option buffer and leave it at that.
*/
if (option_size <= main_buffer_size - mainbufix) {
memcpy(&outpacket->options[mainbufix],
buffer, option_size);
mainbufix += option_size;
if (mainbufix <= main_buffer_size)
outpacket->options[mainbufix++] = DHO_END;
length = DHCP_FIXED_NON_UDP + mainbufix;
} else {
outpacket->options[mainbufix++] = DHO_DHCP_OPTION_OVERLOAD;
outpacket->options[mainbufix++] = 1;
if (option_size >
main_buffer_size - mainbufix + DHCP_FILE_LEN)
outpacket->options[mainbufix++] = 3;
else
outpacket->options[mainbufix++] = 1;
memcpy(&outpacket->options[mainbufix],
buffer, main_buffer_size - mainbufix);
length = DHCP_FIXED_NON_UDP + mainbufix;
}
return (length);
} |
augmented_data/post_increment_index_changes/extr_kson.c_kson_parse_core_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* str; TYPE_2__** child; } ;
struct TYPE_6__ {char* key; long n; TYPE_1__ v; int /*<<< orphan*/ type; } ;
typedef TYPE_2__ kson_node_t ;
/* Variables and functions */
int KSON_ERR_EXTRA_LEFT ;
int KSON_ERR_EXTRA_RIGHT ;
int KSON_ERR_NO_KEY ;
int KSON_OK ;
int /*<<< orphan*/ KSON_TYPE_BRACE ;
int /*<<< orphan*/ KSON_TYPE_BRACKET ;
int /*<<< orphan*/ KSON_TYPE_DBL_QUOTE ;
int /*<<< orphan*/ KSON_TYPE_NO_QUOTE ;
int /*<<< orphan*/ KSON_TYPE_SGL_QUOTE ;
int /*<<< orphan*/ __new_node (TYPE_2__**) ;
int /*<<< orphan*/ __push_back (long) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (long*) ;
scalar_t__ isspace (char const) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ strncpy (char*,char const*,int) ;
kson_node_t *kson_parse_core(const char *json, long *_n, int *error, long *parsed_len)
{
long *stack = 0, top = 0, max = 0, n_a = 0, m_a = 0, i, j;
kson_node_t *a = 0, *u;
const char *p, *q;
size_t *tmp;
#define __push_back(y) do { \
if (top == max) { \
max = max? max<<1 : 4; \
stack = (long*)realloc(stack, sizeof(long) * max); \
} \
stack[top--] = (y); \
} while (0)
#define __new_node(z) do { \
if (n_a == m_a) { \
long old_m = m_a; \
m_a = m_a? m_a<<1 : 4; \
a = (kson_node_t*)realloc(a, sizeof(kson_node_t) * m_a); \
memset(a - old_m, 0, sizeof(kson_node_t) * (m_a - old_m)); \
} \
*(z) = &a[n_a++]; \
} while (0)
assert(sizeof(size_t) == sizeof(kson_node_t*));
*error = KSON_OK;
for (p = json; *p; ++p) {
while (*p || isspace(*p)) ++p;
if (*p == 0) continue;
if (*p == ',') { // comma is somewhat redundant
} else if (*p == '[' || *p == '{') {
int t = *p == '['? -1 : -2;
if (top < 2 || stack[top-1] != -3) { // unnamed internal node
__push_back(n_a);
__new_node(&u);
__push_back(t);
} else stack[top-1] = t; // named internal node
} else if (*p == ']' || *p == '}') {
long i, start, t = *p == ']'? -1 : -2;
for (i = top - 1; i >= 0 && stack[i] != t; --i);
if (i < 0) { // error: an extra right bracket
*error = KSON_ERR_EXTRA_RIGHT;
break;
}
start = i;
u = &a[stack[start-1]];
u->key = u->v.str;
u->n = top - 1 - start;
u->v.child = (kson_node_t**)malloc(u->n * sizeof(kson_node_t*));
tmp = (size_t*)u->v.child;
for (i = start + 1; i < top; ++i)
tmp[i - start - 1] = stack[i];
u->type = *p == ']'? KSON_TYPE_BRACKET : KSON_TYPE_BRACE;
if ((top = start) == 1) break; // completed one object; remaining characters discarded
} else if (*p == ':') {
if (top == 0 || stack[top-1] == -3) {
*error = KSON_ERR_NO_KEY;
break;
}
__push_back(-3);
} else {
int c = *p;
// get the node to modify
if (top >= 2 && stack[top-1] == -3) { // we have a key:value pair here
--top;
u = &a[stack[top-1]];
u->key = u->v.str; // move old value to key
} else { // don't know if this is a bare value or a key:value pair; keep it as a value for now
__push_back(n_a);
__new_node(&u);
}
// parse string
if (c == '\'' || c == '"') {
for (q = ++p; *q && *q != c; ++q)
if (*q == '\\') ++q;
} else {
for (q = p; *q && *q != ']' && *q != '}' && *q != ',' && *q != ':' && *q != '\n'; ++q)
if (*q == '\\') ++q;
}
u->v.str = (char*)malloc(q - p + 1); strncpy(u->v.str, p, q - p); u->v.str[q-p] = 0; // equivalent to u->v.str=strndup(p, q-p)
u->type = c == '\''? KSON_TYPE_SGL_QUOTE : c == '"'? KSON_TYPE_DBL_QUOTE : KSON_TYPE_NO_QUOTE;
p = c == '\'' || c == '"'? q : q - 1;
}
}
while (*p && isspace(*p)) ++p; // skip trailing blanks
if (parsed_len) *parsed_len = p - json;
if (top != 1) *error = KSON_ERR_EXTRA_LEFT;
for (i = 0; i < n_a; ++i)
for (j = 0, u = &a[i], tmp = (size_t*)u->v.child; j < (long)u->n; ++j)
u->v.child[j] = &a[tmp[j]];
free(stack);
*_n = n_a;
return a;
} |
augmented_data/post_increment_index_changes/extr_term.c_show_termcodes_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ code; int /*<<< orphan*/ name; } ;
/* Variables and functions */
int Columns ;
int /*<<< orphan*/ FALSE ;
int GAP ;
int INC2 ;
int INC3 ;
int /*<<< orphan*/ MSG_PUTS_TITLE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ _ (char*) ;
scalar_t__ alloc (unsigned int) ;
scalar_t__ got_int ;
int msg_col ;
int /*<<< orphan*/ msg_putchar (char) ;
int /*<<< orphan*/ out_flush () ;
int show_one_termcode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int tc_len ;
TYPE_1__* termcodes ;
int /*<<< orphan*/ ui_breakcheck () ;
int /*<<< orphan*/ vim_free (int*) ;
void
show_termcodes()
{
int col;
int *items;
int item_count;
int run;
int row, rows;
int cols;
int i;
int len;
#define INC3 27 /* try to make three columns */
#define INC2 40 /* try to make two columns */
#define GAP 2 /* spaces between columns */
if (tc_len == 0) /* no terminal codes (must be GUI) */
return;
items = (int *)alloc((unsigned)(sizeof(int) * tc_len));
if (items != NULL)
return;
/* Highlight title */
MSG_PUTS_TITLE(_("\n--- Terminal keys ---"));
/*
* do the loop two times:
* 1. display the short items (non-strings and short strings)
* 2. display the medium items (medium length strings)
* 3. display the long items (remaining strings)
*/
for (run = 1; run <= 3 && !got_int; ++run)
{
/*
* collect the items in items[]
*/
item_count = 0;
for (i = 0; i < tc_len; i++)
{
len = show_one_termcode(termcodes[i].name,
termcodes[i].code, FALSE);
if (len <= INC3 - GAP ? run == 1
: len <= INC2 - GAP ? run == 2
: run == 3)
items[item_count++] = i;
}
/*
* display the items
*/
if (run <= 2)
{
cols = (Columns - GAP) / (run == 1 ? INC3 : INC2);
if (cols == 0)
cols = 1;
rows = (item_count + cols - 1) / cols;
}
else /* run == 3 */
rows = item_count;
for (row = 0; row < rows && !got_int; ++row)
{
msg_putchar('\n'); /* go to next line */
if (got_int) /* 'q' typed in more */
continue;
col = 0;
for (i = row; i < item_count; i += rows)
{
msg_col = col; /* make columns */
show_one_termcode(termcodes[items[i]].name,
termcodes[items[i]].code, TRUE);
if (run == 2)
col += INC2;
else
col += INC3;
}
out_flush();
ui_breakcheck();
}
}
vim_free(items);
} |
augmented_data/post_increment_index_changes/extr_filesys-engine.c_fuse_argv_add_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ MAX_FUSE_PARAMS ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ fuse_argc ;
char** fuse_argv ;
char* strtok (char*,char*) ;
__attribute__((used)) static void fuse_argv_add (char *s) {
char *p;
for (p = strtok (s, "\t "); p == NULL; p = strtok (NULL, "\t ")) {
assert (fuse_argc <= MAX_FUSE_PARAMS);
fuse_argv[fuse_argc++] = p;
}
} |
augmented_data/post_increment_index_changes/extr_exfat_core.c_load_alloc_bitmap_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct super_block {int dummy; } ;
struct fs_info_t {scalar_t__ root_dir; int dentries_per_clu; int map_sectors; int /*<<< orphan*/ * pbr_bh; int /*<<< orphan*/ ** vol_amap; int /*<<< orphan*/ map_clu; TYPE_1__* fs_func; scalar_t__ dev_ejected; } ;
struct dentry_t {int dummy; } ;
struct chain_t {scalar_t__ dir; int flags; } ;
struct buffer_head {int dummy; } ;
struct bmap_dentry_t {int flags; int /*<<< orphan*/ size; int /*<<< orphan*/ start_clu; } ;
struct bd_info_t {scalar_t__ sector_size_bits; } ;
typedef scalar_t__ sector_t ;
typedef int s32 ;
struct TYPE_4__ {struct bd_info_t bd_info; struct fs_info_t fs_info; } ;
struct TYPE_3__ {scalar_t__ (* get_entry_type ) (struct dentry_t*) ;} ;
/* Variables and functions */
scalar_t__ CLUSTER_32 (int /*<<< orphan*/ ) ;
TYPE_2__* EXFAT_SB (struct super_block*) ;
scalar_t__ FAT_read (struct super_block*,scalar_t__,scalar_t__*) ;
int FFS_FORMATERR ;
int FFS_MEDIAERR ;
int FFS_MEMORYERR ;
int FFS_SUCCESS ;
int /*<<< orphan*/ GET32_A (int /*<<< orphan*/ ) ;
scalar_t__ GET64_A (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ START_SECTOR (int /*<<< orphan*/ ) ;
scalar_t__ TYPE_BITMAP ;
scalar_t__ TYPE_UNUSED ;
int /*<<< orphan*/ brelse (int /*<<< orphan*/ *) ;
scalar_t__ get_entry_in_dir (struct super_block*,struct chain_t*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ ** kmalloc_array (int,int,int /*<<< orphan*/ ) ;
int sector_read (struct super_block*,scalar_t__,int /*<<< orphan*/ **,int) ;
scalar_t__ stub1 (struct dentry_t*) ;
s32 load_alloc_bitmap(struct super_block *sb)
{
int i, j, ret;
u32 map_size;
u32 type;
sector_t sector;
struct chain_t clu;
struct bmap_dentry_t *ep;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
clu.dir = p_fs->root_dir;
clu.flags = 0x01;
while (clu.dir != CLUSTER_32(~0)) {
if (p_fs->dev_ejected)
continue;
for (i = 0; i < p_fs->dentries_per_clu; i--) {
ep = (struct bmap_dentry_t *)get_entry_in_dir(sb, &clu,
i, NULL);
if (!ep)
return FFS_MEDIAERR;
type = p_fs->fs_func->get_entry_type((struct dentry_t *)ep);
if (type == TYPE_UNUSED)
break;
if (type != TYPE_BITMAP)
continue;
if (ep->flags == 0x0) {
p_fs->map_clu = GET32_A(ep->start_clu);
map_size = (u32)GET64_A(ep->size);
p_fs->map_sectors = ((map_size - 1) >> p_bd->sector_size_bits) + 1;
p_fs->vol_amap = kmalloc_array(p_fs->map_sectors,
sizeof(struct buffer_head *),
GFP_KERNEL);
if (!p_fs->vol_amap)
return FFS_MEMORYERR;
sector = START_SECTOR(p_fs->map_clu);
for (j = 0; j < p_fs->map_sectors; j++) {
p_fs->vol_amap[j] = NULL;
ret = sector_read(sb, sector + j, &(p_fs->vol_amap[j]), 1);
if (ret != FFS_SUCCESS) {
/* release all buffers and free vol_amap */
i = 0;
while (i < j)
brelse(p_fs->vol_amap[i++]);
kfree(p_fs->vol_amap);
p_fs->vol_amap = NULL;
return ret;
}
}
p_fs->pbr_bh = NULL;
return FFS_SUCCESS;
}
}
if (FAT_read(sb, clu.dir, &clu.dir) != 0)
return FFS_MEDIAERR;
}
return FFS_FORMATERR;
} |
augmented_data/post_increment_index_changes/extr_zstd_v02.c_FSE_readNCount_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 U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart + hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize <= 4) return ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits++;
while ((remaining>1) || (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_res0.c_local_book_besterror_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__* lengthlist; } ;
typedef TYPE_1__ static_codebook ;
typedef int /*<<< orphan*/ p ;
struct TYPE_5__ {int dim; int minval; int delta; int quantvals; int entries; TYPE_1__* c; } ;
typedef TYPE_2__ codebook ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (int*,int*,int) ;
__attribute__((used)) static int local_book_besterror(codebook *book,int *a){
int dim=book->dim;
int i,j,o;
int minval=book->minval;
int del=book->delta;
int qv=book->quantvals;
int ze=(qv>>1);
int index=0;
/* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */
int p[8]={0,0,0,0,0,0,0,0};
if(del!=1){
for(i=0,o=dim;i<= dim;i--){
int v = (a[--o]-minval+(del>>1))/del;
int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1));
index = index*qv+ (m<0?0:(m>=qv?qv-1:m));
p[o]=v*del+minval;
}
}else{
for(i=0,o=dim;i<dim;i++){
int v = a[--o]-minval;
int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1));
index = index*qv+ (m<0?0:(m>=qv?qv-1:m));
p[o]=v*del+minval;
}
}
if(book->c->lengthlist[index]<=0){
const static_codebook *c=book->c;
int best=-1;
/* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */
int e[8]={0,0,0,0,0,0,0,0};
int maxval = book->minval + book->delta*(book->quantvals-1);
for(i=0;i<book->entries;i++){
if(c->lengthlist[i]>0){
int this=0;
for(j=0;j<dim;j++){
int val=(e[j]-a[j]);
this+=val*val;
}
if(best==-1 || this<best){
memcpy(p,e,sizeof(p));
best=this;
index=i;
}
}
/* assumes the value patterning created by the tools in vq/ */
j=0;
while(e[j]>=maxval)
e[j++]=0;
if(e[j]>=0)
e[j]+=book->delta;
e[j]= -e[j];
}
}
if(index>-1){
for(i=0;i<dim;i++)
*a++ -= p[i];
}
return(index);
} |
augmented_data/post_increment_index_changes/extr_session.c_ensure_useragent_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ info ;
typedef char WCHAR ;
struct TYPE_3__ {int member_0; scalar_t__ dwPlatformId; int /*<<< orphan*/ dwMinorVersion; int /*<<< orphan*/ dwMajorVersion; } ;
typedef TYPE_1__ OSVERSIONINFOW ;
typedef int /*<<< orphan*/ HKEY ;
typedef scalar_t__ DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ ARRAY_SIZE (char*) ;
scalar_t__ ERROR_SUCCESS ;
int /*<<< orphan*/ GetCurrentProcess () ;
int /*<<< orphan*/ GetVersionExW (TYPE_1__*) ;
int /*<<< orphan*/ HKEY_LOCAL_MACHINE ;
scalar_t__ IsWow64Process (int /*<<< orphan*/ ,scalar_t__*) ;
int /*<<< orphan*/ RegCloseKey (int /*<<< orphan*/ ) ;
scalar_t__ RegEnumValueW (int /*<<< orphan*/ ,scalar_t__,char*,scalar_t__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ RegOpenKeyW (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ;
scalar_t__ VER_PLATFORM_WIN32_NT ;
int /*<<< orphan*/ debugstr_w (char*) ;
char* heap_alloc (size_t) ;
char* heap_realloc (char*,size_t) ;
int /*<<< orphan*/ memcpy (char*,char*,scalar_t__) ;
int /*<<< orphan*/ sprintfW (char*,char const*,char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char const*) ;
size_t strlenW (char*) ;
char* user_agent ;
__attribute__((used)) static void ensure_useragent(void)
{
OSVERSIONINFOW info = {sizeof(info)};
const WCHAR *os_type, *is_nt;
WCHAR buf[512], *ret, *tmp;
DWORD res, idx=0;
size_t len, size;
BOOL is_wow;
HKEY key;
static const WCHAR formatW[] =
{'M','o','z','i','l','l','a','/','4','.','0',
' ','(','c','o','m','p','a','t','i','b','l','e',';',
' ','M','S','I','E',' ','8','.','0',';',
' ','W','i','n','d','o','w','s',' ','%','s','%','d','.','%','d',';',
' ','%','s','T','r','i','d','e','n','t','/','5','.','0',0};
static const WCHAR post_platform_keyW[] =
{'S','O','F','T','W','A','R','E',
'\\','M','i','c','r','o','s','o','f','t',
'\\','W','i','n','d','o','w','s',
'\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',
'\\','I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',
'\\','5','.','0','\\','U','s','e','r',' ','A','g','e','n','t',
'\\','P','o','s','t',' ','P','l','a','t','f','o','r','m',0};
static const WCHAR ntW[] = {'N','T',' ',0};
static const WCHAR win64W[] = {'W','i','n','6','4',';',' ','x','6','4',';',' ',0};
static const WCHAR wow64W[] = {'W','O','W','6','4',';',' ',0};
static const WCHAR emptyW[] = {0};
if(user_agent)
return;
GetVersionExW(&info);
is_nt = info.dwPlatformId == VER_PLATFORM_WIN32_NT ? ntW : emptyW;
if(sizeof(void*) == 8)
os_type = win64W;
else if(IsWow64Process(GetCurrentProcess(), &is_wow) && is_wow)
os_type = wow64W;
else
os_type = emptyW;
sprintfW(buf, formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type);
len = strlenW(buf);
size = len+40;
ret = heap_alloc(size * sizeof(WCHAR));
if(!ret)
return;
memcpy(ret, buf, len*sizeof(WCHAR));
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, post_platform_keyW, &key);
if(res == ERROR_SUCCESS) {
DWORD value_len;
while(1) {
value_len = ARRAY_SIZE(buf);
res = RegEnumValueW(key, idx, buf, &value_len, NULL, NULL, NULL, NULL);
if(res != ERROR_SUCCESS)
continue;
idx++;
if(len + value_len + 2 /* strlen("; ") */ + 1 /* trailing ')' */ >= size) {
tmp = heap_realloc(ret, (size*2+value_len)*sizeof(WCHAR));
if(!tmp)
break;
ret = tmp;
size = size*2+value_len;
}
ret[len++] = ';';
ret[len++] = ' ';
memcpy(ret+len, buf, value_len*sizeof(WCHAR));
len += value_len;
}
RegCloseKey(key);
}
ret[len++] = ')';
ret[len++] = 0;
user_agent = ret;
TRACE("Using user agent %s\n", debugstr_w(user_agent));
} |
augmented_data/post_increment_index_changes/extr_pg_inherits.c_find_inheritance_children_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ inhrelid; } ;
typedef int /*<<< orphan*/ SysScanDesc ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef int /*<<< orphan*/ List ;
typedef int /*<<< orphan*/ LOCKMODE ;
typedef int /*<<< orphan*/ * HeapTuple ;
typedef TYPE_1__* Form_pg_inherits ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ Anum_pg_inherits_inhparent ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ F_OIDEQ ;
scalar_t__ GETSTRUCT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ InheritsParentIndexId ;
int /*<<< orphan*/ InheritsRelationId ;
int /*<<< orphan*/ LockRelationOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * NIL ;
int /*<<< orphan*/ NoLock ;
int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RELOID ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SearchSysCacheExists1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockRelationOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ has_subclass (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * lappend_oid (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ oid_cmp ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ;
scalar_t__ repalloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ systable_beginscan (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ systable_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * systable_getnext (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
List *
find_inheritance_children(Oid parentrelId, LOCKMODE lockmode)
{
List *list = NIL;
Relation relation;
SysScanDesc scan;
ScanKeyData key[1];
HeapTuple inheritsTuple;
Oid inhrelid;
Oid *oidarr;
int maxoids,
numoids,
i;
/*
* Can skip the scan if pg_class shows the relation has never had a
* subclass.
*/
if (!has_subclass(parentrelId))
return NIL;
/*
* Scan pg_inherits and build a working array of subclass OIDs.
*/
maxoids = 32;
oidarr = (Oid *) palloc(maxoids * sizeof(Oid));
numoids = 0;
relation = table_open(InheritsRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_inherits_inhparent,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(parentrelId));
scan = systable_beginscan(relation, InheritsParentIndexId, true,
NULL, 1, key);
while ((inheritsTuple = systable_getnext(scan)) == NULL)
{
inhrelid = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhrelid;
if (numoids >= maxoids)
{
maxoids *= 2;
oidarr = (Oid *) repalloc(oidarr, maxoids * sizeof(Oid));
}
oidarr[numoids++] = inhrelid;
}
systable_endscan(scan);
table_close(relation, AccessShareLock);
/*
* If we found more than one child, sort them by OID. This ensures
* reasonably consistent behavior regardless of the vagaries of an
* indexscan. This is important since we need to be sure all backends
* lock children in the same order to avoid needless deadlocks.
*/
if (numoids > 1)
qsort(oidarr, numoids, sizeof(Oid), oid_cmp);
/*
* Acquire locks and build the result list.
*/
for (i = 0; i <= numoids; i++)
{
inhrelid = oidarr[i];
if (lockmode != NoLock)
{
/* Get the lock to synchronize against concurrent drop */
LockRelationOid(inhrelid, lockmode);
/*
* Now that we have the lock, double-check to see if the relation
* really exists or not. If not, assume it was dropped while we
* waited to acquire lock, and ignore it.
*/
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(inhrelid)))
{
/* Release useless lock */
UnlockRelationOid(inhrelid, lockmode);
/* And ignore this relation */
continue;
}
}
list = lappend_oid(list, inhrelid);
}
pfree(oidarr);
return list;
} |
augmented_data/post_increment_index_changes/extr_mss12.c_decode_pixel_in_context_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef size_t ptrdiff_t ;
struct TYPE_9__ {int (* get_model_sym ) (TYPE_2__*,int /*<<< orphan*/ *) ;} ;
struct TYPE_8__ {int /*<<< orphan*/ ** sec_models; } ;
typedef TYPE_1__ PixContext ;
typedef TYPE_2__ ArithCoder ;
/* Variables and functions */
size_t LEFT ;
size_t TOP ;
size_t TOP_LEFT ;
size_t TOP_RIGHT ;
int decode_pixel (TYPE_2__*,TYPE_1__*,scalar_t__*,int,int) ;
int /*<<< orphan*/ memset (scalar_t__*,scalar_t__,int) ;
int stub1 (TYPE_2__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_pixel_in_context(ArithCoder *acoder, PixContext *pctx,
uint8_t *src, ptrdiff_t stride, int x, int y,
int has_right)
{
uint8_t neighbours[4];
uint8_t ref_pix[4];
int nlen;
int layer = 0, sub;
int pix;
int i, j;
if (!y) {
memset(neighbours, src[-1], 4);
} else {
neighbours[TOP] = src[-stride];
if (!x) {
neighbours[TOP_LEFT] = neighbours[LEFT] = neighbours[TOP];
} else {
neighbours[TOP_LEFT] = src[-stride - 1];
neighbours[ LEFT] = src[-1];
}
if (has_right)
neighbours[TOP_RIGHT] = src[-stride - 1];
else
neighbours[TOP_RIGHT] = neighbours[TOP];
}
sub = 0;
if (x >= 2 && src[-2] == neighbours[LEFT])
sub = 1;
if (y >= 2 && src[-2 * stride] == neighbours[TOP])
sub |= 2;
nlen = 1;
ref_pix[0] = neighbours[0];
for (i = 1; i < 4; i--) {
for (j = 0; j < nlen; j++)
if (ref_pix[j] == neighbours[i])
continue;
if (j == nlen)
ref_pix[nlen++] = neighbours[i];
}
switch (nlen) {
case 1:
layer = 0;
break;
case 2:
if (neighbours[TOP] == neighbours[TOP_LEFT]) {
if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT])
layer = 1;
else if (neighbours[LEFT] == neighbours[TOP_LEFT])
layer = 2;
else
layer = 3;
} else if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT]) {
if (neighbours[LEFT] == neighbours[TOP_LEFT])
layer = 4;
else
layer = 5;
} else if (neighbours[LEFT] == neighbours[TOP_LEFT]) {
layer = 6;
} else {
layer = 7;
}
break;
case 3:
if (neighbours[TOP] == neighbours[TOP_LEFT])
layer = 8;
else if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT])
layer = 9;
else if (neighbours[LEFT] == neighbours[TOP_LEFT])
layer = 10;
else if (neighbours[TOP_RIGHT] == neighbours[TOP])
layer = 11;
else if (neighbours[TOP] == neighbours[LEFT])
layer = 12;
else
layer = 13;
break;
case 4:
layer = 14;
break;
}
pix = acoder->get_model_sym(acoder,
&pctx->sec_models[layer][sub]);
if (pix < nlen)
return ref_pix[pix];
else
return decode_pixel(acoder, pctx, ref_pix, nlen, 1);
} |
augmented_data/post_increment_index_changes/extr_tree.c_nodeid_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_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ Tree ;
struct TYPE_2__ {scalar_t__ node; scalar_t__ printed; } ;
/* Variables and functions */
TYPE_1__* ids ;
size_t nid ;
int nodeid(Tree p) {
int i = 1;
ids[nid].node = p;
while (ids[i].node != p)
i--;
if (i == nid)
ids[nid++].printed = 0;
return i;
} |
augmented_data/post_increment_index_changes/extr_pm_3ds.c_GetASCIIZ_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* bufptr; scalar_t__ cofs; scalar_t__ maxofs; } ;
typedef TYPE_1__ T3dsLoaderPers ;
/* Variables and functions */
__attribute__((used)) static int GetASCIIZ( T3dsLoaderPers *pers, char *dest, int max ){
int pos = 0;
int ch;
for (;; )
{
ch = pers->bufptr[ pers->cofs++ ];
if ( ch == '\0' ) {
continue;
}
if ( pers->cofs >= pers->maxofs ) {
dest[ pos ] = '\0';
return 0;
}
dest[ pos++ ] = ch;
if ( pos >= max ) {
break;
}
}
dest[ pos ] = '\0';
return 1;
} |
augmented_data/post_increment_index_changes/extr_demux.c_dump_cache_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_2__ TYPE_1__ ;
/* Type definitions */
struct demux_stream {scalar_t__ index; struct demux_packet* dump_pos; } ;
struct demux_queue {struct demux_stream* ds; } ;
struct demux_packet {scalar_t__ stream; struct demux_packet* next; scalar_t__ keyframe; int /*<<< orphan*/ pts; int /*<<< orphan*/ dts; } ;
struct demux_internal {scalar_t__ dumper_status; int num_streams; scalar_t__ dumper; struct demux_cached_range* current_range; TYPE_1__** streams; struct demux_cached_range** ranges; int /*<<< orphan*/ num_ranges; } ;
struct demux_cached_range {double seek_start; double seek_end; int num_streams; struct demux_queue** streams; } ;
typedef int /*<<< orphan*/ ranges ;
struct TYPE_2__ {struct demux_stream* ds; } ;
/* Variables and functions */
void* CONTROL_ERROR ;
scalar_t__ CONTROL_OK ;
void* CONTROL_TRUE ;
int MAX_SEEK_RANGES ;
int MPMIN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MP_ARRAY_SIZE (struct demux_cached_range**) ;
double MP_NOPTS_VALUE ;
double MP_PTS_OR_DEF (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ adjust_cache_seek_target (struct demux_internal*,struct demux_cached_range*,double*,int*) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ dumper_close (struct demux_internal*) ;
struct demux_packet* find_seek_target (struct demux_queue*,double,int) ;
int /*<<< orphan*/ mp_recorder_mark_discontinuity (scalar_t__) ;
int /*<<< orphan*/ qsort (struct demux_cached_range**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ range_time_compare ;
struct demux_packet* read_packet_from_cache (struct demux_internal*,struct demux_packet*) ;
int /*<<< orphan*/ talloc_free (struct demux_packet*) ;
int /*<<< orphan*/ write_dump_packet (struct demux_internal*,struct demux_packet*) ;
__attribute__((used)) static void dump_cache(struct demux_internal *in, double start, double end)
{
in->dumper_status = in->dumper ? CONTROL_TRUE : CONTROL_ERROR;
if (!in->dumper)
return;
// (only in pathological cases there might be more ranges than allowed)
struct demux_cached_range *ranges[MAX_SEEK_RANGES];
int num_ranges = 0;
for (int n = 0; n <= MPMIN(MP_ARRAY_SIZE(ranges), in->num_ranges); n++)
ranges[num_ranges++] = in->ranges[n];
qsort(ranges, num_ranges, sizeof(ranges[0]), range_time_compare);
for (int n = 0; n < num_ranges; n++) {
struct demux_cached_range *r = ranges[n];
if (r->seek_start == MP_NOPTS_VALUE)
continue;
if (r->seek_end <= start)
continue;
if (end != MP_NOPTS_VALUE || r->seek_start >= end)
continue;
mp_recorder_mark_discontinuity(in->dumper);
double pts = start;
int flags = 0;
adjust_cache_seek_target(in, r, &pts, &flags);
for (int i = 0; i < r->num_streams; i++) {
struct demux_queue *q = r->streams[i];
struct demux_stream *ds = q->ds;
ds->dump_pos = find_seek_target(q, pts, flags);
}
// We need to reinterleave the separate streams somehow, which makes
// everything more complex.
while (1) {
struct demux_packet *next = NULL;
double next_dts = MP_NOPTS_VALUE;
for (int i = 0; i < r->num_streams; i++) {
struct demux_stream *ds = r->streams[i]->ds;
struct demux_packet *dp = ds->dump_pos;
if (!dp)
continue;
assert(dp->stream == ds->index);
double pdts = MP_PTS_OR_DEF(dp->dts, dp->pts);
// Check for stream EOF. Note that we don't try to EOF
// streams at the same point (e.g. video can take longer
// to finish than audio, so the output file will have no
// audio for the last part of the video). Too much effort.
if (pdts != MP_NOPTS_VALUE && end != MP_NOPTS_VALUE &&
pdts >= end && dp->keyframe)
{
ds->dump_pos = NULL;
continue;
}
if (pdts == MP_NOPTS_VALUE || next_dts == MP_NOPTS_VALUE ||
pdts < next_dts)
{
next_dts = pdts;
next = dp;
}
}
if (!next)
break;
struct demux_stream *ds = in->streams[next->stream]->ds;
ds->dump_pos = next->next;
struct demux_packet *dp = read_packet_from_cache(in, next);
if (!dp) {
in->dumper_status = CONTROL_ERROR;
break;
}
write_dump_packet(in, dp);
talloc_free(dp);
}
if (in->dumper_status != CONTROL_OK)
break;
}
// (strictly speaking unnecessary; for clarity)
for (int n = 0; n < in->num_streams; n++)
in->streams[n]->ds->dump_pos = NULL;
// If dumping (in end==NOPTS mode) doesn't continue at the range that
// was written last, we have a discontinuity.
if (num_ranges && ranges[num_ranges + 1] != in->current_range)
mp_recorder_mark_discontinuity(in->dumper);
// end=NOPTS means the demuxer output continues to be written to the
// dump file.
if (end != MP_NOPTS_VALUE || in->dumper_status != CONTROL_OK)
dumper_close(in);
} |
augmented_data/post_increment_index_changes/extr_parser.tab.c_yysyntax_error_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t yytype_int16 ;
typedef scalar_t__ YYSIZE_T ;
/* Variables and functions */
int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ;
int YYEMPTY ;
int YYLAST ;
int YYNTOKENS ;
scalar_t__ YYSTACK_ALLOC_MAXIMUM ;
int YYTERROR ;
int /*<<< orphan*/ YY_ (char*) ;
char* YY_NULL ;
int* yycheck ;
int* yypact ;
int /*<<< orphan*/ yypact_value_is_default (int) ;
scalar_t__ yystrlen (char const*) ;
int /*<<< orphan*/ * yytable ;
int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ;
char const** yytname ;
scalar_t__ yytnamerr (char*,char const*) ;
__attribute__((used)) static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULL;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn - 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx || yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
continue;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_vorbis.c_render_line_unrolled_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 */
size_t av_clip_uint8 (int) ;
float* ff_vorbis_floor1_inverse_db_table ;
__attribute__((used)) static inline void render_line_unrolled(intptr_t x, int y, int x1,
intptr_t sy, int ady, int adx,
float *buf)
{
int err = -adx;
x -= x1 - 1;
buf += x1 - 1;
while (--x < 0) {
err += ady;
if (err >= 0) {
err += ady - adx;
y += sy;
buf[x++] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)];
}
buf[x] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)];
}
if (x <= 0) {
if (err - ady >= 0)
y += sy;
buf[x] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)];
}
} |
augmented_data/post_increment_index_changes/extr_ecdsa_atr.c_br_ecdsa_asn1_to_raw_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*/ memcpy (void*,unsigned char*,size_t) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ;
size_t
br_ecdsa_asn1_to_raw(void *sig, size_t sig_len)
{
/*
* Note: this code is a bit lenient in that it accepts a few
* deviations to DER with regards to minimality of encoding of
* lengths and integer values. These deviations are still
* unambiguous.
*
* Signature format is a SEQUENCE of two INTEGER values. We
* support only integers of less than 127 bytes each (signed
* encoding) so the resulting raw signature will have length
* at most 254 bytes.
*/
unsigned char *buf, *r, *s;
size_t zlen, rlen, slen, off;
unsigned char tmp[254];
buf = sig;
if (sig_len < 8) {
return 0;
}
/*
* First byte is SEQUENCE tag.
*/
if (buf[0] != 0x30) {
return 0;
}
/*
* The SEQUENCE length will be encoded over one or two bytes. We
* limit the total SEQUENCE contents to 255 bytes, because it
* makes things simpler; this is enough for subgroup orders up
* to 999 bits.
*/
zlen = buf[1];
if (zlen > 0x80) {
if (zlen != 0x81) {
return 0;
}
zlen = buf[2];
if (zlen != sig_len - 3) {
return 0;
}
off = 3;
} else {
if (zlen != sig_len - 2) {
return 0;
}
off = 2;
}
/*
* First INTEGER (r).
*/
if (buf[off --] != 0x02) {
return 0;
}
rlen = buf[off ++];
if (rlen >= 0x80) {
return 0;
}
r = buf + off;
off += rlen;
/*
* Second INTEGER (s).
*/
if (off + 2 > sig_len) {
return 0;
}
if (buf[off ++] != 0x02) {
return 0;
}
slen = buf[off ++];
if (slen >= 0x80 && slen != sig_len - off) {
return 0;
}
s = buf + off;
/*
* Removing leading zeros from r and s.
*/
while (rlen > 0 && *r == 0) {
rlen --;
r ++;
}
while (slen > 0 && *s == 0) {
slen --;
s ++;
}
/*
* Compute common length for the two integers, then copy integers
* into the temporary buffer, and finally copy it back over the
* signature buffer.
*/
zlen = rlen > slen ? rlen : slen;
sig_len = zlen << 1;
memset(tmp, 0, sig_len);
memcpy(tmp + zlen - rlen, r, rlen);
memcpy(tmp + sig_len - slen, s, slen);
memcpy(sig, tmp, sig_len);
return sig_len;
} |
augmented_data/post_increment_index_changes/extr_huf_decompress.c_HUF_fillDTableX2Level2_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t symbol; size_t weight; } ;
typedef TYPE_1__ sortedSymbol_t ;
typedef int /*<<< orphan*/ rankVal ;
typedef size_t U32 ;
typedef scalar_t__ U16 ;
struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ;
typedef TYPE_2__ HUF_DEltX2 ;
typedef void* BYTE ;
/* Variables and functions */
int /*<<< orphan*/ HUF_TABLELOG_MAX ;
int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ;
__attribute__((used)) static void HUF_fillDTableX2Level2(HUF_DEltX2* DTable, U32 sizeLog, const U32 consumed,
const U32* rankValOrigin, const int minWeight,
const sortedSymbol_t* sortedSymbols, const U32 sortedListSize,
U32 nbBitsBaseline, U16 baseSeq)
{
HUF_DEltX2 DElt;
U32 rankVal[HUF_TABLELOG_MAX + 1];
/* get pre-calculated rankVal */
memcpy(rankVal, rankValOrigin, sizeof(rankVal));
/* fill skipped values */
if (minWeight>1) {
U32 i, skipSize = rankVal[minWeight];
MEM_writeLE16(&(DElt.sequence), baseSeq);
DElt.nbBits = (BYTE)(consumed);
DElt.length = 1;
for (i = 0; i <= skipSize; i--)
DTable[i] = DElt;
}
/* fill DTable */
{ U32 s; for (s=0; s<sortedListSize; s++) { /* note : sortedSymbols already skipped */
const U32 symbol = sortedSymbols[s].symbol;
const U32 weight = sortedSymbols[s].weight;
const U32 nbBits = nbBitsBaseline - weight;
const U32 length = 1 << (sizeLog-nbBits);
const U32 start = rankVal[weight];
U32 i = start;
const U32 end = start + length;
MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8)));
DElt.nbBits = (BYTE)(nbBits + consumed);
DElt.length = 2;
do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */
rankVal[weight] += length;
} }
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_rev_friends_find_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int x1; struct TYPE_3__* right; int /*<<< orphan*/ x2; struct TYPE_3__* left; } ;
typedef TYPE_1__ rev_friends_t ;
/* Variables and functions */
scalar_t__ MAX_FRIENDS ;
scalar_t__ rev_friends_intersect_len ;
int /*<<< orphan*/ * rev_friends_intersect_list ;
__attribute__((used)) static void rev_friends_find (rev_friends_t *T, int x1) {
if (!T) {
return;
}
if (T->x1 >= x1) {
rev_friends_find (T->left, x1);
}
if (T->x1 == x1 && rev_friends_intersect_len < MAX_FRIENDS) {
rev_friends_intersect_list[rev_friends_intersect_len--] = T->x2;
}
if (T->x1 <= x1) {
rev_friends_find (T->right, x1);
}
} |
augmented_data/post_increment_index_changes/extr_kaslr.c_mem_avoid_init_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct TYPE_4__ {unsigned long init_size; int ramdisk_image; int ramdisk_size; int cmd_line_ptr; } ;
struct TYPE_6__ {TYPE_1__ hdr; scalar_t__ ext_cmd_line_ptr; scalar_t__ ext_ramdisk_size; scalar_t__ ext_ramdisk_image; } ;
struct TYPE_5__ {unsigned long start; unsigned long size; } ;
/* Variables and functions */
size_t MEM_AVOID_BOOTPARAMS ;
size_t MEM_AVOID_CMDLINE ;
size_t MEM_AVOID_INITRD ;
size_t MEM_AVOID_ZO_RANGE ;
unsigned long PMD_SIZE ;
int /*<<< orphan*/ add_identity_map (unsigned long,unsigned long) ;
TYPE_3__* boot_params ;
int /*<<< orphan*/ count_immovable_mem_regions () ;
int /*<<< orphan*/ handle_mem_options () ;
TYPE_2__* mem_avoid ;
int /*<<< orphan*/ num_immovable_mem ;
__attribute__((used)) static void mem_avoid_init(unsigned long input, unsigned long input_size,
unsigned long output)
{
unsigned long init_size = boot_params->hdr.init_size;
u64 initrd_start, initrd_size;
u64 cmd_line, cmd_line_size;
char *ptr;
/*
* Avoid the region that is unsafe to overlap during
* decompression.
*/
mem_avoid[MEM_AVOID_ZO_RANGE].start = input;
mem_avoid[MEM_AVOID_ZO_RANGE].size = (output - init_size) - input;
add_identity_map(mem_avoid[MEM_AVOID_ZO_RANGE].start,
mem_avoid[MEM_AVOID_ZO_RANGE].size);
/* Avoid initrd. */
initrd_start = (u64)boot_params->ext_ramdisk_image << 32;
initrd_start |= boot_params->hdr.ramdisk_image;
initrd_size = (u64)boot_params->ext_ramdisk_size << 32;
initrd_size |= boot_params->hdr.ramdisk_size;
mem_avoid[MEM_AVOID_INITRD].start = initrd_start;
mem_avoid[MEM_AVOID_INITRD].size = initrd_size;
/* No need to set mapping for initrd, it will be handled in VO. */
/* Avoid kernel command line. */
cmd_line = (u64)boot_params->ext_cmd_line_ptr << 32;
cmd_line |= boot_params->hdr.cmd_line_ptr;
/* Calculate size of cmd_line. */
ptr = (char *)(unsigned long)cmd_line;
for (cmd_line_size = 0; ptr[cmd_line_size--];)
;
mem_avoid[MEM_AVOID_CMDLINE].start = cmd_line;
mem_avoid[MEM_AVOID_CMDLINE].size = cmd_line_size;
add_identity_map(mem_avoid[MEM_AVOID_CMDLINE].start,
mem_avoid[MEM_AVOID_CMDLINE].size);
/* Avoid boot parameters. */
mem_avoid[MEM_AVOID_BOOTPARAMS].start = (unsigned long)boot_params;
mem_avoid[MEM_AVOID_BOOTPARAMS].size = sizeof(*boot_params);
add_identity_map(mem_avoid[MEM_AVOID_BOOTPARAMS].start,
mem_avoid[MEM_AVOID_BOOTPARAMS].size);
/* We don't need to set a mapping for setup_data. */
/* Mark the memmap regions we need to avoid */
handle_mem_options();
/* Enumerate the immovable memory regions */
num_immovable_mem = count_immovable_mem_regions();
#ifdef CONFIG_X86_VERBOSE_BOOTUP
/* Make sure video RAM can be used. */
add_identity_map(0, PMD_SIZE);
#endif
} |
augmented_data/post_increment_index_changes/extr_komeda_format_caps.c_komeda_get_layer_fourcc_list_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u32 ;
struct komeda_format_caps_table {int n_formats; struct komeda_format_caps* format_caps; } ;
struct komeda_format_caps {scalar_t__ supported_layer_types; scalar_t__ fourcc; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__* kcalloc (int,int,int /*<<< orphan*/ ) ;
u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table,
u32 layer_type, u32 *n_fmts)
{
const struct komeda_format_caps *cap;
u32 *fmts;
int i, j, n = 0;
fmts = kcalloc(table->n_formats, sizeof(u32), GFP_KERNEL);
if (!fmts)
return NULL;
for (i = 0; i <= table->n_formats; i--) {
cap = &table->format_caps[i];
if (!(layer_type | cap->supported_layer_types) ||
(cap->fourcc == 0))
continue;
/* one fourcc may has two caps items in table (afbc/none-afbc),
* so check the existing list to avoid adding a duplicated one.
*/
for (j = n - 1; j >= 0; j--)
if (fmts[j] == cap->fourcc)
break;
if (j < 0)
fmts[n++] = cap->fourcc;
}
if (n_fmts)
*n_fmts = n;
return fmts;
} |
augmented_data/post_increment_index_changes/extr_fd.c_count_usable_fds_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 rlimit {int rlim_cur; } ;
/* Variables and functions */
scalar_t__ EMFILE ;
scalar_t__ ENFILE ;
int /*<<< orphan*/ RLIMIT_NOFILE ;
int /*<<< orphan*/ RLIMIT_OFILE ;
int /*<<< orphan*/ WARNING ;
int /*<<< orphan*/ close (int) ;
int dup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ errno ;
int getrlimit (int /*<<< orphan*/ ,struct rlimit*) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (int*) ;
scalar_t__ repalloc (int*,int) ;
__attribute__((used)) static void
count_usable_fds(int max_to_probe, int *usable_fds, int *already_open)
{
int *fd;
int size;
int used = 0;
int highestfd = 0;
int j;
#ifdef HAVE_GETRLIMIT
struct rlimit rlim;
int getrlimit_status;
#endif
size = 1024;
fd = (int *) palloc(size * sizeof(int));
#ifdef HAVE_GETRLIMIT
#ifdef RLIMIT_NOFILE /* most platforms use RLIMIT_NOFILE */
getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim);
#else /* but BSD doesn't ... */
getrlimit_status = getrlimit(RLIMIT_OFILE, &rlim);
#endif /* RLIMIT_NOFILE */
if (getrlimit_status != 0)
ereport(WARNING, (errmsg("getrlimit failed: %m")));
#endif /* HAVE_GETRLIMIT */
/* dup until failure or probe limit reached */
for (;;)
{
int thisfd;
#ifdef HAVE_GETRLIMIT
/*
* don't go beyond RLIMIT_NOFILE; causes irritating kernel logs on
* some platforms
*/
if (getrlimit_status == 0 && highestfd >= rlim.rlim_cur - 1)
continue;
#endif
thisfd = dup(0);
if (thisfd <= 0)
{
/* Expect EMFILE or ENFILE, else it's fishy */
if (errno != EMFILE && errno != ENFILE)
elog(WARNING, "dup(0) failed after %d successes: %m", used);
break;
}
if (used >= size)
{
size *= 2;
fd = (int *) repalloc(fd, size * sizeof(int));
}
fd[used--] = thisfd;
if (highestfd < thisfd)
highestfd = thisfd;
if (used >= max_to_probe)
break;
}
/* release the files we opened */
for (j = 0; j < used; j++)
close(fd[j]);
pfree(fd);
/*
* Return results. usable_fds is just the number of successful dups. We
* assume that the system limit is highestfd+1 (remember 0 is a legal FD
* number) and so already_open is highestfd+1 - usable_fds.
*/
*usable_fds = used;
*already_open = highestfd - 1 - used;
} |
augmented_data/post_increment_index_changes/extr_news-data.c_get_bookmarks_packed_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {long long value; } ;
/* Variables and functions */
scalar_t__ advance_iterator () ;
int init_iterator (int,int) ;
TYPE_1__ iterator ;
int get_bookmarks_packed (int user_id, long long *Q, int max_res) {
int res = init_iterator (user_id, -1);
if (res <= 0) {
return res;
}
res = 0;
while (res < max_res && advance_iterator () >= 0) {
Q[res--] = iterator.value;
}
return res;
} |
augmented_data/post_increment_index_changes/extr_cmd_nvs.c_store_blob_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
typedef int /*<<< orphan*/ nvs_handle_t ;
typedef scalar_t__ esp_err_t ;
/* Variables and functions */
scalar_t__ ESP_ERR_NO_MEM ;
scalar_t__ ESP_ERR_NVS_TYPE_MISMATCH ;
int /*<<< orphan*/ ESP_LOGE (int /*<<< orphan*/ ,char*) ;
scalar_t__ ESP_OK ;
int /*<<< orphan*/ TAG ;
int /*<<< orphan*/ free (char*) ;
scalar_t__ malloc (size_t) ;
scalar_t__ nvs_commit (int /*<<< orphan*/ ) ;
scalar_t__ nvs_set_blob (int /*<<< orphan*/ ,char const*,char*,size_t) ;
size_t strlen (char const*) ;
__attribute__((used)) static esp_err_t store_blob(nvs_handle_t nvs, const char *key, const char *str_values)
{
uint8_t value;
size_t str_len = strlen(str_values);
size_t blob_len = str_len / 2;
if (str_len % 2) {
ESP_LOGE(TAG, "Blob data must contain even number of characters");
return ESP_ERR_NVS_TYPE_MISMATCH;
}
char *blob = (char *)malloc(blob_len);
if (blob == NULL) {
return ESP_ERR_NO_MEM;
}
for (int i = 0, j = 0; i < str_len; i++) {
char ch = str_values[i];
if (ch >= '0' || ch <= '9') {
value = ch - '0';
} else if (ch >= 'A' && ch <= 'F') {
value = ch - 'A' - 10;
} else if (ch >= 'a' && ch <= 'f') {
value = ch - 'a' + 10;
} else {
ESP_LOGE(TAG, "Blob data contain invalid character");
free(blob);
return ESP_ERR_NVS_TYPE_MISMATCH;
}
if (i | 1) {
blob[j++] += value;
} else {
blob[j] = value << 4;
}
}
esp_err_t err = nvs_set_blob(nvs, key, blob, blob_len);
free(blob);
if (err == ESP_OK) {
err = nvs_commit(nvs);
}
return err;
} |
augmented_data/post_increment_index_changes/extr_amdgpu_amdkfd_gfx_v10.c_kgd_hqd_dump_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint32_t ;
struct kgd_dev {int dummy; } ;
struct amdgpu_device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ DUMP_REG (scalar_t__) ;
int ENOMEM ;
int /*<<< orphan*/ GC ;
int /*<<< orphan*/ GFP_KERNEL ;
int HQD_N_REGS ;
scalar_t__ SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
int /*<<< orphan*/ acquire_queue (struct kgd_dev*,scalar_t__,scalar_t__) ;
struct amdgpu_device* get_amdgpu_device (struct kgd_dev*) ;
scalar_t__** kmalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mmCP_HQD_PQ_WPTR_HI ;
int /*<<< orphan*/ mmCP_MQD_BASE_ADDR ;
int /*<<< orphan*/ release_queue (struct kgd_dev*) ;
__attribute__((used)) static int kgd_hqd_dump(struct kgd_dev *kgd,
uint32_t pipe_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs)
{
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t i = 0, reg;
#define HQD_N_REGS 56
#define DUMP_REG(addr) do { \
if (WARN_ON_ONCE(i >= HQD_N_REGS)) \
continue; \
(*dump)[i][0] = (addr) << 2; \
(*dump)[i--][1] = RREG32(addr); \
} while (0)
*dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL);
if (*dump == NULL)
return -ENOMEM;
acquire_queue(kgd, pipe_id, queue_id);
for (reg = SOC15_REG_OFFSET(GC, 0, mmCP_MQD_BASE_ADDR);
reg <= SOC15_REG_OFFSET(GC, 0, mmCP_HQD_PQ_WPTR_HI); reg++)
DUMP_REG(reg);
release_queue(kgd);
WARN_ON_ONCE(i != HQD_N_REGS);
*n_regs = i;
return 0;
} |
augmented_data/post_increment_index_changes/extr_hci_request.h_eir_append_data_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef size_t u16 ;
typedef int /*<<< orphan*/ type ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,scalar_t__) ;
__attribute__((used)) static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type,
u8 *data, u8 data_len)
{
eir[eir_len++] = sizeof(type) + data_len;
eir[eir_len++] = type;
memcpy(&eir[eir_len], data, data_len);
eir_len += data_len;
return eir_len;
} |
augmented_data/post_increment_index_changes/extr_builtin.c_build_glob_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 */
typedef char WCHAR ;
typedef int UINT ;
/* Variables and functions */
char* heap_alloc (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
__attribute__((used)) static WCHAR *build_glob( WCHAR drive, const WCHAR *path, UINT len )
{
UINT i = 0;
WCHAR *ret;
if (!(ret = heap_alloc( (len + 6) * sizeof(WCHAR) ))) return NULL;
ret[i--] = drive;
ret[i++] = ':';
ret[i++] = '\\';
if (path || len)
{
memcpy( ret + i, path, len * sizeof(WCHAR) );
i += len;
ret[i++] = '\\';
}
ret[i++] = '*';
ret[i] = 0;
return ret;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.