diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2024-06-21 07:50:02 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2024-06-21 07:53:30 +0200 |
commit | 02bbc3c83aec597e4b8c873916e9e29f3d02b132 (patch) | |
tree | 3215858aa089784ac27c86346792dcdbe6529fdb /src/common/parse_manifest.c | |
parent | 15cd9a3881b030a1a4bddc809f038f86ec27e66d (diff) | |
download | postgresql-02bbc3c83aec597e4b8c873916e9e29f3d02b132.tar.gz postgresql-02bbc3c83aec597e4b8c873916e9e29f3d02b132.zip |
parse_manifest: Use const char *
This adapts the manifest parsing code to take advantage of the
const-ified jsonapi.
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://www.postgresql.org/message-id/flat/f732b014-f614-4600-a437-dba5a2c3738b%40eisentraut.org
Diffstat (limited to 'src/common/parse_manifest.c')
-rw-r--r-- | src/common/parse_manifest.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/parse_manifest.c b/src/common/parse_manifest.c index 373a4f6c00f..612e120b17a 100644 --- a/src/common/parse_manifest.c +++ b/src/common/parse_manifest.c @@ -112,7 +112,7 @@ static void json_manifest_finalize_system_identifier(JsonManifestParseState *par static void json_manifest_finalize_file(JsonManifestParseState *parse); static void json_manifest_finalize_wal_range(JsonManifestParseState *parse); static void verify_manifest_checksum(JsonManifestParseState *parse, - char *buffer, size_t size, + const char *buffer, size_t size, pg_cryptohash_ctx *incr_ctx); static void json_manifest_parse_failure(JsonManifestParseContext *context, char *msg); @@ -183,7 +183,7 @@ json_parse_manifest_incremental_shutdown(JsonManifestParseIncrementalState *incs void json_parse_manifest_incremental_chunk( - JsonManifestParseIncrementalState *incstate, char *chunk, size_t size, + JsonManifestParseIncrementalState *incstate, const char *chunk, size_t size, bool is_last) { JsonParseErrorType res, @@ -206,7 +206,7 @@ json_parse_manifest_incremental_chunk( if (!is_last) { if (pg_cryptohash_update(incstate->manifest_ctx, - (uint8 *) chunk, size) < 0) + (const uint8 *) chunk, size) < 0) context->error_cb(context, "could not update checksum of manifest"); } else @@ -225,7 +225,7 @@ json_parse_manifest_incremental_chunk( * invoked and is expected not to return. */ void -json_parse_manifest(JsonManifestParseContext *context, char *buffer, +json_parse_manifest(JsonManifestParseContext *context, const char *buffer, size_t size) { JsonLexContext *lex; @@ -810,7 +810,7 @@ json_manifest_finalize_wal_range(JsonManifestParseState *parse) * parse incr_ctx will be NULL. */ static void -verify_manifest_checksum(JsonManifestParseState *parse, char *buffer, +verify_manifest_checksum(JsonManifestParseState *parse, const char *buffer, size_t size, pg_cryptohash_ctx *incr_ctx) { JsonManifestParseContext *context = parse->context; @@ -858,7 +858,7 @@ verify_manifest_checksum(JsonManifestParseState *parse, char *buffer, { manifest_ctx = incr_ctx; } - if (pg_cryptohash_update(manifest_ctx, (uint8 *) buffer, penultimate_newline + 1) < 0) + if (pg_cryptohash_update(manifest_ctx, (const uint8 *) buffer, penultimate_newline + 1) < 0) context->error_cb(context, "could not update checksum of manifest"); if (pg_cryptohash_final(manifest_ctx, manifest_checksum_actual, sizeof(manifest_checksum_actual)) < 0) |