Changeset 24391 for trunk/extsrc/gpcsw/gpcsrc/fits/libfh
- Timestamp:
- Jun 12, 2009, 3:53:07 PM (17 years ago)
- Location:
- trunk/extsrc/gpcsw/gpcsrc/fits/libfh
- Files:
-
- 2 edited
-
fh.c (modified) (9 diffs)
-
fh_table.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh.c
r23490 r24391 200 200 /* Functions that do file operations WITH RETRY: */ 201 201 static int write_file(int fd, const void* buf, int len); 202 static int read_file(int fd, constvoid* buf, int len);202 static int read_file(int fd, void* buf, int len); 203 203 static int seek_file(int fd, off_t off); /* Performs lseek(SEEK_SET) */ 204 204 static int fh_lock_file(HeaderUnit hu, int fd, fh_mode mode); … … 234 234 * this information in debug mode. 235 235 */ 236 const char* fh_rcs_version(void); /* proto to make gcc happy */ 236 237 const char* fh_rcs_version(void) { return rcs_id; } 237 238 … … 274 275 275 276 static void 276 null_log(const char* s) { if (s) ; }277 null_log(const char* s) { if (s) return; } 277 278 /* 278 279 * It's also possible to pass a NULL to fh_log_xxx() and rely only on the … … 309 310 310 311 HeaderUnit 311 fh_create( )312 fh_create(void) 312 313 { 313 314 HeaderUnitStruct* rtn; … … 1941 1942 HeaderUnitStruct* list = FH_HU(hu); 1942 1943 char writebuf[FH_BLOCK_SIZE]; 1943 int i = 0, writelen; 1944 int i = 0; 1945 unsigned int writelen; 1944 1946 int blocks_left; 1945 1947 fh_result result; … … 2446 2448 else /* byte-swapping case requires a temporary buffer */ 2447 2449 { 2448 unsigned char outbuf[32768];2450 unsigned char* outbuf[32768]; 2449 2451 2450 2452 while (bytes_left) … … 2811 2813 while (len) 2812 2814 { 2813 rtn = write(fd, (char*)buf, len); 2815 rtn = write(fd, (const char*)buf, len); 2816 2817 switch (rtn) 2818 { 2819 case -1: if (errno == EINTR || errno == EAGAIN) 2820 continue; /* retry */ 2821 return -1; /* permanent failure */ 2822 case 0: return count; 2823 default: 2824 { 2825 len -= rtn; 2826 count += rtn; 2827 buf = (const char*)buf + rtn; 2828 } 2829 } 2830 } 2831 return count; 2832 } 2833 2834 static int 2835 read_file(int fd, void* buf, int len) 2836 { 2837 int rtn; 2838 int count = 0; 2839 2840 while (len) 2841 { 2842 rtn = read(fd, (char*)buf, len); 2814 2843 2815 2844 switch (rtn) … … 2831 2860 2832 2861 static int 2833 read_file(int fd, const void* buf, int len)2834 {2835 int rtn;2836 int count = 0;2837 2838 while (len)2839 {2840 rtn = read(fd, (char*)buf, len);2841 2842 switch (rtn)2843 {2844 case -1: if (errno == EINTR || errno == EAGAIN)2845 continue; /* retry */2846 return -1; /* permanent failure */2847 case 0: return count;2848 default:2849 {2850 len -= rtn;2851 count += rtn;2852 buf = (char*)buf + rtn;2853 }2854 }2855 }2856 return count;2857 }2858 2859 static int2860 2862 seek_file(int fd, off_t off) 2861 2863 { … … 2969 2971 fh_compare(const void* a, const void* b) 2970 2972 { 2971 double diff = (*((FitsCard* *)a))->idx - (*((FitsCard**)b))->idx;2973 double diff = (*((FitsCard* const*)a))->idx - (*((FitsCard* const*)b))->idx; 2972 2974 2973 2975 if (diff < 0) return -1; -
trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh_table.c
r23924 r24391 180 180 181 181 /* Write the format specifiers for each column. */ 182 for(i=0; i < table->num_cols; i++) 183 { 182 for (i=0; i < table->num_cols; i++) 183 { 184 int n; 185 184 186 idx = 5.0 + i/10.; 185 intn = i + 1; /* FITS numbering scheme starts from 1. */187 n = i + 1; /* FITS numbering scheme starts from 1. */ 186 188 snprintf(keyword, FH_NAME_SIZE + 1, "TFORM%d", n); 187 189 if((table->cols[i].format == FH_TABLE_FORMAT_FLOAT) || … … 214 216 * nice to have from a self-documenting perspective, isn't strictly 215 217 * necessary to interpret the actual table values. */ 216 for(i=0; i < table->num_cols; i++) 217 { 218 for (i=0; i < table->num_cols; i++) 219 { 220 int n; 221 218 222 idx = 7.0 + i/10.; 219 intn = i + 1; /* FITS numbering scheme starts from 1. */223 n = i + 1; /* FITS numbering scheme starts from 1. */ 220 224 snprintf(keyword, FH_NAME_SIZE + 1, "TTYPE%d", n); 221 225 fh_set_str(hu, idx, keyword, table->cols[i].name,
Note:
See TracChangeset
for help on using the changeset viewer.
