$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r78136 - in trunk: boost/filesystem libs/filesystem/doc libs/filesystem/test libs/filesystem/test/msvc10
From: bdawes_at_[hidden]
Date: 2012-04-22 11:07:09
Author: bemandawes
Date: 2012-04-22 11:07:08 EDT (Sun, 22 Apr 2012)
New Revision: 78136
URL: http://svn.boost.org/trac/boost/changeset/78136
Log:
Filesystem: Fix #6819; A path operand with a source that was a one character array was treated as empty, even if it wasn't empty. Such arrays can occur and be non-empty in unions or in code using C variable length array idioms.
Text files modified: 
   trunk/boost/filesystem/path.hpp                     |     8 ++++----                                
   trunk/boost/filesystem/path_traits.hpp              |     4 ++--                                    
   trunk/libs/filesystem/doc/release_history.html      |     5 ++++-                                   
   trunk/libs/filesystem/test/msvc10/filesystem-v3.sln |    11 -----------                             
   trunk/libs/filesystem/test/path_test.cpp            |    14 ++++++++++++++                          
   5 files changed, 24 insertions(+), 18 deletions(-)
Modified: trunk/boost/filesystem/path.hpp
==============================================================================
--- trunk/boost/filesystem/path.hpp	(original)
+++ trunk/boost/filesystem/path.hpp	2012-04-22 11:07:08 EDT (Sun, 22 Apr 2012)
@@ -704,10 +704,10 @@
   {
     if (path_traits::empty(source))
       return *this;
-      string_type::size_type sep_pos(m_append_separator_if_needed());
-      path_traits::dispatch(source, m_pathname, cvt);
-      if (sep_pos)
-        m_erase_redundant_separator(sep_pos);
+    string_type::size_type sep_pos(m_append_separator_if_needed());
+    path_traits::dispatch(source, m_pathname, cvt);
+    if (sep_pos)
+      m_erase_redundant_separator(sep_pos);
     return *this;
   }
 
Modified: trunk/boost/filesystem/path_traits.hpp
==============================================================================
--- trunk/boost/filesystem/path_traits.hpp	(original)
+++ trunk/boost/filesystem/path_traits.hpp	2012-04-22 11:07:08 EDT (Sun, 22 Apr 2012)
@@ -85,8 +85,8 @@
   }
 
   template <typename T, size_t N> inline
-     bool empty(T (&)[N])
-       { return N <= 1; }
+     bool empty(T (&x)[N])
+       { return !x[0]; }
 
   // value types differ  ---------------------------------------------------------------//
   //
Modified: trunk/libs/filesystem/doc/release_history.html
==============================================================================
--- trunk/libs/filesystem/doc/release_history.html	(original)
+++ trunk/libs/filesystem/doc/release_history.html	2012-04-22 11:07:08 EDT (Sun, 22 Apr 2012)
@@ -74,6 +74,9 @@
   Implementation of filesystem::rename() method for MS Windows is wrong, by 
   adding MOVEFILE_COPY_ALLOWED to deal with renames across drives, volumes, file 
   systems. Fix has no effect on non-Windows systems.</li>
+  <li>Fix #6819; A path operand with a source that was a one character array was 
+  treated as empty, even if it wasn't empty. Such arrays can occur in unions or 
+  in code using C variable length array idioms.</li>
 </ul>
 
 <h2>1.49.0</h2>
@@ -158,7 +161,7 @@
 </ul>
 <hr>
 <p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->19 April, 2012<!--webbot bot="Timestamp" endspan i-checksum="29871" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->22 April, 2012<!--webbot bot="Timestamp" endspan i-checksum="29858" --></p>
 <p>© Copyright Beman Dawes, 2011</p>
 <p> Use, modification, and distribution are subject to the Boost Software 
 License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">
Modified: trunk/libs/filesystem/test/msvc10/filesystem-v3.sln
==============================================================================
--- trunk/libs/filesystem/test/msvc10/filesystem-v3.sln	(original)
+++ trunk/libs/filesystem/test/msvc10/filesystem-v3.sln	2012-04-22 11:07:08 EDT (Sun, 22 Apr 2012)
@@ -102,13 +102,6 @@
                 {272DFC15-6292-49DF-B457-6784A183EAC3} = {272DFC15-6292-49DF-B457-6784A183EAC3}
         EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ticket_test", "ticket_test\ticket_test.vcxproj", "{AD2B00B7-D2CB-47B9-B6BA-15652188E072}"
-	ProjectSection(ProjectDependencies) = postProject
-		{0EA788CA-FA52-4290-A4D0-F616390B203B} = {0EA788CA-FA52-4290-A4D0-F616390B203B}
-		{F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
-		{FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
-	EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exec_monitor_dll", "exec_monitor_dll\exec_monitor_dll.vcxproj", "{0EA788CA-FA52-4290-A4D0-F616390B203B}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exec_monitor_lib", "exec_monitor_lib\exec_monitor_lib.vcxproj", "{272DFC15-6292-49DF-B457-6784A183EAC3}"
@@ -227,10 +220,6 @@
                 {3B3010C5-D6D7-4320-A992-4EA61F256279}.Debug|Win32.Build.0 = Debug|Win32
                 {3B3010C5-D6D7-4320-A992-4EA61F256279}.Release|Win32.ActiveCfg = Release|Win32
                 {3B3010C5-D6D7-4320-A992-4EA61F256279}.Release|Win32.Build.0 = Release|Win32
-		{AD2B00B7-D2CB-47B9-B6BA-15652188E072}.Debug|Win32.ActiveCfg = Debug|Win32
-		{AD2B00B7-D2CB-47B9-B6BA-15652188E072}.Debug|Win32.Build.0 = Debug|Win32
-		{AD2B00B7-D2CB-47B9-B6BA-15652188E072}.Release|Win32.ActiveCfg = Release|Win32
-		{AD2B00B7-D2CB-47B9-B6BA-15652188E072}.Release|Win32.Build.0 = Release|Win32
                 {0EA788CA-FA52-4290-A4D0-F616390B203B}.Debug|Win32.ActiveCfg = Debug|Win32
                 {0EA788CA-FA52-4290-A4D0-F616390B203B}.Debug|Win32.Build.0 = Debug|Win32
                 {0EA788CA-FA52-4290-A4D0-F616390B203B}.Release|Win32.ActiveCfg = Release|Win32
Modified: trunk/libs/filesystem/test/path_test.cpp
==============================================================================
--- trunk/libs/filesystem/test/path_test.cpp	(original)
+++ trunk/libs/filesystem/test/path_test.cpp	2012-04-22 11:07:08 EDT (Sun, 22 Apr 2012)
@@ -1567,6 +1567,20 @@
       append_test_aux("foo", "bar", "foo/bar");
     }
 
+    // ticket #6819
+    union
+    {
+      char a[1];
+      char b[3];
+    } u;
+
+    u.b[0] = 'a';
+    u.b[1] = 'b';
+    u.b[2] = '\0';
+
+    path p6819;
+    p6819 /= u.a;
+    BOOST_TEST_EQ(p6819, path("ab"));
   }
 
 //  self_assign_and_append_tests  ------------------------------------------------------//