Commit 60857365 authored by Albert Astals Cid's avatar Albert Astals Cid

Force C locale in LC_NUMERIC when calling cmsGetPostScriptCSA

Otherwise we get brokenly formatted PS
parent c290052d
Pipeline #171863 passed with stage
in 2 minutes and 57 seconds
......@@ -45,6 +45,7 @@
#include <algorithm>
#include <memory>
#include <clocale>
#include <cstddef>
#include <cmath>
#include <cstring>
......@@ -2223,14 +2224,22 @@ char *GfxICCBasedColorSpace::getPostScriptCSA()
}
void *rawprofile = profile.get();
// We need the setlocale game
// until we can depend on https://github.com/mm2/Little-CMS/issues/223 being fixed
char *old = setlocale(LC_NUMERIC, "C");
size = cmsGetPostScriptCSA(cmsGetProfileContextID(rawprofile), rawprofile, getIntent(), 0, nullptr, 0);
setlocale(LC_NUMERIC, old);
if (size == 0) {
error(errSyntaxWarning, -1, "PostScript CSA is nullptr");
return nullptr;
}
psCSA = (char *)gmalloc(size + 1);
// We need the setlocale game
// until we can depend on https://github.com/mm2/Little-CMS/issues/223 being fixed
old = setlocale(LC_NUMERIC, "C");
cmsGetPostScriptCSA(cmsGetProfileContextID(rawprofile), rawprofile, getIntent(), 0, psCSA, size);
setlocale(LC_NUMERIC, old);
psCSA[size] = 0;
return psCSA;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment