Browse Source

Fix compile error: cannot declare variable in the middle of a function in pure C

bel 11 years ago
parent
commit
6cafec758d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/civetweb.c

+ 2 - 2
src/civetweb.c

@@ -4595,7 +4595,7 @@ static void read_websocket(struct mg_connection *conn)
        The original websocket upgrade request is never removed, so the queue
        begins after it. */
     unsigned char *buf = (unsigned char *) conn->buf + conn->request_len;
-    int n;
+    int n, error;
 
     /* body_len is the length of the entire queue in bytes
        len is the length of the current message
@@ -4664,7 +4664,7 @@ static void read_websocket(struct mg_connection *conn)
                 /* Overflow case */
                 len = body_len - header_len;
                 memcpy(data, buf + header_len, len);
-                int error = 0;
+                error = 0;
                 while (len < data_len) {
                     int n = pull(NULL, conn, data + len, (int)(data_len - len));
                     if (n < 0) {