aboutsummaryrefslogtreecommitdiff
path: root/src/userspace/libc/string
diff options
context:
space:
mode:
authorMarvin Borner2020-04-29 21:16:56 +0200
committerMarvin Borner2020-04-29 21:16:56 +0200
commit0f54f0de1004c6e9a455c295dc76879ac37a408f (patch)
treeb3a6b086f33689fe887fdfcf80fa4e749b07d119 /src/userspace/libc/string
parent4546c75d685475d8b9f215b588364e1d1bbd0b79 (diff)
Fixed several warnings, errors and dumb bugs
Diffstat (limited to 'src/userspace/libc/string')
-rw-r--r--src/userspace/libc/string/strcat.c6
-rw-r--r--src/userspace/libc/string/strcati.c4
-rw-r--r--src/userspace/libc/string/strcmp.c2
-rw-r--r--src/userspace/libc/string/strcpy.c4
-rw-r--r--src/userspace/libc/string/strdisp.c2
-rw-r--r--src/userspace/libc/string/strdup.c2
-rw-r--r--src/userspace/libc/string/strinv.c2
-rw-r--r--src/userspace/libc/string/strlen.c4
8 files changed, 13 insertions, 13 deletions
diff --git a/src/userspace/libc/string/strcat.c b/src/userspace/libc/string/strcat.c
index f62d6e2..bb8f09b 100644
--- a/src/userspace/libc/string/strcat.c
+++ b/src/userspace/libc/string/strcat.c
@@ -3,10 +3,10 @@
void strcat(char *dest, char *orig)
{
- u8 s_dest = strlen(dest);
- u8 s_orig = strlen(orig);
+ u32 s_dest = strlen(dest);
+ u32 s_orig = strlen(orig);
- for (u8 i = 0; i < s_orig; i++)
+ for (u32 i = 0; i < s_orig; i++)
dest[s_dest + i] = orig[i];
dest[s_dest + s_orig] = 0;
} \ No newline at end of file
diff --git a/src/userspace/libc/string/strcati.c b/src/userspace/libc/string/strcati.c
index 5da986d..d82fbfc 100644
--- a/src/userspace/libc/string/strcati.c
+++ b/src/userspace/libc/string/strcati.c
@@ -3,8 +3,8 @@
void strcati(char *dest, char *orig)
{
- u8 s_orig = strlen(orig);
+ u32 s_orig = strlen(orig);
strdisp(dest, (int)s_orig);
- for (u8 i = 0; i < s_orig; i++)
+ for (u32 i = 0; i < s_orig; i++)
dest[i] = orig[i];
} \ No newline at end of file
diff --git a/src/userspace/libc/string/strcmp.c b/src/userspace/libc/string/strcmp.c
index 4282520..932877d 100644
--- a/src/userspace/libc/string/strcmp.c
+++ b/src/userspace/libc/string/strcmp.c
@@ -6,7 +6,7 @@ char strcmp(char *a, char *b)
if (strlen(a) != strlen(b))
return 1;
- for (u8 i = 0; i < strlen(a); i++)
+ for (u32 i = 0; i < strlen(a); i++)
if (a[i] != b[i])
return 1;
diff --git a/src/userspace/libc/string/strcpy.c b/src/userspace/libc/string/strcpy.c
index 733f7ba..a12d3e0 100644
--- a/src/userspace/libc/string/strcpy.c
+++ b/src/userspace/libc/string/strcpy.c
@@ -3,9 +3,9 @@
void strcpy(char *dest, char *orig)
{
- u8 s_orig = strlen(orig);
+ u32 s_orig = strlen(orig);
- for (u8 i = 0; i < s_orig; i++)
+ for (u32 i = 0; i < s_orig; i++)
dest[i] = orig[i];
dest[s_orig] = 0;
} \ No newline at end of file
diff --git a/src/userspace/libc/string/strdisp.c b/src/userspace/libc/string/strdisp.c
index 7e8c05a..88815ef 100644
--- a/src/userspace/libc/string/strdisp.c
+++ b/src/userspace/libc/string/strdisp.c
@@ -3,7 +3,7 @@
void strdisponce(char *str)
{
- for (u8 i = sizeof(str) + 2; i > 0; i--)
+ for (u32 i = sizeof(str) + 2; i > 0; i--)
str[i] = str[i - 1];
str[0] = 0;
}
diff --git a/src/userspace/libc/string/strdup.c b/src/userspace/libc/string/strdup.c
index f2a7c35..a42b02d 100644
--- a/src/userspace/libc/string/strdup.c
+++ b/src/userspace/libc/string/strdup.c
@@ -5,7 +5,7 @@
char *strdup(char *orig)
{
- u8 s_orig = strlen(orig);
+ u32 s_orig = strlen(orig);
char *ret = (char *)malloc(s_orig + 1);
strcpy(ret, orig);
return ret;
diff --git a/src/userspace/libc/string/strinv.c b/src/userspace/libc/string/strinv.c
index 38f0b78..261e57e 100644
--- a/src/userspace/libc/string/strinv.c
+++ b/src/userspace/libc/string/strinv.c
@@ -3,7 +3,7 @@
void strinv(char *str)
{
- u8 s_str = strlen(str);
+ u32 s_str = strlen(str);
int iterations = (int)s_str / 2;
for (int i = 0; i < iterations; i++) {
diff --git a/src/userspace/libc/string/strlen.c b/src/userspace/libc/string/strlen.c
index cc8b804..cb04675 100644
--- a/src/userspace/libc/string/strlen.c
+++ b/src/userspace/libc/string/strlen.c
@@ -1,8 +1,8 @@
#include <stdint.h>
-u8 strlen(char *str)
+u32 strlen(char *str)
{
- u8 len = 0;
+ u32 len = 0;
while (str[len])
len++;
return len;