On Wed, Oct 16, 2024 at 3:16 PM Nathan Hartman <hartman.nat...@gmail.com> wrote:
>
> On Wed, Oct 16, 2024 at 10:45 AM <rin...@apache.org> wrote:
>>
>> Author: rinrab
>> Date: Wed Oct 16 14:45:20 2024
>> New Revision: 1921361
>>
>> URL: http://svn.apache.org/viewvc?rev=1921361&view=rev
>> Log:
>> Fix compilation with CLang on Windows.
>>
>> Before, we were invoking the svn_utf__win32_utf8_to_utf16() function with
>> non-constant pointer, passed into the 'result' argument. However, in the
>> svn_io__utf8_to_unicode_longpath function implementation, there is a
>> conversion to a constant pointer causing the following error when compiling
>> with CLang:
>>
>> [[[
>> subversion\libsvn_subr\io.c(1902,42): error : cannot take the address of
>> an rvalue of type 'const WCHAR *' (aka 'const unsigned short *')
>> ]]]
>>
>> In this commit, this conversion will be removed in order to prevent the 
>> error,
>> how it is done in the other places, where the function is utilized.
>>
>> There still will be a warning of implicit conversion, which has to be
>> fixed generally in this function.
>>
>> * subversion/libsvn_subr/io.c
>>   (svn_io__utf8_to_unicode_longpath): Do not convert 'buffer' to 'const 
>> WCHAR *'
>>    before taking address of it.
>>
>> Modified:
>>     subversion/trunk/subversion/libsvn_subr/io.c
>>
>> Modified: subversion/trunk/subversion/libsvn_subr/io.c
>> URL: 
>> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1921361&r1=1921360&r2=1921361&view=diff
>> ==============================================================================
>> --- subversion/trunk/subversion/libsvn_subr/io.c (original)
>> +++ subversion/trunk/subversion/libsvn_subr/io.c Wed Oct 16 14:45:20 2024
>> @@ -1899,7 +1899,7 @@ svn_io__utf8_to_unicode_longpath(const W
>>          }
>>      }
>>
>> -    SVN_ERR(svn_utf__win32_utf8_to_utf16(&(const WCHAR*)buffer, source,
>> +    SVN_ERR(svn_utf__win32_utf8_to_utf16(&buffer, source,
>>                                           prefix, result_pool));
>>
>>      /* Convert slashes to backslashes because the \\?\ path format
>>
>>
>
> I didn't look at the code; replying to the commit message from mobile, but...
>
> Because Clang complained about taking the address of a RVALUE, I think it was 
> a typo in the code, rather than inability to use const.
>
> I think this was intended:
>
> (const WCHAR*)&buffer
>
> but this was written:
>
> &(const WCHAR*)buffer
>
> and I wonder how MSVC didn't notice that.


Please disregard the last message. The change in r1921361 is correct.

Cheers,
Nathan

Reply via email to