Sophie

Sophie

distrib > Fedora > 16 > x86_64 > media > updates-src > by-pkgid > aa0d9981be5577f36574429e19c7c660 > files > 3

pion-net-4.0.7-4.fc16.src.rpm

Update the sources to use Boost Filesystems version 3. Version 2 is obsolete.

Author: Jan Vcelak <jvcelak@redhat.com>

diff - a/common/build/pion-boost.inc b/common/build/pion-boost.inc
--- a/common/build/pion-boost.inc
+++ b/common/build/pion-boost.inc
@@ -5,7 +5,7 @@
 # Check for Boost
 AX_BOOST_BASE([1.35])
 # AC_MSG_NOTICE(Boost home directory: $BOOST_HOME_DIR)
-CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS -DBOOST_FILESYSTEM_VERSION=2"
+CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
 
 # Check for Boost library extension
diff -u a/common/src/PionPlugin.cpp b/common/src/PionPlugin.cpp
--- a/common/src/PionPlugin.cpp
+++ b/common/src/PionPlugin.cpp
@@ -58,7 +58,7 @@ void PionPlugin::addPluginDirectory(cons
 	if (! boost::filesystem::exists(plugin_path) )
 		throw DirectoryNotFoundException(dir);
 	boost::mutex::scoped_lock plugin_lock(m_plugin_mutex);
-	m_plugin_dirs.push_back(plugin_path.directory_string());
+	m_plugin_dirs.push_back(plugin_path.string());
 }
 
 void PionPlugin::resetPluginDirectories(void)
@@ -204,7 +204,7 @@ bool PionPlugin::checkForFile(std::strin
 	try {
 		// is_regular may throw if directory is not readable
 		if (boost::filesystem::is_regular(test_path)) {
-			final_path = test_path.file_string();
+			final_path = test_path.string();
 			return true;
 		}
 	} catch (...) {}
@@ -225,7 +225,7 @@ bool PionPlugin::checkForFile(std::strin
 	try {
 		// is_regular may throw if directory is not readable
 		if (boost::filesystem::is_regular(test_path)) {
-			final_path = test_path.file_string();
+			final_path = test_path.string();
 			return true;
 		}
 	} catch (...) {}
@@ -291,7 +291,7 @@ void PionPlugin::getAllPluginNames(std::
 		for (boost::filesystem::directory_iterator it2(*it); it2 != end; ++it2) {
 			if (boost::filesystem::is_regular(*it2)) {
 				if (boost::filesystem::extension(it2->path()) == PionPlugin::PION_PLUGIN_EXTENSION) {
-					plugin_names.push_back(PionPlugin::getPluginName(it2->path().leaf()));
+					plugin_names.push_back(PionPlugin::getPluginName(it2->path().filename().native()));
 				}
 			}
 		}
@@ -309,11 +309,11 @@ void *PionPlugin::loadDynamicLibrary(con
 #else
 	// convert into a full/absolute/complete path since dlopen()
 	// does not always search the CWD on some operating systems
-	const boost::filesystem::path full_path = boost::filesystem::complete(plugin_file);
+	const boost::filesystem::path full_path = boost::filesystem::absolute(plugin_file);
 	// NOTE: you must load shared libraries using RTLD_GLOBAL on Unix platforms
 	// due to a bug in GCC (or Boost::any, depending on which crowd you want to believe).
 	// see: http://svn.boost.org/trac/boost/ticket/754
-	return dlopen(full_path.file_string().c_str(), RTLD_LAZY | RTLD_GLOBAL);
+	return dlopen(full_path.string().c_str(), RTLD_LAZY | RTLD_GLOBAL);
 #endif
 }
 
diff -u a/common/tests/PionPluginPtrTests.cpp b/common/tests/PionPluginPtrTests.cpp
--- a/common/tests/PionPluginPtrTests.cpp
+++ b/common/tests/PionPluginPtrTests.cpp
@@ -230,7 +230,7 @@ BOOST_AUTO_TEST_SUITE_END()
 class Sandbox_F {
 public:
 	Sandbox_F() {
-		m_cwd = boost::filesystem::current_path().directory_string();
+		m_cwd = boost::filesystem::current_path().string();
 		boost::filesystem::remove_all("sandbox");
 		BOOST_REQUIRE(boost::filesystem::create_directory("sandbox"));
 		BOOST_REQUIRE(boost::filesystem::create_directory("sandbox/dir1"));
diff -u a/net/services/FileService.cpp b/net/services/FileService.cpp
--- a/net/services/FileService.cpp
+++ b/net/services/FileService.cpp
@@ -137,8 +137,8 @@ void FileService::operator()(HTTPRequest
 
 	// make sure that the requested file is within the configured directory
 	file_path.normalize();
-	std::string file_string = file_path.file_string();
-	if (file_string.find(m_directory.directory_string()) != 0) {
+	std::string file_string = file_path.string();
+	if (file_string.find(m_directory.string()) != 0) {
 		PION_LOG_WARN(m_logger, "Request for file outside of directory ("
 					  << getResource() << "): " << relative_path);
 		static const std::string FORBIDDEN_HTML_START =
@@ -319,7 +319,7 @@ void FileService::operator()(HTTPRequest
 						   << getResource() << "): " << relative_path);
 
 			// determine the MIME type
-			response_file.setMimeType(findMIMEType( response_file.getFilePath().leaf() ));
+			response_file.setMimeType(findMIMEType( response_file.getFilePath().filename().native() ));
 
 			// get the file_size and last_modified timestamp
 			response_file.update();
@@ -597,7 +597,7 @@ void FileService::stop(void)
 void FileService::scanDirectory(const boost::filesystem::path& dir_path)
 {
 	PION_LOG_DEBUG(m_logger, "Scanning directory (" << getResource() << "): "
-				   << dir_path.directory_string());
+				   << dir_path.string());
 
 	// iterate through items in the directory
 	boost::filesystem::directory_iterator end_itr;
@@ -614,8 +614,8 @@ void FileService::scanDirectory(const bo
 			// item is a regular file
 
 			// figure out relative path to the file
-			std::string file_path_string( itr->path().file_string() );
-			std::string relative_path( file_path_string.substr(m_directory.directory_string().size() + 1) );
+			std::string file_path_string( itr->path().string() );
+			std::string relative_path( file_path_string.substr(m_directory.string().size() + 1) );
 
 			// add item to cache (use placeholder if scan == 1)
 			addCacheEntry(relative_path, *itr, m_scan_setting == 1);
@@ -628,7 +628,7 @@ FileService::addCacheEntry(const std::st
 						   const boost::filesystem::path& file_path,
 						   const bool placeholder)
 {
-	DiskFile cache_entry(file_path, NULL, 0, 0, findMIMEType(file_path.leaf()));
+	DiskFile cache_entry(file_path, NULL, 0, 0, findMIMEType(file_path.filename().native()));
 	if (! placeholder) {
 		cache_entry.update();
 		// only read the file if its size is <= max_cache_size
@@ -636,7 +636,7 @@ FileService::addCacheEntry(const std::st
 			try { cache_entry.read(); }
 			catch (std::exception&) {
 				PION_LOG_ERROR(m_logger, "Unable to add file to cache: "
-							   << file_path.file_string());
+							   << file_path.string());
 				return std::make_pair(m_cache_map.end(), false);
 			}
 		}
@@ -647,10 +647,10 @@ FileService::addCacheEntry(const std::st
 
 	if (add_entry_result.second) {
 		PION_LOG_DEBUG(m_logger, "Added file to cache: "
-					   << file_path.file_string());
+					   << file_path.string());
 	} else {
 		PION_LOG_ERROR(m_logger, "Unable to insert cache entry for file: "
-					   << file_path.file_string());
+					   << file_path.string());
 	}
 
 	return add_entry_result;
@@ -713,7 +713,7 @@ void DiskFile::read(void)
 
 	// read the file into memory
 	if (!file_stream.is_open() || !file_stream.read(m_file_content.get(), m_file_size))
-		throw FileService::FileReadException(m_file_path.file_string());
+		throw FileService::FileReadException(m_file_path.string());
 }
 
 bool DiskFile::checkUpdated(void)
@@ -751,7 +751,7 @@ DiskFileSender::DiskFileSender(DiskFile&
 {
 	PION_LOG_DEBUG(m_logger, "Preparing to send file"
 				   << (m_disk_file.hasFileContent() ? " (cached): " : ": ")
-				   << m_disk_file.getFilePath().file_string());
+				   << m_disk_file.getFilePath().string());
 
 		// set the Content-Type HTTP header using the file's MIME type
 	m_writer->getResponse().setContentType(m_disk_file.getMimeType());
@@ -795,7 +795,7 @@ void DiskFileSender::send(void)
 			m_file_stream.open(m_disk_file.getFilePath(), std::ios::in | std::ios::binary);
 			if (! m_file_stream.is_open()) {
 				PION_LOG_ERROR(m_logger, "Unable to open file: "
-							   << m_disk_file.getFilePath().file_string());
+							   << m_disk_file.getFilePath().string());
 				return;
 			}
 		}
@@ -811,10 +811,10 @@ void DiskFileSender::send(void)
 		if (! m_file_stream.read(m_content_buf.get(), m_file_bytes_to_send)) {
 			if (m_file_stream.gcount() > 0) {
 				PION_LOG_ERROR(m_logger, "File size inconsistency: "
-							   << m_disk_file.getFilePath().file_string());
+							   << m_disk_file.getFilePath().string());
 			} else {
 				PION_LOG_ERROR(m_logger, "Unable to read file: "
-							   << m_disk_file.getFilePath().file_string());
+							   << m_disk_file.getFilePath().string());
 			}
 			return;
 		}