commit e83f3bb

Devine Lu Linvega  ·  2025-01-22 22:56:39 +0000 UTC
parent c822c36
(file.c) Remove needless masking
1 files changed,  +19, -19
+19, -19
  1@@ -45,26 +45,26 @@ typedef struct {
  2 
  3 static UxnFile uxn_file[2];
  4 
  5-static Uint16
  6-put_fill(Uint8 *dest, Uint16 len, char c)
  7+static int
  8+put_fill(Uint8 *dest, int len, char c)
  9 {
 10-	Uint16 i;
 11+	int i;
 12 	for(i = 0; i < len; i++)
 13 		*(dest++) = c;
 14 	return len;
 15 }
 16 
 17-static Uint16
 18-put_size(Uint8 *dest, Uint16 len, off_t size)
 19+static int
 20+put_size(Uint8 *dest, int len, off_t size)
 21 {
 22-	Uint16 i;
 23+	int i;
 24 	for(i = 0, dest += len; i < len; i++, size >>= 4)
 25 		*(--dest) = "0123456789abcdef"[(Uint8)(size & 0xf)];
 26 	return len;
 27 }
 28 
 29-static Uint16
 30-put_stat(Uint8 *dest, Uint16 len, int size, int err, int dir, int capsize)
 31+static int
 32+put_stat(Uint8 *dest, int len, int size, int err, int dir, int capsize)
 33 {
 34 	if(err) return put_fill(dest, len, '!');
 35 	if(dir) return put_fill(dest, len, '-');
 36@@ -72,8 +72,8 @@ put_stat(Uint8 *dest, Uint16 len, int size, int err, int dir, int capsize)
 37 	return put_size(dest, len, size);
 38 }
 39 
 40-static Uint16
 41-put_statfile(Uint8 *dest, Uint16 len, const char *filepath, const char *basename)
 42+static int
 43+put_statfile(Uint8 *dest, unsigned int len, const char *filepath, const char *basename)
 44 {
 45 	int err, dir;
 46 	struct stat st;
 47@@ -84,8 +84,8 @@ put_statfile(Uint8 *dest, Uint16 len, const char *filepath, const char *basename
 48 	return snprintf((char *)dest, len, dir ? " %s/\n" : " %s\n", basename) + 4;
 49 }
 50 
 51-static Uint16
 52-put_fdir(UxnFile *uf, Uint8 *dest, Uint16 len)
 53+static int
 54+put_fdir(UxnFile *uf, Uint8 *dest, int len)
 55 {
 56 	Uint8 *_dest = dest;
 57 	static char pathname[0x2000];
 58@@ -138,7 +138,7 @@ file_reset(UxnFile *uf)
 59 	uf->state = IDLE;
 60 }
 61 
 62-static Uint16
 63+static int
 64 file_init(UxnFile *uf, Uint16 addr)
 65 {
 66 	file_reset(uf);
 67@@ -146,7 +146,7 @@ file_init(UxnFile *uf, Uint16 addr)
 68 	return 0;
 69 }
 70 
 71-static Uint16
 72+static int
 73 file_read(UxnFile *uf, Uint16 addr, int len)
 74 {
 75 	void *dest = &uxn.ram[addr];
 76@@ -164,8 +164,8 @@ file_read(UxnFile *uf, Uint16 addr, int len)
 77 	return 0;
 78 }
 79 
 80-static Uint16
 81-file_write(UxnFile *uf, Uint16 addr, Uint16 len, Uint8 flags)
 82+static int
 83+file_write(UxnFile *uf, Uint16 addr, int len, Uint8 flags)
 84 {
 85 	Uint16 ret = 0;
 86 	file_write_dir(uf->filepath);
 87@@ -184,8 +184,8 @@ file_write(UxnFile *uf, Uint16 addr, Uint16 len, Uint8 flags)
 88 	return ret;
 89 }
 90 
 91-static Uint16
 92-file_stat(UxnFile *uf, Uint16 addr, Uint16 len)
 93+static int
 94+file_stat(UxnFile *uf, Uint16 addr, int len)
 95 {
 96 	int err, dir;
 97 	struct stat st;
 98@@ -194,7 +194,7 @@ file_stat(UxnFile *uf, Uint16 addr, Uint16 len)
 99 	return put_stat(&uxn.ram[addr], len, st.st_size, err, dir, 0);
100 }
101 
102-static Uint16
103+static int
104 file_delete(UxnFile *uf)
105 {
106 	return unlink(uf->filepath);