Skip to content

Commit

Permalink
Merge pull request #19 from OSGeo/schwehr-unused-variables
Browse files Browse the repository at this point in the history
Remove unused variables [#18]
  • Loading branch information
schwehr authored Feb 7, 2021
2 parents 854ae52 + 105aa26 commit 28ffc4e
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 87 deletions.
6 changes: 2 additions & 4 deletions contrib/dbfcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ int main( int argc, char ** argv )

{
DBFHandle hDBF;
int *panWidth, i, iRecord;
char szFormat[32], szField[1024];
int i, iRecord;
char cTitle[32], nTitle[32];
int nWidth, nDecimals;
int cnWidth, cnDecimals;
DBFHandle cDBF;
DBFFieldType hType,cType;
int ci, ciRecord;
char tfile[160];
int hflds, j, cflds;
int hflds, cflds;
int verbose = 0;
int force = 0;
int mismatch = 0;
Expand Down Expand Up @@ -127,7 +126,6 @@ int main( int argc, char ** argv )
ciRecord = DBFGetRecordCount( cDBF );
for ( i = 0; i < hflds;i ++ )
{
double cf;
ci = fld_m[i];
if ( ci != -1 )
{
Expand Down
10 changes: 2 additions & 8 deletions contrib/dbfinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,9 @@ int main( int argc, char ** argv )

{
DBFHandle hDBF;
int *panWidth, i, iRecord;
char szFormat[32], szField[1024];
char ftype[32], cTitle[32], nTitle[32];
int *panWidth, i;
char ftype[32];
int nWidth, nDecimals;
int cnWidth, cnDecimals;
DBFHandle cDBF;
DBFFieldType hType,cType;
int ci, ciRecord;

/* -------------------------------------------------------------------- */
/* Display a usage message. */
Expand Down Expand Up @@ -78,7 +73,6 @@ int main( int argc, char ** argv )
for( i = 0; i < DBFGetFieldCount(hDBF); i++ )
{
char szTitle[12];
DBFFieldType eType;

switch ( DBFGetFieldInfo( hDBF, i, szTitle, &nWidth, &nDecimals )) {
case FTString:
Expand Down
15 changes: 1 addition & 14 deletions contrib/shpcentrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,8 @@ int main( int argc, char ** argv )
{
SHPHandle old_SHP, new_SHP;
DBFHandle old_DBF, new_DBF;
int nShapeType, nEntities, nVertices, nParts, *panParts, i, iPart;
double *padVertices, adBounds[4];
const char *pszPlus;
DBFFieldType idfld_type;
int idfld, nflds;
char kv[257] = "";
char idfldName[120] = "";
char fldName[120] = "";
char shpFileName[120] = "";
char dbfFileName[120] = "";
double apeture[4];
int nShapeType, nEntities, i;
char *DBFRow = NULL;
int Cpan[2] = { 0,0 };
int byRing = 1;
PT Centrd;
SHPObject *psCShape, *cent_pt;
Expand Down Expand Up @@ -107,8 +96,6 @@ int main( int argc, char ** argv )

for( i = 0; i < nEntities; i++ )
{
int res ;

psCShape = SHPReadObject( old_SHP, i );

if ( byRing == 1 ) {
Expand Down
22 changes: 5 additions & 17 deletions contrib/shpdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,13 @@
int main( int argc, char ** argv )

{
SHPHandle old_SHP, new_SHP;
DBFHandle old_DBF, new_DBF;
int nShapeType, nEntities, nVertices, nParts, *panParts, i, iPart;
double *padVertices, adBounds[4];
const char *pszPlus;
DBFFieldType idfld_type;
int idfld, nflds;
char kv[257] = "";
char idfldName[120] = "";
char fldName[120] = "";
char shpFileName[120] = "";
char dbfFileName[120] = "";
SHPHandle old_SHP;
DBFHandle old_DBF;
int nShapeType, nEntities, i;
char *DBFRow = NULL;
int Cpan[2] = { 0,0 };
int byRing = 1;
PT oCentrd, ringCentrd;
SHPObject *psCShape, *cent_pt;
SHPObject *psCShape;
double oArea = 0.0, oLen = 0.0;

if( argc < 2 )
Expand All @@ -81,8 +71,6 @@ int main( int argc, char ** argv )
SHPGetInfo( old_SHP, &nEntities, &nShapeType, NULL, NULL );
for( i = 0; i < nEntities; i++ )
{
int res ;

psCShape = SHPReadObject( old_SHP, i );

if ( byRing == 1 ) {
Expand All @@ -92,7 +80,7 @@ int main( int argc, char ** argv )
prevStart = psCShape->nVertices;
for ( ring = (psCShape->nParts - 1); ring >= 0; ring-- ) {
SHPObject *psO;
int j, numVtx, rStart;
int numVtx, rStart;

rStart = psCShape->panPartStart[ring];
if ( ring == (psCShape->nParts -1) )
Expand Down
2 changes: 1 addition & 1 deletion contrib/shpdxf.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ main (int argc, char **argv)
char fldName[15];
char id[255];
double elev;
int parts, *panParts, nParts, nVertices;
int *panParts, nParts, nVertices;
FILE *dxf;
SHPHandle shp;
DBFHandle dbf;
Expand Down
28 changes: 11 additions & 17 deletions contrib/shpgeo.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ int SHPOGisType ( int GeomType, int toOGis) {
* **************************************************************************/
static int SHPReadSHPStream ( SHPObject *psCShape, char *stream_obj) {

int obj_storage;
int my_order, need_swap =0, GeoType ;
int use_Z = 0;
int use_M = 0;
Expand Down Expand Up @@ -292,7 +291,7 @@ int use_M = 0;
static int SHPWriteSHPStream ( WKBStreamObj *stream_obj, SHPObject *psCShape ) {

/*int obj_storage = 0;*/
int need_swap = 0, my_order, GeoType;
int need_swap = 0;
int use_Z = 0;
int use_M = 0;

Expand Down Expand Up @@ -372,8 +371,7 @@ static int WKBStreamRead ( WKBStreamObj* wso, void* this, int tcount, int tsize
SHPObject* SHPReadOGisWKB ( WKBStreamObj *stream_obj) {
SHPObject *psCShape;
char WKB_order;
int need_swap = 0, my_order, GeoType = 0;
int use_Z = 0, use_M = 0;
int my_order, GeoType = 0;
int nSHPType, thisDim;

WKBStreamRead ( stream_obj, &WKB_order, 1, sizeof(char));
Expand Down Expand Up @@ -412,9 +410,7 @@ SHPObject* SHPReadOGisWKB ( WKBStreamObj *stream_obj) {
*
* **************************************************************************/
int SHPWriteOGisWKB ( WKBStreamObj* stream_obj, SHPObject *psCShape ) {

int need_swap = 0, my_order, GeoType, thisDim;
int use_Z = 0, use_M = 0;
int my_order, GeoType, thisDim;
char LSB = 1;
/* indicate that this WKB is in LSB Order */

Expand Down Expand Up @@ -495,7 +491,7 @@ int SHPWriteOGisWKB ( WKBStreamObj* stream_obj, SHPObject *psCShape ) {
int SHPWriteOGisPolygon ( WKBStreamObj *stream_obj, SHPObject *psCShape ) {
SHPObject **ppsC;
SHPObject *psC;
int rPart, ring, rVertices, cpart, cParts, nextring, i, j;
int rPart, ring, rVertices, cpart, cParts, nextring, j;
char Flag = 1;
int GeoType = OGIST_POLYGON;

Expand Down Expand Up @@ -600,7 +596,7 @@ int SHPWriteOGisPoint ( WKBStreamObj *stream_obj, SHPObject *psCShape ) {
SHPObject* SHPReadOGisPolygon ( WKBStreamObj *stream_obj ) {
SHPObject **ppsC;
SHPObject *psC;
int rPart, ring, rVertices, cpart, cParts, nextring, i, j;
int rPart, ring, rVertices, cpart, cParts, j;
int totParts, totVertices, pRings, nParts;

psC = SHPCreateObject ( SHPT_POLYGON, -1, 0, NULL, NULL, 0,
Expand Down Expand Up @@ -667,7 +663,7 @@ SHPObject* SHPReadOGisPolygon ( WKBStreamObj *stream_obj ) {
SHPObject* SHPReadOGisLine ( WKBStreamObj *stream_obj ) {
SHPObject **ppsC;
SHPObject *psC;
int rPart, ring, rVertices, cpart, cParts, nextring, i, j;
int rPart, ring, rVertices, cpart, cParts, j;
int totParts, totVertices, pRings, nParts;

psC = SHPCreateObject ( SHPT_ARC, -1, 0, NULL, NULL, 0,
Expand Down Expand Up @@ -1004,9 +1000,8 @@ PT SHPCentrd_2d ( SHPObject *psCShape ) {
*
* **************************************************************************/
int RingCentroid_2d ( int nVertices, double *a, double *b, PT *C, double *Area ) {
int iv,jv;
int sign_x, sign_y;
double dy_Area, dx_Area, Cx_accum, Cy_accum, ppx, ppy;
int iv;
double dx_Area, Cx_accum, Cy_accum, ppx, ppy;
double x_base, y_base, x, y;

/* the centroid of a closed Ring is defined as
Expand Down Expand Up @@ -1079,7 +1074,7 @@ int SHPRingDir_2d ( SHPObject *psCShape, int Ring ) {
int i, ti, last_vtx;
double tX;
double *a, *b;
double dx0, dx1, dy0, dy1, v1, v2 ,v3;
double dx0, dx1, dy0, dy1, v3;

tX = 0.0;
a = psCShape->padfX;
Expand Down Expand Up @@ -1148,7 +1143,7 @@ int SHPRingDir_2d ( SHPObject *psCShape, int Ring ) {
* **************************************************************************/
double SHPArea_2d ( SHPObject *psCShape ) {
double cArea;
int ring, ring_vtx, ringDir, ring_nVertices;
int ring, ring_vtx, ring_nVertices;

cArea = 0;
if ( !(SHPDimension (psCShape->nSHPType) & SHPD_AREA) )
Expand Down Expand Up @@ -1249,7 +1244,7 @@ double RingLength_2d ( int nVertices, double *a, double *b ) {
*
* **************************************************************************/
double RingArea_2d ( int nVertices, double *a, double *b ) {
int iv,jv;
int iv;
double ppx, ppy;
static double Area;
double dx_Area;
Expand Down Expand Up @@ -1496,7 +1491,6 @@ SHPObject* SHPClone ( SHPObject *psCShape, int lowPart, int highPart ) {
/************************************************************************/
void SwapG( void *so, void *in, int this_cnt, int this_size ) {
int i, j;
unsigned char temp;

/* return to a new pointer otherwise it would invalidate existing data */
/* as prevent further use of it */
Expand Down
10 changes: 3 additions & 7 deletions contrib/shpinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@
int main( int argc, char ** argv )

{
SHPHandle hSHP, cSHP;
int nShapeType, nEntities, nVertices, nParts, *panParts, i, iPart;
double *padVertices, adfBndsMin[4], adfBndsMax[4];
const char *pszPlus;
int cShapeType, cEntities, cVertices, cParts, *cpanParts, ci, cPart;
double *cpadVertices, cadBounds[4];
const char *cpszPlus;
SHPHandle hSHP;
int nShapeType, nEntities;
double adfBndsMin[4], adfBndsMax[4];
char sType [15]= "";
/* -------------------------------------------------------------------- */
/* Display a usage message. */
Expand Down
25 changes: 6 additions & 19 deletions contrib/shpwkb.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,12 @@

int main( int argc, char ** argv )
{
SHPHandle old_SHP, new_SHP;
DBFHandle old_DBF, new_DBF;
int nShapeType, nEntities, nVertices, nParts, *panParts, i, iPart;
double *padVertices, adBounds[4];
const char *pszPlus;
DBFFieldType idfld_type;
int idfld, nflds;
char kv[257] = "";
char idfldName[120] = "";
char fldName[120] = "";
char shpFileName[120] = "";
char dbfFileName[120] = "";
SHPHandle old_SHP;
DBFHandle old_DBF;
int nShapeType, nEntities, i;
char *DBFRow = NULL;
int Cpan[2] = { 0,0 };
int byRing = 0;
PT oCentrd, ringCentrd;
SHPObject *psCShape, *cent_pt;
double oArea = 0.0, oLen = 0.0;
SHPObject *psCShape;
WKBStreamObj *wkbObj = NULL;
FILE *wkb_file = NULL;

Expand Down Expand Up @@ -90,13 +78,12 @@ int main( int argc, char ** argv )
psCShape = SHPReadObject( old_SHP, i );

if ( byRing == 1 ) {
int ring, prevStart, ringDir;
double ringArea;
int ring, prevStart;

prevStart = psCShape->nVertices;
for ( ring = (psCShape->nParts - 1); ring >= 0; ring-- ) {
SHPObject *psO;
int j, numVtx, rStart;
int numVtx, rStart;

rStart = psCShape->panPartStart[ring];
if ( ring == (psCShape->nParts -1) )
Expand Down

0 comments on commit 28ffc4e

Please sign in to comment.