-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use class to temporary override locale to C
(cherry picked from commit 0ecef35)
- Loading branch information
Showing
8 changed files
with
118 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,43 @@ | |||
/*************************************************************************** | |||
qgslocalec.h - temporary C numeric locale | |||
------------------- | |||
begin : Jun 15th 2015 | |||
copyright : (C) 2015 by Juergen E. Fischer | |||
email : jef at norbit dot de | |||
***************************************************************************/ | |||
|
|||
/*************************************************************************** | |||
* * | |||
* This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | |||
* * | |||
***************************************************************************/ | |||
|
|||
#include <qgslocalec.h> | |||
|
|||
#include <locale.h> | |||
#include <QByteArray> | |||
|
|||
QMutex QgsLocaleNumC::sLocaleLock; | |||
|
|||
QgsLocaleNumC::QgsLocaleNumC() | |||
{ | |||
sLocaleLock.lock(); | |||
|
|||
mOldlocale = setlocale( LC_NUMERIC, NULL ); | |||
if ( mOldlocale ) | |||
mOldlocale = qstrdup( mOldlocale ); | |||
|
|||
setlocale( LC_NUMERIC, "C" ); | |||
} | |||
|
|||
QgsLocaleNumC::~QgsLocaleNumC() | |||
{ | |||
setlocale( LC_NUMERIC, mOldlocale ); | |||
if ( mOldlocale ) | |||
delete [] mOldlocale; | |||
|
|||
sLocaleLock.unlock(); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,34 @@ | |||
/*************************************************************************** | |||
qgslocalec.h - temporary C numeric locale | |||
------------------- | |||
begin : Jun 15th 2015 | |||
copyright : (C) 2015 by Juergen E. Fischer | |||
email : jef at norbit dot de | |||
***************************************************************************/ | |||
|
|||
/*************************************************************************** | |||
* * | |||
* This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | |||
* * | |||
***************************************************************************/ | |||
|
|||
#ifndef QGSLOCALENUMC_H | |||
#define QGSLOCALENUMC_H | |||
|
|||
#include <QMutex> | |||
|
|||
class CORE_EXPORT QgsLocaleNumC | |||
{ | |||
char *mOldlocale; | |||
static QMutex sLocaleLock; | |||
|
|||
public: | |||
QgsLocaleNumC(); | |||
~QgsLocaleNumC(); | |||
|
|||
}; | |||
|
|||
#endif // QGSLOCALENUMC_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters