diff --git a/src/backend/access/gist/gistbuildbuffers.c b/src/backend/access/gist/gistbuildbuffers.c index 538e3880c9..60911e6aac 100644 --- a/src/backend/access/gist/gistbuildbuffers.c +++ b/src/backend/access/gist/gistbuildbuffers.c @@ -38,7 +38,7 @@ static long gistBuffersGetFreeBlock(GISTBuildBuffers *gfbb); static void gistBuffersReleaseBlock(GISTBuildBuffers *gfbb, long blocknum); static void ReadTempFileBlock(BufFile *file, long blknum, void *ptr); -static void WriteTempFileBlock(BufFile *file, long blknum, void *ptr); +static void WriteTempFileBlock(BufFile *file, long blknum, const void *ptr); /* @@ -764,7 +764,7 @@ ReadTempFileBlock(BufFile *file, long blknum, void *ptr) } static void -WriteTempFileBlock(BufFile *file, long blknum, void *ptr) +WriteTempFileBlock(BufFile *file, long blknum, const void *ptr) { if (BufFileSeekBlock(file, blknum) != 0) elog(ERROR, "could not seek to block %ld in temporary file", blknum); diff --git a/src/backend/backup/backup_manifest.c b/src/backend/backup/backup_manifest.c index a54185fdab..68a2337a21 100644 --- a/src/backend/backup/backup_manifest.c +++ b/src/backend/backup/backup_manifest.c @@ -21,7 +21,7 @@ #include "utils/builtins.h" #include "utils/json.h" -static void AppendStringToManifest(backup_manifest_info *manifest, char *s); +static void AppendStringToManifest(backup_manifest_info *manifest, const char *s); /* * Does the user want a backup manifest? @@ -385,7 +385,7 @@ SendBackupManifest(backup_manifest_info *manifest, bbsink *sink) * Append a cstring to the manifest. */ static void -AppendStringToManifest(backup_manifest_info *manifest, char *s) +AppendStringToManifest(backup_manifest_info *manifest, const char *s) { int len = strlen(s); diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index b07cca28d6..2202ba43f7 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -622,7 +622,7 @@ BufFileRead(BufFile *file, void *ptr, size_t size) * ereport(). */ void -BufFileWrite(BufFile *file, void *ptr, size_t size) +BufFileWrite(BufFile *file, const void *ptr, size_t size) { size_t nthistime; @@ -655,7 +655,7 @@ BufFileWrite(BufFile *file, void *ptr, size_t size) file->pos += nthistime; if (file->nbytes < file->pos) file->nbytes = file->pos; - ptr = (char *) ptr + nthistime; + ptr = (const char *) ptr + nthistime; size -= nthistime; } } diff --git a/src/backend/utils/sort/logtape.c b/src/backend/utils/sort/logtape.c index 9db220b7ea..23a5e7f2a0 100644 --- a/src/backend/utils/sort/logtape.c +++ b/src/backend/utils/sort/logtape.c @@ -220,7 +220,7 @@ struct LogicalTapeSet }; static LogicalTape *ltsCreateTape(LogicalTapeSet *lts); -static void ltsWriteBlock(LogicalTapeSet *lts, long blocknum, void *buffer); +static void ltsWriteBlock(LogicalTapeSet *lts, long blocknum, const void *buffer); static void ltsReadBlock(LogicalTapeSet *lts, long blocknum, void *buffer); static long ltsGetBlock(LogicalTapeSet *lts, LogicalTape *lt); static long ltsGetFreeBlock(LogicalTapeSet *lts); @@ -235,7 +235,7 @@ static void ltsInitReadBuffer(LogicalTape *lt); * No need for an error return convention; we ereport() on any error. */ static void -ltsWriteBlock(LogicalTapeSet *lts, long blocknum, void *buffer) +ltsWriteBlock(LogicalTapeSet *lts, long blocknum, const void *buffer) { /* * BufFile does not support "holes", so if we're about to write a block @@ -759,7 +759,7 @@ LogicalTapeSetForgetFreeSpace(LogicalTapeSet *lts) * There are no error returns; we ereport() on failure. */ void -LogicalTapeWrite(LogicalTape *lt, void *ptr, size_t size) +LogicalTapeWrite(LogicalTape *lt, const void *ptr, size_t size) { LogicalTapeSet *lts = lt->tapeSet; size_t nthistime; @@ -826,7 +826,7 @@ LogicalTapeWrite(LogicalTape *lt, void *ptr, size_t size) lt->pos += nthistime; if (lt->nbytes < lt->pos) lt->nbytes = lt->pos; - ptr = (char *) ptr + nthistime; + ptr = (const char *) ptr + nthistime; size -= nthistime; } } diff --git a/src/include/storage/buffile.h b/src/include/storage/buffile.h index a4922d1853..636a0b9071 100644 --- a/src/include/storage/buffile.h +++ b/src/include/storage/buffile.h @@ -39,7 +39,7 @@ typedef struct BufFile BufFile; extern BufFile *BufFileCreateTemp(bool interXact); extern void BufFileClose(BufFile *file); extern size_t BufFileRead(BufFile *file, void *ptr, size_t size); -extern void BufFileWrite(BufFile *file, void *ptr, size_t size); +extern void BufFileWrite(BufFile *file, const void *ptr, size_t size); extern int BufFileSeek(BufFile *file, int fileno, off_t offset, int whence); extern void BufFileTell(BufFile *file, int *fileno, off_t *offset); extern int BufFileSeekBlock(BufFile *file, long blknum); diff --git a/src/include/utils/logtape.h b/src/include/utils/logtape.h index 8c742ac491..1afd527e13 100644 --- a/src/include/utils/logtape.h +++ b/src/include/utils/logtape.h @@ -66,7 +66,7 @@ extern LogicalTape *LogicalTapeCreate(LogicalTapeSet *lts); extern LogicalTape *LogicalTapeImport(LogicalTapeSet *lts, int worker, TapeShare *shared); extern void LogicalTapeSetForgetFreeSpace(LogicalTapeSet *lts); extern size_t LogicalTapeRead(LogicalTape *lt, void *ptr, size_t size); -extern void LogicalTapeWrite(LogicalTape *lt, void *ptr, size_t size); +extern void LogicalTapeWrite(LogicalTape *lt, const void *ptr, size_t size); extern void LogicalTapeRewindForRead(LogicalTape *lt, size_t buffer_size); extern void LogicalTapeFreeze(LogicalTape *lt, TapeShare *share); extern size_t LogicalTapeBackspace(LogicalTape *lt, size_t size);