diff -r 0757c2976f96 -r 1ec2202bb75b imgtools/romtools/rombuild/r_obey.cpp --- a/imgtools/romtools/rombuild/r_obey.cpp Mon Nov 29 15:37:06 2010 +0800 +++ b/imgtools/romtools/rombuild/r_obey.cpp Mon Nov 29 15:43:27 2010 +0800 @@ -1072,33 +1072,33 @@ if (isPeFile) iNumberOfPeFiles++; - // check the PC file exists - char* nname = NormaliseFileName(iReader.Word(1)); - if(gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(nname)) - { - char* tempnname = strdup(nname); - unsigned int namelen = 0; - if(UniConv::UTF82DefaultCodePage(tempnname, strlen(tempnname), &nname, &namelen) < 0) + if(EKeywordHardwareConfigRepositoryData == aKeyword) { // check hcr file + // check the PC file exists + char* nname = NormaliseFileName(iReader.Word(1)); + if(gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(nname)) { - Print(EError, "Invalid filename encoding: %s\n", tempnname); + char* tempnname = strdup(nname); + unsigned int namelen = 0; + if(UniConv::UTF82DefaultCodePage(tempnname, strlen(tempnname), &nname, &namelen) < 0) + { + Print(EError, "Invalid filename encoding: %s\n", tempnname); + free(tempnname); + iMissingFiles++; + delete[] nname; + return EFalse; + } free(tempnname); - iMissingFiles++; - delete[] nname; - return EFalse; } - free(tempnname); - } - ifstream test(nname,ios_base::binary | ios_base::in); - - if (!test.is_open()) { - Print(EError,"Cannot open file %s for input.\n",iReader.Word(1)); - if(EKeywordHardwareConfigRepositoryData == aKeyword) { - delete []nname; - return EFalse ; + ifstream test(nname,ios_base::binary | ios_base::in); + + if (!test.is_open()) { + Print(EError,"Cannot open file %s for input.\n",iReader.Word(1)); + if(EKeywordHardwareConfigRepositoryData == aKeyword) { + delete []nname; + return EFalse ; + } + iMissingFiles++; } - iMissingFiles++; - } - if(EKeywordHardwareConfigRepositoryData == aKeyword) { // check hcr file TUint32 magicWord = 0; test.read(reinterpret_cast(&magicWord),sizeof(TUint32)); @@ -1108,10 +1108,9 @@ delete []nname; return EFalse; } - + test.close(); + delete []nname; } - test.close(); - delete []nname; TBool endOfName=EFalse;