diff options
author | Yi Kong <yikong@google.com> | 2018-07-23 16:44:35 -0700 |
---|---|---|
committer | Yi Kong <yikong@google.com> | 2018-07-23 16:44:35 -0700 |
commit | 5bf7958f51d94c1a1ab288622ec5e562c0358da8 (patch) | |
tree | eba3d2a3a4d63d099a2188ecf7d42482c476d668 /verity | |
parent | 52b5c79cac2c8f6ef51ed9187d8ef3d937ef13bf (diff) | |
download | extras-5bf7958f51d94c1a1ab288622ec5e562c0358da8.tar.gz |
[verity] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: I1772953d2e66d3030aaa5a65e42d6ad664d19d78
Diffstat (limited to 'verity')
-rw-r--r-- | verity/build_verity_tree_main.cpp | 14 | ||||
-rw-r--r-- | verity/fec/image.cpp | 8 | ||||
-rw-r--r-- | verity/fec/main.cpp | 30 |
3 files changed, 26 insertions, 26 deletions
diff --git a/verity/build_verity_tree_main.cpp b/verity/build_verity_tree_main.cpp index 3635a975..9eaaa79e 100644 --- a/verity/build_verity_tree_main.cpp +++ b/verity/build_verity_tree_main.cpp @@ -55,13 +55,13 @@ int main(int argc, char** argv) { while (1) { constexpr struct option long_options[] = { - {"salt-str", required_argument, 0, 'a'}, - {"salt-hex", required_argument, 0, 'A'}, - {"help", no_argument, 0, 'h'}, - {"sparse", no_argument, 0, 'S'}, - {"verity-size", required_argument, 0, 's'}, - {"verbose", no_argument, 0, 'v'}, - {nullptr, 0, 0, 0}}; + {"salt-str", required_argument, nullptr, 'a'}, + {"salt-hex", required_argument, nullptr, 'A'}, + {"help", no_argument, nullptr, 'h'}, + {"sparse", no_argument, nullptr, 'S'}, + {"verity-size", required_argument, nullptr, 's'}, + {"verbose", no_argument, nullptr, 'v'}, + {nullptr, 0, nullptr, 0}}; int c = getopt_long(argc, argv, "a:A:hSs:v", long_options, nullptr); if (c < 0) { break; diff --git a/verity/fec/image.cpp b/verity/fec/image.cpp index 58853cf5..4b5502e4 100644 --- a/verity/fec/image.cpp +++ b/verity/fec/image.cpp @@ -346,7 +346,7 @@ static void * process(void *cookie) { image_proc_ctx *ctx = (image_proc_ctx *)cookie; ctx->func(ctx); - return NULL; + return nullptr; } bool image_process(image_proc_func func, image *ctx) @@ -417,7 +417,7 @@ bool image_process(image_proc_func func, image *ctx) assert(args[i].start < args[i].end); assert((args[i].end - args[i].start) % ctx->rs_n == 0); - if (pthread_create(&pthreads[i], NULL, process, &args[i]) != 0) { + if (pthread_create(&pthreads[i], nullptr, process, &args[i]) != 0) { FATAL("failed to create thread %d\n", i); } @@ -427,7 +427,7 @@ bool image_process(image_proc_func func, image *ctx) ctx->rv = 0; for (int i = 0; i < threads; ++i) { - if (pthread_join(pthreads[i], NULL) != 0) { + if (pthread_join(pthreads[i], nullptr) != 0) { FATAL("failed to join thread %d: %s\n", i, strerror(errno)); } @@ -435,7 +435,7 @@ bool image_process(image_proc_func func, image *ctx) if (args[i].rs) { free_rs_char(args[i].rs); - args[i].rs = NULL; + args[i].rs = nullptr; } } diff --git a/verity/fec/main.cpp b/verity/fec/main.cpp index 6063a66f..451c9303 100644 --- a/verity/fec/main.cpp +++ b/verity/fec/main.cpp @@ -71,7 +71,7 @@ static void decode_rs(struct image_proc_ctx *ctx) } memcpy(&data[fcx->rs_n], &fcx->fec[ctx->fec_pos], fcx->roots); - rv = decode_rs_char(ctx->rs, data, NULL, 0); + rv = decode_rs_char(ctx->rs, data, nullptr, 0); if (rv < 0) { FATAL("failed to recover [%" PRIu64 ", %" PRIu64 ")\n", @@ -279,21 +279,21 @@ int main(int argc, char **argv) while (1) { const static struct option long_options[] = { - {"help", no_argument, 0, 'h'}, - {"encode", no_argument, 0, 'e'}, - {"decode", no_argument, 0, 'd'}, - {"sparse", no_argument, 0, 'S'}, - {"roots", required_argument, 0, 'r'}, - {"inplace", no_argument, 0, 'i'}, - {"threads", required_argument, 0, 'j'}, - {"print-fec-size", required_argument, 0, 's'}, - {"get-ecc-start", required_argument, 0, 'E'}, - {"get-verity-start", required_argument, 0, 'V'}, - {"padding", required_argument, 0, 'p'}, - {"verbose", no_argument, 0, 'v'}, - {NULL, 0, 0, 0} + {"help", no_argument, nullptr, 'h'}, + {"encode", no_argument, nullptr, 'e'}, + {"decode", no_argument, nullptr, 'd'}, + {"sparse", no_argument, nullptr, 'S'}, + {"roots", required_argument, nullptr, 'r'}, + {"inplace", no_argument, nullptr, 'i'}, + {"threads", required_argument, nullptr, 'j'}, + {"print-fec-size", required_argument, nullptr, 's'}, + {"get-ecc-start", required_argument, nullptr, 'E'}, + {"get-verity-start", required_argument, nullptr, 'V'}, + {"padding", required_argument, nullptr, 'p'}, + {"verbose", no_argument, nullptr, 'v'}, + {nullptr, 0, nullptr, 0} }; - int c = getopt_long(argc, argv, "hedSr:ij:s:E:V:p:v", long_options, NULL); + int c = getopt_long(argc, argv, "hedSr:ij:s:E:V:p:v", long_options, nullptr); if (c < 0) { break; } |