--- a/secureswitools/swisistools/source/interpretsislib/is_utils.cpp Wed Sep 15 12:20:42 2010 +0300
+++ b/secureswitools/swisistools/source/interpretsislib/is_utils.cpp Wed Oct 13 14:40:19 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
@@ -75,63 +75,20 @@
}
-void ConvertToPlatformSpecificPath( TUint16* aIn, TUint32 len )
-{
- while( len-- > 0 )
- {
- if( *aIn == '\\' )
- {
- *aIn = '/';
- }
- aIn++;
- }
-}
-
-#ifdef __TOOLS2_LINUX__
-void ConvertToForwardSlash( std::wstring& aIn)
-{
- std::wstring::size_type idx = 0;
-
- while( (idx = aIn.find(L"\\", idx)) != std::wstring::npos)
- {
- aIn.replace( idx, 1, KDirectorySeparator );
- }
-}
-#endif
-
-
void ConvertToLocalPath( std::wstring& aIn, const std::wstring& aDrivePath )
{
std::wstring::size_type idx = 0;
-
- #ifndef __TOOLS2_LINUX__
- while( (idx = aIn.find(L"//", idx)) != std::wstring::npos)
+ while( (idx = aIn.find(L"\\\\", idx)) != std::wstring::npos)
{
- aIn.replace( idx, 2, KDoubleSlashPathPrefix );
+ aIn.replace( idx, 4, KDirectorySeparator );
}
-
+ //
idx = 0;
-
while( (idx = aIn.find(L"/", idx)) != std::wstring::npos)
{
aIn.replace( idx, 1, KDirectorySeparator );
}
- #else
-
- idx = 0;
-
- while( (idx = aIn.find(L"\\\\", idx)) != std::wstring::npos)
- {
- aIn.replace( idx, 2, KDoubleSlashPathPrefix );
- }
-
- idx = 0;
-
- while( (idx = aIn.find(L"\\", idx)) != std::wstring::npos)
- {
- aIn.replace( idx, 1, KDirectorySeparator );
- }
- #endif
+
// If the first two characters represent a drive specification
// then replace them entirely with the value from the
// PC's path ('aDrivePath').
@@ -141,14 +98,15 @@
const bool startsWithDrive = StringUtils::StartsWithDrive( aIn );
if ( startsWithDrive )
{
- aIn.replace(aIn.begin(), aIn.begin()+2, aDrivePath.c_str());
+ aIn.replace(aIn.begin(), aIn.begin()+2, aDrivePath);
}
else
{
- aIn.insert( 0, aDrivePath.c_str() );
+ aIn.insert( 0, aDrivePath );
}
}
+
struct TPair {
TUint16 first;
TUint16 second;
@@ -1050,22 +1008,10 @@
}
int FoldedCompare(const std::wstring& aLeft, const std::wstring& aRight)
{
- std::wstring iLeft=aLeft.c_str();
- std::wstring iRight=aRight.c_str();
-
-#ifdef __TOOLS2_LINUX__
- std::wstring::size_type idx = 0;
-
- while( (idx = iLeft.find(L"\\", idx)) != std::wstring::npos)
- {
- iLeft.replace( idx, 1, KDirectorySeparator );
- }
-#endif
-
- std::wstring::const_iterator l = iLeft.begin();
- std::wstring::const_iterator r = iRight.begin();
- std::wstring::const_iterator le = iLeft.end();
- std::wstring::const_iterator re = iRight.end();
+ std::wstring::const_iterator l = aLeft.begin();
+ std::wstring::const_iterator r = aRight.begin();
+ std::wstring::const_iterator le = aLeft.end();
+ std::wstring::const_iterator re = aRight.end();
while (l != le && r != re)
{
@@ -1079,7 +1025,7 @@
++r;
}
- return iLeft.size() - iRight.size();
+ return aLeft.size() - aRight.size();
}
int ReadSecurityInfo( SBinarySecurityInfo& aInfo, const std::wstring aFileName )
@@ -1099,12 +1045,7 @@
throw "Failed in redirection operation";
}
-#ifndef __LINUX__
nulStdErr = fopen("NUL:" , "w");
-#else
- nulStdErr = fopen("/dev/null", "w");
-#endif
-
if (!nulStdErr)
{
throw "Failed in redirection operation";
@@ -1146,25 +1087,3 @@
} // end for i
}
-const std::wstring Utils::IntegerToWideString(int aInt)
- {
- std::wstringstream wstream;
- wstream << aInt;
- return wstream.str();
- }
-
-std::wstring Utils::Int64ToWideString(TInt64 aInt)
- {
- std::wstringstream strInt64;
- strInt64 << aInt;
- return strInt64.str();
- }
-
-int Utils::WideStringToInteger(const std::wstring& aWideString)
- {
- unsigned long int value=0;
- std::wstringstream str(aWideString);
- str >> value;
- return value;
- }
-