----------------------------------------------------- //
| 939 | |
| 940 | // ----------------------------------------------------- // |
| 941 | void bFile::getMatchingFileDNA(short *dna_addr, const char *lookupName, const char *lookupType, char *strcData, char *data, bool fixupPointers) |
| 942 | { |
| 943 | // find the matching memory dna data |
| 944 | // to the file being loaded. Fill the |
| 945 | // memory with the file data... |
| 946 | |
| 947 | int len = dna_addr[1]; |
| 948 | dna_addr += 2; |
| 949 | |
| 950 | for (int i = 0; i < len; i++, dna_addr += 2) |
| 951 | { |
| 952 | const char *type = mFileDNA->getType(dna_addr[0]); |
| 953 | const char *name = mFileDNA->getName(dna_addr[1]); |
| 954 | |
| 955 | int eleLen = mFileDNA->getElementSize(dna_addr[0], dna_addr[1]); |
| 956 | |
| 957 | if ((mFlags & FD_BROKEN_DNA) != 0) |
| 958 | { |
| 959 | if ((strcmp(type, "short") == 0) && (strcmp(name, "int") == 0)) |
| 960 | { |
| 961 | eleLen = 0; |
| 962 | } |
| 963 | } |
| 964 | |
| 965 | if (strcmp(lookupName, name) == 0) |
| 966 | { |
| 967 | //int arrayLenold = mFileDNA->getArraySize((char*)name.c_str()); |
| 968 | int arrayLen = mFileDNA->getArraySizeNew(dna_addr[1]); |
| 969 | //assert(arrayLenold == arrayLen); |
| 970 | |
| 971 | if (name[0] == '*') |
| 972 | { |
| 973 | // cast pointers |
| 974 | int ptrFile = mFileDNA->getPointerSize(); |
| 975 | int ptrMem = mMemoryDNA->getPointerSize(); |
| 976 | safeSwapPtr(strcData, data); |
| 977 | |
| 978 | if (fixupPointers) |
| 979 | { |
| 980 | if (arrayLen > 1) |
| 981 | { |
| 982 | //void **sarray = (void**)strcData; |
| 983 | //void **darray = (void**)data; |
| 984 | |
| 985 | char *cpc, *cpo; |
| 986 | cpc = (char *)strcData; |
| 987 | cpo = (char *)data; |
| 988 | |
| 989 | for (int a = 0; a < arrayLen; a++) |
| 990 | { |
| 991 | safeSwapPtr(cpc, cpo); |
| 992 | m_pointerFixupArray.push_back(cpc); |
| 993 | cpc += ptrMem; |
| 994 | cpo += ptrFile; |
| 995 | } |
| 996 | } |
| 997 | else |
| 998 | { |
nothing calls this directly
no test coverage detected