comparison target-utils/libtiffs/rdinmem.c @ 60:87cb03b35f77

target-utils: long-overdue s/mpffs/tiffs/ and s/MPFFS/TIFFS/ rename
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 26 Oct 2016 15:52:14 +0000
parents e7502631a0f9
children 9214118ae941
comparison
equal deleted inserted replaced
59:819335e06fd1 60:87cb03b35f77
2 #include "types.h" 2 #include "types.h"
3 #include "struct.h" 3 #include "struct.h"
4 #include "globals.h" 4 #include "globals.h"
5 #include "macros.h" 5 #include "macros.h"
6 6
7 mpffs_read_into_ram(pathname, buf, maxlen, lenrtn) 7 tiffs_read_into_ram(pathname, buf, maxlen, lenrtn)
8 char *pathname; 8 char *pathname;
9 u8 *buf; 9 u8 *buf;
10 size_t maxlen, *lenrtn; 10 size_t maxlen, *lenrtn;
11 { 11 {
12 int stat, cont; 12 int stat, cont;
13 u8 *chunk_start; 13 u8 *chunk_start;
14 size_t chunk_size, real_len, roomleft; 14 size_t chunk_size, real_len, roomleft;
15 15
16 stat = mpffs_find_file(pathname, &chunk_start, &chunk_size, &cont); 16 stat = tiffs_find_file(pathname, &chunk_start, &chunk_size, &cont);
17 if (stat < 0) 17 if (stat < 0)
18 return(stat); 18 return(stat);
19 if (chunk_size > maxlen) { 19 if (chunk_size > maxlen) {
20 toobig: printf("Error: %s is bigger than the read buffer\n", pathname); 20 toobig: printf("Error: %s is bigger than the read buffer\n", pathname);
21 return(-1); 21 return(-1);
23 real_len = chunk_size; 23 real_len = chunk_size;
24 bcopy(chunk_start, buf, chunk_size); 24 bcopy(chunk_start, buf, chunk_size);
25 buf += chunk_size; 25 buf += chunk_size;
26 roomleft = maxlen - chunk_size; 26 roomleft = maxlen - chunk_size;
27 while (cont) { 27 while (cont) {
28 stat = mpffs_get_segment(cont, &chunk_start, &chunk_size, 28 stat = tiffs_get_segment(cont, &chunk_start, &chunk_size,
29 &cont); 29 &cont);
30 if (stat < 0) 30 if (stat < 0)
31 return(stat); 31 return(stat);
32 if (chunk_size > roomleft) 32 if (chunk_size > roomleft)
33 goto toobig; 33 goto toobig;