Navigation Menu

Skip to content

Commit

Permalink
Fix a couple of gcc warnings in picomodel library
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 28, 2017
1 parent 786a864 commit 6554709
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 3 additions & 0 deletions libs/picomodel/lwo/lwo2.c
Expand Up @@ -292,6 +292,9 @@ int lwValidateObject( char *filename, picoMemStream_t *fp, unsigned int *failID,

if ( id != ID_FORM ) {
if ( failpos ) *failpos = 12;

formsize++; /* silence compiler warning about unused variable */

return PICO_PMV_ERROR_SIZE;
}

Expand Down
4 changes: 3 additions & 1 deletion libs/picomodel/lwo/lwob.c
Expand Up @@ -10,6 +10,7 @@ Ernie Wright 17 Sep 00

#include "../picointernal.h"
#include "lwo2.h"
#include <stdint.h>

/* disable warnings */
#ifdef WIN32
Expand Down Expand Up @@ -550,7 +551,7 @@ int lwGetPolygons5( picoMemStream_t *fp, int cksize, lwPolygonList *plist, int p
bp += 2;
}
j -= 1;
pp->surf = ( lwSurface * ) j;
pp->surf = ( lwSurface * ) (intptr_t) j;

pp++;
pv += nv;
Expand Down Expand Up @@ -720,6 +721,7 @@ int lwValidateObject5( char *filename, picoMemStream_t *fp, unsigned int *failID

if ( id != ID_FORM || type != ID_LWOB ) {
if ( failpos ) *failpos = 12;
formsize++; /* silence compiler warning about unused variable */
return PICO_PMV_ERROR_IDENT;
}

Expand Down
11 changes: 6 additions & 5 deletions libs/picomodel/lwo/pntspols.c
Expand Up @@ -9,7 +9,7 @@ Ernie Wright 17 Sep 00

#include "../picointernal.h"
#include "lwo2.h"

#include <stdint.h>

/*
======================================================================
Expand Down Expand Up @@ -334,7 +334,8 @@ int lwResolvePolySurfaces( lwPolygonList *polygon, lwTagList *tlist,
lwSurface **surf, int *nsurfs )
{
lwSurface **s, *st;
int i, index;
int i;
intptr_t index;

if ( tlist->count == 0 ) return 1;

Expand All @@ -353,7 +354,7 @@ int lwResolvePolySurfaces( lwPolygonList *polygon, lwTagList *tlist,
}

for ( i = 0; i < polygon->count; i++ ) {
index = ( int ) polygon->pol[ i ].surf;
index = ( intptr_t ) polygon->pol[ i ].surf;
if ( index < 0 || index > tlist->count ) return 0;
if ( !s[ index ] ) {
s[ index ] = lwDefaultSurface();
Expand Down Expand Up @@ -525,9 +526,9 @@ int lwGetPolygonTags( picoMemStream_t *fp, int cksize, lwTagList *tlist,
j = getVX( fp ) + tlist->offset;
rlen = get_flen();
if ( rlen < 0 || rlen > cksize ) return 0;

switch ( type ) {
case ID_SURF: plist->pol[ i ].surf = ( lwSurface * ) j; break;
case ID_SURF: plist->pol[ i ].surf = ( lwSurface * ) (intptr_t) j; break;
case ID_PART: plist->pol[ i ].part = j; break;
case ID_SMGP: plist->pol[ i ].smoothgrp = j; break;
}
Expand Down

0 comments on commit 6554709

Please sign in to comment.