/[public]/psiconv/trunk/lib/psiconv/parse_simple.c
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/parse_simple.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 64 Revision 79
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*/ 18*/
19 19
20#include "config.h" 20#include "config.h"
21#include "compat.h"
22
21#include <stdlib.h> 23#include <stdlib.h>
22 24
23#include "parse_routines.h" 25#include "parse_routines.h"
26#include "error.h"
24 27
25psiconv_u8 psiconv_read_u8(const psiconv_buffer buf,int lev,psiconv_u32 off, 28psiconv_u8 psiconv_read_u8(const psiconv_buffer buf,int lev,psiconv_u32 off,
26 int *status) 29 int *status)
27{ 30{
28 psiconv_u8 *ptr; 31 psiconv_u8 *ptr;
29 ptr = psiconv_list_get(buf,off); 32 ptr = psiconv_buffer_get(buf,off);
30 if (!ptr) { 33 if (!ptr) {
31 psiconv_warn(lev,off,"Trying byte read past the end of the file"); 34 psiconv_warn(lev,off,"Trying byte read past the end of the file");
32 if (status) 35 if (status)
33 *status = -PSICONV_E_PARSE; 36 *status = -PSICONV_E_PARSE;
34 return 0; 37 return 0;
40 43
41psiconv_u16 psiconv_read_u16(const psiconv_buffer buf,int lev,psiconv_u32 off, 44psiconv_u16 psiconv_read_u16(const psiconv_buffer buf,int lev,psiconv_u32 off,
42 int *status) 45 int *status)
43{ 46{
44 psiconv_u8 *ptr0,*ptr1; 47 psiconv_u8 *ptr0,*ptr1;
45 ptr0 = psiconv_list_get(buf,off); 48 ptr0 = psiconv_buffer_get(buf,off);
46 ptr1 = psiconv_list_get(buf,off+1); 49 ptr1 = psiconv_buffer_get(buf,off+1);
47 if (!ptr0 || !ptr1) { 50 if (!ptr0 || !ptr1) {
48 psiconv_warn(lev,off,"Trying word read past the end of the file"); 51 psiconv_warn(lev,off,"Trying word read past the end of the file");
49 if (status) 52 if (status)
50 *status = -PSICONV_E_PARSE; 53 *status = -PSICONV_E_PARSE;
51 return 0; 54 return 0;
57 60
58psiconv_u32 psiconv_read_u32(const psiconv_buffer buf,int lev,psiconv_u32 off, 61psiconv_u32 psiconv_read_u32(const psiconv_buffer buf,int lev,psiconv_u32 off,
59 int *status) 62 int *status)
60{ 63{
61 psiconv_u8 *ptr0,*ptr1,*ptr2,*ptr3; 64 psiconv_u8 *ptr0,*ptr1,*ptr2,*ptr3;
62 ptr0 = psiconv_list_get(buf,off); 65 ptr0 = psiconv_buffer_get(buf,off);
63 ptr1 = psiconv_list_get(buf,off+1); 66 ptr1 = psiconv_buffer_get(buf,off+1);
64 ptr2 = psiconv_list_get(buf,off+2); 67 ptr2 = psiconv_buffer_get(buf,off+2);
65 ptr3 = psiconv_list_get(buf,off+3); 68 ptr3 = psiconv_buffer_get(buf,off+3);
66 if (!ptr0 || !ptr1 || !ptr2 || !ptr3) { 69 if (!ptr0 || !ptr1 || !ptr2 || !ptr3) {
67 psiconv_warn(lev,off,"Trying long read past the end of the file"); 70 psiconv_warn(lev,off,"Trying long read past the end of the file");
68 if (status) 71 if (status)
69 *status = -PSICONV_E_PARSE; 72 *status = -PSICONV_E_PARSE;
70 return 0; 73 return 0;

Legend:
Removed from v.64  
changed lines
  Added in v.79

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26