]> git.eshelyaron.com Git - emacs.git/commitdiff
(Bindat Functions): Say "unibyte string"
authorThien-Thi Nguyen <ttn@gnuvola.org>
Thu, 25 May 2006 09:01:43 +0000 (09:01 +0000)
committerThien-Thi Nguyen <ttn@gnuvola.org>
Thu, 25 May 2006 09:01:43 +0000 (09:01 +0000)
explicitly for `bindat-unpack' and `bindat-pack' descriptions.
(Bindat Examples): Don't call `string-make-unibyte' in example.

lispref/processes.texi

index 9eb733236a940141103d2f3da3b3b44d6cf62e85..501c4a65c57998939071edeb39ce0fd05a003251 100644 (file)
@@ -2245,7 +2245,8 @@ specification, @code{raw-data} to a byte array, and @var{struct} to an
 alist representing unpacked field data.
 
 @defun bindat-unpack spec raw-data &optional pos
-This function unpacks data from the byte array @code{raw-data}
+This function unpacks data from the unibyte string or byte
+array @code{raw-data}
 according to @var{spec}.  Normally this starts unpacking at the
 beginning of the byte array, but if @var{pos} is non-@code{nil}, it
 specifies a zero-based starting position to use instead.
@@ -2277,13 +2278,9 @@ to @var{spec}.
 This function returns a byte array packed according to @var{spec} from
 the data in the alist @var{struct}.  Normally it creates and fills a
 new byte array starting at the beginning.  However, if @var{raw-data}
-is non-@code{nil}, it specifies a pre-allocated string or vector to
+is non-@code{nil}, it specifies a pre-allocated unibyte string or vector to
 pack into.  If @var{pos} is non-@code{nil}, it specifies the starting
 offset for packing into @code{raw-data}.
-
-@c ??? Isn't this a bug?  Shouldn't it always be unibyte?
-Note: The result is a multibyte string; use @code{string-make-unibyte}
-on it to make it unibyte if necessary.
 @end defun
 
 @defun bindat-ip-to-string ip
@@ -2367,18 +2364,17 @@ COOKIES, indicates the border between entries."
     (with-temp-buffer
       (set-buffer-multibyte nil)
       (insert
-       (string-make-unibyte
-        (bindat-pack
-         fcookie-index-spec
-         `((:version . 2)
-           (:count . ,count)
-           (:longest . ,max)
-           (:shortest . ,min)
-           (:flags . 0)
-           (:delim . ,delim)
-           (:offset . ,(mapcar (lambda (o)
-                                 (list (cons :foo o)))
-                               (nreverse offsets)))))))
+       (bindat-pack
+        fcookie-index-spec
+        `((:version . 2)
+          (:count . ,count)
+          (:longest . ,max)
+          (:shortest . ,min)
+          (:flags . 0)
+          (:delim . ,delim)
+          (:offset . ,(mapcar (lambda (o)
+                                (list (cons :foo o)))
+                              (nreverse offsets))))))
       (let ((coding-system-for-write 'raw-text-unix))
         (write-file (or index (concat cookies ".dat")))))))
 @end lisp