Skip to content

Commit c77cac9

Browse files
committed
filenames.h: add explicit char* casts to strchr/strrchr results for C23
1 parent 50827bc commit c77cac9

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Quake/filenames.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,16 @@ static inline const char *FIND_LAST_DIRSEP (const char *_the_path) {
9393
#else
9494
static inline char *FIND_FIRST_DIRSEP(const char *_the_path) {
9595
/* FIXME: What about C:FOO ? */
96-
char *p1 = strchr(_the_path, '/');
97-
char *p2 = strchr(_the_path, '\\');
96+
char *p1 = (char *) strchr(_the_path, '/');
97+
char *p2 = (char *) strchr(_the_path, '\\');
9898
if (p1 == NULL) return p2;
9999
if (p2 == NULL) return p1;
100100
return (p1 < p2)? p1 : p2;
101101
}
102102
static inline char *FIND_LAST_DIRSEP (const char *_the_path) {
103103
/* FIXME: What about C:FOO ? */
104-
char *p1 = strrchr(_the_path, '/');
105-
char *p2 = strrchr(_the_path, '\\');
104+
char *p1 = (char *) strrchr(_the_path, '/');
105+
char *p2 = (char *) strrchr(_the_path, '\\');
106106
if (p1 == NULL) return p2;
107107
if (p2 == NULL) return p1;
108108
return (p1 > p2)? p1 : p2;
@@ -145,19 +145,19 @@ static inline const char *FIND_LAST_DIRSEP (const char *_the_path) {
145145
}
146146
#else
147147
static inline char *FIND_FIRST_DIRSEP(const char *_the_path) {
148-
char *p = strchr(_the_path, ':');
148+
char *p = (char *) strchr(_the_path, ':');
149149
if (p != NULL) return p;
150150
return strchr(_the_path, '/');
151151
}
152152
static inline char *FIND_LAST_DIRSEP (const char *_the_path) {
153-
char *p = strrchr(_the_path, '/');
153+
char *p = (char *) strrchr(_the_path, '/');
154154
if (p != NULL) return p;
155155
return strchr(_the_path, ':');
156156
}
157157
#endif /* C++ */
158158

159159
/* ---------------------- assumed UNIX-ish : ---------------------- */
160-
#else /* */
160+
#else /**/
161161

162162
#define IS_DIR_SEPARATOR(c) ((c) == '/')
163163
#define DIR_SEPARATOR_CHAR '/'
@@ -181,10 +181,10 @@ static inline const char *FIND_LAST_DIRSEP (const char *_the_path) {
181181
}
182182
#else
183183
static inline char *FIND_FIRST_DIRSEP(const char *_the_path) {
184-
return strchr(_the_path, '/');
184+
return (char *) strchr(_the_path, '/');
185185
}
186186
static inline char *FIND_LAST_DIRSEP (const char *_the_path) {
187-
return strrchr(_the_path, '/');
187+
return (char *) strrchr(_the_path, '/');
188188
}
189189
#endif /* C++ */
190190

0 commit comments

Comments
 (0)