From 813e32e7909e7fb5a7d052171b5328e1419bdff9 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 13 Mar 2012 18:15:18 -0400 Subject: [PATCH 1/2] preserve OBJ defaults --- data/schema/upgrade_0.3.0.xsl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/data/schema/upgrade_0.3.0.xsl b/data/schema/upgrade_0.3.0.xsl index 3c63e49e..7cbad598 100644 --- a/data/schema/upgrade_0.3.0.xsl +++ b/data/schema/upgrade_0.3.0.xsl @@ -43,6 +43,16 @@ + + + + + + + + From 4c3b1d00149b68092da3a6133a13b97ee7e74d2c Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Mon, 26 Mar 2012 12:51:55 -0400 Subject: [PATCH 2/2] minor improvements to mmap.cpp --- src/libcore/mmap.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/libcore/mmap.cpp b/src/libcore/mmap.cpp index 58f8ffbc..6ba55438 100644 --- a/src/libcore/mmap.cpp +++ b/src/libcore/mmap.cpp @@ -7,7 +7,7 @@ MTS_NAMESPACE_BEGIN -MemoryMappedFile::MemoryMappedFile(const fs::path &filename) : m_filename(filename) { +MemoryMappedFile::MemoryMappedFile(const fs::path &filename) : m_filename(filename), m_data(NULL) { if (!fs::exists(filename)) Log(EError, "The file \"%s\" does not exist!", filename.file_string().c_str()); m_size = (size_t) fs::file_size(filename); @@ -41,20 +41,23 @@ MemoryMappedFile::MemoryMappedFile(const fs::path &filename) : m_filename(filena } MemoryMappedFile::~MemoryMappedFile() { -#if defined(__LINUX__) || defined(__OSX__) - Log(ETrace, "Unmapping \"%s\" from memory", - m_filename.file_string().c_str()); - int retval = munmap(m_data, m_size); - if (retval != 0) - Log(EError, "munmap(): unable to unmap memory!"); -#elif defined(WIN32) - if (!UnmapViewOfFile(m_data)) - Log(EError, "UnmapViewOfFile(): unable to unmap memory: %s", lastErrorText().c_str()); - if (!CloseHandle(m_fileMapping)) - Log(EError, "CloseHandle(): unable to close file mapping: %s", lastErrorText().c_str()); - if (!CloseHandle(m_file)) - Log(EError, "CloseHandle(): unable to close file: %s", lastErrorText().c_str()); -#endif + if (m_data) { + Log(ETrace, "Unmapping \"%s\" from memory", + m_filename.file_string().c_str()); + + #if defined(__LINUX__) || defined(__OSX__) + int retval = munmap(m_data, m_size); + if (retval != 0) + Log(EError, "munmap(): unable to unmap memory!"); + #elif defined(WIN32) + if (!UnmapViewOfFile(m_data)) + Log(EError, "UnmapViewOfFile(): unable to unmap memory: %s", lastErrorText().c_str()); + if (!CloseHandle(m_fileMapping)) + Log(EError, "CloseHandle(): unable to close file mapping: %s", lastErrorText().c_str()); + if (!CloseHandle(m_file)) + Log(EError, "CloseHandle(): unable to close file: %s", lastErrorText().c_str()); + #endif + } } MTS_IMPLEMENT_CLASS(MemoryMappedFile, false, Object)