Lines Matching refs:offset
212 void Buffer::WriteInt32BE(int32_t value, uint32_t offset)
217 WriteBytes(data_, 4, raw_ + byteOffset_ + offset);
220 int32_t Buffer::ReadInt32BE(uint32_t offset)
223 ReadBytes(data_, offset, 4);
228 void Buffer::WriteInt32LE(int32_t value, uint32_t offset)
233 WriteBytes(data_, 4, raw_ + byteOffset_ + offset);
236 int32_t Buffer::ReadInt32LE(uint32_t offset)
239 ReadBytes(data_, offset, 4);
244 void Buffer::WriteUInt32BE(int32_t value, uint32_t offset)
249 WriteBytes(data_, 4, raw_ + byteOffset_ + offset);
252 uint32_t Buffer::ReadUInt32BE(uint32_t offset)
255 ReadBytes(data_, offset, 4);
260 void Buffer::WriteUInt32LE(int32_t value, uint32_t offset)
265 WriteBytes(data_, 4, raw_ + byteOffset_ + offset);
268 uint32_t Buffer::ReadUInt32LE(uint32_t offset)
271 ReadBytes(data_, offset, 4);
291 void Buffer::ReadBytes(uint8_t *data, uint32_t offset, uint32_t length)
301 if (memcpy_s(data, length, raw_ + byteOffset_ + offset, length) != EOK) {
318 void Buffer::WriteByte(uint8_t number, uint32_t offset)
320 WriteBytes(&number, 1, raw_ + byteOffset_ + offset);
330 unsigned int Buffer::WriteString(string value, unsigned int offset, unsigned int length)
333 bool isWriteSuccess = WriteBytes(str, length, raw_ + byteOffset_ + offset);
337 void Buffer::WriteStringLoop(string value, unsigned int offset, unsigned int end, unsigned int length)
339 if (end - offset <= 0 || value.length() == 0) {
342 unsigned int loop = length > end - offset ? end - offset : length;
345 while (offset < end) {
346 if (loop + offset > end) {
347 WriteBytes(str, end - offset, raw_ + byteOffset_ + offset);
349 WriteBytes(str, loop, raw_ + byteOffset_ + offset);
351 offset += loop;
369 unsigned int Buffer::WriteString(std::u16string value, unsigned int offset, unsigned int length)
372 return this->WriteString(str, offset, length);
375 void Buffer::WriteStringLoop(std::u16string value, unsigned int offset, unsigned int end)
379 this->WriteStringLoop(str, offset, end, value.length() * 2);
398 void Buffer::SetArray(vector<uint8_t> array, unsigned int offset)
402 WriteBytes(array.data(), size, raw_ + byteOffset_ + offset);
405 void Buffer::FillBuffer(Buffer *buffer, unsigned int offset, unsigned int end)
410 if (end - offset <= 0) {
413 unsigned int loop = buffer->GetLength() > end - offset ? end - offset : buffer->GetLength();
415 while (offset < end) {
416 if (offset + loop > end) {
417 loop = end - offset;
419 WriteBytes(buffer->GetRaw() + buffer->byteOffset_, loop, raw_ + byteOffset_ + offset);
420 offset += loop;
424 void Buffer::FillNumber(vector<uint8_t> numbers, unsigned int offset, unsigned int end)
426 if (end - offset <= 0) {
429 unsigned int loop = numbers.size() > end - offset ? end - offset : numbers.size();
431 while (offset < end) {
432 if (offset + loop > end) {
433 loop = end - offset;
435 WriteBytes(numbers.data(), loop, raw_ + byteOffset_ + offset);
436 offset += loop;
464 void Buffer::FillString(string value, unsigned int offset, unsigned int end, string encoding)
469 this->WriteStringLoop(u16Str, offset, end);
472 this->WriteStringLoop(str, offset, end, str.length());
476 unsigned int Buffer::WriteString(string value, unsigned int offset, unsigned int length, string encoding)
482 lengthWrote = this->WriteString(u16Str, offset, length);
485 lengthWrote = this->WriteString(str, offset, length);
526 int Buffer::IndexOf(const char *data, uint32_t offset, uint32_t len, uint64_t &resultIndex)
528 if (data == nullptr || length_ <= offset) {
531 uint8_t *sData = new (std::nothrow) uint8_t[length_ - offset];
536 ReadBytes(sData, offset, length_ - offset);
537 int index = FindIndex(sData, reinterpret_cast<uint8_t *>(const_cast<char *>(data)), length_ - offset, len);
543 resultIndex = static_cast<uint64_t>(offset) + static_cast<uint64_t>(index);
550 int Buffer::LastIndexOf(const char *data, uint32_t offset, uint32_t len)
552 if (data == nullptr || length_ <= offset) {
555 uint8_t *sData = new (std::nothrow) uint8_t[length_ - offset];
560 ReadBytes(sData, offset, length_ - offset);
561 int result = FindLastIndex(sData, reinterpret_cast<uint8_t *>(const_cast<char *>(data)), length_ - offset, len);