From: Jakub Skowron Date: Tue, 31 May 2016 10:46:57 +0000 (+0200) Subject: [Filesystem] Fix crash in filesystem_provider_deviced.cc on emulator X-Git-Tag: submit/tizen/20160601.063935^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F15%2F72315%2F2;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Filesystem] Fix crash in filesystem_provider_deviced.cc on emulator When generating id from UUID out_of_range was thrown by std::stoul, because long is too short (4 bytes on 32 bit simulator). Changed id to be hash of UUID. Previously only first two fields (6 bytes) were used. [Verification] tct-filesystem-tizen-tests automated and manual test pass 100% tct-systeminfo-tizen-tests automated test pass 100% Change-Id: Iaadaf21760c48eb540b206d3d029bd8b6d53841f Signed-off-by: Jakub Skowron --- diff --git a/src/common/filesystem/filesystem_provider_deviced.cc b/src/common/filesystem/filesystem_provider_deviced.cc index 87e04a54..4f17cc66 100644 --- a/src/common/filesystem/filesystem_provider_deviced.cc +++ b/src/common/filesystem/filesystem_provider_deviced.cc @@ -225,10 +225,7 @@ std::string FilesystemProviderDeviced::GetNameFromPath( int FilesystemProviderDeviced::GetIdFromUUID(const char* const char_uuid) { LoggerD("Entered"); - std::string uuid = char_uuid; - size_t hyphen = uuid.find("-"); - std::string clear_uuid = uuid.substr(0, hyphen) + uuid.substr(hyphen + 1); - return static_cast(std::stoul(clear_uuid, nullptr, 16)); + return (int)std::hash()( std::string(char_uuid) ); } Storages FilesystemProviderDeviced::GetStorages() {