From 2878639cd77e0e3cfd9f818c7131db267ee0bc06 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 4 Jan 2024 17:20:50 -0800 Subject: [PATCH] (file) Expand stat port to show longer file length than a short --- src/devices/file.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/devices/file.c b/src/devices/file.c index e89a760..6385c26 100644 --- 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; }