Changes in uspace/lib/libc/generic/io/io.c [c77a64f:2a5af223] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/io/io.c
rc77a64f r2a5af223 341 341 size_t fread(void *buf, size_t size, size_t nmemb, FILE *stream) 342 342 { 343 size_t left, done; 344 345 if (size == 0 || nmemb == 0) 346 return 0; 347 343 size_t left = size * nmemb; 344 size_t done = 0; 345 348 346 /* Make sure no data is pending write. */ 349 347 _fflushbuf(stream); 350 351 left = size * nmemb;352 done = 0;353 348 354 349 while ((left > 0) && (!stream->error) && (!stream->eof)) { … … 370 365 static size_t _fwrite(const void *buf, size_t size, size_t nmemb, FILE *stream) 371 366 { 372 size_t left; 373 size_t done; 374 375 if (size == 0 || nmemb == 0) 376 return 0; 377 378 left = size * nmemb; 379 done = 0; 380 367 size_t left = size * nmemb; 368 size_t done = 0; 369 381 370 while ((left > 0) && (!stream->error)) { 382 371 ssize_t wr; … … 432 421 uint8_t b; 433 422 bool need_flush; 434 435 if (size == 0 || nmemb == 0) 436 return 0; 437 423 438 424 /* If not buffered stream, write out directly. */ 439 425 if (stream->btype == _IONBF) { … … 554 540 } 555 541 556 int ftell(FILE *stream)557 {558 off_t rc = lseek(stream->fd, 0, SEEK_CUR);559 if (rc == (off_t) (-1)) {560 /* errno has been set by lseek. */561 return -1;562 }563 564 return rc;565 }566 567 542 void rewind(FILE *stream) 568 543 { … … 595 570 } 596 571 597 void clearerr(FILE *stream)598 {599 stream->eof = false;600 stream->error = false;601 }602 603 572 int fphone(FILE *stream) 604 573 {
Note:
See TracChangeset
for help on using the changeset viewer.