forked from KolibriOS/kolibrios
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:
parent
5f69e793ff
commit
b3dd287ea0
@ -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++;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user