From 7a658fa71570e9ff68c2dc4e0a7b316b47b0e56d Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Thu, 14 Mar 2013 10:23:23 +0900 Subject: [PATCH] Update unmerged source code [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] Update unmerged source code [SCMRequest] N/A Change-Id: I2aaaabb7eafff04f2dcf5adb050e4e5a6229b36b --- .gitignore | 5 +- modules/localization/src/localization_utils.cpp | 104 ------------- .../rpc/include/dpl/rpc/generic_rpc_connection.h | 2 +- modules/utils/src/file_utils.cpp | 161 --------------------- .../include/dpl/wrt-dao-ro/global_config.h | 5 +- modules/widget_dao/orm/wrt_db | 2 +- 6 files changed, 7 insertions(+), 272 deletions(-) delete mode 100644 modules/localization/src/localization_utils.cpp delete mode 100644 modules/utils/src/file_utils.cpp diff --git a/.gitignore b/.gitignore index fd5511d..79ad2fa 100755 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,5 @@ -build_log *.log -*.pyc -usr -opt +*.a *.o *.so *.so.* diff --git a/modules/localization/src/localization_utils.cpp b/modules/localization/src/localization_utils.cpp deleted file mode 100644 index 6298a5c..0000000 --- a/modules/localization/src/localization_utils.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file localization_utils.cpp - * @author Bartosz Janiak (b.janiak@samsung.com) - * @version 1.0 - */ - -#include - -#include -#include - -namespace LocalizationUtils { -static LanguageTagsList m_systemLanguageTags; -static LanguageTagsList m_languageTags; -static DPL::ReadWriteMutex m_readWriteMutex; - -template -void FindAndReplace(StringType& source, - const StringType& find, - const StringType& replace) -{ - size_t pos = 0; - while ((pos = source.find(find, pos)) != StringType::npos) { - source.replace(pos, find.length(), replace); - pos += replace.length(); - } -} - -DPL::String BCP47LanguageTagToLocale(const DPL::String& inLanguageTag) -{ - DPL::String languageTag(inLanguageTag); - FindAndReplace(languageTag, DPL::String(L"-"), DPL::String(L"_")); - return languageTag; -} - -DPL::String LocaleToBCP47LanguageTag(const DPL::String& inLocaleString) -{ - DPL::String localeString = inLocaleString.substr( - 0, - inLocaleString. - find_first_of(L".")); - FindAndReplace(localeString, DPL::String(L"_"), DPL::String(L"-")); - return localeString; -} - -void UpdateUserAgentLanguageTags() -{ - // WARNING!!!!! This function shall be called - // only when mutex is locked in readWriteMode! - - m_languageTags.clear(); - - FOREACH(i, m_systemLanguageTags) { - DPL::String tag = LocaleToBCP47LanguageTag(*i); - while (true) { //W3C Packaging 9. Step 5. 2. D - if (tag.empty()) { - continue; - } - - LogDebug("Adding user locale '" << tag << "'"); - m_languageTags.push_back(tag); - - size_t subtagPos = tag.find_last_of(L"-"); - if (subtagPos == DPL::String::npos) { - break; - } - tag = tag.substr(0, subtagPos); - } - } - - m_languageTags.push_back(L"en"); - m_languageTags.push_back(L""); -} - -void SetSystemLanguageTags(const LanguageTagsList& tags) -{ - DPL::ReadWriteMutex::ScopedWriteLock lock(&m_readWriteMutex); - if (m_systemLanguageTags != tags) { - m_systemLanguageTags = tags; - UpdateUserAgentLanguageTags(); - } -} - -LanguageTagsList GetUserAgentLanguageTags() -{ - DPL::ReadWriteMutex::ScopedReadLock lock(&m_readWriteMutex); - return m_languageTags; -} -} diff --git a/modules/rpc/include/dpl/rpc/generic_rpc_connection.h b/modules/rpc/include/dpl/rpc/generic_rpc_connection.h index 7810ef9..d9614c6 100644 --- a/modules/rpc/include/dpl/rpc/generic_rpc_connection.h +++ b/modules/rpc/include/dpl/rpc/generic_rpc_connection.h @@ -46,7 +46,7 @@ class GenericRPCConnection : * Costructor * * Abstract waitable input/outobject is acquired by class and destroyed upon - * desctructor + * destructor */ explicit GenericRPCConnection(AbstractWaitableInputOutput *inputOutput); virtual ~GenericRPCConnection(); diff --git a/modules/utils/src/file_utils.cpp b/modules/utils/src/file_utils.cpp deleted file mode 100644 index c6e77e2..0000000 --- a/modules/utils/src/file_utils.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file file_utils.cpp - * @author Bartosz Janiak (b.janiak@samsung.com) - * @version 1.0 - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -namespace { -int try_mkdir(const char* path, - mode_t mode) -{ - struct stat st; - int err = 0; - - if (::stat(path, &st) != 0) { - if (::mkdir(path, mode) != 0) { - err = -1; - } - } else if (!S_ISDIR(st.st_mode)) { - errno = ENOTDIR; - err = -1; - } - - return err; -} - -int mkpath(const char* path, - mode_t mode) -{ - char* copy = ::strdup(path); - if (NULL == copy) { - return -1; - } - - int err = 0; - char* ptr = copy; - char* slash = NULL; - - while ((0 == err) && (NULL != (slash = ::strchr(ptr, '/')))) { - if (slash != ptr) { - *slash = '\0'; - err = try_mkdir(copy, mode); - *slash = '/'; - } - ptr = slash + 1; - } - - if (0 == err) { - err = try_mkdir(path, mode); - } - - ::free(copy); - return err; -} - -int RmNode(const char* path); - -int RmDir(const char* path) -{ - DIR* dir = ::opendir(path); - if (NULL == dir) { - return -1; - } - - int return_code; - struct dirent entry = NULL; - struct dirent* entry_result; - - for (return_code = readdir_r(dir, &entry, &entry_result) != 0; - entry_result != NULL && return_code != 0; - return_code = readdir_r(dir, &entry, &entry_result)) - { - errno = 0; - if (!::strncmp(entry.d_name, ".", 1) || - !::strncmp(entry.d_name, "..", 2)) - { - continue; - } - std::string fullPath = WrtDB::PathBuilder(path) - .Append(entry.d_name) - .GetFullPath(); - if (RmNode(fullPath.c_str()) != 0) { - int error = errno; - TEMP_FAILURE_RETRY(::closedir(dir)); - errno = error; - return -1; - } - } - - int error = (!errno) ? errno : return_code; - if (TEMP_FAILURE_RETRY(::closedir(dir)) != 0) { - return -1; - } - errno = error; - - return (errno == 0 ? ::rmdir(path) : -1); -} - -int RmNode(const char* path) -{ - struct stat st; - if (::lstat(path, &st) != 0) { - return -1; - } - return (S_ISDIR(st.st_mode) ? RmDir(path) : ::unlink(path)); -} -} - -namespace FileUtils { -bool FileExists(const DPL::String& absolutePath) -{ - struct stat statStruct; - if (stat(DPL::ToUTF8String(absolutePath).c_str(), &statStruct) == 0) { - return S_ISREG(statStruct.st_mode); - } else { - return false; - } -} - -void MakePath(const std::string& path, - mode_t mode) -{ - if (mkpath(path.c_str(), mode) == -1) { - ThrowMsg(CreateDirectoryException, "Cannot make path"); - } -} - -void RemoveDir(const std::string& path) -{ - if (RmDir(path.c_str()) != 0) { - ThrowMsg(RemoveDirectoryException, DPL::GetErrnoString()); - } -} -} diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h b/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h index a2fa66a..13cec1d 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h @@ -65,7 +65,10 @@ inline const char* GetUserInstalledWidgetPath() */ inline const char* GetUserPreloadedWidgetPath() { - return "/usr/apps"; + // temp + // return "/usr/apps"; + + return "/opt/usr/apps"; } /** diff --git a/modules/widget_dao/orm/wrt_db b/modules/widget_dao/orm/wrt_db index a10f230..ba8a277 100755 --- a/modules/widget_dao/orm/wrt_db +++ b/modules/widget_dao/orm/wrt_db @@ -370,7 +370,7 @@ SQL( INSERT INTO UserAgents VALUES("Galaxy S II", "Mozilla/5.0 (Linux; U; Android 2.3.5; en-gb; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"); INSERT INTO UserAgents VALUES("Galaxy S III", "Mozilla/5.0 (Linux; U; Android 4.0.4; en-gb; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"); INSERT INTO UserAgents VALUES("SLP Galaxy", "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; GT-I9500 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"); - INSERT INTO UserAgents VALUES("Tizen", "Mozilla/5.0 (Linux; U; Tizen 1.0; en-us) AppleWebKit/534.46 (KHTML, like Gecko) Mobile Tizen Browser/1.0"); + INSERT INTO UserAgents VALUES("Tizen", "Mozilla/5.0 (Linux; U; Tizen 2.1; en-us; SAMSUNG GT-I8800) AppleWebKit/537.1 (KHTML, like Gecko) Version/2.1.0 Mobile"); INSERT INTO UserAgents VALUES("Galaxy Nexus", "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; Galaxy Nexus Build/IML74K) AppleWebKit/535.7 (KHTML, like Gecko) Mobile Safari/535.7"); INSERT INTO UserAgents VALUES("Samsung", "Mozilla/5.0 (SAMSUNG; SAMSUNG-GT-I9200/1.0; U; Linux/SLP/2.0; ko-kr) AppleWebKit/534.4 (KHTML, like Gecko) Dolfin/2.0 Mobile"); INSERT INTO UserAgents VALUES("Samsung Dolfin", "SAMSUNG-GT-S8500/S8500XXJD2 SHP/VPP/R5 Dolfin/2.0 Nextreaming SMM-MMS/1.2.0 profile/MIDP-2.1 configuration/CLDC-1.1"); -- 2.7.4