From 09a9a8ff22b193b8e9fa2d6efb5f3ded6449ca28 Mon Sep 17 00:00:00 2001 From: deflected Date: Thu, 22 Mar 2018 12:35:09 +0200 Subject: [PATCH] multifile: Return vector_uchar from readSubfile - Return vector_uchar from readSubfile instead of string. This will correct problems with Python 3 unicode strings and will return bytes instead. Signed-off-by: deflected Closes #290 --- panda/src/express/multifile.I | 6 +++--- panda/src/express/multifile.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/panda/src/express/multifile.I b/panda/src/express/multifile.I index 5e20779f0d..a498534726 100644 --- a/panda/src/express/multifile.I +++ b/panda/src/express/multifile.I @@ -278,12 +278,12 @@ remove_subfile(const string &subfile_name) { } /** - * Returns a string that contains the entire contents of the indicated + * Returns a vector_uchar that contains the entire contents of the indicated * subfile. */ -INLINE string Multifile:: +INLINE vector_uchar Multifile:: read_subfile(int index) { - string result; + vector_uchar result; read_subfile(index, result); return result; } diff --git a/panda/src/express/multifile.h b/panda/src/express/multifile.h index f290c98602..d9f7217dfd 100644 --- a/panda/src/express/multifile.h +++ b/panda/src/express/multifile.h @@ -24,6 +24,7 @@ #include "indirectLess.h" #include "referenceCount.h" #include "pvector.h" +#include "vector_uchar.h" #ifdef HAVE_OPENSSL typedef struct x509_st X509; @@ -125,7 +126,7 @@ PUBLISHED: streampos get_subfile_internal_start(int index) const; size_t get_subfile_internal_length(int index) const; - BLOCKING INLINE string read_subfile(int index); + BLOCKING INLINE vector_uchar read_subfile(int index); BLOCKING istream *open_read_subfile(int index); BLOCKING static void close_read_subfile(istream *stream); BLOCKING bool extract_subfile(int index, const Filename &filename);