Changeset: c9b1997fce8e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c9b1997fce8e
Modified Files:
        common/stream/winio.c
Branch: makelibstreamgreatagain
Log Message:

There has to be a default case: reading from a file.


diffs (49 lines):

diff --git a/common/stream/winio.c b/common/stream/winio.c
--- a/common/stream/winio.c
+++ b/common/stream/winio.c
@@ -356,15 +356,15 @@ win_console_in_stream(const char *name)
 {
        HANDLE h = GetStdHandle(STD_INPUT_HANDLE);
        struct console *c = NULL;
-       stream *s = create_stream(name);
-       if (s == NULL) {
-               mnstr_set_error_errno(NULL, MNSTR_OPEN_ERROR, NULL);
-               return NULL;
-       }
-       s->readonly = true;
+       stream *s;
 
        switch (GetFileType(h)) {
        case FILE_TYPE_PIPE:
+               s = create_stream(name);
+               if (s == NULL) {
+                       mnstr_set_error_errno(NULL, MNSTR_OPEN_ERROR, NULL);
+                       return NULL;
+               }
                s->stream_data.p = h;
                s->read = pipe_read;
                s->write = NULL;
@@ -376,6 +376,11 @@ win_console_in_stream(const char *name)
                s->fsetpos = NULL;
                break;
        case FILE_TYPE_CHAR:
+               s = create_stream(name);
+               if (s == NULL) {
+                       mnstr_set_error_errno(NULL, MNSTR_OPEN_ERROR, NULL);
+                       return NULL;
+               }
                c = malloc(sizeof(struct console));
                if (c == NULL) {
                        destroy_stream(s);
@@ -396,7 +401,11 @@ win_console_in_stream(const char *name)
                s->fsetpos = NULL;
                s->isutf8 = true;
                break;
+       default:
+               s = file_rstream(stdin, false, name);
+               break;
        }
+       s->readonly = true;
        return s;
 }
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to