From 14f5a26027399f7178e60b3d652590a02462dccd Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 18 Jul 2021 12:27:21 -0700 Subject: [PATCH] use const char for fopen mode Fixes -Wwrite-strings warnings. Signed-off-by: Rosen Penev --- include/filehandling.h | 4 ++-- include/types.h | 2 +- src/filehandling.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/filehandling.h b/include/filehandling.h index 1d13097e4..db03ac456 100644 --- a/include/filehandling.h +++ b/include/filehandling.h @@ -15,8 +15,8 @@ int _wopen (const char *path, int oflag, ...); #endif -bool hc_fopen (HCFILE *fp, const char *path, char *mode); -bool hc_fopen_raw (HCFILE *fp, const char *path, char *mode); +bool hc_fopen (HCFILE *fp, const char *path, const char *mode); +bool hc_fopen_raw (HCFILE *fp, const char *path, const char *mode); int hc_fscanf (HCFILE *fp, const char *format, void *ptr); int hc_fprintf (HCFILE *fp, const char *format, ...); int hc_vfprintf (HCFILE *fp, const char *format, va_list ap); diff --git a/include/types.h b/include/types.h index ed22a95ee..9b58e6c6a 100644 --- a/include/types.h +++ b/include/types.h @@ -1075,7 +1075,7 @@ typedef struct hc_fp bool is_zip; int bom_size; - char *mode; + const char *mode; const char *path; } HCFILE; diff --git a/src/filehandling.c b/src/filehandling.c index 54ba73369..9edd1cb35 100644 --- a/src/filehandling.c +++ b/src/filehandling.c @@ -21,7 +21,7 @@ int _wopen (const char *path, int oflag, ...) } #endif -bool hc_fopen (HCFILE *fp, const char *path, char *mode) +bool hc_fopen (HCFILE *fp, const char *path, const char *mode) { if (path == NULL || mode == NULL) return false; @@ -130,7 +130,7 @@ bool hc_fopen (HCFILE *fp, const char *path, char *mode) return true; } -bool hc_fopen_raw (HCFILE *fp, const char *path, char *mode) +bool hc_fopen_raw (HCFILE *fp, const char *path, const char *mode) { if (path == NULL || mode == NULL) return false;