ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhcopy.c
(Generate patch)

Comparing ray/src/hd/rhcopy.c (file contents):
Revision 3.32 by greg, Mon Oct 21 18:19:32 2019 UTC vs.
Revision 3.33 by greg, Thu Nov 7 23:17:58 2019 UTC

# Line 94 | Line 94 | userr:
94   #define H_BADF  01
95   #define H_OBST  02
96   #define H_OBSF  04
97 + #define H_SWAP  010
98  
99   static int
100   holheadline(            /* check holodeck header line */
# Line 101 | Line 102 | holheadline(           /* check holodeck header line */
102          void    *vhf
103   )
104   {
105 +        int     be;
106          char    fmt[MAXFMTLEN];
107          int     *hf = vhf;
108  
# Line 122 | Line 124 | holheadline(           /* check holodeck header line */
124                          error(WARNING, "bad OBSTRUCTIONS value in holodeck");
125                  return(0);
126          }
127 +        if ((be = isbigendian(s)) >= 0) {
128 +                if (be != nativebigendian())
129 +                        *hf |= H_SWAP;
130 +        }
131          return(0);
132   }
133  
# Line 144 | Line 150 | openholo(              /* open existing holodeck file for i/o */
150          }
151                                          /* check header and magic number */
152          if (getheader(fp, holheadline, &hflags) < 0 ||
153 <                        hflags&H_BADF || getw(fp) != HOLOMAGIC) {
154 <                sprintf(errmsg, "file \"%s\" not in holodeck format", fname);
153 >                        hflags&(H_BADF|H_SWAP) || getw(fp) != HOLOMAGIC) {
154 >                sprintf(errmsg, "holodeck \"%s\" not in expected format", fname);
155                  error(USER, errmsg);
156          }
157          fd = dup(fileno(fp));                   /* dup file handle */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines