]> git.sven.stormbind.net Git - sven/fuse-exfat.git/blobdiff - libexfat/cluster.c
New upstream version 1.3.0+git20220115
[sven/fuse-exfat.git] / libexfat / cluster.c
index 15cd9aa339da22d8616be9d333c53021cf1ea219..0f2e91b07317e4bfbb9bc180b180a54021bfa7c3 100644 (file)
@@ -122,7 +122,7 @@ static cluster_t find_bit_and_set(bitmap_t* bitmap, size_t start, size_t end)
 
        for (i = start_index; i < end_index; i++)
        {
-               if (bitmap[i] == ~((bitmap_t) 0))
+               if (bitmap[i] == (bitmap_t) ~((bitmap_t) 0))
                        continue;
                start_bitindex = MAX(i * sizeof(bitmap_t) * 8, start);
                end_bitindex = MIN((i + 1) * sizeof(bitmap_t) * 8, end);
@@ -280,7 +280,7 @@ static int grow_file(struct exfat* ef, struct exfat_node* node,
                                shrink_file(ef, node, current + allocated, allocated);
                        return -ENOSPC;
                }
-               if (next != previous - 1 && node->is_contiguous)
+               if (next != previous + 1 && node->is_contiguous)
                {
                        /* it's a pity, but we are not able to keep the file contiguous
                           anymore */