From 9ff520455713760fe2f9912dd1bd364831c8e08a Mon Sep 17 00:00:00 2001 From: "dahyeong.kim" Date: Thu, 11 Apr 2013 21:52:34 +0900 Subject: [PATCH] [DCM-1209]if path is empty, query can not be set. Change-Id: Iefa954f9a45536a43101f0df6775088e72d271a0 Signed-off-by: dahyeong.kim --- src/base/utility/FBaseUtilUri.cpp | 47 ++++++++++++++------------------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/src/base/utility/FBaseUtilUri.cpp b/src/base/utility/FBaseUtilUri.cpp index 87d6d37..8147f53 100644 --- a/src/base/utility/FBaseUtilUri.cpp +++ b/src/base/utility/FBaseUtilUri.cpp @@ -1631,73 +1631,60 @@ Uri::ParseHierarchicalUri(const Tizen::Base::String& str, int startSsp, Tizen::B { result r = E_SUCCESS; int curIndex = startSsp; -// bool isServerAuth; String tempPath; String queSharp(L"?#"); String doubleSlash(L"//"); - bool startsWith = str.StartsWith(doubleSlash, curIndex); - int position = 0; bool isPath = false; - int temp = 0; + int temp = -1; + + bool startsWith = str.StartsWith(doubleSlash, curIndex); if (startsWith) { curIndex += 2; -// int indexOf; String special(L"/?#"); - int index = Scan(str, curIndex, special); - if (index > (int) curIndex) + if (index > curIndex) { r = str.SubString(curIndex, index - curIndex, authority); if (IsFailed(r)) { goto CATCH; } - - //bool isServer; - //r = ParseAuthority(str, curIndex, isServer); - //if (IsFailed(r)) goto CATCH; } - else if (index < (int) str.GetLength()) - { - // allow an empty authority -// authority = String::Empty(); - // empty statement - } - else + else if (index >= str.GetLength()) { r = E_INVALID_FORMAT; goto CATCH; } + curIndex += authority.GetLength(); + if (curIndex == str.GetLength()) + { + r = E_SUCCESS; + goto CATCH; + } } - r = queSharp.IndexOf(str[0], 0, temp); - if (r == E_SUCCESS) + queSharp.IndexOf(str[0], 0, temp); + if (temp >= 0) { position = 0; } else { - position = Scan(str, curIndex, queSharp); // may be empty - if (position < 0) - { - r = E_INVALID_FORMAT; - goto CATCH; - } + position = Scan(str, curIndex, queSharp); - if (position == curIndex) + if (position == curIndex && authority.GetLength() == 0) { - // There is no path and query - r = E_SUCCESS; + // If both authority and path are empty, it returns error. + r = E_INVALID_FORMAT; goto CATCH; } - } r = str.SubString(curIndex, position - curIndex, tempPath); -- 2.7.4