Anpassungen fuer LDMUD 3.6

read_bytes() verarbeitet bytes statt string.

Change-Id: I6a2d80bd51b0805de758eb3188934f0cea6be82f
diff --git a/secure/simul_efun/comm.c b/secure/simul_efun/comm.c
index 6c995a9..ea47fd3 100644
--- a/secure/simul_efun/comm.c
+++ b/secure/simul_efun/comm.c
@@ -105,16 +105,20 @@
     if (!stringp(file) || !this_player())
         return 0;
 
-    string txt = read_bytes(file, -(TAIL_MAX_BYTES + 80), (TAIL_MAX_BYTES + 80));
+    bytes bs = read_bytes(file, -(TAIL_MAX_BYTES + 80),
+                          (TAIL_MAX_BYTES + 80));
     // read_bytes() returns 0 if the start of the section given by
-    // parameter #2 lies beyond the beginning of the file.
+    // parameter #2 lies before the beginning of the file.
     // In this case we simply try and read the entire file.
-    if (!stringp(txt) && file_size(file) < TAIL_MAX_BYTES+80)
-      txt = read_file(file);
+    if (!bytesp(bs) && file_size(file) < TAIL_MAX_BYTES+80)
+      bs = read_bytes(file, 0, (TAIL_MAX_BYTES + 80));
     // Exit if still nothing could be read.
-    if (!stringp(txt))
+    if (!bytesp(bs))
       return 0;
 
+    // convert to string
+    string txt = to_text(bs, "UTF-8");
+
     // cut off first (incomplete) line
     int index = strstr(txt, "\n");
     if (index > -1) {
diff --git a/secure/simul_efun/files.c b/secure/simul_efun/files.c
index 107df99..50ae24b 100644
--- a/secure/simul_efun/files.c
+++ b/secure/simul_efun/files.c
@@ -90,7 +90,7 @@
 {
 
     int ptr;
-    string bytes;
+    bytes byte_seq;
 
     set_this_object(previous_object());
     if (!sizeof(source)||!sizeof(dest)||source==dest||(file_size(source)==-1)||
@@ -116,11 +116,11 @@
     }
     do
     {
-      bytes = read_bytes(source, ptr, MAXLEN); ptr += MAXLEN;
-      if (!bytes) bytes="";
-      write_file(dest, bytes);
+      byte_seq = read_bytes(source, ptr, MAXLEN); ptr += MAXLEN;
+      if (!byte_seq) byte_seq="";
+      write_file(dest, byte_seq);
     }
-    while(sizeof(bytes) == MAXLEN);
+    while(sizeof(byte_seq) == MAXLEN);
     return 0;
 }
 #endif //!__EFUN_DEFINED__(copy_file)
diff --git a/secure/simul_efun/spare/comm.c b/secure/simul_efun/spare/comm.c
index 6c995a9..ea47fd3 100644
--- a/secure/simul_efun/spare/comm.c
+++ b/secure/simul_efun/spare/comm.c
@@ -105,16 +105,20 @@
     if (!stringp(file) || !this_player())
         return 0;
 
-    string txt = read_bytes(file, -(TAIL_MAX_BYTES + 80), (TAIL_MAX_BYTES + 80));
+    bytes bs = read_bytes(file, -(TAIL_MAX_BYTES + 80),
+                          (TAIL_MAX_BYTES + 80));
     // read_bytes() returns 0 if the start of the section given by
-    // parameter #2 lies beyond the beginning of the file.
+    // parameter #2 lies before the beginning of the file.
     // In this case we simply try and read the entire file.
-    if (!stringp(txt) && file_size(file) < TAIL_MAX_BYTES+80)
-      txt = read_file(file);
+    if (!bytesp(bs) && file_size(file) < TAIL_MAX_BYTES+80)
+      bs = read_bytes(file, 0, (TAIL_MAX_BYTES + 80));
     // Exit if still nothing could be read.
-    if (!stringp(txt))
+    if (!bytesp(bs))
       return 0;
 
+    // convert to string
+    string txt = to_text(bs, "UTF-8");
+
     // cut off first (incomplete) line
     int index = strstr(txt, "\n");
     if (index > -1) {
diff --git a/secure/simul_efun/spare/files.c b/secure/simul_efun/spare/files.c
index 107df99..50ae24b 100644
--- a/secure/simul_efun/spare/files.c
+++ b/secure/simul_efun/spare/files.c
@@ -90,7 +90,7 @@
 {
 
     int ptr;
-    string bytes;
+    bytes byte_seq;
 
     set_this_object(previous_object());
     if (!sizeof(source)||!sizeof(dest)||source==dest||(file_size(source)==-1)||
@@ -116,11 +116,11 @@
     }
     do
     {
-      bytes = read_bytes(source, ptr, MAXLEN); ptr += MAXLEN;
-      if (!bytes) bytes="";
-      write_file(dest, bytes);
+      byte_seq = read_bytes(source, ptr, MAXLEN); ptr += MAXLEN;
+      if (!byte_seq) byte_seq="";
+      write_file(dest, byte_seq);
     }
-    while(sizeof(bytes) == MAXLEN);
+    while(sizeof(byte_seq) == MAXLEN);
     return 0;
 }
 #endif //!__EFUN_DEFINED__(copy_file)