Changeset 7869e48 for libfaim/bstream.c
- Timestamp:
- Jan 12, 2013, 1:43:13 PM (10 years ago)
- Children:
- e3a0d71, 4485285
- Parents:
- 4626016
- git-author:
- Jason Gross <jgross@mit.edu> (01/12/13 13:13:18)
- git-committer:
- Jason Gross <jgross@mit.edu> (01/12/13 13:43:13)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfaim/bstream.c
re374dee r7869e48 6 6 7 7 #define FAIM_INTERNAL 8 #include <aim.h> 8 #include <aim.h> 9 9 10 10 faim_internal int aim_bstream_init(aim_bstream_t *bs, fu8_t *data, int len) 11 11 { 12 12 13 13 if (!bs) 14 14 return -1; … … 63 63 faim_internal fu8_t aimbs_get8(aim_bstream_t *bs) 64 64 { 65 66 if (aim_bstream_empty(bs) < 1) 67 return 0; /* XXX throw an exception */ 68 65 66 if (aim_bstream_empty(bs) < 1) 67 return 0; /* XXX throw an exception */ 68 69 69 bs->offset++; 70 70 71 71 return aimutil_get8(bs->data + bs->offset - 1); 72 72 } … … 74 74 faim_internal fu16_t aimbs_get16(aim_bstream_t *bs) 75 75 { 76 77 if (aim_bstream_empty(bs) < 2) 78 return 0; /* XXX throw an exception */ 79 76 77 if (aim_bstream_empty(bs) < 2) 78 return 0; /* XXX throw an exception */ 79 80 80 bs->offset += 2; 81 81 82 82 return aimutil_get16(bs->data + bs->offset - 2); 83 83 } … … 85 85 faim_internal fu32_t aimbs_get32(aim_bstream_t *bs) 86 86 { 87 88 if (aim_bstream_empty(bs) < 4) 89 return 0; /* XXX throw an exception */ 90 87 88 if (aim_bstream_empty(bs) < 4) 89 return 0; /* XXX throw an exception */ 90 91 91 bs->offset += 4; 92 92 93 93 return aimutil_get32(bs->data + bs->offset - 4); 94 94 } … … 96 96 faim_internal fu8_t aimbs_getle8(aim_bstream_t *bs) 97 97 { 98 99 if (aim_bstream_empty(bs) < 1) 100 return 0; /* XXX throw an exception */ 101 98 99 if (aim_bstream_empty(bs) < 1) 100 return 0; /* XXX throw an exception */ 101 102 102 bs->offset++; 103 103 104 104 return aimutil_getle8(bs->data + bs->offset - 1); 105 105 } … … 107 107 faim_internal fu16_t aimbs_getle16(aim_bstream_t *bs) 108 108 { 109 110 if (aim_bstream_empty(bs) < 2) 111 return 0; /* XXX throw an exception */ 112 109 110 if (aim_bstream_empty(bs) < 2) 111 return 0; /* XXX throw an exception */ 112 113 113 bs->offset += 2; 114 114 115 115 return aimutil_getle16(bs->data + bs->offset - 2); 116 116 } … … 118 118 faim_internal fu32_t aimbs_getle32(aim_bstream_t *bs) 119 119 { 120 121 if (aim_bstream_empty(bs) < 4) 122 return 0; /* XXX throw an exception */ 123 120 121 if (aim_bstream_empty(bs) < 4) 122 return 0; /* XXX throw an exception */ 123 124 124 bs->offset += 4; 125 125 126 126 return aimutil_getle32(bs->data + bs->offset - 4); 127 127 }
Note: See TracChangeset
for help on using the changeset viewer.