mirror of
https://github.com/postgres/postgres.git
synced 2025-09-09 13:09:39 +03:00
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
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user