emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/tzz/nettle 3d07352: WIP: GnuTLS: add TODO for extr


From: Teodor Zlatanov
Subject: [Emacs-diffs] scratch/tzz/nettle 3d07352: WIP: GnuTLS: add TODO for extract_data_from_object file support
Date: Thu, 20 Apr 2017 12:01:32 -0400 (EDT)

branch: scratch/tzz/nettle
commit 3d07352529176c0e05af1afa168cc0cc2fa457f4
Author: Ted Zlatanov <address@hidden>
Commit: Ted Zlatanov <address@hidden>

    WIP: GnuTLS: add TODO for extract_data_from_object file support
---
 src/fns.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/fns.c b/src/fns.c
index 36279fb..147a3cd 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4793,7 +4793,7 @@ extract_data_from_object (Lisp_Object spec,
                    ? SBYTES (object)
                    : string_char_to_byte (object, end_char));
     }
-  else
+  else if (BUFFERP (object))
     {
       struct buffer *prev = current_buffer;
 
@@ -4897,6 +4897,22 @@ extract_data_from_object (Lisp_Object spec,
       *start_byte = 0;
       *end_byte = SBYTES (object);
     }
+  else /* If not a string or a buffer, object must be a list in the form
+          (file "filename").  */
+    {
+      CHECK_CONS (object);
+
+      if (!EQ ((XCAR (object)), Qfile))
+        error ("Expected (file \"filename\") but got something else in the 
first position");
+
+      Lisp_Object filename = XCAR (XCDR (object));
+
+      if (! STRINGP (filename))
+        error ("Expected (file \"filename\") but got a non-string for the 
filename");
+
+      // Should we use Finsert_file_contents()?!??!
+      error ("Direct file reads are not supported yet.");
+    }
 
   return SSDATA (object);
 }
@@ -5060,6 +5076,9 @@ disregarding any coding systems.  If nil, use the current 
buffer.  */ )
 void
 syms_of_fns (void)
 {
+  /* For extract_data_from_object().  */
+  DEFSYM (Qfile, "file");
+
   DEFSYM (Qmd5,    "md5");
   DEFSYM (Qsha1,   "sha1");
   DEFSYM (Qsha224, "sha224");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]