Revert "[N_SE-33612] In Decode(), add code to check if str[0] is '+' or '-'"
authorDahyeong Kim <dahyeong.kim@tizendev.org>
Mon, 15 Apr 2013 05:59:45 +0000 (14:59 +0900)
committerGerrit Code Review <gerrit2@kim11>
Mon, 15 Apr 2013 05:59:45 +0000 (14:59 +0900)
This reverts commit 4b30fc57624f1b4b438eca24017daaf885ce9b44

src/base/FBaseInt8.cpp
src/base/FBaseInteger.cpp
src/base/FBaseLong.cpp
src/base/FBaseShort.cpp

index 40dd62f..284df62 100644 (file)
@@ -109,7 +109,7 @@ Int8::Decode(const String& s, char& ret)
        wchar_t* pEnd = null;
        String str(s);
 
-       if (s[0] == L'-' || s[0] == L'+')
+       if (s[0] == L'-')
        {
                startIndex = 1;
                minLength = 3;
index 96563b2..244374c 100644 (file)
@@ -90,28 +90,20 @@ Integer::Decode(const String& s, int& ret)
                "[%s] The length of s MUST be greater than 0.", GetErrorMessage(E_NUM_FORMAT));
 
        int radix = 0;
-       int startIndex = 0;
-       int minLength = 2;
        wchar_t* pEnd = null;
        String str(s);
 
-       if (s[0] == L'-' || s[0] == L'+')
-       {
-               startIndex = 1;
-               minLength = 3;
-       }
-
        // Find radix
-       if (s[startIndex] == L'#')
+       if (s[0] == L'#')
        {
                radix = Character::RADIX_HEXADECIMAL;
 
                // Remove '#'
-               str.Remove(startIndex, 1);
+               str.Remove(0, 1);
        }
-       else if (s[startIndex] == L'0' && (s.GetLength() >= minLength))
+       else if (s[0] == L'0' && (s.GetLength() >= 2))
        {
-               if (s[startIndex + 1] == L'x' || s[startIndex + 1] == L'X')
+               if (s[1] == L'x' || s[1] == L'X')
                {
                        radix = Character::RADIX_HEXADECIMAL;
                }
index b6ed711..d349748 100644 (file)
@@ -101,28 +101,20 @@ Long::Decode(const String& s, long& ret)
                "[%s] The length of s MUST be greater than 0.", GetErrorMessage(E_NUM_FORMAT));
 
        int radix = 0;
-       int startIndex = 0;
-       int minLength = 2;
        wchar_t* pEnd = null;
        String str(s);
 
-       if (s[0] == L'-' || s[0] == L'+')
-       {
-               startIndex = 1;
-               minLength = 3;
-       }
-
        // Find radix
-       if (s[startIndex] == L'#')
+       if (s[0] == L'#')
        {
                radix = Character::RADIX_HEXADECIMAL;
 
                // Remove '#'
-               str.Remove(startIndex, 1);
+               str.Remove(0, 1);
        }
-       else if (s[startIndex] == L'0' && (s.GetLength() >= minLength))
+       else if (s[0] == L'0' && (s.GetLength() >= 2))
        {
-               if (s[startIndex + 1] == L'x' || s[startIndex + 1] == L'X')
+               if (s[1] == L'x' || s[1] == L'X')
                {
                        radix = Character::RADIX_HEXADECIMAL;
                }
index 18f8fa5..f40452c 100644 (file)
@@ -108,28 +108,20 @@ Short::Decode(const String& s, short& ret)
 
        long value = 0;
        int radix = 0;
-       int startIndex = 0;
-       int minLength = 2;
        wchar_t* pEnd = null;
        String str(s);
 
-       if (s[0] == L'-' || s[0] == L'+')
-       {
-               startIndex = 1;
-               minLength = 3;
-       }
-
        // Find radix
-       if (s[startIndex] == L'#')
+       if (s[0] == L'#')
        {
                radix = Character::RADIX_HEXADECIMAL;
 
                // Remove '#'
-               str.Remove(startIndex, 1);
+               str.Remove(0, 1);
        }
-       else if (s[startIndex] == L'0' && (s.GetLength() >= minLength))
+       else if (s[0] == L'0' && (s.GetLength() >= 2))
        {
-               if (s[startIndex + 1] == L'x' || s[startIndex + 1] == L'X')
+               if (s[1] == L'x' || s[1] == L'X')
                {
                        radix = Character::RADIX_HEXADECIMAL;
                }