File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -827,8 +827,8 @@ ti_Rewind:
827827 or a , a
828828 sbc hl , hl
829829 ret
830- scf
831830.ret_neg_one:
831+ scf
832832 sbc hl , hl
833833 ret
834834
@@ -850,6 +850,7 @@ ti_Tell:
850850 pop hl
851851 ret
852852.ret_neg_one:
853+ scf
853854 sbc hl , hl
854855 ret
855856
@@ -871,6 +872,7 @@ ti_GetSize:
871872 pop hl
872873 ret
873874.ret_neg_one:
875+ scf
874876 sbc hl , hl
875877 ret
876878
Original file line number Diff line number Diff line change 11#include <stdio.h>
22#include <fileioc.h>
3+ #include <stdint.h>
34
45long int __attribute__((weak )) ftell (FILE * stream )
56{
@@ -11,5 +12,10 @@ long int __attribute__((weak)) ftell(FILE *stream)
1112 return -1L ;
1213 }
1314
14- return (long int )ti_Tell (stream -> slot );
15+ // ti_Tell shouldn't return a value greater than OS_VAR_MAX_SIZE (65512) unless an error occurs
16+ uint16_t ret = ti_Tell (stream -> slot );
17+ if (ret == UINT16_MAX ) {
18+ return -1L ;
19+ }
20+ return (long int )ret ;
1521}
You can’t perform that action at this time.
0 commit comments