imgtools/romtools/readimage/src/common.cpp
changeset 0 044383f39525
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * @internalComponent 
       
    16 * @released
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #include "common.h"
       
    22  
       
    23 ImageReaderException::ImageReaderException(const char* aFile, const char* aErrMessage) : \
       
    24 	iImgFileName(aFile), iErrMessage(aErrMessage)
       
    25 {
       
    26 }
       
    27 
       
    28 void ImageReaderException::Report()
       
    29 {
       
    30 	*out << "Error : " << iImgFileName.c_str() << " : " << iErrMessage.c_str() << endl;
       
    31 }
       
    32 
       
    33 ImageReaderUsageException::ImageReaderUsageException(const char* /* aOption */,const char* aErrMessage) : \
       
    34 	ImageReaderException("", aErrMessage)
       
    35 {
       
    36 }
       
    37 
       
    38 void ImageReaderUsageException::Report()
       
    39 {
       
    40 	*out << "Usage Error:" << iErrMessage.c_str() << endl;
       
    41 }
       
    42 
       
    43 ostream& DumpInHex(char* aDesc, TUint32 aData, bool aContinue, TUint aDataWidth, \
       
    44 				   char aFiller, TUint aMaxDescWidth)
       
    45 {
       
    46 	TUint aDescLen = strlen(aDesc);
       
    47 	
       
    48 	*out << aDesc;
       
    49 	if( !aContinue )
       
    50 	{
       
    51 		while( aDescLen < aMaxDescWidth ){
       
    52 			*out << ".";
       
    53 			aDescLen++;
       
    54 		}
       
    55 	}
       
    56 	out->width(aDataWidth);
       
    57 	out->fill(aFiller);
       
    58 	
       
    59 	*out << hex << aData;
       
    60 
       
    61 	return *out;
       
    62 }
       
    63 
       
    64 bool ReaderUtil::IsExecutable(TUint8* Uids1)
       
    65 {
       
    66 	//In the little-endian world
       
    67 	if( Uids1[3] == 0x10 && Uids1[2] == 0x0 && Uids1[1] == 0x0 )
       
    68 	{
       
    69 		if(Uids1[0] == 0x79 || Uids1[0] == 0x7a)
       
    70 			return true;
       
    71 	}
       
    72 	return false;
       
    73 }
       
    74