* moved ErrnoMaintainer into its own header to be reusable.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37931 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010, Oliver Tappe, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _ERRNO_MAINTAINER_H
|
||||||
|
#define _ERRNO_MAINTAINER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A helper class resetting errno to 0 if it has been set during the execution
|
||||||
|
* of ICU methods. Any changes of errno shall only be done by our callers.
|
||||||
|
*/
|
||||||
|
class ErrnoMaintainer {
|
||||||
|
public:
|
||||||
|
ErrnoMaintainer()
|
||||||
|
: fErrnoUponEntry(errno)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~ErrnoMaintainer()
|
||||||
|
{
|
||||||
|
if (errno != 0 && fErrnoUponEntry == 0)
|
||||||
|
errno = 0;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
int fErrnoUponEntry;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _ERRNO_MAINTAINER_H
|
||||||
@@ -8,11 +8,12 @@
|
|||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <ErrnoMaintainer.h>
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
@@ -24,27 +25,6 @@ CreateInstance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A helper class resetting errno to 0 if it has been set during the execution
|
|
||||||
* of ICU methods. Any changes of errno shall only be done by our callers.
|
|
||||||
*/
|
|
||||||
class ErrnoMaintainer {
|
|
||||||
public:
|
|
||||||
ErrnoMaintainer()
|
|
||||||
: fErrnoUponEntry(errno)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~ErrnoMaintainer()
|
|
||||||
{
|
|
||||||
if (errno != 0 && fErrnoUponEntry == 0)
|
|
||||||
errno = 0;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
int fErrnoUponEntry;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
ICULocaleBackend::ICULocaleBackend()
|
ICULocaleBackend::ICULocaleBackend()
|
||||||
:
|
:
|
||||||
fMonetaryData(fLocaleConv),
|
fMonetaryData(fLocaleConv),
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
SubDir HAIKU_TOP src system libroot add-ons icu locale ;
|
SubDir HAIKU_TOP src system libroot add-ons icu locale ;
|
||||||
|
|
||||||
UsePrivateHeaders [ FDirName libroot locale ] ;
|
UsePrivateHeaders
|
||||||
UsePrivateHeaders [ FDirName libroot time ] ;
|
libroot
|
||||||
|
[ FDirName libroot locale ]
|
||||||
|
[ FDirName libroot time ]
|
||||||
|
;
|
||||||
|
|
||||||
local sources =
|
local sources =
|
||||||
ICUCategoryData.cpp
|
ICUCategoryData.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user