[mew-dist 24049] Re: string-bytesの実行結果が違う?

Tatsuya Kinoshita tats at example.com
2003年 10月 2日 (木) 00:54:29 JST


On October 1, 2003, [mew-win32 03976],
Kazu Yamamoto <kazu at example.com> wrote:

> > すみません、会社の FireWall のせいで anonCVS への
> > 接続が出来ません。
> > 申し訳ないのですが、patch として配布いただけない
> > でしょうか。
> 
> 3.3 に当るか分りませんが、こんな感じです。

[mew-dist 24045]でのバウンダリ修正と合わせて、3.3にちゃんと当たる
パッチにしてみました。stableのブランチにも適用していただけませんか?

-- 
木下達也
-------------- next part --------------

* Removing string-bytes().
* Replace ":" with "_" in boundary strings.

(backport from Mew 4 on 2003-10-01)

--- mew-3.3.orig/mew-encode.el
+++ mew-3.3/mew-encode.el
@@ -733,7 +733,8 @@
   (unless string (setq string "Next_Part"))
   (format mew-default-boundary
 	  string
-	  (mew-replace-character (current-time-string) 32 ?_)
+	  (mew-replace-character
+	   (mew-replace-character (current-time-string) 32 ?_) ?: ?_)
 	  (mew-random-string 3 t)))
 
 (defun mew-encode-multipart (syntax path depth &optional buffered)
--- mew-3.3.orig/mew-func.el
+++ mew-3.3/mew-func.el
@@ -996,11 +996,14 @@
      , at example.com))
 
 (defsubst mew-region-bytes (beg end buf)
-  (if (fboundp 'string-bytes)
-      (save-excursion
-	(set-buffer buf)
-	(string-bytes (mew-buffer-substring beg end)))
-    (- end beg)))
+  (save-excursion
+    (set-buffer buf)
+    (save-restriction
+      (narrow-to-region beg end)
+      (mew-set-buffer-multibyte nil)
+      (prog1
+	  (- (point-max) (point-min))
+	(mew-set-buffer-multibyte t)))))
 
 (defun mew-count-lines (beg end &optional skip-regex)
   "Return number of lines between BEG and END."


Mew-dist メーリングリストの案内