Explorar el Código

Fix warning for unused arguments if MG_USE_OPEN_FILE is not set

bel hace 8 años
padre
commit
b4abb02f55
Se han modificado 1 ficheros con 12 adiciones y 2 borrados
  1. 12 2
      src/civetweb.c

+ 12 - 2
src/civetweb.c

@@ -2254,6 +2254,8 @@ open_file_in_memory(const struct mg_connection *conn,
                     struct mg_file *filep,
                     int mode)
 {
+#if defined(MG_USE_OPEN_FILE)
+
 	size_t size = 0;
 	const char *buf = NULL;
 	if (!conn) {
@@ -2264,7 +2266,6 @@ open_file_in_memory(const struct mg_connection *conn,
 		return 0;
 	}
 
-#if defined(MG_USE_OPEN_FILE)
 	if (conn->ctx->callbacks.open_file) {
 		buf = conn->ctx->callbacks.open_file(conn, path, &size);
 		if (buf != NULL) {
@@ -2291,9 +2292,18 @@ open_file_in_memory(const struct mg_connection *conn,
 			filep->stat.is_gzipped = 0;
 		}
 	}
-#endif
 
 	return (buf != NULL);
+
+#else
+    (void)conn;
+    (void)path;
+    (void)filep;
+    (void)mode;
+
+    return 0;
+
+#endif
 }