----------------------------------------------------- //
| 1050 | |
| 1051 | // ----------------------------------------------------- // |
| 1052 | void bFile::swapStruct(int dna_nr, char *data, bool ignoreEndianFlag) |
| 1053 | { |
| 1054 | if (dna_nr == -1) return; |
| 1055 | |
| 1056 | short *strc = mFileDNA->getStruct(dna_nr); |
| 1057 | //short *firstStrc = strc; |
| 1058 | |
| 1059 | int elementLen = strc[1]; |
| 1060 | strc += 2; |
| 1061 | |
| 1062 | short first = mFileDNA->getStruct(0)[0]; |
| 1063 | |
| 1064 | char *buf = data; |
| 1065 | for (int i = 0; i < elementLen; i++, strc += 2) |
| 1066 | { |
| 1067 | char *type = mFileDNA->getType(strc[0]); |
| 1068 | char *name = mFileDNA->getName(strc[1]); |
| 1069 | |
| 1070 | int size = mFileDNA->getElementSize(strc[0], strc[1]); |
| 1071 | if (strc[0] >= first && name[0] != '*') |
| 1072 | { |
| 1073 | int old_nr = mFileDNA->getReverseType(type); |
| 1074 | int arrayLen = mFileDNA->getArraySizeNew(strc[1]); |
| 1075 | if (arrayLen == 1) |
| 1076 | { |
| 1077 | swapStruct(old_nr, buf, ignoreEndianFlag); |
| 1078 | } |
| 1079 | else |
| 1080 | { |
| 1081 | char *tmpBuf = buf; |
| 1082 | for (int i = 0; i < arrayLen; i++) |
| 1083 | { |
| 1084 | swapStruct(old_nr, tmpBuf, ignoreEndianFlag); |
| 1085 | tmpBuf += size / arrayLen; |
| 1086 | } |
| 1087 | } |
| 1088 | } |
| 1089 | else |
| 1090 | { |
| 1091 | //int arrayLenOld = mFileDNA->getArraySize(name); |
| 1092 | int arrayLen = mFileDNA->getArraySizeNew(strc[1]); |
| 1093 | //assert(arrayLenOld == arrayLen); |
| 1094 | swapData(buf, strc[0], arrayLen, ignoreEndianFlag); |
| 1095 | } |
| 1096 | buf += size; |
| 1097 | } |
| 1098 | } |
| 1099 | |
| 1100 | void bFile::resolvePointersMismatch() |
| 1101 | { |
nothing calls this directly
no test coverage detected