diff options
author | Yi Kong <yikong@google.com> | 2018-07-23 16:31:11 -0700 |
---|---|---|
committer | Yi Kong <yikong@google.com> | 2018-07-23 23:32:01 +0000 |
commit | 17ba95ed9e65099db60e1e14ce6be51e87675707 (patch) | |
tree | e650ef5d7da0621e36ccdc7ca776869831cd2947 /libsparse/sparse.cpp | |
parent | 7e7cefa2c7972be72b915512b12bcab1e9f36a36 (diff) |
[libsparse] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: I43dae734817cae7a260ffc7afcd85fbd4451eddf
Diffstat (limited to 'libsparse/sparse.cpp')
-rw-r--r-- | libsparse/sparse.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libsparse/sparse.cpp b/libsparse/sparse.cpp index 6ff97b6ab..cb288c555 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 @@ static struct backed_block* move_chunks_up_to_len(struct sparse_file* from, stru 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 @@ static struct backed_block* move_chunks_up_to_len(struct sparse_file* from, stru 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 @@ static struct backed_block* move_chunks_up_to_len(struct sparse_file* from, stru /* 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 @@ int sparse_file_resparse(struct sparse_file* in_s, unsigned int max_len, struct 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); |