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 <j.skowron@samsung.com>
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<unsigned int>(std::stoul(clear_uuid, nullptr, 16));
+ return (int)std::hash<std::string>()( std::string(char_uuid) );
}
Storages FilesystemProviderDeviced::GetStorages() {