Переглянути джерело

Restructure code - join two if (#473)

bel2125 8 роки тому
батько
коміт
1e9d3f69ec
1 змінених файлів з 12 додано та 17 видалено
  1. 12 17
      src/handle_form.inl

+ 12 - 17
src/handle_form.inl

@@ -851,24 +851,19 @@ mg_handle_form_request(struct mg_connection *conn,
 						       path);
 						       path);
 						mg_fclose(&fstore.access);
 						mg_fclose(&fstore.access);
 						remove_bad_file(conn, path);
 						remove_bad_file(conn, path);
-					}
-					file_size += (int64_t)n;
-				}
-			}
-
-			if (field_storage == FORM_FIELD_STORAGE_STORE) {
-
-				if (fstore.access.fp) {
-					r = mg_fclose(&fstore.access);
-					if (r == 0) {
-						/* stored successfully */
-						field_stored(conn, path, file_size, fdh);
 					} else {
 					} else {
-						mg_cry(conn,
-						       "%s: Error saving file %s",
-						       __func__,
-						       path);
-						remove_bad_file(conn, path);
+						file_size += (int64_t)n;
+						r = mg_fclose(&fstore.access);
+						if (r == 0) {
+							/* stored successfully */
+							field_stored(conn, path, file_size, fdh);
+						} else {
+							mg_cry(conn,
+							       "%s: Error saving file %s",
+							       __func__,
+							       path);
+							remove_bad_file(conn, path);
+						}
 					}
 					}
 					fstore.access.fp = NULL;
 					fstore.access.fp = NULL;
 				}
 				}