uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 2878639cd77e0e3cfd9f818c7131db267ee0bc06
parent 6712c3eeb9bf01bc73f03d254e5c3c4441874777
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Thu,  4 Jan 2024 17:20:50 -0800

(file) Expand stat port to show longer file length than a short

Diffstat:
Msrc/devices/file.c | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/devices/file.c b/src/devices/file.c @@ -235,17 +235,17 @@ file_stat(UxnFile *c, char *p, Uint16 len) if(c->outside_sandbox || !len) return 0; if(stat(c->current_filename, &st)) - for(i = 0; i < len && i < 4; i++) + for(i = 0; i < len; i++) p[i] = '!'; else if(S_ISDIR(st.st_mode)) - for(i = 0; i < len && i < 4; i++) + for(i = 0; i < len; i++) p[i] = '-'; - else if(st.st_size >= 0x10000) - for(i = 0; i < len && i < 4; i++) + else if(st.st_size >= 1 << (len << 2)) + for(i = 0; i < len; i++) p[i] = '?'; else - for(i = 0, size = st.st_size; i < len && i < 4; i++, size <<= 4) - p[i] = inthex(size >> 0xc); + for(i = 0, size = st.st_size; i < len; i++) + p[i] = inthex(size >> ((len - i - 1) << 2)); return len; }