summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLeon Arber <larber@ncsa.uiuc.edu>2005-03-13 23:38:11 (GMT)
committerLeon Arber <larber@ncsa.uiuc.edu>2005-03-13 23:38:11 (GMT)
commit82b3a0ca4a4c04c6ad75b30a5b8491b0f4321bd0 (patch)
tree5e4a52d66b2d9a8988d9eb5dd536725e664ebb2d /tools
parentc33f593665c25e410d6da692daa322a1e88162eb (diff)
downloadhdf5-82b3a0ca4a4c04c6ad75b30a5b8491b0f4321bd0.zip
hdf5-82b3a0ca4a4c04c6ad75b30a5b8491b0f4321bd0.tar.gz
hdf5-82b3a0ca4a4c04c6ad75b30a5b8491b0f4321bd0.tar.bz2
[svn-r10206]
Purpose: Bug fix. Description: ph5diff fails on modi4 due to the way snprintf works on IRIX. Solution: The C99 standard says that, if there isn't enough room in the string, snprintf should return the number of characters that would have been written to the output string if there were enough room. The snprintf on modi4 would return the number of characters that is was able to write succesfully to the string if space ran out. The ph5diff logic that checks if the output buffer was full did not handle this sort of return value correctly. Used VSNPRINTF_WORKS from configure test to check how snprintf works and do the logic accordingly. Platforms tested: modi4 Misc. update:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5diff/ph5diff_main.c4
-rw-r--r--tools/lib/h5diff_util.c16
-rw-r--r--tools/lib/ph5diff.h2
3 files changed, 11 insertions, 11 deletions
diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c
index 3d34af8..082a6bd 100644
--- a/tools/h5diff/ph5diff_main.c
+++ b/tools/h5diff/ph5diff_main.c
@@ -53,7 +53,6 @@ static void ph5diff_worker(int );
int main(int argc, const char *argv[])
{
- int i;
int nID = 0;
const char *fname1 = NULL;
const char *fname2 = NULL;
@@ -61,7 +60,6 @@ int main(int argc, const char *argv[])
const char *objname2 = NULL;
hsize_t nfound=0;
diff_opt_t options;
- MPI_Status Status;
outBuffOffset = 0;
g_Parallel = 1;
@@ -133,8 +131,8 @@ ph5diff_worker(int nID)
char filenames[2][1024];
char out_data[PRINT_DATA_MAX_SIZE] = {0};
hsize_t nfound=0;
+ int i;
MPI_Status Status;
- int i;
MPI_Comm_rank(MPI_COMM_WORLD, &nID);
outBuffOffset = 0;
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index c55028c..818a933 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -49,17 +49,20 @@ void parallel_print(const char* format, ...)
if(overflow_file == NULL) /*no overflow has occurred yet */
{
bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap);
-
- va_end(ap);
+
+ va_end(ap);
va_start(ap, format);
- if(bytes_written >= (OUTBUFF_SIZE-outBuffOffset))
+#ifdef VSNPRINTF_WORKS
+ if(bytes_written >= (OUTBUFF_SIZE-outBuffOffset))
+#else
+ if((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset))
+#endif
{
/* Delete the characters that were written to outBuff since they will be written to the overflow_file */
- memset(outBuff+outBuffOffset, 0, OUTBUFF_SIZE - outBuffOffset);
-
+ memset(outBuff+outBuffOffset, 0, OUTBUFF_SIZE - outBuffOffset);
+
overflow_file = tmpfile();
-
if(overflow_file == NULL)
printf("Warning: Could not create overflow file. Output may be truncated.\n");
else
@@ -71,7 +74,6 @@ void parallel_print(const char* format, ...)
else
bytes_written = HDvfprintf(overflow_file, format, ap);
-
}
va_end(ap);
}
diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h
index 44e5b26..911f354 100644
--- a/tools/lib/ph5diff.h
+++ b/tools/lib/ph5diff.h
@@ -17,7 +17,7 @@
#define PRINT_DATA_MAX_SIZE 512
-#define OUTBUFF_SIZE PRINT_DATA_MAX_SIZE*2
+#define OUTBUFF_SIZE PRINT_DATA_MAX_SIZE*4
/* Send from manager to workers */
#define MPI_TAG_ARGS 1
#define MPI_TAG_PRINT_TOK 2