mirror of https://github.com/CGAL/cgal
Fix types
This commit is contained in:
parent
dfc9a2f04b
commit
3b61a9d611
|
|
@ -48,7 +48,7 @@ PTRIMAGE_FORMAT createGisFormat() {
|
||||||
CGAL_INLINE_FUNCTION
|
CGAL_INLINE_FUNCTION
|
||||||
int writeGis( char *name, _image* im) {
|
int writeGis( char *name, _image* im) {
|
||||||
char *outputName;
|
char *outputName;
|
||||||
int res;
|
std::size_t res;
|
||||||
std::size_t length, extLength = 0;
|
std::size_t length, extLength = 0;
|
||||||
|
|
||||||
length=strlen(name);
|
length=strlen(name);
|
||||||
|
|
@ -142,8 +142,8 @@ int writeGis( char *name, _image* im) {
|
||||||
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
|
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
|
||||||
}
|
}
|
||||||
sprintf( str+strlen(str), "\n" );
|
sprintf( str+strlen(str), "\n" );
|
||||||
res = static_cast<int>(ImageIO_write( im, str, strlen( str )));
|
res = ImageIO_write( im, str, strlen( str ));
|
||||||
if ( res <= 0 ) {
|
if ( res < strlen(str) ) {
|
||||||
fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
|
fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
|
||||||
if ( outputName != NULL ) ImageIO_free( outputName );
|
if ( outputName != NULL ) ImageIO_free( outputName );
|
||||||
return( -3 );
|
return( -3 );
|
||||||
|
|
@ -161,8 +161,8 @@ int writeGis( char *name, _image* im) {
|
||||||
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
|
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
|
||||||
}
|
}
|
||||||
sprintf( str+strlen(str), "\n" );
|
sprintf( str+strlen(str), "\n" );
|
||||||
res = static_cast<int>(ImageIO_write( im, str, strlen( str )));
|
res = ImageIO_write( im, str, strlen( str ));
|
||||||
if ( res <= 0 ) {
|
if ( res < strlen(str) ) {
|
||||||
fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
|
fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
|
||||||
if ( outputName != NULL ) ImageIO_free( outputName );
|
if ( outputName != NULL ) ImageIO_free( outputName );
|
||||||
return( -3 );
|
return( -3 );
|
||||||
|
|
@ -188,8 +188,8 @@ int writeGis( char *name, _image* im) {
|
||||||
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
|
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
|
||||||
}
|
}
|
||||||
sprintf( str+strlen(str), "\n" );
|
sprintf( str+strlen(str), "\n" );
|
||||||
res = static_cast<int>(ImageIO_write(im, str, strlen(str)));
|
res = ImageIO_write( im, str, strlen( str ));
|
||||||
if ( res <= 0 ) {
|
if ( res < strlen(str) ) {
|
||||||
fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
|
fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
|
||||||
if ( outputName != NULL ) ImageIO_free( outputName );
|
if ( outputName != NULL ) ImageIO_free( outputName );
|
||||||
return( -3 );
|
return( -3 );
|
||||||
|
|
@ -207,8 +207,8 @@ int writeGis( char *name, _image* im) {
|
||||||
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
|
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
|
||||||
}
|
}
|
||||||
sprintf( str+strlen(str), "\n" );
|
sprintf( str+strlen(str), "\n" );
|
||||||
res = static_cast<int>(ImageIO_write(im, str, strlen(str)));
|
res = ImageIO_write( im, str, strlen( str ));
|
||||||
if ( res <= 0 ) {
|
if ( res < strlen(str) ) {
|
||||||
fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
|
fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
|
||||||
if ( outputName != NULL ) ImageIO_free( outputName );
|
if ( outputName != NULL ) ImageIO_free( outputName );
|
||||||
return( -3 );
|
return( -3 );
|
||||||
|
|
@ -222,13 +222,14 @@ int writeGis( char *name, _image* im) {
|
||||||
} /* end of switch( im->wordKind ) */
|
} /* end of switch( im->wordKind ) */
|
||||||
|
|
||||||
ImageIO_free( str );
|
ImageIO_free( str );
|
||||||
|
if (outputName != NULL) ImageIO_free(outputName);
|
||||||
|
return static_cast<int>(res);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res = _writeInrimageData(im);
|
bool ret = _writeInrimageData(im);
|
||||||
|
if (outputName != NULL) ImageIO_free(outputName);
|
||||||
|
return (ret ? 1 : -1);
|
||||||
}
|
}
|
||||||
if ( outputName != NULL ) ImageIO_free( outputName );
|
|
||||||
return res;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL_INLINE_FUNCTION
|
CGAL_INLINE_FUNCTION
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ int _writeInrimageHeader(const _image *im,
|
||||||
|
|
||||||
/** Writes the given image body in an already opened file.
|
/** Writes the given image body in an already opened file.
|
||||||
@param im image descriptor */
|
@param im image descriptor */
|
||||||
int _writeInrimageData(const _image *im);
|
bool _writeInrimageData(const _image *im);
|
||||||
|
|
||||||
/** read header from an opened inrimage file
|
/** read header from an opened inrimage file
|
||||||
@param im opened inrmage descriptor */
|
@param im opened inrmage descriptor */
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ int _writeInrimageHeader(const _image *im, ENDIANNESS end) {
|
||||||
|
|
||||||
/* Writes the given image body in an already opened file.*/
|
/* Writes the given image body in an already opened file.*/
|
||||||
CGAL_INLINE_FUNCTION
|
CGAL_INLINE_FUNCTION
|
||||||
int _writeInrimageData(const _image *im) {
|
bool _writeInrimageData(const _image *im) {
|
||||||
std::size_t size, nbv, nwrt, i, v;
|
std::size_t size, nbv, nwrt, i, v;
|
||||||
unsigned char **vp;
|
unsigned char **vp;
|
||||||
|
|
||||||
|
|
@ -204,8 +204,8 @@ int _writeInrimageData(const _image *im) {
|
||||||
if(im->vectMode != VM_NON_INTERLACED) {
|
if(im->vectMode != VM_NON_INTERLACED) {
|
||||||
size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
|
size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
|
||||||
nwrt = ImageIO_write(im, im->data, size);
|
nwrt = ImageIO_write(im, im->data, size);
|
||||||
if(nwrt != size) return -1;
|
if(nwrt != size) return false;
|
||||||
else return 1;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* non interlaced vectors: interlace for saving */
|
/* non interlaced vectors: interlace for saving */
|
||||||
|
|
@ -218,14 +218,14 @@ int _writeInrimageData(const _image *im) {
|
||||||
for(i = 0; i < nbv; i++)
|
for(i = 0; i < nbv; i++)
|
||||||
for(v = 0; v < im->vdim; v++) {
|
for(v = 0; v < im->vdim; v++) {
|
||||||
if(ImageIO_write(im, (const void *) vp[v], im->wdim) != im->wdim)
|
if(ImageIO_write(im, (const void *) vp[v], im->wdim) != im->wdim)
|
||||||
return -1;
|
return false;
|
||||||
vp[v] += im->wdim;
|
vp[v] += im->wdim;
|
||||||
}
|
}
|
||||||
ImageIO_free(vp);
|
ImageIO_free(vp);
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return -1;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -486,14 +486,13 @@ int writeInrimage(char *name,_image *im) {
|
||||||
return( res );
|
return( res );
|
||||||
}
|
}
|
||||||
|
|
||||||
res = _writeInrimageData( im );
|
if (!_writeInrimageData(im)) {
|
||||||
if (res < 0) {
|
|
||||||
fprintf(stderr, "writeInrimage: error: unable to write data of \'%s\'\n",
|
fprintf(stderr, "writeInrimage: error: unable to write data of \'%s\'\n",
|
||||||
name);
|
name);
|
||||||
ImageIO_close( im );
|
ImageIO_close( im );
|
||||||
im->fd = NULL;
|
im->fd = NULL;
|
||||||
im->openMode = OM_CLOSE;
|
im->openMode = OM_CLOSE;
|
||||||
return( res );
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageIO_close( im );
|
ImageIO_close( im );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue