]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix a typo in the previous delta to bfdio.c.
authorNick Clifton <nickc@redhat.com>
Tue, 1 Mar 2022 13:13:42 +0000 (13:13 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 1 Mar 2022 13:13:42 +0000 (13:13 +0000)
PR 25713
* bfdio.c (_bfd_real_fopen): Fix typo.

bfd/ChangeLog
bfd/bfdio.c

index 843bdc8d8a19e4d0162079240d06a05f0e42c0c5..4925fffaa15cd538db840a70f377a5b00c569af3 100644 (file)
@@ -1,3 +1,9 @@
+2022-03-01  Torbjörn Svensson  <torbjorn.svensson@st.com>
+           Fred Eisele  <fredrick.eisele@gmail.com>
+
+       PR 25713
+       * bfdio.c (_bfd_real_fopen): Fix typo.
+
 2022-03-01  Nick Clifton  <nickc@redhat.com>
 
        PR 28848
@@ -6,9 +12,10 @@
        TAG_FP_arch set then reset the TAG_ABI_HardFP_use.
 
 2022-02-28  Torbjörn Svensson  <torbjorn.svensson@st.com>
+           Fred Eisele  <fredrick.eisele@gmail.com>
 
        PR 25713
-       * bfdio.c (_bfd_real_fopen): Fix handling of parhs longer than 260
+       * bfdio.c (_bfd_real_fopen): Fix handling of paths longer than 260
        characters on Windows hosts.
 
 2022-02-28  Nick Clifton  <nickc@redhat.com>
index 82310ffabc1d172402ea0a9cd915272bebd1d9dd..5c9a655589440271469e5ebd4d3c578c71972f35 100644 (file)
@@ -116,45 +116,47 @@ _bfd_real_fopen (const char *filename, const char *modes)
     }
 
 #elif defined (_WIN32)
-  /* 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;
+  /* 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.
-      1) get the length: Calling with lpWideCharStr set to null returns the length.
-      2) convert the string: Calling with cbMultiByte set to -1 includes the terminating null.  */
-   size_t partPathWSize = MultiByteToWideChar (CP_UTF8, 0, partPathOrig, -1, NULL, 0);
-   wchar_t *partPath = calloc (partPathWSize, sizeof(wchar_t));
+      1) Get the length: Calling with lpWideCharStr set to null returns the length.
+      2) Convert the string: Calling with cbMultiByte set to -1 includes the terminating null.  */
+   size_t         partPathWSize = MultiByteToWideChar (CP_UTF8, 0, filename, -1, NULL, 0);
+   wchar_t *      partPath = calloc (partPathWSize, sizeof(wchar_t));
+   size_t         ix;
 
-   MultiByteToWideChar (CP_UTF8, 0, partPathOrig, -1, partPath, partPathWSize);
+   MultiByteToWideChar (CP_UTF8, 0, filename, -1, partPath, partPathWSize);
 
    /* Convert any UNIX style path separators into the DOS i.e. backslash separator.  */
-   size_t ix;
    for (ix = 0; ix < partPathLen; ix++)
      if (IS_UNIX_DIR_SEPARATOR(filename[ix]))
        partPath[ix] = '\\';
 
    /* Getting the full path from the provided partial path.
-      1) get the length:
-      2) resolve the path.  */
-   long fullPathWSize = GetFullPathNameW (partPath, 0, NULL, lpFilePart);
-   wchar_t *fullPath = calloc (fullPathWSize + sizeof(prefix) + 1, sizeof(wchar_t));
+      1) Get the length.
+      2) Resolve the path.  */
+   long       fullPathWSize = GetFullPathNameW (partPath, 0, NULL, lpFilePart);
+   wchar_t *  fullPath = calloc (fullPathWSize + sizeof(prefix) + 1, sizeof(wchar_t));
 
    wcscpy (fullPath, prefix);
-   int prefixLen = sizeof(prefix) / sizeof(wchar_t);
-   wchar_t* fullPathOffset = fullPath + prefixLen - 1;
+
+   int        prefixLen = sizeof(prefix) / sizeof(wchar_t);
+   wchar_t *  fullPathOffset = fullPath + prefixLen - 1;
+
    GetFullPathNameW (partPath, fullPathWSize, fullPathOffset, lpFilePart);
    free (partPath);
 
    /* It is non-standard for modes to exceed 16 characters.  */
-   wchar_t modesW[16 + sizeof(ccs)];
+   wchar_t    modesW[16 + sizeof(ccs)];
+
    MultiByteToWideChar (CP_UTF8, 0, modes, -1, modesW, sizeof(modesW));
    wcscat (modesW, ccs);
 
-   FILE* file = _wfopen (fullPath, mdesW);
+   FILE *     file = _wfopen (fullPath, modesW);
    free (fullPath);
 
    return close_on_exec (file);