Browse Source

Fix vor VisualStudio 2010/2012 compiler

bel2125 5 years ago
parent
commit
34a4373e51
1 changed files with 7 additions and 4 deletions
  1. 7 4
      src/civetweb.c

+ 7 - 4
src/civetweb.c

@@ -14568,6 +14568,9 @@ set_ports_option(struct mg_context *phys_ctx)
 	int portsTotal = 0;
 	int portsOk = 0;
 
+	const char* opt_txt;
+	long opt_max_connections;
+
 	if (!phys_ctx) {
 		return 0;
 	}
@@ -14734,12 +14737,12 @@ set_ports_option(struct mg_context *phys_ctx)
 			continue;
 		}
 
-		const char* p = phys_ctx->dd.config[MAX_CONNECTIONS];
-		const long opt_max_connections = strtol(p, NULL, 10);
-		if(opt_max_connections > INT_MAX || opt_max_connections < 1) {
+		opt_txt = phys_ctx->dd.config[MAX_CONNECTIONS];
+		opt_max_connections = strtol(opt_txt, NULL, 10);
+		if ((opt_max_connections > INT_MAX) || (opt_max_connections < 1)) {
 			mg_cry_ctx_internal(phys_ctx, 
 					    "max_connections value \"%s\" is invalid", 
-					    p);
+				opt_txt);
 			continue;
 		}