]> sjero.net Git - wget/commitdiff
MinGW compatibility fixes
authorRay Satiro <raysatiro@yahoo.com>
Tue, 21 May 2013 22:06:25 +0000 (18:06 -0400)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Sun, 16 Jun 2013 20:55:38 +0000 (22:55 +0200)
src/ChangeLog
src/url.c

index f6096989ef13b92a5eb31b0ff25945951b0af821..4021d9cc86de8cdcee776371044cd212d34e1470 100644 (file)
@@ -1,3 +1,7 @@
+2013-05-21  Ray Satiro  <raysatiro@yahoo.com>
+
+       * url.c (url_file_name): Use MAX_PATH in Windows.
+
 2013-06-13  Darshit Shah  <darnir@gmail.com>
 
        * http.c (gethttp): Follow RFC 2616 and httpbis specifications when
index 87d6290ac1b032220345607de378f3e9ae2d6da9..5e2b9a3bde9f1a0d79a74bfc093317ceb3e21783 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -1617,7 +1617,26 @@ url_file_name (const struct url *u, char *replaced_filename)
   append_char ('\0', &temp_fnres);
 
   /* Check that the length of the file name is acceptable. */
+#ifdef WINDOWS
+  if (MAX_PATH > (fnres.tail + CHOMP_BUFFER + 2))
+    {
+      max_length = MAX_PATH - (fnres.tail + CHOMP_BUFFER + 2);
+      /* FIXME: In Windows a filename is usually limited to 255 characters.
+      To really be accurate you could call GetVolumeInformation() to get
+      lpMaximumComponentLength
+      */
+      if (max_length > 255)
+        {
+          max_length = 255;
+        }
+    }
+  else
+    {
+      max_length = 0;
+    }
+#else
   max_length = get_max_length (fnres.base, fnres.tail, _PC_NAME_MAX) - CHOMP_BUFFER;
+#endif
   if (max_length > 0 && strlen (temp_fnres.base) > max_length)
     {
       logprintf (LOG_NOTQUIET, "The name is too long, %lu chars total.\n",