]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: SETMETADATA - Reorder if checks to remove unnecessary indenting
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 24 Mar 2020 15:51:57 +0000 (17:51 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Fri, 27 Mar 2020 14:29:33 +0000 (14:29 +0000)
Nothing changes in the code logic.

src/imap/cmd-setmetadata.c

index 6f309cde79fcefbfc203510fbe3a32c488bd2cf0..85be2eab4ec1100fc8cc9d85a122d49be2c39683 100644 (file)
@@ -129,33 +129,33 @@ cmd_setmetadata_entry_read_stream(struct imap_setmetadata_context *ctx)
 
        while ((ret = i_stream_read_more(ctx->input, &data, &size)) > 0)
                i_stream_skip(ctx->input, size);
-       if (ret < 0) {
-               if (ctx->input->v_offset != ctx->entry_value_len) {
-                       /* client disconnected */
-                       i_assert(ctx->input->eof);
-                       return -1;
-               }
+       if (ret == 0)
+               return 0;
 
-               /* finished reading the value */
-               i_stream_seek(ctx->input, 0);
+       if (ctx->input->v_offset != ctx->entry_value_len) {
+               /* client disconnected */
+               i_assert(ctx->input->eof);
+               return -1;
+       }
 
-               if (ctx->failed) {
-                       i_stream_unref(&ctx->input);
-                       return 1;
-               }
+       /* finished reading the value */
+       i_stream_seek(ctx->input, 0);
 
-               i_zero(&value);
-               value.value_stream = ctx->input;
-               if (imap_metadata_set(ctx->trans, ctx->entry_name, &value) < 0) {
-                       /* delay reporting the failure so we'll finish
-                          reading the command input */
-                       ctx->storage_failure = TRUE;
-                       ctx->failed = TRUE;
-               }
+       if (ctx->failed) {
                i_stream_unref(&ctx->input);
                return 1;
        }
-       return 0;
+
+       i_zero(&value);
+       value.value_stream = ctx->input;
+       if (imap_metadata_set(ctx->trans, ctx->entry_name, &value) < 0) {
+               /* delay reporting the failure so we'll finish
+                  reading the command input */
+               ctx->storage_failure = TRUE;
+               ctx->failed = TRUE;
+       }
+       i_stream_unref(&ctx->input);
+       return 1;
 }
 
 static int