[vlc-commits] httpd: reduce variable scope

Rémi Denis-Courmont git at videolan.org
Mon Jun 8 16:44:09 CEST 2020


vlc/vlc-3.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  6 20:09:57 2020 +0300| [c30865ca5ab08c7c310a3bbab96158b64f990a18] | committer: Rémi Denis-Courmont

httpd: reduce variable scope

(cherry picked from commit 8af01b05092ff66ee82ec398fcde2b781b3d2c15)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c30865ca5ab08c7c310a3bbab96158b64f990a18
---

 src/network/httpd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/network/httpd.c b/src/network/httpd.c
index 92254adb56..ced2de8ef2 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -1708,7 +1708,6 @@ static void httpdLoop(httpd_host_t *host)
 
     int canc = vlc_savecancel();
     for (int i_client = 0; i_client < host->i_client; i_client++) {
-        int64_t i_offset;
         httpd_client_t *cl = host->client[i_client];
         if (cl->i_ref < 0 || (cl->i_ref == 0 &&
                     (cl->i_state == HTTPD_CLIENT_DEAD ||
@@ -1913,7 +1912,7 @@ static void httpdLoop(httpd_host_t *host)
                         cl->i_state = HTTPD_CLIENT_DEAD;
                     httpd_MsgClean(&cl->answer);
                 } else {
-                    i_offset = cl->answer.i_body_offset;
+                    int64_t i_offset = cl->answer.i_body_offset;
                     httpd_MsgClean(&cl->answer);
 
                     cl->answer.i_body_offset = i_offset;
@@ -1926,8 +1925,8 @@ static void httpdLoop(httpd_host_t *host)
                 }
                 break;
 
-            case HTTPD_CLIENT_WAITING:
-                i_offset = cl->answer.i_body_offset;
+            case HTTPD_CLIENT_WAITING: {
+                int64_t i_offset = cl->answer.i_body_offset;
                 int i_msg = cl->query.i_type;
 
                 httpd_MsgInit(&cl->answer);
@@ -1944,6 +1943,7 @@ static void httpdLoop(httpd_host_t *host)
                     cl->answer.i_body = 0;
                     cl->i_state = HTTPD_CLIENT_SENDING;
                 }
+            }
         }
 
         if (pufd->events != 0)



More information about the vlc-commits mailing list