Skip to content

Commit bba44fc

Browse files
committed
ext/iconv: Add const specifier
1 parent ef180f1 commit bba44fc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

ext/iconv/iconv.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@
6363
#define PHP_ICONV_IMPL_VALUE "unknown"
6464
#endif
6565

66-
static char *get_iconv_version(void) {
67-
char *version = "unknown";
66+
static const char *get_iconv_version(void) {
67+
const char *version = "unknown";
6868

6969
#ifdef HAVE_LIBICONV
7070
static char buf[16];
7171
snprintf(buf, sizeof(buf), "%d.%d", _libiconv_version >> 8, _libiconv_version & 0xff);
7272
version = buf;
7373
#elif defined(HAVE_GLIBC_ICONV)
74-
version = (char *) gnu_get_libc_version();
74+
version = gnu_get_libc_version();
7575
#endif
7676

7777
return version;
@@ -243,7 +243,7 @@ PHP_MSHUTDOWN_FUNCTION(miconv)
243243
/* {{{ PHP_MINFO_FUNCTION */
244244
PHP_MINFO_FUNCTION(miconv)
245245
{
246-
zval *iconv_impl, *iconv_ver;
246+
const zval *iconv_impl, *iconv_ver;
247247

248248
iconv_impl = zend_get_constant_str("ICONV_IMPL", sizeof("ICONV_IMPL")-1);
249249
iconv_ver = zend_get_constant_str("ICONV_VERSION", sizeof("ICONV_VERSION")-1);
@@ -308,7 +308,7 @@ static zend_result php_iconv_output_handler(void **nothing, php_output_context *
308308

309309
int mimetype_len = 0;
310310
if (SG(sapi_headers).mimetype && !strncasecmp(SG(sapi_headers).mimetype, "text/", 5)) {
311-
char *s = strchr(SG(sapi_headers).mimetype,';');
311+
const char *s = strchr(SG(sapi_headers).mimetype,';');
312312
if (s == NULL){
313313
mimetype = SG(sapi_headers).mimetype;
314314
} else {
@@ -321,7 +321,7 @@ static zend_result php_iconv_output_handler(void **nothing, php_output_context *
321321

322322
if (mimetype != NULL && (!(output_context->op & PHP_OUTPUT_HANDLER_CLEAN) || ((output_context->op & PHP_OUTPUT_HANDLER_START) && !(output_context->op & PHP_OUTPUT_HANDLER_FINAL)))) {
323323
size_t len;
324-
char *p = strstr(get_output_encoding(), "//");
324+
const char *p = strstr(get_output_encoding(), "//");
325325

326326
if (p) {
327327
len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, (int) (p - get_output_encoding()), get_output_encoding());
@@ -2577,7 +2577,7 @@ static php_stream_filter *php_iconv_stream_filter_factory_create(const char *nam
25772577
{
25782578
php_stream_filter *retval = NULL;
25792579
php_iconv_stream_filter *inst;
2580-
char *from_charset = NULL, *to_charset = NULL;
2580+
const char *from_charset = NULL, *to_charset = NULL;
25812581
size_t from_charset_len, to_charset_len;
25822582

25832583
if ((from_charset = strchr(name, '.')) == NULL) {

0 commit comments

Comments
 (0)