Ignore:
Timestamp:
May 27, 2009, 9:09:42 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/lib/xfile.c

    r136 r232  
    355355size_t x_fread(void *p, size_t size, size_t nmemb, XFILE *f)
    356356{
     357        size_t remaining = size * nmemb;
    357358        size_t total = 0;
    358         while (total < size*nmemb) {
    359                 int c = x_fgetc(f);
    360                 if (c == EOF) break;
    361                 (total+(char *)p)[0] = (char)c;
    362                 total++;
     359
     360        while (remaining > 0) {
     361                size_t thistime;
     362
     363                x_fillbuf(f);
     364
     365                if (f->bufused == 0) {
     366                        f->flags |= X_FLAG_EOF;
     367                        break;
     368                }
     369
     370                thistime = MIN(f->bufused, remaining);
     371
     372                memcpy((char *)p+total, f->next, thistime);
     373
     374                f->next += thistime;
     375                f->bufused -= thistime;
     376                remaining -= thistime;
     377                total += thistime;
    363378        }
    364379        return total/size;
Note: See TracChangeset for help on using the changeset viewer.