@@ -380,7 +380,11 @@ __unf_init(bool read, bool byte_swap)
380380 }
381381 if (byte_swap )
382382 __fortio_swap_bytes ((char * )& rec_len , __INT , 1 );
383- {
383+ if (!f90_old_huge_rec_fmt ()) {
384+ continued = (rec_len < 0 );
385+ if (continued )
386+ rec_len = - rec_len ;
387+ } else {
384388 continued = ((rec_len & CONT_FLAG ) != 0 );
385389 rec_len &= ~CONT_FLAG ;
386390 }
@@ -1197,7 +1201,10 @@ __unf_end(bool to_be_continued)
11971201 while (continued ) {
11981202 if (__io_fread (& rec_len , 4 , 1 , Fcb -> fp ) != 1 )
11991203 UNF_ERR (__io_errno ());
1200- {
1204+ if (!f90_old_huge_rec_fmt ()) {
1205+ if (__io_fseek (Fcb -> fp , - rec_len + 4 , SEEK_CUR ))
1206+ continued = (rec_len < 0 );
1207+ } else {
12011208 if (__io_fseek (Fcb -> fp , (rec_len &= ~CONT_FLAG ) + 4 , SEEK_CUR ))
12021209 continued = (rec_len & CONT_FLAG );
12031210 }
@@ -1256,7 +1263,9 @@ __unf_end(bool to_be_continued)
12561263 /* If this record's data is to be continued in the next record,
12571264 set the continuation bit in this record's leading length word. */
12581265 if (to_be_continued ) {
1259- {
1266+ if (!f90_old_huge_rec_fmt ()) {
1267+ unf_rec .u .s .bytecnt = - unf_rec .u .s .bytecnt ;
1268+ } else {
12601269 unf_rec .u .s .bytecnt |= CONT_FLAG ;
12611270 }
12621271 }
@@ -1273,7 +1282,9 @@ __unf_end(bool to_be_continued)
12731282 /* If this record is a continuation of the previous record, set the
12741283 continuation bit in this record's trailing length word. */
12751284 if (continued ) {
1276- {
1285+ if (!f90_old_huge_rec_fmt ()) {
1286+ unf_rec .u .s .bytecnt = - unf_rec .u .s .bytecnt ;
1287+ } else {
12771288 unf_rec .u .s .bytecnt |= CONT_FLAG ;
12781289 }
12791290 }
@@ -2033,7 +2044,12 @@ __usw_end(bool to_be_continued)
20332044 if (__io_fread (& rec_len , 4 , 1 , Fcb -> fp ) != 1 )
20342045 UNF_ERR (__io_errno ());
20352046 __fortio_swap_bytes ((char * )& rec_len , __INT , 1 );
2036- {
2047+ if (!f90_old_huge_rec_fmt ()) {
2048+ if (__io_fseek (Fcb -> fp , - rec_len + 4 , SEEK_CUR )) {
2049+ UNF_ERR (__io_errno ());
2050+ }
2051+ continued = (rec_len < 0 );
2052+ } else {
20372053 if (__io_fseek (Fcb -> fp , (rec_len &= ~CONT_FLAG ) + 4 , SEEK_CUR )) {
20382054 UNF_ERR (__io_errno ());
20392055 }
@@ -2101,9 +2117,14 @@ __usw_end(bool to_be_continued)
21012117 UNF_ERR (__io_errno ());
21022118 if (__io_fseek (Fcb -> fp , (seekoffx_t )unf_rec .u .s .bytecnt , SEEK_CUR ) != 0 )
21032119 UNF_ERR (__io_errno ());
2120+ if (to_be_continued && !continued ) {
2121+ bs_tmp = f90_old_huge_rec_fmt () ? - bs_tmp : bs_tmp & ~CONT_FLAG_SW ;
2122+ }
21042123 }
21052124 /* If this record is a continuation of the previous record, set the
21062125 continuation bit in this record's trailing length word. */
2126+ if (continued )
2127+ bs_tmp = f90_old_huge_rec_fmt () ? bs_tmp : (bs_tmp | CONT_FLAG_SW );
21072128 continued = to_be_continued ;
21082129 /* write record length at end of record */
21092130 if ((FWRITE (& bs_tmp , RCWSZ , 1 , Fcb -> fp )) != 1 )
0 commit comments