79#define _XOPEN_SOURCE 600
90# include <sys/types.h>
95#include "RConfigure.h"
131#include "compiledata.h"
167static struct AddPseudoGlobals {
184 Info(
"TFile",
"default ctor");
310 ::Fatal(
"TFile::TFile",
"ROOT system not initialized");
380 if (!create && !recreate && !
update && !read) {
387 if (!fname1 || !fname1[0]) {
388 Error(
"TFile",
"file name is not specified");
393 if (!strcmp(fname1,
"/dev/null") &&
414 Error(
"TFile",
"error expanding path %s", fname1);
429 SysError(
"TFile",
"could not delete %s (errno: %d)",
439 Error(
"TFile",
"file %s already exists", fname);
448 Error(
"TFile",
"no write permission, could not open file %s", fname);
454 Error(
"TFile",
"file %s does not exist", fname);
458 Error(
"TFile",
"no read permission, could not open file %s", fname);
471 SysError(
"TFile",
"file %s can not be opened", fname);
482 SysError(
"TFile",
"file %s can not be opened for reading", fname);
497 gROOT->GetListOfClosedObjects()->Add(
this);
533 gROOT->GetListOfClosedObjects()->Remove(
this);
570 Error(
"Init",
"archive %s can only be opened in read mode",
GetName());
589 Error(
"Init",
"member %s not found in archive %s",
627 char *header =
new char[
kBEGIN+200];
632 Error(
"Init",
"%s failed to read the file type data.",
639 if (strncmp(header,
"root", 4)) {
645 char *buffer = header + 4;
648 frombuf(buffer, &headerLength);
651 Int_t send,sfree,sinfo;
672 if (fBEGIN < 0 || fBEGIN >
fEND) {
674 Error(
"Init",
"file %s has an incorrect header length (%lld) or incorrect end of file length (%lld)",
686 Warning(
"Init",
"file %s probably not closed, cannot read free segments",
GetName());
691 char *buffer_keyloc =
nullptr;
696 Error(
"Init",
"file %s has an incorrect header length (%lld) or incorrect end of file length (%lld)",
703 header =
new char[nbytes];
708 Error(
"Init",
"%s failed to read the file header information at %lld (size=%d)",
714 buffer_keyloc = header;
717 buffer_keyloc = header+
fBEGIN;
720 frombuf(buffer,&version); versiondir = version%1000;
725 if (version > 1000) {
730 Int_t sdir,sparent,skeys;
738 buffer_keyloc +=
sizeof(
Int_t);
740 frombuf(buffer_keyloc, &keyversion);
742 if (keyversion > 1000) {
753 if (fNbytesName < 10 || fNbytesName > 10000) {
754 Error(
"Init",
"cannot read directory info of file %s",
GetName());
760 if ((size =
GetSize()) == -1) {
790 Error(
"Init",
"file %s is truncated at %lld bytes: should be %lld, "
793 Error(
"Init",
"file %s is truncated at %lld bytes: should be %lld",
799 Warning(
"Init",
"file %s probably not closed, "
800 "trying to recover",
GetName());
808 Warning(
"Init",
"successfully recovered %d keys", nrecov);
810 Warning(
"Init",
"no keys recovered, file has been made a Zombie");
818 gROOT->GetListOfFiles()->Add(
this);
824 Int_t lenIndex =
gROOT->GetListOfStreamerInfo()->GetSize()+1;
825 if (lenIndex < 5000) lenIndex = 5000;
832 gROOT->GetListOfFiles()->Remove(
this);
838 Warning(
"Init",
"no StreamerInfo found in %s therefore preventing schema evolution when reading this file."
839 " The file was produced with version %d.%02d/%02d of ROOT.",
850 while ((key = (
TKey*)next())) {
860 gROOT->GetListOfClosedObjects()->Add(
this);
908 while ((key = iter()) !=
nullptr) {
966 gROOT->GetListOfFiles()->Remove(
this);
967 gROOT->GetListOfBrowsers()->RecursiveRemove(
this);
968 gROOT->GetListOfClosedObjects()->Add(
this);
979 return new TKey(obj,
name, bufsize, mother);
987 return new TKey(obj, cl,
name, bufsize, mother);
999 static TFile *currentFile =
nullptr;
1031 Info(
"Delete",
"deleting name = %s", namecycle);
1052 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFileDrawMap"))) {
1053 if (
h->LoadPlugin() == -1)
1093 Version_t version = TFile::Class_Version();
1094 tobuf(buffer, version);
1110 if (result >= (
double)std::numeric_limits<Int_t>::max()) {
1111 return std::numeric_limits<Int_t>::max() -1;
1113 return (
Int_t)result;
1127 Int_t nbytes, objlen, nwh = 64;
1128 char *header =
new char[
fBEGIN];
1134 while (idcur <
fEND-100) {
1149 if (nbytes == 0)
break;
1155 if (!objlen) objlen = nbytes-keylen;
1157 uncomp += keylen + objlen;
1228 Int_t nread = maxbytes;
1231 Warning(
"GetRecordHeader",
"%s: parameter maxbytes = %d must be >= 4",
1237 Warning(
"GetRecordHeader",
"%s: failed to read header data (maxbytes = %d)",
1248 if (nb < 0)
return nread;
1250 const Int_t headerSize = 16;
1251 if (nread < headerSize)
return nread;
1256 if (!olen) olen = nbytes-klen;
1274 if (
const_cast<TFile*
>(
this)->
SysStat(
fD, &
id, &size, &flags, &modtime)) {
1275 Error(
"GetSize",
"cannot stat the file %s",
GetName());
1301 TList *list =
nullptr;
1304 auto key = std::make_unique<TKey>(
this);
1306 auto buf = buffer.data();
1310 Warning(
"GetRecordHeader",
"%s: failed to read the StreamerInfo data from disk.",
1312 return {
nullptr, 1, hash};
1316 if (lookupSICache) {
1319 if (
gDebug > 0)
Info(
"GetStreamerInfo",
"The streamer info record for file %s has already been treated, skipping it.",
GetName());
1320 return {
nullptr, 0, hash};
1324 (
void) lookupSICache;
1326 key->ReadKeyBuffer(buf);
1327 list =
dynamic_cast<TList*
>(key->ReadObjWithBuffer(buffer.data()));
1330 list = (
TList*)
Get(
"StreamerInfo");
1334 Info(
"GetStreamerInfoList",
"cannot find the StreamerInfo record in file %s",
1336 return {
nullptr, 1, hash};
1339 return {list, 0, hash};
1406 if(!newfree)
return;
1410 if (nbytesl > 2000000000) nbytesl = 2000000000;
1413 char * buffer =
new char[nb];
1414 char * psave = buffer;
1415 tobuf(buffer, nbytes);
1488 bool forComp = options.
Contains(
"forcomp");
1489 bool extended = options.
Contains(
"extended");
1493 Int_t nbytes,date,time,objlen;
1501 constexpr Int_t nwheader = 512;
1503 char header[nwheader];
1504 char classname[512];
1509 unsigned char nDigits = std::log10(
fEND) + 1;
1511 while (idcur <
fEND) {
1513 Int_t nread = nwheader;
1514 if (idcur+nread >=
fEND) nread =
fEND-idcur-1;
1517 Warning(
"Map",
"%s: failed to read the key data from disk at %lld.",
1525 Printf(
"Address = %lld\tNbytes = %d\t=====E R R O R=======", idcur, nbytes);
1530 Printf(
"Address = %lld\tNbytes = %d\t=====G A P===========", idcur, nbytes);
1541 if (versionkey > 1000) {
1550 if ( ((buffer-header) + nwhc) > nwheader )
1551 nwhc = nwheader - (buffer-header);
1552 for (
int i = 0;i < nwhc; i++)
frombuf(buffer, &classname[i]);
1553 classname[(
int)nwhc] =
'\0';
1554 if (idcur ==
fSeekFree) strlcpy(classname,
"FreeSegments",512);
1555 if (idcur ==
fSeekInfo) strlcpy(classname,
"StreamerInfo",512);
1556 if (idcur ==
fSeekKeys) strlcpy(classname,
"KeysList",512);
1559 if ( (buffer-header) >= nwheader )
1565 else if ( ((buffer-header) + nwhc) > nwheader )
1566 nwhc = nwheader - (buffer-header);
1568 for (
int i = 0;i < nwhc; i++)
frombuf(buffer, &keyname[i]);
1569 keyname[(
int)nwhc] =
'\0';
1571 if ( (buffer-header) >= nwheader )
1577 else if ( ((buffer-header) + nwhc) > nwheader )
1578 nwhc = nwheader - (buffer-header);
1580 for (
int i = 0;i < nwhc; i++)
frombuf(buffer, &keytitle[i]);
1581 keytitle[(
int)nwhc] =
'\0';
1583 extrainfo.
Form(
" name: %-16s title: %s", keyname, keytitle);
1588 if (objlen != nbytes - keylen) {
1590 Printf(
"%d/%06d At:%-*lld N=%-8d %-14s CX = %5.2f %s", date, time, nDigits + 1, idcur, nbytes, classname,
1591 cx, extrainfo.
Data());
1593 Printf(
"%d/%06d At:%-*lld N=%-8d %-14s %s", date, time, nDigits + 1, idcur, nbytes, classname, extrainfo.
Data());
1597 if (objlen != nbytes - keylen) {
1599 Printf(
"At:%-*lld N=%-8d K=%-3d O=%-8d %-14s CX = %5.2f %s", nDigits+1, idcur, nbytes, keylen, objlen, classname, cx, extrainfo.
Data());
1601 Printf(
"At:%-*lld N=%-8d K=%-3d O=%-8d %-14s CX = 1 %s", nDigits+1, idcur, nbytes, keylen, objlen, classname, extrainfo.
Data());
1607 Printf(
"%d/%06d At:%-*lld N=%-8d %-14s",date,time, nDigits+1, idcur,1,
"END");
1609 Printf(
"At:%-*lld N=%-8d K= O= %-14s", nDigits+1, idcur,1,
"END");
1664 Error(
"ReadBuffer",
"error reading all requested bytes from file %s, got %ld of %d",
1711 Error(
"ReadBuffer",
"error reading all requested bytes from file %s, got %ld of %d",
1742 for (
Int_t j = 0; j < nbuf; j++) {
1756 char *buf2 =
nullptr;
1759 cur = pos[i]+len[i];
1762 if (bigRead || (i>=nbuf)) {
1776 Long64_t nahead = pos[i-1]+len[i-1]-curbegin;
1781 for (
Int_t j=0;j<
n;j++) {
1782 memcpy(&buf[k],&buf2[pos[i-
n+j]-curbegin],len[i-
n+j]);
1792 curbegin = i < nbuf ? pos[i] : 0;
1795 if (buf2)
delete [] buf2;
1845 if (fNbytesFree < 0 || fNbytesFree >
fEND) {
1881 snprintf(pidname,32,
"ProcessID%d",pidf);
1884 printf(
"ReadProcessID, name=%s, file=%s, pid=%lx\n",pidname,
GetName(),(
Long_t)pid);
1893 TIter next(pidslist);
1969 Int_t nbytes,date,time,objlen,nwheader;
1972 char *buffer, *bufread;
1977 if ((size =
GetSize()) == -1) {
1978 Error(
"Recover",
"cannot stat the file %s",
GetName());
1989 Int_t nread = nwheader;
1991 while (idcur <
fEND) {
1993 if (idcur+nread >=
fEND) nread =
fEND-idcur-1;
1996 Error(
"Recover",
"%s: failed to read the key data from disk at %lld.",
2004 Error(
"Recover",
"Address = %lld\tNbytes = %d\t=====E R R O R=======", idcur, nbytes);
2019 if (versionkey > 1000) {
2028 char *classname =
nullptr;
2029 if (nwhc <= 0 || nwhc > 100)
break;
2030 classname =
new char[nwhc+1];
2031 int i, nwhci = nwhc;
2032 for (i = 0;i < nwhc; i++)
frombuf(buffer, &classname[i]);
2033 classname[nwhci] =
'\0';
2037 && strcmp(classname,
"TBasket")) {
2038 key =
new TKey(
this);
2040 if (!strcmp(key->
GetName(),
"StreamerInfo")) {
2051 delete [] classname;
2056 if (max_file_size <
fEND) max_file_size =
fEND+1000000000;
2063 if (nrecov)
Write();
2086 if (opt !=
"READ" && opt !=
"UPDATE") {
2087 Error(
"ReOpen",
"mode must be either READ or UPDATE, not %s", opt.
Data());
2094 if (opt ==
"READ") {
2130 SysError(
"ReOpen",
"file %s can not be opened in read mode",
GetName());
2152 SysError(
"ReOpen",
"file %s can not be opened in update mode",
GetName());
2161 Warning(
"ReOpen",
"file %s probably not closed, cannot read free segments",
GetName());
2182 Error(
"SetOffset",
"seeking from end in archive is not (yet) supported");
2206 Error(
"Seek",
"seeking from end in archive is not (yet) supported");
2210 if ((retpos =
SysSeek(
fD, offset, whence)) < 0)
2211 SysError(
"Seek",
"cannot seek to position %lld in file %s, retpos=%lld",
2238 if (level < 0) level = 0;
2239 if (level > 99) level = 99;
2294 if (cache) cache->
SetFile(
this, action);
2324 if (
b.IsReading()) {
2327 b.WriteVersion(TFile::IsA());
2385 Error(
"Write const",
"A const TFile object should not be saved. We try to proceed anyway.");
2386 return const_cast<TFile*
>(
this)->
Write(
n, opt, bufsize);
2417 Error(
"WriteBuffer",
"error writing all requested bytes to file %s, wrote %ld of %d",
2444 Error(
"WriteBuffer",
"error writing to cache");
2469 auto createKey = [
this]() {
2473 while ((afree = (
TFree*) next())) {
2474 nbytes += afree->
Sizeof();
2476 if (!nbytes)
return (
TKey*)
nullptr;
2482 return (
TKey*)
nullptr;
2487 TKey *key = createKey();
2504 char *start = buffer;
2508 while ((afree = (
TFree*) next())) {
2513 auto actualBytes = buffer-start;
2514 if ( actualBytes != nbytes ) {
2515 if (actualBytes < nbytes) {
2518 memset(buffer,0,nbytes-actualBytes);
2520 Error(
"WriteFree",
"The free block list TKey wrote more data than expected (%d vs %ld). Most likely there has been an out-of-bound write.",nbytes,(
long int)actualBytes);
2537 const char *root =
"root";
2538 char *psave =
new char[
fBEGIN];
2539 char *buffer = psave;
2541 memcpy(buffer, root, 4); buffer += 4;
2544 tobuf(buffer, version);
2546 if (version < 1000000) {
2550 tobuf(buffer, nfree);
2560 tobuf(buffer, nfree);
2571 Int_t nbytes = buffer - psave;
2662 path +=
"/PROOF-INF";
2664 const char *afile = 0;
2667 if (strcmp(afile,
".") == 0)
continue;
2668 if (strcmp(afile,
"..") == 0)
continue;
2669 filepath.
Form(
"%s/%s", path.
Data(), afile);
2671 Warning(
"MakeProject",
"1: problems unlinking '%s' ('%s', '%s')", filepath.
Data(), path.
Data(), afile);
2678 if (strcmp(afile,
".") == 0)
continue;
2679 if (strcmp(afile,
"..") == 0)
continue;
2680 filepath.
Form(
"%s/%s", path.
Data(), afile);
2682 Warning(
"MakeProject",
"2: problems unlinking '%s' ('%s', '%s')", filepath.
Data(), path.
Data(), afile);
2686 Warning(
"MakeProject",
"problems unlinking '%s'", path.
Data());
2690 path.
Form(
"%s/%s/PROOF-INF", pardir.
Data(), parname.
Data());
2692 Error(
"MakeProject",
"problems creating '%s'", path.
Data());
2707 }
else if (opt.
Contains(
"recreate")) {
2711 Error(
"MakeProject",
"cannot create directory '%s'",dirname);
2719 if (strcmp(afile,
".") == 0)
continue;
2720 if (strcmp(afile,
"..") == 0)
continue;
2721 dirpath.
Form(
"%s/%s",dirname,afile);
2729 Error(
"MakeProject",
"cannot create directory %s, already existing",dirname);
2734 Error(
"MakeProject",
"cannot create directory '%s'",dirname);
2747 if (filelist) filelist = (
TList*)filelist->
Clone();
2749 Error(
"MakeProject",
"file %s has no StreamerInfo",
GetName());
2753 TString clean_dirname(dirname);
2754 if (makepar) clean_dirname.
Form(
"%s/%s", pardir.
Data(), parname.
Data());
2755 if (clean_dirname[clean_dirname.
Length()-1]==
'/') {
2757 }
else if (clean_dirname[clean_dirname.
Length()-1]==
'\\') {
2759 if (clean_dirname[clean_dirname.
Length()-1]==
'\\') {
2764 if (makepar) subdirname = parname;
2765 if (subdirname ==
"") {
2766 Error(
"MakeProject",
"Directory name must not be empty.");
2771 TString spath; spath.
Form(
"%s/%sProjectSource.cxx",clean_dirname.
Data(),subdirname.
Data());
2772 FILE *sfp = fopen(spath.
Data(),
"w");
2774 Error(
"MakeProject",
"Unable to create the source file %s.",spath.
Data());
2777 fprintf(sfp,
"namespace std {}\nusing namespace std;\n");
2778 fprintf(sfp,
"#include \"%sProjectHeaders.h\"\n\n",subdirname.
Data() );
2779 if (!
genreflex) fprintf(sfp,
"#include \"%sLinkDef.h\"\n\n",subdirname.
Data() );
2780 fprintf(sfp,
"#include \"%sProjectDict.cxx\"\n\n",subdirname.
Data() );
2781 fprintf(sfp,
"struct DeleteObjectFunctor {\n");
2782 fprintf(sfp,
" template <typename T>\n");
2783 fprintf(sfp,
" void operator()(const T *ptr) const {\n");
2784 fprintf(sfp,
" delete ptr;\n");
2785 fprintf(sfp,
" }\n");
2786 fprintf(sfp,
" template <typename T, typename Q>\n");
2787 fprintf(sfp,
" void operator()(const std::pair<T,Q> &) const {\n");
2788 fprintf(sfp,
" // Do nothing\n");
2789 fprintf(sfp,
" }\n");
2790 fprintf(sfp,
" template <typename T, typename Q>\n");
2791 fprintf(sfp,
" void operator()(const std::pair<T,Q*> &ptr) const {\n");
2792 fprintf(sfp,
" delete ptr.second;\n");
2793 fprintf(sfp,
" }\n");
2794 fprintf(sfp,
" template <typename T, typename Q>\n");
2795 fprintf(sfp,
" void operator()(const std::pair<T*,Q> &ptr) const {\n");
2796 fprintf(sfp,
" delete ptr.first;\n");
2797 fprintf(sfp,
" }\n");
2798 fprintf(sfp,
" template <typename T, typename Q>\n");
2799 fprintf(sfp,
" void operator()(const std::pair<T*,Q*> &ptr) const {\n");
2800 fprintf(sfp,
" delete ptr.first;\n");
2801 fprintf(sfp,
" delete ptr.second;\n");
2802 fprintf(sfp,
" }\n");
2803 fprintf(sfp,
"};\n\n");
2810 TIter flnext(filelist);
2814 if (info->IsA() != TStreamerInfo::Class()) {
2817 if (strstr(info->
GetName(),
"@@")) {
2834 for(
auto rule : rules) {
2835 if( rule->IsRenameRule() || rule->IsAliasRule() )
2838 if ( rule->HasTarget( el->
GetName()) && rule->GetAttributes()[0] != 0 ) {
2839 TString attr( rule->GetAttributes() );
2865 TIter nextextra(&extrainfos);
2868 filelist->
Add(info);
2875 if (info->IsA() != TStreamerInfo::Class()) {
2879 TIter subnext(list);
2884 if (subinfo->IsA() != TStreamerInfo::Class()) {
2891 if ( (sublen > len) && subinfo->
GetName()[len+1]==
':'
2894 subClasses.
Add(subinfo);
2899 subClasses.
Clear(
"nodelete");
2901 extrainfos.
Clear(
"nodelete");
2904 path.
Form(
"%s/%sProjectHeaders.h",clean_dirname.
Data(),subdirname.
Data());
2905 FILE *allfp = fopen(path,
"a");
2907 Error(
"MakeProject",
"Cannot open output file:%s\n",path.
Data());
2909 fprintf(allfp,
"#include \"%sProjectInstances.h\"\n", subdirname.
Data());
2913 printf(
"MakeProject has generated %d classes in %s\n",ngener,clean_dirname.
Data());
2916 if (!opt.
Contains(
"+") && !makepar) {
2924 FILE *fpMAKE =
nullptr;
2929 path.
Form(
"%s/makep.cmd",clean_dirname.
Data());
2931 path.
Form(
"%s/MAKEP",clean_dirname.
Data());
2934 fpMAKE = fopen(path,
"wb");
2936 fpMAKE = fopen(path,
"w");
2939 Error(
"MakeProject",
"cannot open file %s", path.
Data());
2948 FILE *ifp =
nullptr;
2949 path.
Form(
"%s/%sProjectInstances.h",clean_dirname.
Data(),subdirname.
Data());
2951 ifp = fopen(path,
"wb");
2953 ifp = fopen(path,
"w");
2956 Error(
"MakeProject",
"cannot open path file %s", path.
Data());
2966 fprintf(fpMAKE,
"genreflex %sProjectHeaders.h -o %sProjectDict.cxx --comments --iocomments %s ",subdirname.
Data(),subdirname.
Data(),
gSystem->
GetIncludePath());
2967 path.
Form(
"%s/%sSelection.xml",clean_dirname.
Data(),subdirname.
Data());
2970 path.
Form(
"%s/%sLinkDef.h",clean_dirname.
Data(),subdirname.
Data());
2973 path.
Form(
"%s/%sLinkDef.h",clean_dirname.
Data(),subdirname.
Data());
2979 FILE *fp = fopen(path,
"wb");
2981 FILE *fp = fopen(path,
"w");
2984 Error(
"MakeProject",
"cannot open path file %s", path.
Data());
2993 fprintf(fp,
"<lcgdict>\n");
2996 fprintf(fp,
"#ifdef __CINT__\n");
3005 if (info->IsA() != TStreamerInfo::Class()) {
3008 if (strncmp(info->
GetName(),
"auto_ptr<", strlen(
"auto_ptr<")) == 0) {
3017 for(
auto rule : rules) {
3020 rule->AsString(strrule,
"x");
3023 selections.
Append(strrule);
3026 rule->AsString(strrule);
3027 if (strncmp(strrule.
Data(),
"type=",5)==0) {
3030 fprintf(fp,
"#pragma %s;\n",strrule.
Data());
3037 std::vector<std::string> inside;
3044 switch ( stlkind ) {
3048 what =
"std::pair<";
3058 tmp.
Form(
"<class name=\"%s\" />\n",
what.Data());
3062 tmp.
Form(
"template class %s;\n",
what.Data());
3070 fprintf(fp,
"#pragma link C++ class %s+;\n",
what.Data());
3078 tmp.
Form(
"<class name=\"%s\" />\n",key->
GetName());
3088 fprintf(fp,
"#pragma link C++ class %s+;\n",key->
GetName());
3099 tmp.
Form(
"<class name=\"%s\" />\n",
what.Data());
3103 if (
what[
what.Length()-1] ==
'>') {
3104 tmp.
Form(
"template class %s;\n",
what.Data());
3111 fprintf(fp,
"#pragma link C++ class %s+;\n",
what.Data());
3121 tmp.
Form(
"<class name=\"%s\" />\n",
what.Data());
3125 tmp.
Form(
"template class %s;\n",
what.Data());
3134 fprintf(ifp,
"#ifndef PROJECT_INSTANCES_H\n");
3135 fprintf(ifp,
"#define PROJECT_INSTANCES_H\n");
3136 fprintf(ifp,
"%s",instances.
Data());
3137 fprintf(ifp,
"#endif\n");
3138 fprintf(fp,
"%s",selections.
Data());
3139 fprintf(fp,
"</lcgdict>\n");
3141 fprintf(fp,
"#endif\n");
3155 cmd.
ReplaceAll(
"$ObjectFiles",
object.Data());
3162 TString rootbuild = ROOTBUILD;
3171 fprintf(fpMAKE,
"-s %sSelection.xml \n",subdirname.
Data());
3173 fprintf(fpMAKE,
"%sProjectHeaders.h ",subdirname.
Data());
3174 fprintf(fpMAKE,
"%sLinkDef.h \n",subdirname.
Data());
3177 fprintf(fpMAKE,
"%s\n",cmd.
Data());
3179 printf(
"%s/MAKEP file has been generated\n", clean_dirname.
Data());
3188 Error(
"MakeProject",
"problems creating PAR make file '%s'", filemake.
Data());
3197 Warning(
"MakeProject",
"problems expanding '%s'", mkarchsrc.
Data());
3200 Error(
"MakeProject",
"problems retrieving '%s' to '%s'", mkarchsrc.
Data(), mkarchdst.
Data());
3209 Error(
"MakeProject",
"problems creating BUILD.sh and/or SETUP.C under '%s'", proofinf.
Data());
3222 chmod(cmod.
Data(), 00700);
3224 Printf(
"Files Makefile, Makefile.arch, PROOF-INF/BUILD.sh and"
3225 " PROOF-INF/SETUP.C have been generated under '%s'", clean_dirname.
Data());
3234 Info(
"MakeProject",
"PAR file %s.par generated", clean_dirname.
Data());
3236 Warning(
"MakeProject",
"problems changing directory back to '%s'", curdir.
Data());
3239 Error(
"MakeProject",
"problems changing directory to '%s' - skipping PAR file generation", pardir.
Data());
3242 Warning(
"MakeProject",
"on Windows systems the PAR file cannot be generated out of the package directory!");
3247 if (!makepar && !opt.
Contains(
"nocompilation")) {
3256 chmod(
"makep.cmd",00700);
3261 if (res) printf(
"Shared lib %s has been generated\n",path.
Data());
3266 if (res) printf(
"Shared lib %s has been dynamically linked\n",path.
Data());
3284 if (!filemake || (filemake && strlen(filemake) <= 0)) {
3285 Error(
"MakeProjectParMake",
"path for output file undefined!");
3290 if (!pack || (pack && strlen(pack) <= 0)) {
3291 Error(
"MakeProjectParMake",
"package name undefined!");
3296 FILE *fmk = fopen(filemake,
"wb");
3298 FILE *fmk = fopen(filemake,
"w");
3306 fprintf(fmk,
"# Makefile for the ROOT test programs.\n");
3307 fprintf(fmk,
"# This Makefile shows how to compile and link applications\n");
3308 fprintf(fmk,
"# using the ROOT libraries on all supported platforms.\n");
3309 fprintf(fmk,
"#\n");
3310 fprintf(fmk,
"# Copyright (c) 2000 Rene Brun and Fons Rademakers\n");
3311 fprintf(fmk,
"#\n");
3312 fprintf(fmk,
"# Author: this makefile has been automatically generated via TFile::MakeProject\n");
3314 fprintf(fmk,
"include Makefile.arch\n");
3316 fprintf(fmk,
"#------------------------------------------------------------------------------\n");
3318 fprintf(fmk,
"PACKO = %sProjectSource.$(ObjSuf)\n", pack);
3319 fprintf(fmk,
"PACKS = %sProjectSource.$(SrcSuf) %sProjectDict.$(SrcSuf)\n", pack, pack);
3320 fprintf(fmk,
"PACKSO = lib%s.$(DllSuf)\n", pack);
3322 fprintf(fmk,
"ifeq ($(PLATFORM),win32)\n");
3323 fprintf(fmk,
"PACKLIB = lib%s.lib\n", pack);
3324 fprintf(fmk,
"else\n");
3325 fprintf(fmk,
"PACKLIB = $(PACKSO)\n");
3326 fprintf(fmk,
"endif\n");
3328 fprintf(fmk,
"OBJS = $(PACKO)\n");
3330 fprintf(fmk,
"PROGRAMS =\n");
3332 fprintf(fmk,
"#------------------------------------------------------------------------------\n");
3334 fprintf(fmk,
".SUFFIXES: .$(SrcSuf) .$(ObjSuf) .$(DllSuf)\n");
3336 fprintf(fmk,
"all: $(PACKLIB)\n");
3338 fprintf(fmk,
"$(PACKSO): $(PACKO)\n");
3339 fprintf(fmk,
"ifeq ($(ARCH),aix)\n");
3340 fprintf(fmk,
"\t\t/usr/ibmcxx/bin/makeC++SharedLib $(OutPutOpt) $@ $(LIBS) -p 0 $^\n");
3341 fprintf(fmk,
"else\n");
3342 fprintf(fmk,
"ifeq ($(ARCH),aix5)\n");
3343 fprintf(fmk,
"\t\t/usr/vacpp/bin/makeC++SharedLib $(OutPutOpt) $@ $(LIBS) -p 0 $^\n");
3344 fprintf(fmk,
"else\n");
3345 fprintf(fmk,
"ifeq ($(PLATFORM),macosx)\n");
3346 fprintf(fmk,
"# We need to make both the .dylib and the .so\n");
3347 fprintf(fmk,
"\t\t$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(LIBS)\n");
3348 fprintf(fmk,
"ifneq ($(subst $(MACOSX_MINOR),,1234),1234)\n");
3349 fprintf(fmk,
"ifeq ($(MACOSX_MINOR),4)\n");
3350 fprintf(fmk,
"\t\tln -sf $@ $(subst .$(DllSuf),.so,$@)\n");
3351 fprintf(fmk,
"else\n");
3352 fprintf(fmk,
"\t\t$(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ \\\n");
3353 fprintf(fmk,
"\t\t $(OutPutOpt) $(subst .$(DllSuf),.so,$@)\n");
3354 fprintf(fmk,
"endif\n");
3355 fprintf(fmk,
"endif\n");
3356 fprintf(fmk,
"else\n");
3357 fprintf(fmk,
"ifeq ($(PLATFORM),win32)\n");
3358 fprintf(fmk,
"\t\tbindexplib $* $^ > $*.def\n");
3359 fprintf(fmk,
"\t\tlib -nologo -MACHINE:IX86 $^ -def:$*.def \\\n");
3360 fprintf(fmk,
"\t\t $(OutPutOpt)$(PACKLIB)\n");
3361 fprintf(fmk,
"\t\t$(LD) $(SOFLAGS) $(LDFLAGS) $^ $*.exp $(LIBS) \\\n");
3362 fprintf(fmk,
"\t\t $(OutPutOpt)$@\n");
3363 fprintf(fmk,
"else\n");
3364 fprintf(fmk,
"\t\t$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(LIBS) $(EXPLLINKLIBS)\n");
3365 fprintf(fmk,
"endif\n");
3366 fprintf(fmk,
"endif\n");
3367 fprintf(fmk,
"endif\n");
3368 fprintf(fmk,
"endif\n");
3369 fprintf(fmk,
"\t\t@echo \"$@ done\"\n");
3371 fprintf(fmk,
"clean:\n");
3372 fprintf(fmk,
"\t\t@rm -f $(OBJS) core\n");
3374 fprintf(fmk,
"distclean: clean\n");
3375 fprintf(fmk,
"\t\t@rm -f $(PROGRAMS) $(PACKSO) $(PACKLIB) *Dict.* *.def *.exp \\\n");
3376 fprintf(fmk,
"\t\t *.so *.lib *.dll *.d *.log .def so_locations\n");
3377 fprintf(fmk,
"\t\t@rm -rf cxx_repository\n");
3379 fprintf(fmk,
"# Dependencies\n");
3381 fprintf(fmk,
"%sProjectSource.$(ObjSuf): %sProjectHeaders.h %sLinkDef.h %sProjectDict.$(SrcSuf)\n", pack, pack, pack, pack);
3383 fprintf(fmk,
"%sProjectDict.$(SrcSuf): %sProjectHeaders.h %sLinkDef.h\n", pack, pack, pack);
3384 fprintf(fmk,
"\t\t@echo \"Generating dictionary $@...\"\n");
3385 fprintf(fmk,
"\t\t@rootcint -f $@ $^\n");
3387 fprintf(fmk,
".$(SrcSuf).$(ObjSuf):\n");
3388 fprintf(fmk,
"\t\t$(CXX) $(CXXFLAGS) -c $<\n");
3406 if (!proofinf || (proofinf && strlen(proofinf) <= 0)) {
3407 Error(
"MakeProjectParProofInf",
"directory path undefined!");
3415 Error(
"MakeProjectParProofInf",
"path '%s' %s", proofinf,
3416 ((rcst == 0) ?
"is not a directory" :
"does not exist"));
3421 if (!pack || (pack && strlen(pack) <= 0)) {
3422 Error(
"MakeProjectParProofInf",
"package name undefined!");
3429 path.
Form(
"%s/BUILD.sh", proofinf);
3431 FILE *
f = fopen(path.
Data(),
"wb");
3433 FILE *
f = fopen(path.
Data(),
"w");
3436 Error(
"MakeProjectParProofInf",
"cannot create file '%s' (errno: %d)",
3441 fprintf(
f,
"#! /bin/sh\n");
3442 fprintf(
f,
"# Build libEvent library.\n");
3445 fprintf(
f,
"# The environment variables ROOTPROOFLITE and ROOTPROOFCLIENT can be used to\n");
3446 fprintf(
f,
"# adapt the script to the calling environment\n");
3448 fprintf(
f,
"# if test ! \"x$ROOTPROOFLITE\" = \"x\"; then\n");
3449 fprintf(
f,
"# echo \"event-BUILD: PROOF-Lite node (session has $ROOTPROOFLITE workers)\"\n");
3450 fprintf(
f,
"# elif test ! \"x$ROOTPROOFCLIENT\" = \"x\"; then\n");
3451 fprintf(
f,
"# echo \"event-BUILD: PROOF client\"\n");
3452 fprintf(
f,
"# else\n");
3453 fprintf(
f,
"# echo \"event-BUILD: standard PROOF node\"\n");
3454 fprintf(
f,
"# fi\n");
3456 fprintf(
f,
"if [ \"\" = \"clean\" ]; then\n");
3457 fprintf(
f,
" make distclean\n");
3458 fprintf(
f,
" exit 0\n");
3461 fprintf(
f,
"make\n");
3462 fprintf(
f,
"rc=$?\n");
3463 fprintf(
f,
"echo \"rc=$?\"\n");
3464 fprintf(
f,
"if [ $? != \"0\" ] ; then\n");
3465 fprintf(
f,
" exit 1\n");
3467 fprintf(
f,
"exit 0\n");
3473 path.
Form(
"%s/SETUP.C", proofinf);
3475 f = fopen(path.
Data(),
"wb");
3477 f = fopen(path.
Data(),
"w");
3480 Error(
"MakeProjectParProofInf",
"cannot create file '%s' (errno: %d)",
3485 fprintf(
f,
"Int_t SETUP()\n");
3489 fprintf(
f,
"// The environment variables ROOTPROOFLITE and ROOTPROOFCLIENT can be used to\n");
3490 fprintf(
f,
"// adapt the macro to the calling environment\n");
3492 fprintf(
f,
"// if (gSystem->Getenv(\"ROOTPROOFLITE\")) {\n");
3493 fprintf(
f,
"// Printf(\"event-SETUP: PROOF-Lite node (session has %%s workers)\",\n");
3494 fprintf(
f,
"// gSystem->Getenv(\"ROOTPROOFLITE\"));\n");
3495 fprintf(
f,
"// } else if (gSystem->Getenv(\"ROOTPROOFCLIENT\")) {\n");
3496 fprintf(
f,
"// Printf(\"event-SETUP: PROOF client\");\n");
3497 fprintf(
f,
"// } else {\n");
3498 fprintf(
f,
"// Printf(\"event-SETUP: standard PROOF node\");\n");
3499 fprintf(
f,
"// }\n");
3501 fprintf(
f,
" if (gSystem->Load(\"lib%s\") == -1)\n", pack);
3502 fprintf(
f,
" return -1;\n");
3503 fprintf(
f,
" return 0;\n");
3525 TList *list = listRetcode.fList;
3526 auto retcode = listRetcode.fReturnCode;
3539 if (version > 1000000) version -= 1000000;
3540 if (version < 53419 || (59900 < version && version < 59907)) {
3547 if (!info || info->IsA() != TStreamerInfo::Class()) {
3555 if (!base)
continue;
3567 for (
int mode=0;mode<2; ++mode) {
3577 if (info->IsA() != TStreamerInfo::Class()) {
3580 if (strcmp(obj->
GetName(),
"listOfRules")==0) {
3588 rulelnk = rulelnk->
Next();
3592 Warning(
"ReadStreamerInfo",
"%s has a %s in the list of TStreamerInfo.",
GetName(), info->IsA()->
GetName());
3602 Warning(
"ReadStreamerInfo",
"The StreamerInfo for %s does not have a list of elements.",info->
GetName());
3607 Bool_t isstl = element && strcmp(
"This",element->
GetName())==0;
3609 if ( (!isstl && mode ==0) || (isstl && mode ==1) ) {
3618 printf(
"ReadStreamerInfo, class:%s, illegal uid=%d\n",info->
GetName(),uid);
3684 for (
Int_t i=0;i<npids;i++) {
3696 Info(
"WriteProcessID",
"name=%s, file=%s", name,
GetName());
3730 listOfRules.
SetName(
"listOfRules");
3731 std::set<TClass*> classSet;
3737 if (
gDebug > 0) printf(
" -class: %s info number %d saved\n",info->
GetName(),uid);
3743 if ( classSet.find( clinfo ) == classSet.end() ) {
3744 if (
gDebug > 0) printf(
" -class: %s stored the I/O customization rules\n",info->
GetName());
3751 listOfRules.
Add(obj);
3753 classSet.insert(clinfo);
3764 list.
Add(&listOfRules);
3796 "you want to read through a cache, but you have no valid cache "
3797 "directory set - reading remotely");
3798 ::Info(
"TFile::OpenFromCache",
"set cache directory using TFile::SetCacheFileDir()");
3807 "you want to read through a cache, but you are reading "
3808 "local files - CACHEREAD disabled");
3815 cachefilepath += fileurl.
GetFile();
3819 ::Warning(
"TFile::OpenFromCache",
"you want to read through a cache, but I "
3820 "cannot create the directory %s - CACHEREAD disabled",
3821 cachefilepathbasedir.
Data());
3826 cachefilepath +=
"__";
3830 if (strstr(
name,
"zip=")) {
3835 Int_t optioncount = 0;
3844 if (optioncount!=0) {
3849 newoptions += value;
3859 cachefilepath +=
"__";
3860 cachefilepath += zipname;
3874 char cacheblock[256];
3875 char remotblock[256];
3878 cfurl = cachefilepath;
3879 cfurl +=
"?filetype=raw";
3882 ropt +=
"&filetype=raw";
3895 ::Error(
"TFile::OpenFromCache",
3896 "cannot open the cache file to check cache consistency");
3901 ::Error(
"TFile::OpenFromCache",
3902 "cannot open the remote file to check cache consistency");
3909 if ((!cachefile->
ReadBuffer(cacheblock,256)) &&
3911 if (memcmp(cacheblock, remotblock, 256)) {
3912 ::Warning(
"TFile::OpenFromCache",
"the header of the cache file "
3913 "differs from the remote file - forcing an update");
3917 ::Warning(
"TFile::OpenFromCache",
"the header of the cache and/or "
3918 "remote file are not readable - forcing an update");
3933 ::Warning(
"TFile::OpenFromCache",
"you want to read through a cache, but I "
3934 "cannot make a cache copy of %s - CACHEREAD disabled",
3935 cachefilepathbasedir.
Data());
3941 ::Info(
"TFile::OpenFromCache",
"using local cache copy of %s [%s]",
3945 fileurl.
SetFile(cachefilepath);
3949 tagfile = cachefilepath;
3950 tagfile +=
".ROOT.cachefile";
4006 if (!url || strlen(url) <= 0) {
4007 ::Error(
"TFile::Open",
"no url specified");
4020 TString sto = opts(ito + strlen(
"TIMEOUT="), opts.
Length());
4025 if (
gDebug > 0)
::Info(
"TFile::Open",
"timeout of %d millisec requested", toms);
4027 sto.
Insert(0,
"TIMEOUT=");
4045 ::Info(
"TFile::Open",
"waited %d millisec for asynchronous open", toms - xtms);
4047 ::Info(
"TFile::Open",
"timeout option not supported (requires asynchronous"
4052 ::Error(
"TFile::Open",
"timeout expired while opening '%s'", expandedUrl.
Data());
4059 ::Warning(
"TFile::Open",
"incomplete 'TIMEOUT=' option specification - ignored");
4065 const char *option = opts;
4068 TString namelist(expandedUrl);
4085 while (namelist.
Tokenize(
n, from,
"|") && !
f) {
4088 if (!strcasecmp(option,
"CACHEREAD") ||
4115 f = (
TFile*)
gROOT->ProcessLineFast(
TString::Format(
"new TParallelMergingFile(\"%s\",\"%s\",\"%s\",%d)",
n.Data(),option,ftitle,compress));
4128 lfname = urlname.
GetUrl();
4130 f =
new TFile(lfname.
Data(), option, ftitle, compress);
4135 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name))) {
4136 if (
h->LoadPlugin() == -1)
4138 f = (
TFile*)
h->ExecPlugin(5,
name.Data(), option, ftitle, compress, netopt);
4144 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name))) {
4145 if (
h->LoadPlugin() == -1)
4147 f = (
TFile*)
h->ExecPlugin(2,
name.Data(), option);
4153 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name)) &&
4154 h->LoadPlugin() == 0) {
4155 name.ReplaceAll(
"file:",
"");
4156 f = (
TFile*)
h->ExecPlugin(4,
name.Data(), option, ftitle, compress);
4158 f =
new TFile(
name.Data(), option, ftitle, compress);
4163 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name.Data()))) {
4164 if (
h->LoadPlugin() == -1)
4168 f = (
TFile*)
h->ExecPlugin(5,
name.Data(), option, ftitle, compress, netopt);
4170 f = (
TFile*)
h->ExecPlugin(4,
name.Data(), option, ftitle, compress);
4179 if (
f &&
f->IsZombie()) {
4202 f &&
f->IsWritable() && !
f->IsRaw()) {
4237 const char *ftitle,
Int_t compress,
4245 if (!url || strlen(url) <= 0) {
4246 ::Error(
"TFile::AsyncOpen",
"no url specified");
4258 TString outf =
".TFileAsyncOpen_";
4269 while (namelist.
Tokenize(
n, from,
"|") && !
f) {
4284 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name)) &&
4285 (!strcmp(
h->GetClass(),
"TXNetFile") || !strcmp(
h->GetClass(),
"TNetXNGFile"))
4286 &&
h->LoadPlugin() == 0) {
4291 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name)) &&
4292 !strcmp(
h->GetClass(),
"TAlienFile") &&
h->LoadPlugin() == 0) {
4293 f = (
TFile*)
h->ExecPlugin(5,
name.Data(), option, ftitle, compress,
kTRUE);
4303 if (!notfound && !
f)
4348 if ((
f = fh->
GetFile()) && !(
f->IsZombie())) {
4350 Bool_t cr = (!strcmp(
f->GetOption(),
"CREATE") ||
4351 !strcmp(
f->GetOption(),
"RECREATE") ||
4362 if (
f)
f->fAsyncHandle = fh;
4374#if defined(R__WINGCC)
4377 return ::open(pathname, flags |
O_BINARY, mode);
4378#elif defined(R__SEEK64)
4379 return ::open64(pathname, flags, mode);
4381 return ::open(pathname, flags, mode);
4390 if (fd < 0)
return 0;
4399 return ::read(fd, buf, len);
4407 return ::write(fd, buf, len);
4418#if defined (R__SEEK64)
4419 return ::lseek64(fd, offset, whence);
4421 return ::_lseeki64(fd, offset, whence);
4423 return ::lseek(fd, offset, whence);
4450 return ::_commit(fd);
4521 if (!cached.EndsWith(
"/"))
4528 ::Error(
"TFile::SetCacheFileDir",
"no sufficient permissions on cache directory %s or cannot create it",
TString(cachedir).Data());
4570 cachetagfile +=
".tag.ROOT.cache";
4574 if (lastcleanuptime < cleanupinterval) {
4575 ::Info(
"TFile::ShrinkCacheFileDir",
"clean-up is skipped - last cleanup %lu seconds ago - you requested %lu", lastcleanuptime, cleanupinterval);
4581 cachetagfile +=
"?filetype=raw";
4582 TFile *tagfile =
nullptr;
4584 if (!(tagfile =
TFile::Open(cachetagfile,
"RECREATE"))) {
4585 ::Error(
"TFile::ShrinkCacheFileDir",
"cannot create the cache tag file %s", cachetagfile.
Data());
4593#if defined(R__WIN32)
4594 cmd =
"echo <TFile::ShrinkCacheFileDir>: cleanup to be implemented";
4595#elif defined(R__MACOSX)
4596 cmd.
Form(
"perl -e 'my $cachepath = \"%s\"; my $cachesize = %lld;my $findcommand=\"find $cachepath -type f -exec stat -f \\\"\\%%a::\\%%N::\\%%z\\\" \\{\\} \\\\\\;\";my $totalsize=0;open FIND, \"$findcommand | sort -k 1 |\";while (<FIND>) { my ($accesstime, $filename, $filesize) = split \"::\",$_; $totalsize += $filesize;if ($totalsize > $cachesize) {if ( ( -e \"${filename}.ROOT.cachefile\" ) || ( -e \"${filename}\" ) ) {unlink \"$filename.ROOT.cachefile\";unlink \"$filename\";}}}close FIND;' ",
fgCacheFileDir.
Data(),shrinksize);
4598 cmd.
Form(
"perl -e 'my $cachepath = \"%s\"; my $cachesize = %lld;my $findcommand=\"find $cachepath -type f -exec stat -c \\\"\\%%x::\\%%n::\\%%s\\\" \\{\\} \\\\\\;\";my $totalsize=0;open FIND, \"$findcommand | sort -k 1 |\";while (<FIND>) { my ($accesstime, $filename, $filesize) = split \"::\",$_; $totalsize += $filesize;if ($totalsize > $cachesize) {if ( ( -e \"${filename}.ROOT.cachefile\" ) || ( -e \"${filename}\" ) ) {unlink \"$filename.ROOT.cachefile\";unlink \"$filename\";}}}close FIND;' ",
fgCacheFileDir.
Data(),shrinksize);
4605 ::Error(
"TFile::ShrinkCacheFileDir",
"error executing clean-up script");
4735 forceRemote =
kTRUE;
4736 else if (opts.
Contains(
"remote=0"))
4745 if (fname[0] ==
'/') {
4747 lfname.
Form(
"%s%s", prefix->
Data(), fname);
4750 }
else if (fname[0] ==
'~' || fname[0] ==
'$') {
4768 if (localFile && prefix)
4775 }
else if (
TPMERegexp(
"^(http[s]?|s3http[s]?|[a]?s3|gs|gshttp[s]?){1}:",
"i").Match(
name)) {
4779 }
else if (!strncmp(
name,
"file:", 5)) {
4805 if (of && (of->
GetSize() > 0)) {
4808 while ((
f = (
TFile *)nxf()))
4809 if (
f->Matches(
name))
4822 if (handle && handle->
fFile) {
4852 if (of && (of->
GetSize() > 0)) {
4855 while ((
f = (
TFile *)nxf()))
4856 if (
f->Matches(
name))
4861 return (
const TUrl *)
nullptr;
4869 fprintf(stderr,
"[TFile::Cp] Total %.02f MB\t|", (
Double_t)size/1048576);
4871 for (
int l = 0;
l < 20;
l++) {
4873 if (
l < 20*bytesread/size)
4874 fprintf(stderr,
"=");
4875 else if (
l == 20*bytesread/size)
4876 fprintf(stderr,
">");
4877 else if (
l > 20*bytesread/size)
4878 fprintf(stderr,
".");
4880 fprintf(stderr,
"=");
4886 fprintf(stderr,
"| %.02f %% [%.01f MB/s]\r",
4887 100.0*(size?(bytesread/((
float)size)):1), (lCopy_time>0.)?bytesread/lCopy_time/1048576.:0.);
4911 if (opt !=
"") opt +=
"&";
4920 char *copybuffer =
nullptr;
4922 TFile *sfile =
this;
4923 TFile *dfile =
nullptr;
4939 ::Error(
"TFile::Cp",
"cannot open destination file %s", dst);
4945 rmdestiferror =
kTRUE;
4950 copybuffer =
new char[buffersize];
4952 ::Error(
"TFile::Cp",
"cannot allocate the copy buffer");
4957 Long64_t read, written, totalread, filesize, b00;
4967 if (progressbar)
CpProgress(totalread, filesize,watch);
4972 if (filesize - b1 > (
Long64_t)buffersize) {
4973 readsize = buffersize;
4975 readsize = filesize - b1;
4978 if (readsize == 0)
break;
4984 if ((read <= 0) || readop) {
4985 ::Error(
"TFile::Cp",
"cannot read from source file %s. readsize=%lld read=%lld readop=%d",
4986 sfile->
GetName(), readsize, read, readop);
4993 if ((written != read) || writeop) {
4994 ::Error(
"TFile::Cp",
"cannot write %lld bytes to destination file %s", read, dst);