Fixed sign-compare warnings

This commit is contained in:
Armin Novak 2019-02-07 14:19:40 +01:00
parent 936ab9bb8b
commit e4386e147a
2 changed files with 16 additions and 12 deletions

View File

@ -42,7 +42,7 @@ static MSUSB_PIPE_DESCRIPTOR* msusb_mspipe_new()
static void msusb_mspipes_free(MSUSB_PIPE_DESCRIPTOR** MsPipes,
UINT32 NumberOfPipes)
{
int pnum = 0;
UINT32 pnum = 0;
if (MsPipes)
{
@ -68,7 +68,7 @@ void msusb_mspipes_replace(MSUSB_INTERFACE_DESCRIPTOR* MsInterface,
static MSUSB_PIPE_DESCRIPTOR** msusb_mspipes_read(BYTE* data, UINT32 data_size,
UINT32 NumberOfPipes, int* offset)
{
int pnum, move = 0;
UINT32 pnum, move = 0;
MSUSB_PIPE_DESCRIPTOR** MsPipes;
MsPipes = (MSUSB_PIPE_DESCRIPTOR**) calloc(NumberOfPipes,
sizeof(MSUSB_PIPE_DESCRIPTOR*));
@ -129,7 +129,7 @@ static void msusb_msinterface_free(MSUSB_INTERFACE_DESCRIPTOR* MsInterface)
static void msusb_msinterface_free_list(MSUSB_INTERFACE_DESCRIPTOR**
MsInterfaces, UINT32 NumInterfaces)
{
int inum = 0;
UINT32 inum = 0;
if (MsInterfaces)
{
@ -192,7 +192,7 @@ int msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, BYTE* data,
{
MSUSB_PIPE_DESCRIPTOR** MsPipes;
MSUSB_PIPE_DESCRIPTOR* MsPipe;
int pnum = 0, move = 0;
UINT32 pnum = 0, move = 0;
/* Length */
data_write_UINT16(data, MsInterface->Length);
/* InterfaceNumber */
@ -242,7 +242,8 @@ int msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, BYTE* data,
static MSUSB_INTERFACE_DESCRIPTOR** msusb_msinterface_read_list(BYTE* data,
UINT32 data_size, UINT32 NumInterfaces)
{
int inum, offset = 0;
UINT32 inum;
int offset = 0;
MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces;
MsInterfaces = (MSUSB_INTERFACE_DESCRIPTOR**) calloc(NumInterfaces,
sizeof(MSUSB_INTERFACE_DESCRIPTOR*));
@ -262,7 +263,7 @@ static MSUSB_INTERFACE_DESCRIPTOR** msusb_msinterface_read_list(BYTE* data,
int msusb_msconfig_write(MSUSB_CONFIG_DESCRIPTOR* MsConfg, BYTE* data,
int* offset)
{
int inum = 0;
UINT32 inum = 0;
MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces;
MSUSB_INTERFACE_DESCRIPTOR* MsInterface;
/* ConfigurationHandle*/
@ -300,7 +301,7 @@ void msusb_msconfig_free(MSUSB_CONFIG_DESCRIPTOR* MsConfig)
MSUSB_CONFIG_DESCRIPTOR* msusb_msconfig_read(BYTE* data, UINT32 data_size,
UINT32 NumInterfaces)
{
int i, offset = 0;
UINT32 i, offset = 0;
UINT16 lenInterface;
MSUSB_CONFIG_DESCRIPTOR* MsConfig;
BYTE lenConfiguration, typeConfiguration;
@ -345,7 +346,7 @@ void msusb_msconfig_dump(MSUSB_CONFIG_DESCRIPTOR* MsConfig)
MSUSB_INTERFACE_DESCRIPTOR* MsInterface;
MSUSB_PIPE_DESCRIPTOR** MsPipes;
MSUSB_PIPE_DESCRIPTOR* MsPipe;
int inum = 0, pnum = 0;
UINT32 inum = 0, pnum = 0;
WLog_INFO(TAG, "=================MsConfig:========================");
WLog_INFO(TAG, "wTotalLength:%"PRIu16"", MsConfig->wTotalLength);
WLog_INFO(TAG, "bConfigurationValue:%"PRIu8"", MsConfig->bConfigurationValue);

View File

@ -27,7 +27,10 @@ static BOOL test_overlaps(void)
RingBuffer rb;
DataChunk chunks[2];
BYTE bytes[200];
int nchunks, i, j, k, counter = 0;
size_t i;
size_t k;
int x;
int nchunks, j, counter = 0;
for (i = 0; i < sizeof(bytes); i++)
bytes[i] = (BYTE)i;
@ -46,11 +49,11 @@ static BOOL test_overlaps(void)
if (nchunks != 2 || chunks[0].size != 3 || chunks[1].size != 1)
goto error;
for (i = 0, j = 2; i < nchunks; i++)
for (x = 0, j = 2; x < nchunks; x++)
{
for (k = 0; k < (int) chunks[i].size; k++, j++)
for (k = 0; k < chunks[x].size; k++, j++)
{
if (chunks[i].data[k] != (BYTE)j)
if (chunks[x].data[k] != (BYTE)j)
goto error;
}
}