File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
carta/cpp/plugins/WcsPlotter Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 3
3
#include " grfdriver.h"
4
4
5
5
#include < string.h>
6
+ #include < locale.h>
6
7
extern " C" {
7
8
#include < ast.h>
8
9
};
@@ -433,6 +434,14 @@ AstGridPlotter::plot()
433
434
grfGlobals ()-> vgComposer = m_vgc;
434
435
// pre-cache some things
435
436
grfGlobals ()-> prepare ();
437
+
438
+ // Temporarily override numeric locale, otherwise AST will fail to
439
+ // parse floating point numbers in the FITS header if the user's
440
+ // locale uses a comma as a decimal separator. Back up the old
441
+ // locale so that we can switch back afterwards and minimise impact
442
+ // on the rest of the application.
443
+
444
+ std::string oldLocale = setlocale (LC_NUMERIC, " C" );
436
445
437
446
// get rid of any ast errors from previous calls, just in case
438
447
astClearStatus;
@@ -572,6 +581,10 @@ AstGridPlotter::plot()
572
581
plot = (AstPlot *) astAnnul ( plot );
573
582
wcsinfo = (AstFrameSet *) astAnnul ( wcsinfo );
574
583
fitschan = (AstFitsChan *) astAnnul ( fitschan );
584
+
585
+ // Restore previous numeric locale
586
+
587
+ setlocale (LC_NUMERIC, oldLocale.c_str ());
575
588
576
589
return true ;
577
590
} // plot
You can’t perform that action at this time.
0 commit comments