| 1102 | } |
| 1103 | |
| 1104 | int CDataFileWriter::AddDataSwapped(size_t Size, const void *pData) |
| 1105 | { |
| 1106 | dbg_assert(Size > 0 && pData != nullptr, "Data missing"); |
| 1107 | dbg_assert(Size <= (size_t)std::numeric_limits<int>::max(), "Data too large"); |
| 1108 | dbg_assert(m_vDatas.size() < (size_t)std::numeric_limits<int>::max(), "Too many data"); |
| 1109 | dbg_assert(Size % sizeof(int) == 0, "Invalid data boundary"); |
| 1110 | |
| 1111 | #if defined(CONF_ARCH_ENDIAN_BIG) |
| 1112 | void *pSwapped = malloc(Size); // temporary buffer that we use during compression |
| 1113 | mem_copy(pSwapped, pData, Size); |
| 1114 | swap_endian(pSwapped, sizeof(int), Size / sizeof(int)); |
| 1115 | int Index = AddData(Size, pSwapped); |
| 1116 | free(pSwapped); |
| 1117 | return Index; |
| 1118 | #else |
| 1119 | return AddData(Size, pData); |
| 1120 | #endif |
| 1121 | } |
| 1122 | |
| 1123 | int CDataFileWriter::AddDataString(const char *pStr) |
| 1124 | { |
no test coverage detected