Overview
Comment: | Add -[{read,write}LittleEndianInt{16,32,64}{,:}] to OFStream. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
6217d56014dcdb8c3c853049bd3102d4 |
User & Date: | js on 2010-04-09 15:22:00 |
Other Links: | manifest | tags |
Context
2010-04-09
| ||
15:43 | Work around a compiler bug that can happen in the configure script. check-in: 90548e55c8 user: js tags: trunk | |
15:22 | Add -[{read,write}LittleEndianInt{16,32,64}{,:}] to OFStream. check-in: 6217d56014 user: js tags: trunk | |
15:12 | Add OFSeekableStream and implement seeking for OFFile. check-in: 0890f73f75 user: js tags: trunk | |
Changes
Modified src/OFStream.h from [9b81961a45] to [8e74551eac].
︙ | ︙ | |||
85 86 87 88 89 90 91 92 93 94 95 96 97 98 | /** * Reads an uint64_t from the stream which is encoded in big endian. * * \return An uint64_t from the stream in the native endianess */ - (uint64_t)readBigEndianInt64; /** * Reads nitems items with the specified item size from the stream and returns * them in an OFDataArray. * * \param itemsize The size of each item * \param nitems The number of iteams to read * \return An OFDataArray with at nitems items. | > > > > > > > > > > > > > > > > > > > > > | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | /** * Reads an uint64_t from the stream which is encoded in big endian. * * \return An uint64_t from the stream in the native endianess */ - (uint64_t)readBigEndianInt64; /** * Reads an uint16_t from the stream which is encoded in little endian. * * \return An uint16_t from the stream in native endianess */ - (uint16_t)readLittleEndianInt16; /** * Reads an uint32_t from the stream which is encoded in little endian. * * \return An uint32_t from the stream in the native endianess */ - (uint32_t)readLittleEndianInt32; /** * Reads an uint64_t from the stream which is encoded in little endian. * * \return An uint64_t from the stream in the native endianess */ - (uint64_t)readLittleEndianInt64; /** * Reads nitems items with the specified item size from the stream and returns * them in an OFDataArray. * * \param itemsize The size of each item * \param nitems The number of iteams to read * \return An OFDataArray with at nitems items. |
︙ | ︙ | |||
188 189 190 191 192 193 194 195 196 197 198 199 200 201 | /** * Writes an uint64_t into the stream, encoded in big endian. * * \param int64 An uint64_t */ - (void)writeBigEndianInt64: (uint64_t)int64; /** * Writes from an OFDataArray into the stream. * * \param dataarray The OFDataArray to write into the stream * \return The number of bytes written */ - (size_t)writeDataArray: (OFDataArray*)dataarray; | > > > > > > > > > > > > > > > > > > > > > | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | /** * Writes an uint64_t into the stream, encoded in big endian. * * \param int64 An uint64_t */ - (void)writeBigEndianInt64: (uint64_t)int64; /** * Writes an uint16_t into the stream, encoded in little endian. * * \param int16 An uint16_t */ - (void)writeLittleEndianInt16: (uint16_t)int16; /** * Writes an uint32_t into the stream, encoded in little endian. * * \param int32 An uint32_t */ - (void)writeLittleEndianInt32: (uint32_t)int32; /** * Writes an uint64_t into the stream, encoded in little endian. * * \param int64 An uint64_t */ - (void)writeLittleEndianInt64: (uint64_t)int64; /** * Writes from an OFDataArray into the stream. * * \param dataarray The OFDataArray to write into the stream * \return The number of bytes written */ - (size_t)writeDataArray: (OFDataArray*)dataarray; |
︙ | ︙ |
Modified src/OFStream.m from [62c939ae2f] to [0c60b9fcc6].
︙ | ︙ | |||
145 146 147 148 149 150 151 152 153 154 155 156 157 158 | uint64_t ret; [self readExactlyNBytes: 8 intoBuffer: (char*)&ret]; return OF_BSWAP64_IF_LE(ret); } - (OFDataArray*)readDataArrayWithItemSize: (size_t)itemsize andNItems: (size_t)nitems { OFDataArray *da; char *tmp; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | uint64_t ret; [self readExactlyNBytes: 8 intoBuffer: (char*)&ret]; return OF_BSWAP64_IF_LE(ret); } - (uint16_t)readLittleEndianInt16 { uint16_t ret; [self readExactlyNBytes: 2 intoBuffer: (char*)&ret]; return OF_BSWAP16_IF_BE(ret); } - (uint32_t)readLittleEndianInt32 { uint32_t ret; [self readExactlyNBytes: 4 intoBuffer: (char*)&ret]; return OF_BSWAP32_IF_BE(ret); } - (uint64_t)readLittleEndianInt64 { uint64_t ret; [self readExactlyNBytes: 8 intoBuffer: (char*)&ret]; return OF_BSWAP64_IF_BE(ret); } - (OFDataArray*)readDataArrayWithItemSize: (size_t)itemsize andNItems: (size_t)nitems { OFDataArray *da; char *tmp; |
︙ | ︙ | |||
525 526 527 528 529 530 531 532 533 534 535 536 537 538 | fromBuffer: (char*)&int32]; } - (void)writeBigEndianInt64: (uint64_t)int64 { int64 = OF_BSWAP64_IF_LE(int64); [self writeNBytes: 8 fromBuffer: (char*)&int64]; } - (size_t)writeDataArray: (OFDataArray*)dataarray { return [self writeNBytes: [dataarray count] * [dataarray itemSize] | > > > > > > > > > > > > > > > > > > > > > > > > | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | fromBuffer: (char*)&int32]; } - (void)writeBigEndianInt64: (uint64_t)int64 { int64 = OF_BSWAP64_IF_LE(int64); [self writeNBytes: 8 fromBuffer: (char*)&int64]; } - (void)writeLittleEndianInt16: (uint16_t)int16 { int16 = OF_BSWAP16_IF_BE(int16); [self writeNBytes: 2 fromBuffer: (char*)&int16]; } - (void)writeLittleEndianInt32: (uint32_t)int32 { int32 = OF_BSWAP32_IF_BE(int32); [self writeNBytes: 4 fromBuffer: (char*)&int32]; } - (void)writeLittleEndianInt64: (uint64_t)int64 { int64 = OF_BSWAP64_IF_BE(int64); [self writeNBytes: 8 fromBuffer: (char*)&int64]; } - (size_t)writeDataArray: (OFDataArray*)dataarray { return [self writeNBytes: [dataarray count] * [dataarray itemSize] |
︙ | ︙ |