[PATCH] Committing svn revision 36820: For ZCP-10446: Add boost_compat.h to Makefile.am. #time 1m +review CR-ZCP-1085
marks
marks на zarafa.com
Вт Авг 28 09:58:06 MSK 2012
---
common/Makefile.am | 2 +-
common/Makefile.in | 2 +-
common/boost_compat.h | 87 +++++++++++++++++++++++++++++++++++++++++++++++++
common/ecversion.h | 32 +++++++++---------
4 files changed, 105 insertions(+), 18 deletions(-)
create mode 100644 common/boost_compat.h
diff --git a/zarafa/common/ECConfigImpl.cpp b/zarafa/common/ECConfigImpl.cpp
index 4ee458f..b5c923f 100644
--- a/zarafa/common/ECConfigImpl.cpp
+++ b/zarafa/common/ECConfigImpl.cpp
@@ -60,6 +60,8 @@
#include "charset/convert.h"
+#include "boost_compat.h"
+
using namespace std;
#ifdef _DEBUG
@@ -69,7 +71,6 @@ static char THIS_FILE[] = __FILE__;
#endif
#include <boost/filesystem.hpp>
-
namespace fs = boost::filesystem;
const directive_t ECConfigImpl::s_sDirectives[] = {
@@ -351,11 +352,11 @@ bool ECConfigImpl::ReadConfigFile(const path_type &file, unsigned int ulFlags, u
m_currentFile = file;
if (!exists(file)) {
- errors.push_back("Config file '" + file.file_string() + "' does not exist.");
+ errors.push_back("Config file '" + path_to_string(file) + "' does not exist.");
goto exit;
}
if (is_directory(file)) {
- errors.push_back("Config file '" + file.file_string() + "' is a directory.");
+ errors.push_back("Config file '" + path_to_string(file) + "' is a directory.");
goto exit;
}
@@ -367,8 +368,8 @@ bool ECConfigImpl::ReadConfigFile(const path_type &file, unsigned int ulFlags, u
m_readFiles.insert(file);
- if(!(fp = fopen(file.file_string().c_str(), "rt"))) {
- errors.push_back("Unable to open config file '" + file.file_string() + "'");
+ if(!(fp = fopen(path_to_string(file).c_str(), "rt"))) {
+ errors.push_back("Unable to open config file '" + path_to_string(file) + "'");
goto exit;
}
@@ -453,9 +454,6 @@ bool ECConfigImpl::HandleDirective(string &strLine, unsigned int ulFlags)
}
-#if (((BOOST_VERSION / 100) % 1000) < 36)
- #define remove_filename remove_leaf
-#endif
bool ECConfigImpl::HandleInclude(const char *lpszArgs, unsigned int ulFlags)
{
string strValue;
@@ -464,7 +462,7 @@ bool ECConfigImpl::HandleInclude(const char *lpszArgs, unsigned int ulFlags)
file = (strValue = trim(lpszArgs, " \t\r\n"));
if (!file.is_complete()) {
// Rebuild the path
- file = m_currentFile.remove_filename();
+ file = remove_filename_from_path(m_currentFile);
file /= strValue;
}
@@ -689,8 +687,8 @@ bool ECConfigImpl::WriteSettingsToFile(const char* szFileName)
fs::path pathBakFile;
pathOutFile = pathBakFile = szFileName;
- pathOutFile.remove_filename() /= "config_out.cfg";
- pathBakFile.remove_filename() /= "config_bak.cfg";
+ remove_filename_from_path(pathOutFile) /= "config_out.cfg";
+ remove_filename_from_path(pathBakFile) /= "config_bak.cfg";
ifstream in(szFileName);
@@ -709,7 +707,7 @@ bool ECConfigImpl::WriteSettingsToFile(const char* szFileName)
}
// open temp output file
- ofstream out(pathOutFile.file_string().c_str());
+ ofstream out(path_to_string(pathOutFile.string()).c_str());
settingmap_t::iterator iterSettings;
const char* szName = NULL;
@@ -730,7 +728,7 @@ bool ECConfigImpl::WriteSettingsToFile(const char* szFileName)
// the stdio functions does not work in win release mode in some cases
remove(szFileName);
- rename(pathOutFile.file_string().c_str(),szFileName);
+ rename(path_to_string(pathOutFile).c_str(),szFileName);
return true;
}
diff --git a/zarafa/common/Makefile.am b/zarafa/common/Makefile.am
index d6d74cf..c3bfa3f 100644
--- a/zarafa/common/Makefile.am
+++ b/zarafa/common/Makefile.am
@@ -22,7 +22,7 @@ libcommon_mapi_la_include_HEADERS = rtfutil.h mapiext.h ECGuid.h ECTags.h ECDefs
HtmlToTextParser.h HtmlEntity.h userutil.h ECFeatures.h ECFeatureList.h ECDebugPrint.h ECInterfaceDefs.h \
HrException.h ECIterators.h ECACL.h pthreadutil.h ECThreadPool.h MAPINotifSink.h \
ECDatabaseMySQL.h fileutil.h IStreamAdapter.h IECExchangeModifyTable.h \
- ConsoleTable.h MAPIConsoleTable.h ECFifoStream.h ECMAPIDebug.h \
+ ConsoleTable.h MAPIConsoleTable.h ECFifoStream.h ECMAPIDebug.h boost_compat.h \
$(charset_HEADERS) $(utf8_HEADERS) $(ustringutil_HEADERS) $(mapiptr_HEADERS)
libcommon_mapi_la_includedir = $(includedir)/zarafa
diff --git a/zarafa/common/Makefile.in b/zarafa/common/Makefile.in
index e2704d0..3ef28ca 100644
--- a/zarafa/common/Makefile.in
+++ b/zarafa/common/Makefile.in
@@ -405,7 +405,7 @@ libcommon_mapi_la_include_HEADERS = rtfutil.h mapiext.h ECGuid.h ECTags.h ECDefs
HtmlToTextParser.h HtmlEntity.h userutil.h ECFeatures.h ECFeatureList.h ECDebugPrint.h ECInterfaceDefs.h \
HrException.h ECIterators.h ECACL.h pthreadutil.h ECThreadPool.h MAPINotifSink.h \
ECDatabaseMySQL.h fileutil.h IStreamAdapter.h IECExchangeModifyTable.h \
- ConsoleTable.h MAPIConsoleTable.h ECFifoStream.h ECMAPIDebug.h \
+ ConsoleTable.h MAPIConsoleTable.h ECFifoStream.h ECMAPIDebug.h boost_compat.h \
$(charset_HEADERS) $(utf8_HEADERS) $(ustringutil_HEADERS) $(mapiptr_HEADERS)
libcommon_mapi_la_includedir = $(includedir)/zarafa
diff --git a/zarafa/configure b/zarafa/configure
index 4d34570..0c1e9af 100755
--- a/zarafa/configure
+++ b/zarafa/configure
@@ -19613,8 +19613,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
fi
-# BOOST_BIND
-# BOOST_THREADS([mt])
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the toolset name used by Boost for $CXX" >&5
$as_echo_n "checking for the toolset name used by Boost for $CXX... " >&6; }
if test "${boost_cv_lib_tag+set}" = set; then :
@@ -20414,47 +20412,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking boost version compatibility" >&5
-$as_echo_n "checking boost version compatibility... " >&6; }
-if test -n "$boost_major_version" -a $boost_major_version -ge 146; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: adding backward compatible flags" >&5
-$as_echo "adding backward compatible flags" >&6; }
- BOOST_CPPFLAGS="$BOOSTCPPFLAGS -DBOOST_FILESYSTEM_VERSION=2"
-
- CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
- LIBS="$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for boost filesystem version 2 presence" >&5
-$as_echo_n "checking for boost filesystem version 2 presence... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-#include <boost/filesystem.hpp>
-namespace bfs = boost::filesystem;
-int main() {
- bfs::path path;
- bfs::directory_iterator pi(path);
- pi->path().file_string();
-}
-
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
-$as_echo "ok" >&6; }
-else
- as_fn_error $? "no, boost is too new" "$LINENO" 5
-
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-
- LIBS=$libs_keep
- CFLAGS=$cflags_keep
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
-$as_echo "ok" >&6; }
-fi
# Check whether --enable-icu was given.
if test "${enable_icu+set}" = set; then :
@@ -23465,12 +23422,10 @@ Curl libs : $CURL_LIBS
Pam libs : $PAM_LIBS
Krb5 libs : $KRB5_LIBS
TCMalloc lib : $TCMALLOC_LIBS
-Boost
+Boost :
Flags : $BOOST_CPPFLAGS
FS ldflags : $BOOST_FILESYSTEM_LDFLAGS
FS libs : $BOOST_FILESYSTEM_LIBS
-# Thread ldflags : $BOOST_THREAD_LDFLAGS
-# Thread libs : $BOOST_THREAD_LIBS
ICU libs : $ICU_LIBS
Swig : $want_swig
Python module : $want_python
@@ -23514,12 +23469,10 @@ Curl libs : $CURL_LIBS
Pam libs : $PAM_LIBS
Krb5 libs : $KRB5_LIBS
TCMalloc lib : $TCMALLOC_LIBS
-Boost
+Boost :
Flags : $BOOST_CPPFLAGS
FS ldflags : $BOOST_FILESYSTEM_LDFLAGS
FS libs : $BOOST_FILESYSTEM_LIBS
-# Thread ldflags : $BOOST_THREAD_LDFLAGS
-# Thread libs : $BOOST_THREAD_LIBS
ICU libs : $ICU_LIBS
Swig : $want_swig
Python module : $want_python
diff --git a/zarafa/configure.ac b/zarafa/configure.ac
index 1b1d9ae..e512a93 100644
--- a/zarafa/configure.ac
+++ b/zarafa/configure.ac
@@ -693,36 +693,8 @@ AC_SUBST(EPOLL_CFLAGS)
# Boost
BOOST_REQUIRE([1.35])
BOOST_SMART_PTR
-# BOOST_BIND
-# BOOST_THREADS([mt])
BOOST_FILESYSTEM([mt])
BOOST_DATE_TIME([mt])
-AC_MSG_CHECKING([boost version compatibility])
-if test -n "$boost_major_version" -a $boost_major_version -ge 146; then
- AC_MSG_RESULT([adding backward compatible flags])
- BOOST_CPPFLAGS="$BOOSTCPPFLAGS -DBOOST_FILESYSTEM_VERSION=2"
-
- CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
- LIBS="$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"
-
- AC_MSG_CHECKING([for boost filesystem version 2 presence])
- AC_LINK_IFELSE([
- AC_LANG_SOURCE([
-#include <boost/filesystem.hpp>
-namespace bfs = boost::filesystem;
-int main() {
- bfs::path path;
- bfs::directory_iterator pi(path);
- pi->path().file_string();
-}
- ]) ], [ AC_MSG_RESULT([ok]) ], [ AC_MSG_ERROR([no, boost is too new])
- ])
-
- LIBS=$libs_keep
- CFLAGS=$cflags_keep
-else
- AC_MSG_RESULT([ok])
-fi
AC_ARG_ENABLE(icu, AC_HELP_STRING([--enable-icu],[enable icu support]), [want_icu=${enableval}],[want_icu=auto])
if test "$want_icu" = "no"; then
@@ -868,12 +840,10 @@ Curl libs : $CURL_LIBS
Pam libs : $PAM_LIBS
Krb5 libs : $KRB5_LIBS
TCMalloc lib : $TCMALLOC_LIBS
-Boost
+Boost :
Flags : $BOOST_CPPFLAGS
FS ldflags : $BOOST_FILESYSTEM_LDFLAGS
FS libs : $BOOST_FILESYSTEM_LIBS
-# Thread ldflags : $BOOST_THREAD_LDFLAGS
-# Thread libs : $BOOST_THREAD_LIBS
ICU libs : $ICU_LIBS
Swig : $want_swig
Python module : $want_python
diff --git a/zarafa/mapi4linux/src/m4l.mapisvc.cpp b/zarafa/mapi4linux/src/m4l.mapisvc.cpp
index 88e8dae..4864c5c 100644
--- a/zarafa/mapi4linux/src/m4l.mapisvc.cpp
+++ b/zarafa/mapi4linux/src/m4l.mapisvc.cpp
@@ -56,6 +56,7 @@
#include "mapicode.h"
#include "mapitags.h"
#include "mapiutil.h"
+#include "boost_compat.h"
#include "Util.h"
@@ -64,6 +65,7 @@
#include <boost/algorithm/string.hpp>
namespace ba = boost::algorithm;
+
#include <boost/filesystem.hpp>
namespace bfs = boost::filesystem;
@@ -125,14 +127,14 @@ HRESULT INFLoader::LoadINFs()
if (is_directory(inffile->status()))
continue;
- string strFilename = inffile->path().file_string();
+ string strFilename = path_to_string(inffile->path());
string::size_type pos = strFilename.rfind(".inf", strFilename.size(), strlen(".inf"));
if (pos == string::npos || strFilename.size() - pos != strlen(".inf"))
// silently skip files not ending in pos
continue;
- hr = LoadINF(inffile->path().file_string().c_str());
+ hr = LoadINF(path_to_string(inffile->path()).c_str());
if (hr != hrSuccess)
goto exit;
}
diff --git a/zarafa/provider/libserver/ECSession.cpp b/zarafa/provider/libserver/ECSession.cpp
index b48752e..a5598a1 100644
--- a/zarafa/provider/libserver/ECSession.cpp
+++ b/zarafa/provider/libserver/ECSession.cpp
@@ -84,6 +84,7 @@
#include "pthreadutil.h"
#include "threadutil.h"
+#include "boost_compat.h"
#include <boost/filesystem.hpp>
namespace bfs = boost::filesystem;
@@ -948,7 +949,7 @@ ECRESULT ECAuthSession::ValidateUserCertificate(struct soap *soap, char *lpszNam
if (is_directory(key->status()))
continue;
- lpFileName = key->path().file_string().c_str();
+ lpFileName = path_to_string(key->path()).c_str();
biofile = BIO_new_file(lpFileName, "r");
if (!biofile) {
diff --git a/zarafa/provider/server/ECClientUpdate.cpp b/zarafa/provider/server/ECClientUpdate.cpp
index 9fee168..e22ffd1 100644
--- a/zarafa/provider/server/ECClientUpdate.cpp
+++ b/zarafa/provider/server/ECClientUpdate.cpp
@@ -69,6 +69,7 @@ namespace ba = boost::algorithm;
#include "ECSessionManager.h"
#include "ECDatabase.h"
#include "ECStatsCollector.h"
+#include "boost_compat.h"
/* class and add constructor params? */
extern ECRESULT GetBestServerPath(struct soap *soap, ECSession *lpecSession, const std::string &strServerName, std::string *lpstrServerPath);
@@ -357,13 +358,13 @@ bool GetLatestVersionAtServer(char *szUpdatePath, unsigned int ulTrackid, Client
bfs::directory_iterator update_last;
for (bfs::directory_iterator update(updatesdir); update != update_last; update++) {
- std::string strFilename = update->path().leaf();
+ std::string strFilename = filename_from_path(update->path());
- if (!bfs::is_regular(*update) && !bfs::is_symlink(*update)) {
+ if (!bfs::is_regular_file(*update) && !bfs::is_symlink(*update)) {
continue;
}
- if (!ba::starts_with(update->path().leaf(), strFileStart)) {
+ if (!ba::starts_with(strFilename, strFileStart)) {
g_lpLogger->Log(EC_LOGLEVEL_DEBUG, "Client update: trackid: 0x%08X, Ignoring file %s for client update", ulTrackid, strFilename.c_str());
continue;
}
--MP_/hq//wXhKT2tVb7KITwoVElh--
Подробная информация о списке рассылки Devel