]> git.lizzy.rs Git - linenoise.git/commitdiff
Fixed Visual Studio warning C4204 (nonstandard extension used : non-constant aggregat...
authorBenoit Blanchon <benoit@quasardb.net>
Tue, 12 May 2015 08:22:26 +0000 (10:22 +0200)
committerBenoit Blanchon <benoit@quasardb.net>
Tue, 12 May 2015 08:22:26 +0000 (10:22 +0200)
linenoise.c

index 17303b1eff2fbef8e1a98f4d98a7db74acb88b41..fb2b6808f4c8bd275fcc94959331161d41362fe0 100644 (file)
@@ -642,9 +642,12 @@ static void clearScreen(struct current *current)
 
 static void cursorToLeft(struct current *current)
 {
-    COORD pos = { 0, (SHORT)current->y };
+    COORD pos;
     DWORD n;
 
+    pos.X = 0;
+    pos.Y = (SHORT)current->y;
+
     FillConsoleOutputAttribute(current->outh,
         FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN, current->cols, pos, &n);
     current->x = 0;
@@ -652,9 +655,12 @@ static void cursorToLeft(struct current *current)
 
 static int outputChars(struct current *current, const char *buf, int len)
 {
-    COORD pos = { (SHORT)current->x, (SHORT)current->y };
+    COORD pos;
     DWORD n;
 
+    pos.X = (SHORT)current->x;
+    pos.Y = (SHORT)current->y;
+
     WriteConsoleOutputCharacter(current->outh, buf, len, pos, &n);
     current->x += len;
     return 0;
@@ -662,9 +668,12 @@ static int outputChars(struct current *current, const char *buf, int len)
 
 static void outputControlChar(struct current *current, char ch)
 {
-    COORD pos = { (SHORT)current->x, (SHORT)current->y };
+    COORD pos;
     DWORD n;
 
+    pos.X = (SHORT) current->x;
+    pos.Y = (SHORT) current->y;
+
     FillConsoleOutputAttribute(current->outh, BACKGROUND_INTENSITY, 2, pos, &n);
     outputChars(current, "^", 1);
     outputChars(current, &ch, 1);
@@ -672,15 +681,21 @@ static void outputControlChar(struct current *current, char ch)
 
 static void eraseEol(struct current *current)
 {
-    COORD pos = { (SHORT)current->x, (SHORT)current->y };
+    COORD pos;
     DWORD n;
 
+    pos.X = (SHORT) current->x;
+    pos.Y = (SHORT) current->y;
+
     FillConsoleOutputCharacter(current->outh, ' ', current->cols - current->x, pos, &n);
 }
 
 static void setCursorPos(struct current *current, int x)
 {
-    COORD pos = { (SHORT)x, (SHORT)current->y };
+    COORD pos;
+
+    pos.X = (SHORT)x;
+    pos.Y = (SHORT) current->y;
 
     SetConsoleCursorPosition(current->outh, pos);
     current->x = x;