mirror of
https://github.com/boostorg/filesystem.git
synced 2025-05-12 13:41:47 +00:00
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.
[SVN r78136]
This commit is contained in:
parent
554f819036
commit
6115c31640
@ -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">
|
||||
|
@ -704,10 +704,10 @@ namespace filesystem
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -85,8 +85,8 @@ namespace path_traits {
|
||||
}
|
||||
|
||||
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 ---------------------------------------------------------------//
|
||||
//
|
||||
|
@ -102,13 +102,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "path_test_static", "path_te
|
||||
{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 @@ Global
|
||||
{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
|
||||
|
@ -1567,6 +1567,20 @@ namespace
|
||||
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 ------------------------------------------------------//
|
||||
|
Loading…
x
Reference in New Issue
Block a user