imgtools/romtools/rofsbuild/r_build.cpp
changeset 694 c3fbb20e86f0
parent 691 9eeecb73a5d4
child 698 e3ee96a3961c
child 703 a23be6984256
--- a/imgtools/romtools/rofsbuild/r_build.cpp	Wed Nov 17 14:41:23 2010 +0800
+++ b/imgtools/romtools/rofsbuild/r_build.cpp	Wed Nov 17 16:47:23 2010 +0800
@@ -59,9 +59,6 @@
 #include "cache/cachemanager.hpp"
 
 #include "uniconv.hpp"
-
-#define MAX_LINE 65535
-
 extern TUint checkSum(const void* aPtr);
 
 extern ECompression gCompress;
@@ -628,7 +625,7 @@
 			
 			if(offset > 0xFFFF)
 			{
-				printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (unsigned int)offset);
+				printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (int)offset);
 				throw "fail";
 			}
 			
@@ -643,7 +640,7 @@
 			TUint32 offset = ((((TUint8*) entry) - dirBlockBase) >> 2);
 			if(offset > 0xFFFF)
 			{
-				printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (unsigned int)offset);
+				printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (int)offset);
 				throw "fail";
 			}
 			
@@ -793,18 +790,7 @@
 	iNextNodeForSameFile = aPreviousNode;
 	}
 
-void TRomNode::FlushLogMessages()
-{
-	if(iEntry)
-	{
-		for(int i=0; i < (int) iEntry->iLogMessages.size(); i++)
-		{
-			std::string& log = iEntry->iLogMessages[i];
-			Print(ELog, log.c_str());
-		}
-		iEntry->iLogMessages.clear();
-	}
-}
+
 
 
 
@@ -877,12 +863,9 @@
 TInt TRomBuilderEntry::PlaceFile( TUint8* &aDest,TUint aMaxSize, CBytePair *aBPE ){
 
 
-	char tmpbuf[MAX_LINE];
 	TUint compression = 0;
 	TBool executable = iExecutable;
-	sprintf(tmpbuf,"Reading file %s to image\n", iFileName );
-	iLogMessages.push_back(tmpbuf);
-
+	Print(ELog,"Reading file %s to image\n", iFileName );
 	TUint32 size = HFile::GetLength(iFileName);
 	if (size==0)
 		Print(EWarning, "File %s does not exist or is 0 bytes in length.\n",iFileName);
@@ -1087,14 +1070,12 @@
 
 				if( newFileComp == 0)
 				{
-					sprintf(tmpbuf,"Decompressing executable '%s'\n", iFileName);
-					iLogMessages.push_back(tmpbuf);
+					Print(ELog,"Decompressing executable '%s'\n", iFileName);
 					f.iHdr->iCompressionType = 0;
 				}
 				else
 				{
-					sprintf(tmpbuf,"Compressing executable '%s' with method:%08x\n", iFileName, (unsigned int)newFileComp);
-					iLogMessages.push_back(tmpbuf);
+					Print(ELog,"Compressing executable '%s' with method:%08x\n", iFileName, newFileComp);
 					f.iHdr->iCompressionType = newFileComp;
 				}
 				f.UpdateHeaderCrc();
@@ -1143,12 +1124,11 @@
 					compression = atoi(entryref->GetCachedFileCompressionID());
 					memcpy(&iUids[0], aDest, sizeof(iUids));
 					if (compression)
-						sprintf(tmpbuf,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, (unsigned int) size, (unsigned int)compression);
+						Print(ELog,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, size, compression);
 					else if (iExecutable)
-						sprintf(tmpbuf,"Executable File '%s' size: %08x\n", iFileName, (unsigned int)size);
+						Print(ELog,"Executable File '%s' size: %08x\n", iFileName, size);
 					else
-						sprintf(tmpbuf,"File '%s' size: %08x\n", iFileName, (unsigned int) size);
-					iLogMessages.push_back(tmpbuf);
+						Print(ELog,"File '%s' size: %08x\n", iFileName, size);
 					iRealFileSize = size;	// required later when directory is written
 
 					return size;
@@ -1226,12 +1206,11 @@
 	}
 
 	if (compression)
-		sprintf(tmpbuf,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, (unsigned int) size, (unsigned int) compression);
+		Print(ELog,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, size, compression);
 	else if (iExecutable)
-		sprintf(tmpbuf,"Executable File '%s' size: %08x\n", iFileName, (unsigned int) size);
+		Print(ELog,"Executable File '%s' size: %08x\n", iFileName, size);
 	else
-		sprintf(tmpbuf,"File '%s' size: %08x\n", iFileName, (unsigned int) size);
-	iLogMessages.push_back(tmpbuf);
+		Print(ELog,"File '%s' size: %08x\n", iFileName, size);
 	iCompressEnabled = compression;
 	iRealFileSize = size;	// required later when directory is written
 
@@ -1372,3 +1351,11 @@
 		}
 
 }
+char* TRomBuilderEntry::GetSystemFullName()
+{
+	TBool aIgnoreHiddenAttrib = ETrue;
+	TInt aLen = iRomNode->FullNameLength(aIgnoreHiddenAttrib);
+	char *aBuf = new char[aLen+1];
+	iRomNode->GetFullName(aBuf, aIgnoreHiddenAttrib);
+	return aBuf;
+}