瀏覽代碼

Fix vor VisualStudio 2010/2012 compiler

bel2125 5 年之前
父節點
當前提交
34a4373e51
共有 1 個文件被更改,包括 7 次插入4 次删除
  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;
 		}