public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] _bfd_real_fopen should not use ccs parameter on Windows
@ 2022-05-03 12:39 Yvan Roux
  2022-05-17 14:33 ` Yvan Roux
  0 siblings, 1 reply; 4+ messages in thread
From: Yvan Roux @ 2022-05-03 12:39 UTC (permalink / raw)
  To: binutils

Hi,

As it was discussed in https://sourceware.org/bugzilla/show_bug.cgi?id=25713
according to MSDN, the ccs=UNICODE should only be used when the encoding of the
file stream is supposed to be UTF-8 or UTF-16LE, and is not related to the
encoding of the file name.

Regression tested without any issue.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
Signed-off-by: Yvan ROUX <yvan.roux@foss.st.com>
---
 bfd/bfdio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index 5c9a6555894..dc8d3916509 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -119,7 +119,6 @@ _bfd_real_fopen (const char *filename, const char *modes)
   /* PR 25713: Handle extra long path names possibly containing '..' and '.'.  */
    wchar_t **     lpFilePart = {NULL};
    const wchar_t  prefix[] = L"\\\\?\\";
-   const wchar_t  ccs[] = L", ccs=UNICODE";
    const size_t   partPathLen = strlen (filename) + 1;
 
    /* Converting the partial path from ascii to unicode.
@@ -151,10 +150,9 @@ _bfd_real_fopen (const char *filename, const char *modes)
    free (partPath);
 
    /* It is non-standard for modes to exceed 16 characters.  */
-   wchar_t    modesW[16 + sizeof(ccs)];
+   wchar_t    modesW[16];
 
    MultiByteToWideChar (CP_UTF8, 0, modes, -1, modesW, sizeof(modesW));
-   wcscat (modesW, ccs);
 
    FILE *     file = _wfopen (fullPath, modesW);
    free (fullPath);
-- 
2.17.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] _bfd_real_fopen should not use ccs parameter on Windows
  2022-05-03 12:39 [PATCH] _bfd_real_fopen should not use ccs parameter on Windows Yvan Roux
@ 2022-05-17 14:33 ` Yvan Roux
  2022-05-19  9:59   ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Yvan Roux @ 2022-05-17 14:33 UTC (permalink / raw)
  To: binutils

Ping

On Tue, May 03, 2022 at 02:39:59PM +0200, Yvan Roux via Binutils wrote:
> Hi,
> 
> As it was discussed in https://sourceware.org/bugzilla/show_bug.cgi?id=25713
> according to MSDN, the ccs=UNICODE should only be used when the encoding of the
> file stream is supposed to be UTF-8 or UTF-16LE, and is not related to the
> encoding of the file name.
> 
> Regression tested without any issue.
> 
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
> Signed-off-by: Yvan ROUX <yvan.roux@foss.st.com>
> ---
>  bfd/bfdio.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/bfd/bfdio.c b/bfd/bfdio.c
> index 5c9a6555894..dc8d3916509 100644
> --- a/bfd/bfdio.c
> +++ b/bfd/bfdio.c
> @@ -119,7 +119,6 @@ _bfd_real_fopen (const char *filename, const char *modes)
>    /* PR 25713: Handle extra long path names possibly containing '..' and '.'.  */
>     wchar_t **     lpFilePart = {NULL};
>     const wchar_t  prefix[] = L"\\\\?\\";
> -   const wchar_t  ccs[] = L", ccs=UNICODE";
>     const size_t   partPathLen = strlen (filename) + 1;
>  
>     /* Converting the partial path from ascii to unicode.
> @@ -151,10 +150,9 @@ _bfd_real_fopen (const char *filename, const char *modes)
>     free (partPath);
>  
>     /* It is non-standard for modes to exceed 16 characters.  */
> -   wchar_t    modesW[16 + sizeof(ccs)];
> +   wchar_t    modesW[16];
>  
>     MultiByteToWideChar (CP_UTF8, 0, modes, -1, modesW, sizeof(modesW));
> -   wcscat (modesW, ccs);
>  
>     FILE *     file = _wfopen (fullPath, modesW);
>     free (fullPath);
> -- 
> 2.17.1
> 
> 
> 

-- 
Y.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] _bfd_real_fopen should not use ccs parameter on Windows
  2022-05-17 14:33 ` Yvan Roux
@ 2022-05-19  9:59   ` Nick Clifton
  2022-05-20  6:54     ` Yvan Roux
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2022-05-19  9:59 UTC (permalink / raw)
  To: Yvan Roux, binutils

Hi Yvan,

> Ping

Sorry - busy elsewhere...

>> As it was discussed in https://sourceware.org/bugzilla/show_bug.cgi?id=25713
>> according to MSDN, the ccs=UNICODE should only be used when the encoding of the
>> file stream is supposed to be UTF-8 or UTF-16LE, and is not related to the
>> encoding of the file name.

A fair point - I have gone ahead and applied your patch.

Cheers
   Nick



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] _bfd_real_fopen should not use ccs parameter on Windows
  2022-05-19  9:59   ` Nick Clifton
@ 2022-05-20  6:54     ` Yvan Roux
  0 siblings, 0 replies; 4+ messages in thread
From: Yvan Roux @ 2022-05-20  6:54 UTC (permalink / raw)
  To: Nick Clifton, binutils

On Thu, May 19, 2022 at 10:59:33AM +0100, Nick Clifton wrote:
> Hi Yvan,
> 
> > Ping
> 
> Sorry - busy elsewhere...

No worries, thanks a lot Nick
 
> > > As it was discussed in https://sourceware.org/bugzilla/show_bug.cgi?id=25713
> > > according to MSDN, the ccs=UNICODE should only be used when the encoding of the
> > > file stream is supposed to be UTF-8 or UTF-16LE, and is not related to the
> > > encoding of the file name.
> 
> A fair point - I have gone ahead and applied your patch.
> 
> Cheers
>   Nick
> 
> 

-- 
Y.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-20  6:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 12:39 [PATCH] _bfd_real_fopen should not use ccs parameter on Windows Yvan Roux
2022-05-17 14:33 ` Yvan Roux
2022-05-19  9:59   ` Nick Clifton
2022-05-20  6:54     ` Yvan Roux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).