… | |
… | |
27 | |
27 | |
28 | psiconv_u8 psiconv_read_u8(const psiconv_buffer buf,int lev,psiconv_u32 off, |
28 | psiconv_u8 psiconv_read_u8(const psiconv_buffer buf,int lev,psiconv_u32 off, |
29 | int *status) |
29 | int *status) |
30 | { |
30 | { |
31 | psiconv_u8 *ptr; |
31 | psiconv_u8 *ptr; |
32 | ptr = psiconv_list_get(buf,off); |
32 | ptr = psiconv_buffer_get(buf,off); |
33 | if (!ptr) { |
33 | if (!ptr) { |
34 | 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"); |
35 | if (status) |
35 | if (status) |
36 | *status = -PSICONV_E_PARSE; |
36 | *status = -PSICONV_E_PARSE; |
37 | return 0; |
37 | return 0; |
… | |
… | |
43 | |
43 | |
44 | psiconv_u16 psiconv_read_u16(const psiconv_buffer buf,int lev,psiconv_u32 off, |
44 | psiconv_u16 psiconv_read_u16(const psiconv_buffer buf,int lev,psiconv_u32 off, |
45 | int *status) |
45 | int *status) |
46 | { |
46 | { |
47 | psiconv_u8 *ptr0,*ptr1; |
47 | psiconv_u8 *ptr0,*ptr1; |
48 | ptr0 = psiconv_list_get(buf,off); |
48 | ptr0 = psiconv_buffer_get(buf,off); |
49 | ptr1 = psiconv_list_get(buf,off+1); |
49 | ptr1 = psiconv_buffer_get(buf,off+1); |
50 | if (!ptr0 || !ptr1) { |
50 | if (!ptr0 || !ptr1) { |
51 | 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"); |
52 | if (status) |
52 | if (status) |
53 | *status = -PSICONV_E_PARSE; |
53 | *status = -PSICONV_E_PARSE; |
54 | return 0; |
54 | return 0; |
… | |
… | |
60 | |
60 | |
61 | psiconv_u32 psiconv_read_u32(const psiconv_buffer buf,int lev,psiconv_u32 off, |
61 | psiconv_u32 psiconv_read_u32(const psiconv_buffer buf,int lev,psiconv_u32 off, |
62 | int *status) |
62 | int *status) |
63 | { |
63 | { |
64 | psiconv_u8 *ptr0,*ptr1,*ptr2,*ptr3; |
64 | psiconv_u8 *ptr0,*ptr1,*ptr2,*ptr3; |
65 | ptr0 = psiconv_list_get(buf,off); |
65 | ptr0 = psiconv_buffer_get(buf,off); |
66 | ptr1 = psiconv_list_get(buf,off+1); |
66 | ptr1 = psiconv_buffer_get(buf,off+1); |
67 | ptr2 = psiconv_list_get(buf,off+2); |
67 | ptr2 = psiconv_buffer_get(buf,off+2); |
68 | ptr3 = psiconv_list_get(buf,off+3); |
68 | ptr3 = psiconv_buffer_get(buf,off+3); |
69 | if (!ptr0 || !ptr1 || !ptr2 || !ptr3) { |
69 | if (!ptr0 || !ptr1 || !ptr2 || !ptr3) { |
70 | 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"); |
71 | if (status) |
71 | if (status) |
72 | *status = -PSICONV_E_PARSE; |
72 | *status = -PSICONV_E_PARSE; |
73 | return 0; |
73 | return 0; |