Fix release build issues with raw2ascii under cmake
This commit is contained in:
parent
324ce8acd7
commit
7fb875b44b
1 changed files with 193 additions and 184 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <sys/types.h> /* open() */
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#ifdef _MSC_VER
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
@ -64,8 +65,18 @@ int reads(int fd, char *buf, unsigned int len) {
|
|||
char c;
|
||||
|
||||
len--;
|
||||
while ( (i < len) && (read(fd, &c, 1) != 0) )
|
||||
while ( i < len)
|
||||
{
|
||||
int sz = read(fd, &c, 1);
|
||||
if (sz == 0)
|
||||
return 0;
|
||||
|
||||
if (sz < 0)
|
||||
{
|
||||
printf("read failed: %s\n", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((c == '\n') || (c == '\r') )
|
||||
break;
|
||||
|
||||
|
@ -76,7 +87,6 @@ int reads(int fd, char *buf, unsigned int len) {
|
|||
buf[i++] = '\n';
|
||||
|
||||
buf[i] = '\0';
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -85,7 +95,7 @@ int reads(int fd, char *buf, unsigned int len) {
|
|||
* DEM file */
|
||||
void rawReadDemHdr( fgRAWDEM *raw, char *hdr_file ) {
|
||||
FILE *hdr;
|
||||
static char line[256], key[256], value[256];
|
||||
char line[256], key[256], value[256];
|
||||
int i, len, offset;
|
||||
double tmp;
|
||||
|
||||
|
@ -106,7 +116,6 @@ void rawReadDemHdr( fgRAWDEM *raw, char *hdr_file ) {
|
|||
line[len] = 0; // kill EOL characters
|
||||
}
|
||||
printf("%s ", line);
|
||||
|
||||
len = strlen(line);
|
||||
|
||||
/* extract key */
|
||||
|
@ -183,9 +192,9 @@ void rawReadDemHdr( fgRAWDEM *raw, char *hdr_file ) {
|
|||
(double)raw->ydim / 3600.0);
|
||||
} else {
|
||||
/* ignore for now */
|
||||
printf( "- ignore for now\n" );
|
||||
}
|
||||
printf( "- ignore for now: '%s'\n", key );
|
||||
}
|
||||
} // of line iteration
|
||||
|
||||
raw->rootx = raw->ulxmap - (raw->xdim / 2);
|
||||
raw->rooty = raw->ulymap + (raw->ydim / 2);
|
||||
|
@ -496,7 +505,7 @@ void rawProcessStrip( fgRAWDEM *raw, int lat_degrees, char *path ) {
|
|||
/* convert to arcsec */
|
||||
lat = lat_degrees * 3600;
|
||||
|
||||
printf("Max Latitude = %d arcsec (%f degs)\n", lat, lat_degrees);
|
||||
printf("Max Latitude = %d arcsec (%d degs)\n", lat, lat_degrees);
|
||||
|
||||
/* validity check ... */
|
||||
if ( (lat > raw->rooty) ||
|
||||
|
|
Loading…
Reference in a new issue