From: Martin Baute Date: Tue, 8 Mar 2016 07:15:24 +0000 (+0100) Subject: Pointer typedef resulted in non-const structure where const was intended. X-Git-Url: https://pd.if.org/git/?p=pdclib;a=commitdiff_plain;h=276f7e69f80ac53bfb5da5cc24072dd393485106 Pointer typedef resulted in non-const structure where const was intended. --- diff --git a/internals/_PDCLIB_encoding.h b/internals/_PDCLIB_encoding.h index fdaee7e..10f1140 100644 --- a/internals/_PDCLIB_encoding.h +++ b/internals/_PDCLIB_encoding.h @@ -86,7 +86,7 @@ static inline _PDCLIB_size_t _PDCLIB_c32rtoc16( } } -struct _PDCLIB_charcodec { +struct _PDCLIB_charcodec_t { /* Reads at most *_P_insz code units from *_P_inbuf and writes the result * into *_P_outbuf, writing at most *_P_outsz code units. Updates * *_P_outbuf, *_P_outsz, *_P_inbuf, *_P_outsz with the resulting state diff --git a/internals/_PDCLIB_int.h b/internals/_PDCLIB_int.h index 43ef739..ab1bc90 100644 --- a/internals/_PDCLIB_int.h +++ b/internals/_PDCLIB_int.h @@ -367,7 +367,6 @@ typedef struct _PDCLIB_mbstate { char _PendChar; } _PDCLIB_mbstate_t; -typedef struct _PDCLIB_charcodec *_PDCLIB_charcodec_t; typedef struct _PDCLIB_locale *_PDCLIB_locale_t; typedef struct lconv _PDCLIB_lconv_t; diff --git a/internals/_PDCLIB_locale.h b/internals/_PDCLIB_locale.h index 9644eb4..82e17b0 100644 --- a/internals/_PDCLIB_locale.h +++ b/internals/_PDCLIB_locale.h @@ -82,8 +82,8 @@ typedef struct _PDCLIB_wcinfo } _PDCLIB_wcinfo_t; struct _PDCLIB_locale { - const _PDCLIB_charcodec_t _Codec; - struct lconv _Conv; + const struct _PDCLIB_charcodec_t * _Codec; + struct lconv _Conv; /* ctype / wctype */ /* XXX: Maybe re-evaluate constness of these later on? */ diff --git a/opt/basecodecs/_PDCLIB_ascii.c b/opt/basecodecs/_PDCLIB_ascii.c index 7c73d1b..1432153 100644 --- a/opt/basecodecs/_PDCLIB_ascii.c +++ b/opt/basecodecs/_PDCLIB_ascii.c @@ -62,7 +62,7 @@ static bool c32toascii( return true; } -const struct _PDCLIB_charcodec _PDCLIB_ascii_codec = { +const struct _PDCLIB_charcodec_t _PDCLIB_ascii_codec = { .__mbsinit = ascii_mbsinit, .__mbstoc32s = asciitoc32, .__c32stombs = c32toascii, diff --git a/opt/basecodecs/_PDCLIB_latin1.c b/opt/basecodecs/_PDCLIB_latin1.c index b9de8ca..5961a44 100644 --- a/opt/basecodecs/_PDCLIB_latin1.c +++ b/opt/basecodecs/_PDCLIB_latin1.c @@ -60,7 +60,7 @@ static bool c32tolatin1( return true; } -const struct _PDCLIB_charcodec _PDCLIB_latin1_codec = { +const struct _PDCLIB_charcodec_t _PDCLIB_latin1_codec = { .__mbsinit = latin1_mbsinit, .__mbstoc32s = latin1toc32, .__c32stombs = c32tolatin1, diff --git a/opt/basecodecs/_PDCLIB_utf8.c b/opt/basecodecs/_PDCLIB_utf8.c index 1dfc83a..6348c79 100644 --- a/opt/basecodecs/_PDCLIB_utf8.c +++ b/opt/basecodecs/_PDCLIB_utf8.c @@ -232,7 +232,7 @@ static bool c32toutf8( END_CONVERSION; } -const struct _PDCLIB_charcodec _PDCLIB_utf8_codec = { +const struct _PDCLIB_charcodec_t _PDCLIB_utf8_codec = { .__mbsinit = utf8_mbsinit, .__mbstoc32s = utf8toc32, .__c32stombs = c32toutf8, diff --git a/platform/example/functions/_PDCLIB/stdinit.c b/platform/example/functions/_PDCLIB/stdinit.c index 6481c38..986073e 100644 --- a/platform/example/functions/_PDCLIB/stdinit.c +++ b/platform/example/functions/_PDCLIB/stdinit.c @@ -340,7 +340,7 @@ static const _PDCLIB_ctype_t global_ctype[] = { { 0x00, 0xFF, 0xFF, 0xFF } }; -extern const struct _PDCLIB_charcodec _PDCLIB_ascii_codec; +extern const struct _PDCLIB_charcodec_t _PDCLIB_ascii_codec; struct _PDCLIB_locale _PDCLIB_global_locale = { ._Codec = &_PDCLIB_ascii_codec, ._Conv = { diff --git a/platform/gandr/functions/_PDCLIB/_PDCLIB_stdinit.c b/platform/gandr/functions/_PDCLIB/_PDCLIB_stdinit.c index 9504186..c622ff0 100644 --- a/platform/gandr/functions/_PDCLIB/_PDCLIB_stdinit.c +++ b/platform/gandr/functions/_PDCLIB/_PDCLIB_stdinit.c @@ -279,7 +279,7 @@ static const _PDCLIB_ctype_t global_ctype[] = { { 0x00, 0xFF, 0xFF, 0xFF } }; -extern const struct _PDCLIB_charcodec _PDCLIB_ascii_codec; +extern const struct _PDCLIB_charcodec_t _PDCLIB_ascii_codec; struct _PDCLIB_locale _PDCLIB_global_locale = { ._Codec = &_PDCLIB_ascii_codec, ._Conv = { diff --git a/platform/posix/functions/_PDCLIB/_PDCLIB_stdinit.c b/platform/posix/functions/_PDCLIB/_PDCLIB_stdinit.c index 18fcc22..defb303 100644 --- a/platform/posix/functions/_PDCLIB/_PDCLIB_stdinit.c +++ b/platform/posix/functions/_PDCLIB/_PDCLIB_stdinit.c @@ -346,7 +346,7 @@ static const _PDCLIB_ctype_t global_ctype[] = { { 0x00, 0xFF, 0xFF, 0xFF } }; -extern const struct _PDCLIB_charcodec _PDCLIB_ascii_codec; +extern const struct _PDCLIB_charcodec_t _PDCLIB_ascii_codec; struct _PDCLIB_locale _PDCLIB_global_locale = { ._Codec = &_PDCLIB_ascii_codec, ._Conv = { diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_stdinit.c b/platform/win32/functions/_PDCLIB/_PDCLIB_stdinit.c index d8f1774..15ce30b 100644 --- a/platform/win32/functions/_PDCLIB/_PDCLIB_stdinit.c +++ b/platform/win32/functions/_PDCLIB/_PDCLIB_stdinit.c @@ -343,7 +343,7 @@ static const _PDCLIB_ctype_t global_ctype[] = { { 0x00, 0xFF, 0xFF, 0xFF } }; -extern const struct _PDCLIB_charcodec _PDCLIB_ascii_codec; +extern const struct _PDCLIB_charcodec_t _PDCLIB_ascii_codec; struct _PDCLIB_locale _PDCLIB_global_locale = { ._Codec = &_PDCLIB_ascii_codec, ._Conv = {