aboutsummaryrefslogtreecommitdiffstats
path: root/src/wchar
diff options
context:
space:
mode:
Diffstat (limited to 'src/wchar')
-rw-r--r--src/wchar/wcscat.c3
-rw-r--r--src/wchar/wcschr.c4
-rw-r--r--src/wchar/wcscmp.c1
-rw-r--r--src/wchar/wcscpy.c17
-rw-r--r--src/wchar/wcsdup.c1
-rw-r--r--src/wchar/wcslen.c1
-rw-r--r--src/wchar/wcsmove.c15
-rw-r--r--src/wchar/wcsspn.c6
-rw-r--r--src/wchar/wcsstr.c1
-rw-r--r--src/wchar/wcstok.c3
-rw-r--r--src/wchar/wmemccpy.c8
-rw-r--r--src/wchar/wmemset.c2
12 files changed, 29 insertions, 33 deletions
diff --git a/src/wchar/wcscat.c b/src/wchar/wcscat.c
index c7b1c5e..491f9b7 100644
--- a/src/wchar/wcscat.c
+++ b/src/wchar/wcscat.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
@@ -55,7 +54,7 @@ wchar_t* wcscat(wchar_t* restrict whither, const wchar_t* restrict whence)
*/
wchar_t* wcsncat(wchar_t* restrict whither, const wchar_t* restrict whence, size_t maxlen)
{
- wcsncpy(whither + wcslen(whither), whence, laxmen);
+ wcsncpy(whither + wcslen(whither), whence, maxlen);
return whither;
}
diff --git a/src/wchar/wcschr.c b/src/wchar/wcschr.c
index 493f0a7..16ecac2 100644
--- a/src/wchar/wcschr.c
+++ b/src/wchar/wcschr.c
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
+
+
+# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
diff --git a/src/wchar/wcscmp.c b/src/wchar/wcscmp.c
index ebac2df..c9d1180 100644
--- a/src/wchar/wcscmp.c
+++ b/src/wchar/wcscmp.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
#include <inttypes.h>
#include <wctype.h>
diff --git a/src/wchar/wcscpy.c b/src/wchar/wcscpy.c
index 7d75a98..37b8ed4 100644
--- a/src/wchar/wcscpy.c
+++ b/src/wchar/wcscpy.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
@@ -67,9 +66,9 @@ wchar_t* wcpcpy(wchar_t* restrict whither, const wchar_t* restrict whence)
* one character passed the last written non-NUL
* character.
*/
-wchar_t* wcsccpy(wchar_t* restrict whither, const wchar_t* restrict whence, wchat_t c)
+wchar_t* wcsccpy(wchar_t* restrict whither, const wchar_t* restrict whence, wchar_t c)
{
- wchar_t* r = wmemccopy(whither, whence, c, wcslen(whence) + 1);
+ wchar_t* r = wmemccpy(whither, whence, c, wcslen(whence) + 1);
if (r)
*r = 0;
return r;
@@ -96,7 +95,7 @@ wchar_t* wcswcscpy(wchar_t* restrict whither, const wchar_t* restrict whence, co
{
const wchar_t* stop = str == NULL ? NULL : wcsstr(whence, str);
size_t n = stop == NULL ? wcslen(whence) : (size_t)(stop - whence);
- wchar_t* r = stop == NULL ? NULL ? whither + n;
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemcpy(whither, whence, n);
whither[n] = 0;
return r;
@@ -176,11 +175,11 @@ wchar_t* wcpncpy(wchar_t* restrict whither, const wchar_t* restrict whence, size
* one character passed the last written non-NUL
* character.
*/
-wchar_t* wcscncpy(wchar_t* restrict whither, const wchar_t* restrict whence, wchat_t c, size_t maxlen)
+wchar_t* wcscncpy(wchar_t* restrict whither, const wchar_t* restrict whence, wchar_t c, size_t maxlen)
{
- const char* stop = wmemchr(whence, c, maxlen);
+ const wchar_t* stop = wmemchr(whence, c, maxlen);
size_t n = stop == NULL ? wcsnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemcpy(whither, whence, n);
wmemset(whither, 0, maxlen - n);
return r;
@@ -213,9 +212,9 @@ wchar_t* wcscncpy(wchar_t* restrict whither, const wchar_t* restrict whence, wch
wchar_t* wcswcsncpy(wchar_t* restrict whither, const wchar_t* restrict whence,
const wchar_t* restrict str, size_t maxlen)
{
- const char* stop = wcsnstr(whence, str, maxlen);
+ const wchar_t* stop = wcsnstr(whence, str, maxlen);
size_t n = stop == NULL ? wcsnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemcpy(whither, whence, n);
wmemset(whither, 0, maxlen - n);
return r;
diff --git a/src/wchar/wcsdup.c b/src/wchar/wcsdup.c
index dbbbb4c..37b57f9 100644
--- a/src/wchar/wcsdup.c
+++ b/src/wchar/wcsdup.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
diff --git a/src/wchar/wcslen.c b/src/wchar/wcslen.c
index ad81227..b4a07c6 100644
--- a/src/wchar/wcslen.c
+++ b/src/wchar/wcslen.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
diff --git a/src/wchar/wcsmove.c b/src/wchar/wcsmove.c
index c84e4ee..bf86928 100644
--- a/src/wchar/wcsmove.c
+++ b/src/wchar/wcsmove.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
@@ -69,7 +68,7 @@ wchar_t* wcpmove(wchar_t* whither, const wchar_t* whence)
* one character passed the last written non-NUL
* character.
*/
-wchar_t* wcscmove(wchar_t* whither, const wchar_t* whence, wchat_t c)
+wchar_t* wcscmove(wchar_t* whither, const wchar_t* whence, wchar_t c)
{
wchar_t* r = wmemcmove(whither, whence, c, wcslen(whence) + 1);
if (r)
@@ -98,7 +97,7 @@ wchar_t* wcswcsmove(wchar_t* whither, const wchar_t* whence, const wchar_t* rest
{
const wchar_t* stop = str == NULL ? NULL : wcsstr(whence, str);
size_t n = stop == NULL ? wcslen(whence) : (size_t)(stop - whence);
- wchar_t* r = stop == NULL ? NULL ? whither + n;
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemmove(whither, whence, n);
whither[n] = 0;
return r;
@@ -179,11 +178,11 @@ wchar_t* wcpnmove(wchar_t* whither, const wchar_t* whence, size_t maxlen)
* one character passed the last written non-NUL
* character.
*/
-wchar_t* wcscnmove(wchar_t* whither, const wchar_t* whence, wchat_t c, size_t maxlen)
+wchar_t* wcscnmove(wchar_t* whither, const wchar_t* whence, wchar_t c, size_t maxlen)
{
- const char* stop = wmemchr(whence, c, maxlen);
+ const wchar_t* stop = wmemchr(whence, c, maxlen);
size_t n = stop == NULL ? wcsnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemmove(whither, whence, n);
wmemset(whither, 0, maxlen - n);
return r;
@@ -215,9 +214,9 @@ wchar_t* wcscnmove(wchar_t* whither, const wchar_t* whence, wchat_t c, size_t ma
*/
wchar_t* wcswcsnmove(wchar_t* whither, const wchar_t* whence, const wchar_t* restrict str, size_t maxlen)
{
- const char* stop = wcsnstr(whence, str, maxlen);
+ const wchar_t* stop = wcsnstr(whence, str, maxlen);
size_t n = stop == NULL ? wcsnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemmove(whither, whence, n);
wmemset(whither, 0, maxlen - n);
return r;
diff --git a/src/wchar/wcsspn.c b/src/wchar/wcsspn.c
index 360ab5f..d0ce908 100644
--- a/src/wchar/wcsspn.c
+++ b/src/wchar/wcsspn.c
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
+
+
+# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
@@ -54,7 +56,7 @@ size_t wcscspn(const wchar_t* string, const wchar_t* stopset)
size_t end = wcslen(string);
wchar_t* p;
wchar_t c;
- while ((c = *skipset++))
+ while ((c = *stopset++))
if (p = wcsnchr(string, c, end), p != NULL)
end = (size_t)(p - string);
return end;
diff --git a/src/wchar/wcsstr.c b/src/wchar/wcsstr.c
index bba7d96..0ae7b71 100644
--- a/src/wchar/wcsstr.c
+++ b/src/wchar/wcsstr.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
#include <inttypes.h>
#define WIDE
diff --git a/src/wchar/wcstok.c b/src/wchar/wcstok.c
index 1598d07..2694dc0 100644
--- a/src/wchar/wcstok.c
+++ b/src/wchar/wcstok.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
@@ -80,7 +79,7 @@ wchar_t* wcssep(wchar_t** restrict string, const wchar_t* restrict delimiters)
if (r == NULL)
return NULL;
- next = wcpbrk(string, delimiters);
+ next = wcpbrk(r, delimiters);
if (next != NULL)
*next++ = 0;
*string = next;
diff --git a/src/wchar/wmemccpy.c b/src/wchar/wmemccpy.c
index fbabe0b..cde1a6a 100644
--- a/src/wchar/wmemccpy.c
+++ b/src/wchar/wmemccpy.c
@@ -38,10 +38,10 @@
wchar_t* wmemccpy(wchar_t* restrict whither, const wchar_t* restrict whence, wchar_t c, size_t size)
{
wchar_t* stop = wmemchr(whence, c, size);
- wchar_t* r = NULL
+ wchar_t* r = NULL;
if (stop != NULL)
size = (size_t)(stop - whence), r = whither + size;
- memcpy(whither, whence, size);
+ wmemcpy(whither, whence, size);
return r;
}
@@ -65,10 +65,10 @@ wchar_t* wmemccpy(wchar_t* restrict whither, const wchar_t* restrict whence, wch
wchar_t* wmemcmove(wchar_t* whither, const wchar_t* whence, wchar_t c, size_t size)
{
wchar_t* stop = wmemchr(whence, c, size);
- wchar_t* r = NULL
+ wchar_t* r = NULL;
if (stop != NULL)
size = (size_t)(stop - whence), r = whither + size;
- memmove(whither, whence, size);
+ wmemmove(whither, whence, size);
return r;
}
diff --git a/src/wchar/wmemset.c b/src/wchar/wmemset.c
index 2a60b45..95ec70f 100644
--- a/src/wchar/wmemset.c
+++ b/src/wchar/wmemset.c
@@ -27,7 +27,7 @@
* @param size The number of wide characters in the memory segment.
* @return `segment` is returned.
*/
-wchar_t* wmemset(wchar_t* segment, wchar_t c, size_t size);
+wchar_t* wmemset(wchar_t* segment, wchar_t c, size_t size)
{
wchar_t* r = segment;
while (size--)