]> diplodocus.org Git - nmh/commitdiff
Re-do length calculation for parameter output, and adapt test for new code.
authorKen Hornstein <kenh@pobox.com>
Thu, 27 Feb 2014 03:58:26 +0000 (22:58 -0500)
committerKen Hornstein <kenh@pobox.com>
Thu, 27 Feb 2014 03:58:26 +0000 (22:58 -0500)
test/mhbuild/test-ext-params
uip/mhparse.c

index e81ef47afac05f6b996acef65ab6182b343f73ac..5e4a681b37aa8fb70761c8941d5b0ed21f93be27 100755 (executable)
@@ -89,8 +89,8 @@ This is a test message
 ------- =_aaaaaaaaaa0
 Content-Type: image/jpeg
 Content-Disposition: attachment;
 ------- =_aaaaaaaaaa0
 Content-Type: image/jpeg
 Content-Disposition: attachment;
-       filename*0="This is an example of a rather long filename that is lon";
-       filename*1="ger than would fit on a normal line.jpg"
+       filename*0="This is an example of a rather long filename that is lo";
+       filename*1="nger than would fit on a normal line.jpg"
 Content-Transfer-Encoding: base64
 
 /9g=
 Content-Transfer-Encoding: base64
 
 /9g=
@@ -131,8 +131,9 @@ This is a test message
 ------- =_aaaaaaaaaa0
 Content-Type: image/jpeg
 Content-Disposition: attachment;
 ------- =_aaaaaaaaaa0
 Content-Type: image/jpeg
 Content-Disposition: attachment;
-       filename*0="This is an example of a rather long filename that is lon";
-       filename*1="ger than would fit on a normal line.jpg"
+       filename*0*=UTF-8''This%20is%20an%20%C3%ABxample%20of%20a%20rather;
+       filename*1=" long filename that is longer than would fit on a norma";
+       filename*2="l line.jpg"
 Content-Transfer-Encoding: base64
 
 /9g=
 Content-Transfer-Encoding: base64
 
 /9g=
index 50510856d3577a161f060caf3b85f637c4908a71..5bbaf449e150aa152db7c7e53f20410be1d27d22 100644 (file)
@@ -3618,17 +3618,17 @@ param_len(PM pm, int index, size_t valueoff, int *encode, int *cont,
      *   section.
      * - There are 8-bit characters within N bytes of our section start.
      *   N is calculated based on the number of bytes it would take to
      *   section.
      * - There are 8-bit characters within N bytes of our section start.
      *   N is calculated based on the number of bytes it would take to
-     *   reach CPERLIN - 1.  Specifically:
+     *   reach CPERLIN.  Specifically:
      *         8 (starting tab) +
      *         strlen(param name) +
      *         4 ('* for section marker, '=', opening/closing '"')
      *         strlen (index)
      * is the number of bytes used by everything that isn't part of the
      *         8 (starting tab) +
      *         strlen(param name) +
      *         4 ('* for section marker, '=', opening/closing '"')
      *         strlen (index)
      * is the number of bytes used by everything that isn't part of the
-     *  value.  So that gets subtracted from CPERLIN - 1.
+     *  value.  So that gets subtracted from CPERLIN.
      */
 
     snprintf(indexchar, sizeof(indexchar), "%d", index);
      */
 
     snprintf(indexchar, sizeof(indexchar), "%d", index);
-    maxfit = CPERLIN - (13 + len + strlen(indexchar));
+    maxfit = CPERLIN - (12 + len + strlen(indexchar));
     if ((eightbit && index == 0) || contains8bit(start, start + maxfit)) {
        *encode = 1;
     }
     if ((eightbit && index == 0) || contains8bit(start, start + maxfit)) {
        *encode = 1;
     }
@@ -3655,11 +3655,15 @@ param_len(PM pm, int index, size_t valueoff, int *encode, int *cont,
            pm->pm_lang = getcpy(NULL); /* Default to a blank lang tag */
 
        len++;          /* For the encoding marker */
            pm->pm_lang = getcpy(NULL); /* Default to a blank lang tag */
 
        len++;          /* For the encoding marker */
+       maxfit--;
        if (index == 0) {
        if (index == 0) {
-           len += strlen(pm->pm_charset) + strlen(pm->pm_lang) + 2;
+           int enclen = strlen(pm->pm_charset) + strlen(pm->pm_lang) + 2;
+           len += enclen;
+           maxfit-= enclen;
        } else {
            /*
        } else {
            /*
-            * We know we definitely need to include an index.
+            * We know we definitely need to include an index.  maxfit already
+            * includes the section marker.
             */
            len += strlen(indexchar);
        }
             */
            len += strlen(indexchar);
        }