134 } |
134 } |
135 } |
135 } |
136 |
136 |
137 // ------------------------------------------------------------------------------------------------- |
137 // ------------------------------------------------------------------------------------------------- |
138 // |
138 // |
139 char Bytestream::read_byte() |
139 int8_t Bytestream::read_byte() |
140 { |
140 { |
141 ensure_read_space (1); |
141 ensure_read_space (1); |
142 return *m_cursor++; |
142 return *m_cursor++; |
143 } |
143 } |
144 |
144 |
145 // ------------------------------------------------------------------------------------------------- |
145 // ------------------------------------------------------------------------------------------------- |
146 // |
146 // |
147 short int Bytestream::read_short() |
147 int16_t Bytestream::read_short() |
148 { |
148 { |
149 ensure_read_space (2); |
149 ensure_read_space (2); |
150 short int result = 0; |
150 short int result = 0; |
151 |
151 |
152 for (int i = 0; i < 2; ++i) |
152 for (int i = 0; i < 2; ++i) |
248 resize (allocated_size() + bytes + 128); |
248 resize (allocated_size() + bytes + 128); |
249 } |
249 } |
250 |
250 |
251 // ------------------------------------------------------------------------------------------------- |
251 // ------------------------------------------------------------------------------------------------- |
252 // |
252 // |
253 void Bytestream::write_byte (char val) |
253 void Bytestream::write_byte (int8_t val) |
254 { |
254 { |
255 grow_to_fit (1); |
255 grow_to_fit (1); |
256 write (val); |
256 write (val); |
257 } |
257 } |
258 |
258 |
259 // ------------------------------------------------------------------------------------------------- |
259 // ------------------------------------------------------------------------------------------------- |
260 // |
260 // |
261 void Bytestream::write_short (short int val) |
261 void Bytestream::write_short (int16_t val) |
262 { |
262 { |
263 grow_to_fit (2); |
263 grow_to_fit (2); |
264 |
264 |
265 for (int i = 0; i < 2; ++i) |
265 for (int i = 0; i < 2; ++i) |
266 write ((val >> (i * 8)) & 0xFF); |
266 write ((val >> (i * 8)) & 0xFF); |
267 } |
267 } |
268 |
268 |
269 // ------------------------------------------------------------------------------------------------- |
269 // ------------------------------------------------------------------------------------------------- |
270 // |
270 // |
271 void Bytestream::write_long (long int val) |
271 void Bytestream::write_long (int32_t val) |
272 { |
272 { |
273 grow_to_fit (4); |
273 grow_to_fit (4); |
274 |
274 |
275 for (int i = 0; i < 4; ++i) |
275 for (int i = 0; i < 4; ++i) |
276 write ((val >> (i * 8)) & 0xFF); |
276 write ((val >> (i * 8)) & 0xFF); |