~ubuntu-branches/ubuntu/raring/unrar-nonfree/raring-proposed

« back to all changes in this revision

Viewing changes to file.cpp

  • Committer: Package Import Robot
  • Author(s): Martin Meredith
  • Date: 2012-02-14 22:39:32 UTC
  • mfrom: (1.1.15) (5.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20120214223932-3785038bqlknu15a
Tags: 1:4.1.4-1
* New upstream release
* Updated Watch file
* Added build-indep and build-arch to rules file

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
  if (Success)
104
104
  {
105
105
    hFile=hNewFile;
 
106
 
 
107
    // We use memove instead of strcpy and wcscpy to avoid problems
 
108
    // with overlapped buffers. While we do not call this function with
 
109
    // really overlapped buffers yet, we do call it with Name equal to
 
110
    // FileName like Arc.Open(Arc.FileName,Arc.FileNameW).
106
111
    if (NameW!=NULL)
107
 
      wcscpy(FileNameW,NameW);
 
112
      memmove(FileNameW,NameW,(wcslen(NameW)+1)*sizeof(*NameW));
108
113
    else
109
114
      *FileNameW=0;
110
115
    if (Name!=NULL)
111
 
      strcpy(FileName,Name);
 
116
      memmove(FileName,Name,strlen(Name)+1);
112
117
    else
113
118
      WideToChar(NameW,FileName);
114
119
    AddFileToList(hFile);
493
498
    Seek(0,SEEK_SET);
494
499
  }
495
500
#endif
 
501
 
 
502
#if defined(_UNIX) && defined(USE_FALLOCATE)
 
503
  // fallocate is rather new call. Only latest kernels support it.
 
504
  // So we are not using it by default yet.
 
505
  int fd = fileno(hFile);
 
506
  if (fd >= 0)
 
507
    fallocate(fd, 0, 0, Size);
 
508
#endif
496
509
}
497
510
 
498
511