https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3ba423996c41f9d8a6284a0aac1a44aa332815a6

commit 3ba423996c41f9d8a6284a0aac1a44aa332815a6
Author:     Victor Perevertkin <[email protected]>
AuthorDate: Thu Apr 23 07:28:34 2020 +0300
Commit:     Victor Perevertkin <[email protected]>
CommitDate: Thu Apr 23 07:29:04 2020 +0300

    [BTRFS] Fix build
    CORE-16679
---
 drivers/filesystems/btrfs/compress.c |  6 +++++-
 drivers/filesystems/btrfs/sha256.c   | 32 +++++++++++++++++---------------
 2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/filesystems/btrfs/compress.c 
b/drivers/filesystems/btrfs/compress.c
index eecc00576cd..ee9b89a74cb 100644
--- a/drivers/filesystems/btrfs/compress.c
+++ b/drivers/filesystems/btrfs/compress.c
@@ -888,7 +888,7 @@ NTSTATUS write_compressed(fcb* fcb, uint64_t start_data, 
uint64_t end_data, void
     void* csum = NULL;
 #ifdef __REACTOS__
     int32_t i2;
-    uint32_t i3;
+    uint32_t i3, j;
 #endif // __REACTOS__
 
     if (fcb->Vcb->options.compress_type != 0 && fcb->prop_compression == 
PropCompression_None)
@@ -929,7 +929,11 @@ NTSTATUS write_compressed(fcb* fcb, uint64_t start_data, 
uint64_t end_data, void
         if (!NT_SUCCESS(Status)) {
             ERR("add_calc_job_comp returned %08lx\n", Status);
 
+#ifndef __REACTOS__
             for (unsigned int j = 0; j < i; j++) {
+#else
+            for (j = 0; j < i; j++) {
+#endif // __REACTOS__
                 KeWaitForSingleObject(&parts[j].cj->event, Executive, 
KernelMode, false, NULL);
                 ExFreePool(parts[j].cj);
             }
diff --git a/drivers/filesystems/btrfs/sha256.c 
b/drivers/filesystems/btrfs/sha256.c
index a9ee8c1b93f..4b5af043503 100644
--- a/drivers/filesystems/btrfs/sha256.c
+++ b/drivers/filesystems/btrfs/sha256.c
@@ -187,21 +187,23 @@ void calc_sha256(uint8_t* hash, const void* input, size_t 
len)
                                        const uint32_t s1 = right_rot(w[(j + 
14) & 0xf], 17) ^ right_rot(w[(j + 14) & 0xf], 19) ^ (w[(j + 14) & 0xf] >> 10);
                                        w[j] = w[j] + s0 + w[(j + 9) & 0xf] + 
s1;
                                }
-                               const uint32_t s1 = right_rot(ah[4], 6) ^ 
right_rot(ah[4], 11) ^ right_rot(ah[4], 25);
-                               const uint32_t ch = (ah[4] & ah[5]) ^ (~ah[4] & 
ah[6]);
-                               const uint32_t temp1 = ah[7] + s1 + ch + k[i << 
4 | j] + w[j];
-                               const uint32_t s0 = right_rot(ah[0], 2) ^ 
right_rot(ah[0], 13) ^ right_rot(ah[0], 22);
-                               const uint32_t maj = (ah[0] & ah[1]) ^ (ah[0] & 
ah[2]) ^ (ah[1] & ah[2]);
-                               const uint32_t temp2 = s0 + maj;
-
-                               ah[7] = ah[6];
-                               ah[6] = ah[5];
-                               ah[5] = ah[4];
-                               ah[4] = ah[3] + temp1;
-                               ah[3] = ah[2];
-                               ah[2] = ah[1];
-                               ah[1] = ah[0];
-                               ah[0] = temp1 + temp2;
+                               {
+                                       const uint32_t s1 = right_rot(ah[4], 6) 
^ right_rot(ah[4], 11) ^ right_rot(ah[4], 25);
+                                       const uint32_t ch = (ah[4] & ah[5]) ^ 
(~ah[4] & ah[6]);
+                                       const uint32_t temp1 = ah[7] + s1 + ch 
+ k[i << 4 | j] + w[j];
+                                       const uint32_t s0 = right_rot(ah[0], 2) 
^ right_rot(ah[0], 13) ^ right_rot(ah[0], 22);
+                                       const uint32_t maj = (ah[0] & ah[1]) ^ 
(ah[0] & ah[2]) ^ (ah[1] & ah[2]);
+                                       const uint32_t temp2 = s0 + maj;
+
+                                       ah[7] = ah[6];
+                                       ah[6] = ah[5];
+                                       ah[5] = ah[4];
+                                       ah[4] = ah[3] + temp1;
+                                       ah[3] = ah[2];
+                                       ah[2] = ah[1];
+                                       ah[1] = ah[0];
+                                       ah[0] = temp1 + temp2;
+                               }
                        }
                }
 

Reply via email to