[Time] Fix for getting region.
authorTomasz Marciniak <t.marciniak@samsung.com>
Thu, 3 Sep 2015 12:00:25 +0000 (14:00 +0200)
committerTomasz Marciniak <t.marciniak@samsung.com>
Thu, 3 Sep 2015 12:23:22 +0000 (14:23 +0200)
[Verification] Code compiles.
TCT pass rate 100% (r38)

Change-Id: I4ddcc7e991c0a90f57f7a141a41028f4a1db9171
Signed-off-by: Tomasz Marciniak <t.marciniak@samsung.com>
src/time/time_instance.cc

index a2e427df7bd1a2a39b2488302561cf9b81f9fc52..d9252f119950b49499abf868a4c189bad6c2f8ca 100644 (file)
@@ -433,8 +433,8 @@ Locale* TimeInstance::getDefaultLocale() {
 
    char *str_region = NULL;
    char* p = strchr(tempstr, '.');
-   int len = strlen(tempstr) - strlen(".UTF-8");
-   if (p && len > 0) {
+   int len = strlen(tempstr) - (p != nullptr ? strlen(p) : 0);
+   if (len > 0) {
           str_region = strndup(tempstr, len); //.UTF8 => 5
           defaultLocale = new Locale(str_region);
    }