----------------------------------------------------- //
| 1017 | |
| 1018 | // ----------------------------------------------------- // |
| 1019 | void bFile::swapStruct(int dna_nr, char *data, bool ignoreEndianFlag) |
| 1020 | { |
| 1021 | if (dna_nr == -1) return; |
| 1022 | |
| 1023 | short *strc = mFileDNA->getStruct(dna_nr); |
| 1024 | //short *firstStrc = strc; |
| 1025 | |
| 1026 | int elementLen = strc[1]; |
| 1027 | strc += 2; |
| 1028 | |
| 1029 | short first = mFileDNA->getStruct(0)[0]; |
| 1030 | |
| 1031 | char *buf = data; |
| 1032 | for (int i = 0; i < elementLen; i++, strc += 2) |
| 1033 | { |
| 1034 | char *type = mFileDNA->getType(strc[0]); |
| 1035 | char *name = mFileDNA->getName(strc[1]); |
| 1036 | |
| 1037 | int size = mFileDNA->getElementSize(strc[0], strc[1]); |
| 1038 | if (strc[0] >= first && name[0] != '*') |
| 1039 | { |
| 1040 | int old_nr = mFileDNA->getReverseType(type); |
| 1041 | int arrayLen = mFileDNA->getArraySizeNew(strc[1]); |
| 1042 | if (arrayLen == 1) |
| 1043 | { |
| 1044 | swapStruct(old_nr, buf, ignoreEndianFlag); |
| 1045 | } |
| 1046 | else |
| 1047 | { |
| 1048 | char *tmpBuf = buf; |
| 1049 | for (int i = 0; i < arrayLen; i++) |
| 1050 | { |
| 1051 | swapStruct(old_nr, tmpBuf, ignoreEndianFlag); |
| 1052 | tmpBuf += size / arrayLen; |
| 1053 | } |
| 1054 | } |
| 1055 | } |
| 1056 | else |
| 1057 | { |
| 1058 | //int arrayLenOld = mFileDNA->getArraySize(name); |
| 1059 | int arrayLen = mFileDNA->getArraySizeNew(strc[1]); |
| 1060 | //assert(arrayLenOld == arrayLen); |
| 1061 | swapData(buf, strc[0], arrayLen, ignoreEndianFlag); |
| 1062 | } |
| 1063 | buf += size; |
| 1064 | } |
| 1065 | } |
| 1066 | |
| 1067 | void bFile::resolvePointersMismatch() |
| 1068 | { |
nothing calls this directly
no test coverage detected