IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 12, 2009, 3:53:07 PM (17 years ago)
Author:
eugene
Message:

updates to burntool-and-related from camera svn

Location:
trunk/extsrc/gpcsw/gpcsrc/fits/libfh
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh.c

    r23490 r24391  
    200200/* Functions that do file operations WITH RETRY: */
    201201static int write_file(int fd, const void* buf, int len);
    202 static int read_file(int fd, const void* buf, int len);
     202static int read_file(int fd, void* buf, int len);
    203203static int seek_file(int fd, off_t off); /* Performs lseek(SEEK_SET) */
    204204static int fh_lock_file(HeaderUnit hu, int fd, fh_mode mode);
     
    234234 * this information in debug mode.
    235235 */
     236const char* fh_rcs_version(void); /* proto to make gcc happy */
    236237const char* fh_rcs_version(void) { return rcs_id; }
    237238
     
    274275
    275276static void
    276 null_log(const char* s) { if (s) ; }
     277null_log(const char* s) { if (s) return; }
    277278/*
    278279 * It's also possible to pass a NULL to fh_log_xxx() and rely only on the
     
    309310
    310311HeaderUnit
    311 fh_create()
     312fh_create(void)
    312313{
    313314   HeaderUnitStruct* rtn;
     
    19411942   HeaderUnitStruct* list = FH_HU(hu);
    19421943   char writebuf[FH_BLOCK_SIZE];
    1943    int i = 0, writelen;
     1944   int i = 0;
     1945   unsigned int writelen;
    19441946   int blocks_left;
    19451947   fh_result result;
     
    24462448   else /* byte-swapping case requires a temporary buffer */
    24472449   {
    2448       unsigned char outbuf[32768];
     2450      unsigned char* outbuf[32768];
    24492451
    24502452      while (bytes_left)
     
    28112813   while (len)
    28122814   {
    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
     2834static int
     2835read_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);
    28142843
    28152844      switch (rtn)
     
    28312860
    28322861static 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 int
    28602862seek_file(int fd, off_t off)
    28612863{
     
    29692971fh_compare(const void* a, const void* b)
    29702972{
    2971    double diff = (*((FitsCard**)a))->idx - (*((FitsCard**)b))->idx;
     2973   double diff = (*((FitsCard* const*)a))->idx - (*((FitsCard* const*)b))->idx;
    29722974
    29732975   if (diff < 0) return -1;
  • trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh_table.c

    r23924 r24391  
    180180
    181181   /* 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
    184186      idx = 5.0 + i/10.;
    185       int n = i + 1; /* FITS numbering scheme starts from 1. */
     187      n = i + 1; /* FITS numbering scheme starts from 1. */
    186188      snprintf(keyword, FH_NAME_SIZE + 1, "TFORM%d", n);
    187189      if((table->cols[i].format == FH_TABLE_FORMAT_FLOAT) ||
     
    214216    * nice to have from a self-documenting perspective, isn't strictly
    215217    * 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
    218222      idx = 7.0 + i/10.;
    219       int n = i + 1; /* FITS numbering scheme starts from 1. */
     223      n = i + 1; /* FITS numbering scheme starts from 1. */
    220224      snprintf(keyword, FH_NAME_SIZE + 1, "TTYPE%d", n);
    221225      fh_set_str(hu, idx, keyword, table->cols[i].name,
Note: See TracChangeset for help on using the changeset viewer.