Mercurial > hg > svcore
comparison system/System.cpp @ 303:15b47d30c085
* Ensure locale from environment is retained after plugin load, not
just C locale
author | Chris Cannam |
---|---|
date | Fri, 05 Oct 2007 13:26:47 +0000 |
parents | 7033e188b2b2 |
children | 65311fb86166 |
comparison
equal
deleted
inserted
replaced
302:726b32522e3f | 303:15b47d30c085 |
---|---|
263 perror("statvfs failed"); | 263 perror("statvfs failed"); |
264 return -1; | 264 return -1; |
265 } | 265 } |
266 #endif | 266 #endif |
267 } | 267 } |
268 | 268 |
269 static char *startupLocale = 0; | |
270 | |
271 void | |
272 StoreStartupLocale() | |
273 { | |
274 char *loc = setlocale(LC_ALL, 0); | |
275 if (!loc) return; | |
276 if (startupLocale) free(startupLocale); | |
277 startupLocale = strdup(loc); | |
278 } | |
279 | |
280 void | |
281 RestoreStartupLocale() | |
282 { | |
283 if (!startupLocale) { | |
284 setlocale(LC_ALL, ""); | |
285 } else { | |
286 setlocale(LC_ALL, startupLocale); | |
287 } | |
288 } | |
269 | 289 |
270 double mod(double x, double y) { return x - (y * floor(x / y)); } | 290 double mod(double x, double y) { return x - (y * floor(x / y)); } |
271 float modf(float x, float y) { return x - (y * floorf(x / y)); } | 291 float modf(float x, float y) { return x - (y * floorf(x / y)); } |
272 | 292 |
273 double princarg(double a) { return mod(a + M_PI, -2 * M_PI) + M_PI; } | 293 double princarg(double a) { return mod(a + M_PI, -2 * M_PI) + M_PI; } |