[content] modify parsing EXIF metadata
authormin.ah.kim <min.ah.kim@samsung.com>
Wed, 10 Apr 2013 05:40:51 +0000 (14:40 +0900)
committermin.ah.kim <min.ah.kim@samsung.com>
Wed, 10 Apr 2013 09:49:09 +0000 (18:49 +0900)
Change-Id: Iff9df6748829c6ce322f32190b6d354c2eb854ef
Signed-off-by: min.ah.kim <min.ah.kim@samsung.com>
src/FCnt_ContentManagerUtilImpl.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 942720b..2881d29
@@ -194,9 +194,35 @@ _ContentManagerUtilImpl::GetImageMetaN(const String& contentPath, bool internal)
                                                {
                                                        ssBuff[l] = mmBuff[l + index + 1]; //add 1 to skip the ','
                                                }
+
+                                               char *pLocal;
+                                               std::unique_ptr<char> pCurrentLocal(null);
+                                               pLocal = setlocale (LC_ALL, 0); // Get the name of the current locale.
+                                               if( pLocal == null )
+                                               {
+                                                       SysLog(NID_CNT, "setlocale failed. (get current locale)");
+                                                       continue;
+                                               }
+                                               pCurrentLocal.reset(strdup (pLocal));
+
+                                               pLocal = setlocale(LC_ALL, "C");
+                                               if( pLocal == null )
+                                               {
+                                                       SysLog(NID_CNT, "setlocale failed. (set POSIX C locale)");
+                                                       continue;
+                                               }
+
                                                double ddVal = atof(buf); // degree value
                                                double mmVal = atof(mmBuff); // minutesvalue
                                                double ssVal = atof(ssBuff); // seconds value
+
+                                               pLocal = setlocale (LC_ALL, pCurrentLocal.get()); // restore the locale.
+                                               if( pLocal == null )
+                                               {
+                                                       SysLog(NID_CNT, "setlocale failed. (set current locale)");
+                                                       continue;
+                                               }
+
                                                pMetadata->latitude = ddVal + (mmVal/MINUTES) + (ssVal/SECONDS);
 
                                                // if latitude designation is Southern (SOUTH) then latitude degree will be negative DD
@@ -223,9 +249,35 @@ _ContentManagerUtilImpl::GetImageMetaN(const String& contentPath, bool internal)
                                                {
                                                        ssBuff[l] = mmBuff[l + index + 1]; //add 1 to skip the ','
                                                }
+
+                                               char *pLocal;
+                                               std::unique_ptr<char> pCurrentLocal(null);
+                                               pLocal = setlocale (LC_ALL, 0); // Get the name of the current locale.
+                                               if( pLocal == null )
+                                               {
+                                                       SysLog(NID_CNT, "setlocale failed. (get current locale)");
+                                                       continue;
+                                               }
+                                               pCurrentLocal.reset(strdup (pLocal));
+
+                                               pLocal = setlocale(LC_ALL, "C");
+                                               if( pLocal == null )
+                                               {
+                                                       SysLog(NID_CNT, "setlocale failed. (set POSIX C locale)");
+                                                       continue;
+                                               }
+
                                                double ddVal = atof(buf); // degree value
                                                double mmVal = atof(mmBuff); // minutesvalue
                                                double ssVal = atof(ssBuff); // seconds value
+
+                                               pLocal = setlocale (LC_ALL, pCurrentLocal.get()); // restore the locale.
+                                               if( pLocal == null )
+                                               {
+                                                       SysLog(NID_CNT, "setlocale failed. (set current locale)");
+                                                       continue;
+                                               }
+
                                                pMetadata->longitude = ddVal + (mmVal/MINUTES) + (ssVal/SECONDS);
 
                                                // if longitude designation is Western (WEST) then longitude degree will be negative DD