Patch to: 1. make savi 64-bit clean by use of u_int16_t etc. 2. clean up file-handling use. Patch from Claus-Justus Heine http://sourceforge.net/tracker/index.php?func=detail&aid=946504&group_id=36827&atid=418163 diff -c5pr savi1.2.3/src/gv_utils.c savi1.2.3-64-clean/src/gv_utils.c *** savi1.2.3/src/gv_utils.c Thu Apr 15 23:00:00 2004 --- savi1.2.3-64-clean/src/gv_utils.c Sun May 2 22:53:50 2004 *************** test_ieee_float() *** 77,88 **** void gv_stream_init_proc() { ! gv_out = stdout; ! gv_in = stdin; } /* * gv_init_proc * --- 77,99 ---- void gv_stream_init_proc() { ! /* we redirect stdout to stderr and close stdin */ ! int fdout, fdin, fderr; ! ! fdin = dup(fileno(stdin)); ! fdout = dup(fileno(stdout)); ! fderr = dup(fileno(stderr)); ! ! gv_out = fdopen(fdout, "a"); ! fclose(stdout); ! stdout = fdopen(fderr, "a"); ! gv_in = fdopen(fdin, "r"); ! fclose(stdin); ! stdin = fopen("/dev/null", "r"); } /* * gv_init_proc * *************** gv_send_cmd(int argc, char *argv[]) *** 447,457 **** * to native (big endian) format. * This is for writing in binary format to Geomview and * assumes that unsigned ints are a 32 bit word. */ void ! htonl_buffer(unsigned long int *buf, unsigned int n) { /* * if we are not little-endian, do nothing. */ if (GV_BINARY_FORMAT_AVAILABLE != GV_LITTLE_ENDIAN) return; --- 458,468 ---- * to native (big endian) format. * This is for writing in binary format to Geomview and * assumes that unsigned ints are a 32 bit word. */ void ! htonl_buffer(u_int32_t *buf, unsigned int n) { /* * if we are not little-endian, do nothing. */ if (GV_BINARY_FORMAT_AVAILABLE != GV_LITTLE_ENDIAN) return; *************** htonl_buffer(unsigned long int *buf, uns *** 469,479 **** * to native (big endian) format. * This is for writing in binary format to Geomview and * assumes that unsigned shorts are a 16 bit word. */ void ! htons_buffer(unsigned short int *buf, unsigned int n) { /* * if we are not little-endian, do nothing. */ if (GV_BINARY_FORMAT_AVAILABLE != GV_LITTLE_ENDIAN) return; --- 480,490 ---- * to native (big endian) format. * This is for writing in binary format to Geomview and * assumes that unsigned shorts are a 16 bit word. */ void ! htons_buffer(u_int16_t *buf, unsigned int n) { /* * if we are not little-endian, do nothing. */ if (GV_BINARY_FORMAT_AVAILABLE != GV_LITTLE_ENDIAN) return; diff -c5pr savi1.2.3/src/include/gv_utils.h savi1.2.3-64-clean/src/include/gv_utils.h *** savi1.2.3/src/include/gv_utils.h Thu Apr 15 23:00:00 2004 --- savi1.2.3-64-clean/src/include/gv_utils.h Sun May 2 22:53:50 2004 *************** *** 22,31 **** --- 22,32 ---- #ifndef _GV_UTILS_H_ #define _GV_UTILS_H_ #include + #include /* * Try to check if machine has 32-bit unsigned ints and 32-bit floats * and 16-bit shorts, then use a more efficient method of writing to * Geomview. The test is conservative; you may increase performance *************** unsigned int gv_ready(void); *** 63,72 **** char *gv_begin_cmd(int argc, char *argv[]); char *gv_end_cmd(int argc, char *argv[]); char *gv_wait_cmd(int argc, char *argv[]); char *gv_send_cmd(int argc, char *argv[]); ! void htonl_buffer(unsigned long int *buf, unsigned int n); ! void htons_buffer(unsigned short int *buf, unsigned int n); #endif /* !_GV_UTILS_H_ */ --- 64,73 ---- char *gv_begin_cmd(int argc, char *argv[]); char *gv_end_cmd(int argc, char *argv[]); char *gv_wait_cmd(int argc, char *argv[]); char *gv_send_cmd(int argc, char *argv[]); ! void htonl_buffer(u_int32_t *buf, unsigned int n); ! void htons_buffer(u_int16_t *buf, unsigned int n); #endif /* !_GV_UTILS_H_ */