rational_precision2double.c: fix many warnings, and do not build it on CMake on shared lib builds
This commit is contained in:
parent
edc16ac20a
commit
721120d0d7
@ -194,8 +194,12 @@ endif()
|
|||||||
add_executable(custom_dir custom_dir.c)
|
add_executable(custom_dir custom_dir.c)
|
||||||
target_link_libraries(custom_dir tiff port)
|
target_link_libraries(custom_dir tiff port)
|
||||||
|
|
||||||
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
add_executable(rational_precision2double rational_precision2double.c)
|
add_executable(rational_precision2double rational_precision2double.c)
|
||||||
target_link_libraries(rational_precision2double tiff port)
|
target_link_libraries(rational_precision2double tiff port)
|
||||||
|
add_test(NAME "rational_precision2double"
|
||||||
|
COMMAND "rational_precision2double")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(defer_strile_loading defer_strile_loading.c)
|
add_executable(defer_strile_loading defer_strile_loading.c)
|
||||||
target_link_libraries(defer_strile_loading tiff port)
|
target_link_libraries(defer_strile_loading tiff port)
|
||||||
|
@ -46,8 +46,9 @@
|
|||||||
#define GOTOFAILURE
|
#define GOTOFAILURE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
#pragma warning( disable : 4101)
|
#pragma warning( disable : 4101)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "tif_config.h"
|
#include "tif_config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -153,6 +154,7 @@ _XTIFFDefaultDirectory(TIFF *tif)
|
|||||||
n = N(tifFieldInfo);
|
n = N(tifFieldInfo);
|
||||||
//_TIFFMergeFields(tif, const TIFFField info[], uint32 n);
|
//_TIFFMergeFields(tif, const TIFFField info[], uint32 n);
|
||||||
nadded = _TIFFMergeFields(tif, tifFieldInfo, n);
|
nadded = _TIFFMergeFields(tif, tifFieldInfo, n);
|
||||||
|
(void)nadded;
|
||||||
|
|
||||||
/* Since an XTIFF client module may have overridden
|
/* Since an XTIFF client module may have overridden
|
||||||
* the default directory method, we call it now to
|
* the default directory method, we call it now to
|
||||||
@ -182,7 +184,7 @@ main()
|
|||||||
/* delete file, if exists */
|
/* delete file, if exists */
|
||||||
ret = unlink(filenameClassicTiff);
|
ret = unlink(filenameClassicTiff);
|
||||||
errorNo = errno;
|
errorNo = errno;
|
||||||
if (ret != 0 && errno != ENOENT) {
|
if (ret != 0 && errorNo != ENOENT) {
|
||||||
fprintf(stderr, "Can't delete test TIFF file %s.\n", filenameClassicTiff);
|
fprintf(stderr, "Can't delete test TIFF file %s.\n", filenameClassicTiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +201,7 @@ main()
|
|||||||
/*--- Test with BIG-TIFF ---*/
|
/*--- Test with BIG-TIFF ---*/
|
||||||
/* delete file, if exists */
|
/* delete file, if exists */
|
||||||
ret = unlink(filenameBigTiff);
|
ret = unlink(filenameBigTiff);
|
||||||
if (ret != 0 && errno != ENOENT) {
|
if (ret != 0 && errorNo != ENOENT) {
|
||||||
fprintf(stderr, "Can't delete test TIFF file %s.\n", filenameBigTiff);
|
fprintf(stderr, "Can't delete test TIFF file %s.\n", filenameBigTiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +220,7 @@ main()
|
|||||||
/* delete file, if exists */
|
/* delete file, if exists */
|
||||||
ret = unlink(filenameClassicTiff);
|
ret = unlink(filenameClassicTiff);
|
||||||
errorNo = errno;
|
errorNo = errno;
|
||||||
if (ret != 0 && errno != ENOENT) {
|
if (ret != 0 && errorNo != ENOENT) {
|
||||||
fprintf(stderr, "Can't delete test TIFF file %s.\n", filenameClassicTiff);
|
fprintf(stderr, "Can't delete test TIFF file %s.\n", filenameClassicTiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,9 +258,7 @@ int
|
|||||||
write_test_tiff(TIFF* tif, const char* filenameRead, int blnAllCustomTags) {
|
write_test_tiff(TIFF* tif, const char* filenameRead, int blnAllCustomTags) {
|
||||||
unsigned char buf[SPP] = {0, 127, 255};
|
unsigned char buf[SPP] = {0, 127, 255};
|
||||||
/*-- Additional variables --*/
|
/*-- Additional variables --*/
|
||||||
int retCode, retCode2;
|
int retCode;
|
||||||
unsigned char* pGpsVersion;
|
|
||||||
char auxStr[200];
|
|
||||||
float auxFloat = 0.0f;
|
float auxFloat = 0.0f;
|
||||||
double auxDouble = 0.0;
|
double auxDouble = 0.0;
|
||||||
uint16 auxUint16 = 0;
|
uint16 auxUint16 = 0;
|
||||||
@ -271,7 +271,6 @@ write_test_tiff(TIFF* tif, const char* filenameRead, int blnAllCustomTags) {
|
|||||||
long nTags;
|
long nTags;
|
||||||
|
|
||||||
const TIFFFieldArray* tFieldArray;
|
const TIFFFieldArray* tFieldArray;
|
||||||
const TIFFField** tifFields; /* actual field info */
|
|
||||||
unsigned long tTag;
|
unsigned long tTag;
|
||||||
TIFFDataType tType;
|
TIFFDataType tType;
|
||||||
short tWriteCount;
|
short tWriteCount;
|
||||||
@ -286,9 +285,6 @@ write_test_tiff(TIFF* tif, const char* filenameRead, int blnAllCustomTags) {
|
|||||||
#define VARIABLE_ARRAY_SIZE 6
|
#define VARIABLE_ARRAY_SIZE 6
|
||||||
|
|
||||||
/* -- Test data for writing -- */
|
/* -- Test data for writing -- */
|
||||||
char auxCharArrayW[N_SIZE];
|
|
||||||
short auxShortArrayW[N_SIZE];
|
|
||||||
long auxLongArrayW[N_SIZE];
|
|
||||||
float auxFloatArrayW[N_SIZE];
|
float auxFloatArrayW[N_SIZE];
|
||||||
double auxDoubleArrayW[N_SIZE];
|
double auxDoubleArrayW[N_SIZE];
|
||||||
char auxTextArrayW[N_SIZE][STRSIZE];
|
char auxTextArrayW[N_SIZE][STRSIZE];
|
||||||
@ -309,18 +305,12 @@ write_test_tiff(TIFF* tif, const char* filenameRead, int blnAllCustomTags) {
|
|||||||
float flt2;
|
float flt2;
|
||||||
} auxDblUnion;
|
} auxDblUnion;
|
||||||
|
|
||||||
float* pFloat;
|
|
||||||
void* pVoidArray;
|
void* pVoidArray;
|
||||||
float* pFloatArray;
|
float* pFloatArray;
|
||||||
double* pDoubleArray;
|
|
||||||
char* pAscii;
|
|
||||||
char auxCharArray[2 * STRSIZE];
|
|
||||||
short auxShortArray[2 * N_SIZE];
|
|
||||||
long auxLongArray[2 * N_SIZE];
|
|
||||||
float auxFloatArray[2 * N_SIZE];
|
float auxFloatArray[2 * N_SIZE];
|
||||||
double auxDoubleArray[2 * N_SIZE];
|
double auxDoubleArray[2 * N_SIZE];
|
||||||
double dblDiff, dblDiffLimit;
|
double dblDiff, dblDiffLimit;
|
||||||
float fltDiff, fltDiffLimit;
|
float fltDiff;
|
||||||
#define RATIONAL_EPS (1.0/30000.0) /* reduced difference of rational values, approx 3.3e-5 */
|
#define RATIONAL_EPS (1.0/30000.0) /* reduced difference of rational values, approx 3.3e-5 */
|
||||||
|
|
||||||
|
|
||||||
@ -328,15 +318,6 @@ write_test_tiff(TIFF* tif, const char* filenameRead, int blnAllCustomTags) {
|
|||||||
for (i = 0; i < N_SIZE; i++) {
|
for (i = 0; i < N_SIZE; i++) {
|
||||||
sprintf(auxTextArrayW[i], "N%d-String-%d_tttttttttttttttttttttttttttttx", i, i);
|
sprintf(auxTextArrayW[i], "N%d-String-%d_tttttttttttttttttttttttttttttx", i, i);
|
||||||
}
|
}
|
||||||
for (i = 0; i < N_SIZE; i++) {
|
|
||||||
auxCharArrayW[i] = (char)(i + 1);
|
|
||||||
}
|
|
||||||
for (i = 0; i < N_SIZE; i++) {
|
|
||||||
auxShortArrayW[i] = (short)(i + 1) * 7;
|
|
||||||
}
|
|
||||||
for (i = 0; i < N_SIZE; i++) {
|
|
||||||
auxLongArrayW[i] = (i + 1) * 133;
|
|
||||||
}
|
|
||||||
for (i = 0; i < N_SIZE; i++) {
|
for (i = 0; i < N_SIZE; i++) {
|
||||||
auxFloatArrayW[i] = (float)((i + 1) * 133) / 3.3f;
|
auxFloatArrayW[i] = (float)((i + 1) * 133) / 3.3f;
|
||||||
}
|
}
|
||||||
@ -601,7 +582,7 @@ write_test_tiff(TIFF* tif, const char* filenameRead, int blnAllCustomTags) {
|
|||||||
} /* blnAllCustomTags */ /*==== END END - Automatically check all custom rational tags == WRITING END ===*/
|
} /* blnAllCustomTags */ /*==== END END - Automatically check all custom rational tags == WRITING END ===*/
|
||||||
|
|
||||||
/*-- Write dummy pixel data. --*/
|
/*-- Write dummy pixel data. --*/
|
||||||
if (!TIFFWriteScanline(tif, buf, 0, 0) < 0) {
|
if (TIFFWriteScanline(tif, buf, 0, 0) < 0) {
|
||||||
fprintf (stderr, "Can't write image data.\n");
|
fprintf (stderr, "Can't write image data.\n");
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user