summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorXuan Bai <xuanbai@hdfgroup.org>2004-08-18 22:00:55 (GMT)
committerXuan Bai <xuanbai@hdfgroup.org>2004-08-18 22:00:55 (GMT)
commitee21dce85ce38fe7f718322b59288aabd3906e76 (patch)
tree5a8857f77d22032791763ce3d183531d91c51caf /tools
parent3abcdf8e9c0bc816da90aff466e7b8ee511145ce (diff)
downloadhdf5-ee21dce85ce38fe7f718322b59288aabd3906e76.zip
hdf5-ee21dce85ce38fe7f718322b59288aabd3906e76.tar.gz
hdf5-ee21dce85ce38fe7f718322b59288aabd3906e76.tar.bz2
[svn-r9110] Purpose:
Update. Description: Make some minor change so that h5jam.c is compatible with Windows. Solution: 1. unistd.h is not available in windows system. Add a macro for this header file as: #ifdef H5_HAVE_UNISTD_H #include <unistd.h> #endif 2. Change open, read, write, lseek functions to HDopen, HDread, HDwrite, and HDlseek, as these HD functions are more comtatible with Windows system. 3. add #include H5private.h 4. remove #include <stdlib.h> Platforms tested: Windows 2000 Windows XP eirene (Note: I talked with Bob and Kent about these changes before check-in) Misc. update:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5jam/h5jam.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c
index 07194cb..f5cdfe0 100644
--- a/tools/h5jam/h5jam.c
+++ b/tools/h5jam/h5jam.c
@@ -13,12 +13,15 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdio.h>
-#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
+
+#ifdef H5_HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "hdf5.h"
+#include "H5private.h"
#include "h5tools_utils.h"
#define TRUE 1
@@ -233,7 +236,7 @@ main (int argc, const char *argv[])
H5Pclose (plist);
H5Fclose (ifile);
- ufid = open (ub_file, O_RDONLY);
+ ufid = HDopen (ub_file, O_RDONLY, 0);
if (ufid < 0)
{
@@ -252,7 +255,7 @@ main (int argc, const char *argv[])
fsize = sbuf.st_size;
- h5fid = open (input_file, O_RDONLY);
+ h5fid = HDopen (input_file, O_RDONLY, 0);
if (h5fid < 0)
{
@@ -273,7 +276,7 @@ main (int argc, const char *argv[])
if (output_file == NULL)
{
- ofid = open (input_file, O_WRONLY);
+ ofid = HDopen (input_file, O_WRONLY, 0);
if (ofid < 0)
{
@@ -284,7 +287,7 @@ main (int argc, const char *argv[])
}
else
{
- ofid = open (output_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+ ofid = HDopen (output_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (ofid < 0)
{
@@ -435,23 +438,24 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
while (howmuch > 0)
{
- lseek (outfid, (off_t) to, SEEK_SET);
- lseek (infid, (off_t) from, SEEK_SET);
+ HDlseek (outfid, (off_t) to, SEEK_SET);
+ HDlseek (infid, (off_t) from, SEEK_SET);
if (howmuch > 512)
{
- nchars = read (infid, buf, (unsigned) 512);
+ nchars = HDread (infid, buf, (unsigned) 512);
}
else
{
- nchars = read (infid, buf, howmuch);
+ nchars = HDread (infid, buf, howmuch);
}
+
if (nchars <= 0)
{
printf ("huh? \n");
exit (1);
}
- /*ncw = */ write (outfid, buf, (unsigned) nchars);
+ /*ncw = */ HDwrite (outfid, buf, (unsigned) nchars);
/* assert (ncw == nchars) */
@@ -526,14 +530,14 @@ write_pad (int ofile, hsize_t where)
buf[0] = '\0';
- lseek (ofile, (off_t) where, SEEK_SET);
+ HDlseek (ofile, (off_t) where, SEEK_SET);
psize = compute_user_block_size (where);
psize -= where;
for (i = 0; i < psize; i++)
{
- write (ofile, buf, 1);
+ HDwrite (ofile, buf, 1);
}
return (where + psize); /* the new size of the file. */
}