kolibri-libc:

- Fix fwrite and fread working with a void pointer.

git-svn-id: svn://kolibrios.org@8627 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2021-03-02 20:49:28 +00:00
parent 5f69e793ff
commit b3dd287ea0
2 changed files with 2 additions and 3 deletions

View File

@ -11,7 +11,7 @@ size_t fread(void *restrict ptr, size_t size, size_t nmemb, FILE *restrict strea
break; break;
} }
ptr[i] = c; *(char*)(ptr+i) = c;
bytes_read++; bytes_read++;
} }

View File

@ -5,8 +5,7 @@ size_t fwrite(const void *restrict ptr, size_t size, size_t nmemb, FILE *restric
unsigned bytes_count = size * nmemb; unsigned bytes_count = size * nmemb;
for (size_t i = 0; i < bytes_count; i++) { for (size_t i = 0; i < bytes_count; i++) {
char c = ptr[i]; char c = *(char*)(ptr+i);
if (fputc(c, stream) != c) { if (fputc(c, stream) != c) {
break; break;
} }