File: 60_hdrhtml_locale.diff

package info (click to toggle)
luminance-hdr 2.6.1.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 34,860 kB
  • sloc: cpp: 43,967; ansic: 4,122; xml: 116; makefile: 20; sh: 7
file content (35 lines) | stat: -rw-r--r-- 1,405 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: Fixes locale problems in export to HTML feature
  This patch fixes a problem caused by certain locales in the export to HTML
  feature. In particular, in the wrong calculation of image size and other 
  numerical values, in locales that use the dot as separator of thousands.
Author: Leonardo Montecchi <lmontecchi@montex.org>
Last-Update: 2019-08-22

--- a/src/HdrHTML/hdrhtml.cpp
+++ b/src/HdrHTML/hdrhtml.cpp
@@ -792,10 +792,13 @@ void HDRHTMLSet::generate_webpage(const
                                   const char *out_dir,
                                   const char *object_output,
                                   const char *html_output, bool verbose) {
     if (image_list.empty()) return;
 
+    string user_locale = locale("").name();
+    locale::global(locale::classic());
+
     ostringstream out_file_name;
     if (out_dir != NULL) out_file_name << out_dir << "/";
     if (page_name == NULL)
         out_file_name << image_list.front().base_name << ".html";
     else
@@ -858,10 +861,11 @@ void HDRHTMLSet::generate_webpage(const
             print_image_htmlcode(hofs, this, NULL);
         } catch (pfs::Exception &e) {
             throw;
         }
     }
+    locale::global(locale(user_locale.c_str()));
 }
 
 void print_image_objects(ostream &out, void *user_data, const char *parameter) {
     HDRHTMLSet *hdrhtml_set = static_cast<HDRHTMLSet *>(user_data);