[libsparse] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: I43dae734817cae7a260ffc7afcd85fbd4451eddf
diff --git a/libsparse/sparse.cpp b/libsparse/sparse.cpp
index 6ff97b6..cb288c5 100644
--- a/libsparse/sparse.cpp
+++ b/libsparse/sparse.cpp
@@ -30,13 +30,13 @@
struct sparse_file* sparse_file_new(unsigned int block_size, int64_t len) {
struct sparse_file* s = reinterpret_cast<sparse_file*>(calloc(sizeof(struct sparse_file), 1));
if (!s) {
- return NULL;
+ return nullptr;
}
s->backed_block_list = backed_block_list_new(block_size);
if (!s->backed_block_list) {
free(s);
- return NULL;
+ return nullptr;
}
s->block_size = block_size;
@@ -252,7 +252,7 @@
unsigned int len) {
int64_t count = 0;
struct output_file* out_counter;
- struct backed_block* last_bb = NULL;
+ struct backed_block* last_bb = nullptr;
struct backed_block* bb;
struct backed_block* start;
unsigned int last_block = 0;
@@ -270,7 +270,7 @@
out_counter = output_file_open_callback(out_counter_write, &count, to->block_size, to->len, false,
true, 0, false);
if (!out_counter) {
- return NULL;
+ return nullptr;
}
for (bb = start; bb; bb = backed_block_iter_next(bb)) {
@@ -281,7 +281,7 @@
/* will call out_counter_write to update count */
ret = sparse_file_write_block(out_counter, bb);
if (ret) {
- bb = NULL;
+ bb = nullptr;
goto out;
}
if (file_len + count > len) {
@@ -330,13 +330,13 @@
if (c < out_s_count) {
out_s[c] = s;
} else {
- backed_block_list_move(s->backed_block_list, tmp->backed_block_list, NULL, NULL);
+ backed_block_list_move(s->backed_block_list, tmp->backed_block_list, nullptr, nullptr);
sparse_file_destroy(s);
}
c++;
} while (bb);
- backed_block_list_move(tmp->backed_block_list, in_s->backed_block_list, NULL, NULL);
+ backed_block_list_move(tmp->backed_block_list, in_s->backed_block_list, nullptr, nullptr);
sparse_file_destroy(tmp);