SNAP Library 2.4, User Reference  2015-05-11 19:40:56
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
zipfl.cpp
Go to the documentation of this file.
1 // ZIP Input-File
3 
4 #if defined(GLib_WIN)
5  TStr TZipIn::SevenZipPath = "C:\\7Zip";
6 #elif defined(GLib_CYGWIN)
7  TStr TZipIn::SevenZipPath = "/usr/bin";
8 #elif defined(GLib_MACOSX)
9  TStr TZipIn::SevenZipPath = "/usr/local/bin";
10 #else
11  TStr TZipIn::SevenZipPath = "/usr/bin";
12 #endif
13 
14 
16 const int TZipIn::MxBfL=32*1024;
17 
18 void TZipIn::CreateZipProcess(const TStr& Cmd, const TStr& ZipFNm) {
19  const TStr CmdLine = TStr::Fmt("%s %s", Cmd.CStr(), ZipFNm.CStr());
20  #ifdef GLib_WIN
21  PROCESS_INFORMATION piProcInfo;
22  STARTUPINFO siStartInfo;
23  ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION));
24  ZeroMemory( &siStartInfo, sizeof(STARTUPINFO));
25  siStartInfo.cb = sizeof(STARTUPINFO);
26  siStartInfo.hStdOutput = ZipStdoutWr;
27  siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
28  // Create the child process.
29  const BOOL FuncRetn = CreateProcess(NULL,
30  (LPSTR) CmdLine.CStr(), // command line
31  NULL, // process security attributes
32  NULL, // primary thread security attributes
33  TRUE, // handles are inherited
34  0, // creation flags
35  NULL, // use parent's environment
36  NULL, // use parent's current directory
37  &siStartInfo, // STARTUPINFO pointer
38  &piProcInfo); // receives PROCESS_INFORMATION
39  EAssertR(FuncRetn!=0, TStr::Fmt("Can not execute '%s'", CmdLine.CStr()).CStr());
40  CloseHandle(piProcInfo.hProcess);
41  CloseHandle(piProcInfo.hThread);
42  #else
43  ZipStdoutRd = popen(CmdLine.CStr(), "r");
44  if (ZipStdoutRd == 0) { // try using SevenZipPath
45  ZipStdoutRd = popen((TZipIn::SevenZipPath+"/"+CmdLine).CStr(), "r");
46  }
47  EAssertR(ZipStdoutRd != NULL, TStr::Fmt("Can not execute '%s'", CmdLine.CStr()).CStr());
48  #endif
49 }
50 
52  EAssertR(CurFPos < FLen, "End of file "+GetSNm()+" reached.");
53  EAssertR((BfC==BfL)/*&&((BfL==-1)||(BfL==MxBfL))*/, "Error reading file '"+GetSNm()+"'.");
54  #ifdef GLib_WIN
55  // Read output from the child process
56  DWORD BytesRead;
57  EAssert(ReadFile(ZipStdoutRd, Bf, MxBfL, &BytesRead, NULL) != 0);
58  #else
59  size_t BytesRead = fread(Bf, 1, MxBfL, ZipStdoutRd);
60  EAssert(BytesRead != 0);
61  #endif
62  BfL = (int) BytesRead;
63  CurFPos += BytesRead;
64  EAssertR((BfC!=0)||(BfL!=0), "Error reading file '"+GetSNm()+"'.");
65  BfC = 0;
66 }
67 
68 TZipIn::TZipIn(const TStr& FNm) : TSBase(FNm.CStr()), TSIn(FNm), ZipStdoutRd(NULL), ZipStdoutWr(NULL),
69  FLen(0), CurFPos(0), Bf(NULL), BfC(0), BfL(0) {
70  EAssertR(! FNm.Empty(), "Empty file-name.");
71  EAssertR(TFile::Exists(FNm), TStr::Fmt("File %s does not exist", FNm.CStr()).CStr());
72  FLen = 0;
73  // non-zip files not supported, need uncompressed file length information
74  if (FNm.GetFExt() != ".zip") {
75  printf("*** Error: file %s, compression format %s not supported\n", FNm.CStr(), FNm.GetFExt().CStr());
76  EFailR(TStr::Fmt("File %s: compression format %s not supported", FNm.CStr(), FNm.GetFExt().CStr()).CStr());
77  }
78  FLen = TZipIn::GetFLen(FNm);
79  // return for malformed files
80  if (FLen == 0) { return; } // empty file
81  #ifdef GLib_WIN
82  // create pipes
83  SECURITY_ATTRIBUTES saAttr;
84  saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
85  saAttr.bInheritHandle = TRUE;
86  saAttr.lpSecurityDescriptor = NULL;
87  // Create a pipe for the child process's STDOUT.
88  const int PipeBufferSz = 32*1024;
89  EAssertR(CreatePipe(&ZipStdoutRd, &ZipStdoutWr, &saAttr, PipeBufferSz), "Stdout pipe creation failed");
90  // Ensure the read handle to the pipe for STDOUT is not inherited.
91  SetHandleInformation(ZipStdoutRd, HANDLE_FLAG_INHERIT, 0);
92  #else
93  // no implementation needed
94  #endif
95  CreateZipProcess(GetCmd(FNm), FNm);
96  Bf = new char[MxBfL]; BfC = BfL=-1;
97  FillBf();
98 }
99 
100 TZipIn::TZipIn(const TStr& FNm, bool& OpenedP) : TSBase(FNm.CStr()), TSIn(FNm), ZipStdoutRd(NULL), ZipStdoutWr(NULL),
101  FLen(0), CurFPos(0), Bf(NULL), BfC(0), BfL(0) {
102  EAssertR(! FNm.Empty(), "Empty file-name.");
103  FLen = TZipIn::GetFLen(FNm);
104  OpenedP = TFile::Exists(FNm);
105  if (OpenedP) {
106  #ifdef GLib_WIN
107  SECURITY_ATTRIBUTES saAttr;
108  saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
109  saAttr.bInheritHandle = TRUE;
110  saAttr.lpSecurityDescriptor = NULL;
111  // Create a pipe for the child process's STDOUT.
112  EAssertR(CreatePipe(&ZipStdoutRd, &ZipStdoutWr, &saAttr, 0), "Stdout pipe creation failed");
113  // Ensure the read handle to the pipe for STDOUT is not inherited.
114  SetHandleInformation(ZipStdoutRd, HANDLE_FLAG_INHERIT, 0);
115  #else
116  // no implementation needed
117  #endif
118  CreateZipProcess(GetCmd(FNm.GetFExt()), FNm);
119  Bf = new char[MxBfL]; BfC = BfL=-1;
120  FillBf();
121  }
122 }
123 
124 PSIn TZipIn::New(const TStr& FNm) {
125  return PSIn(new TZipIn(FNm));
126 }
127 
128 PSIn TZipIn::New(const TStr& FNm, bool& OpenedP){
129  return PSIn(new TZipIn(FNm, OpenedP));
130 }
131 
133  #ifdef GLib_WIN
134  if (ZipStdoutRd != NULL) {
135  EAssertR(CloseHandle(ZipStdoutRd), "Closing read-end of pipe failed"); }
136  if (ZipStdoutWr != NULL) {
137  EAssertR(CloseHandle(ZipStdoutWr)!=0, "Closing write-end of pipe failed"); }
138  #else
139  if (ZipStdoutRd != NULL) {
140  EAssertR(pclose(ZipStdoutRd) != -1, "Closing of the process failed"); }
141  #endif
142  if (Bf != NULL) { delete[] Bf; }
143 }
144 
145 int TZipIn::GetBf(const void* LBf, const TSize& LBfL){
146  int LBfS=0;
147  if (TSize(BfC+LBfL)>TSize(BfL)){
148  for (TSize LBfC=0; LBfC<LBfL; LBfC++){
149  if (BfC==BfL){FillBf();}
150  LBfS+=((char*)LBf)[LBfC]=Bf[BfC++];}
151  } else {
152  for (TSize LBfC=0; LBfC<LBfL; LBfC++){
153  LBfS+=(((char*)LBf)[LBfC]=Bf[BfC++]);}
154  }
155  return LBfS;
156 }
157 
158 // Gets the next line to LnChA.
159 // Returns true, if LnChA contains a valid line.
160 // Returns false, if LnChA is empty, such as end of file was encountered.
161 bool TZipIn::GetNextLnBf(TChA& LnChA) {
162  int Status;
163  int BfN; // new pointer to the end of line
164  int BfP; // previous pointer to the line start
165  LnChA.Clr();
166  do {
167  if (BfC >= BfL) { BfP = 0; } // reset the current pointer, FindEol() will read a new buffer
168  else { BfP = BfC; }
169  Status = FindEol(BfN);
170  if (Status >= 0) {
171  LnChA.AddBf(&Bf[BfP],BfN-BfP);
172  if (Status == 1) { return true; } // got a complete line
173  }
174  // get more data, if the line is incomplete
175  } while (Status == 0);
176  // eof or the last line has no newline
177  return !LnChA.Empty();
178 }
179 
180 // Sets BfN to the end of line or end of buffer. Reads more data, if needed.
181 // Returns 1, when an end of line was found, BfN is end of line.
182 // Returns 0, when an end of line was not found and more data is required,
183 // BfN is end of buffer.
184 // Returns -1, when an end of file was found, BfN is not defined.
185 int TZipIn::FindEol(int& BfN) {
186  char Ch;
187  if (BfC >= BfL) { // check for eof, read more data
188  if (Eof()) { return -1; }
189  FillBf();
190  }
191  while (BfC < BfL) {
192  Ch = Bf[BfC++];
193  if (Ch=='\n') { BfN = BfC-1; return 1; }
194  if (Ch=='\r' && Bf[BfC+1]=='\n') {
195  BfC++; BfN = BfC-2; return 1; }
196  }
197  BfN = BfC;
198  return 0;
199 }
200 
201 bool TZipIn::IsZipExt(const TStr& FNmExt) {
203  return FExtToCmdH.IsKey(FNmExt);
204 }
205 
207  // 7za decompress: "e -y -bd -so";
208  #ifdef GLib_WIN
209  const char* ZipCmd = "7z.exe e -y -bd -so";
210  #else
211  const char* ZipCmd = "7za e -y -bd -so";
212  #endif
213  if (FExtToCmdH.Empty()) {
214  FExtToCmdH.AddDat(".gz", ZipCmd);
215  FExtToCmdH.AddDat(".7z", ZipCmd);
216  FExtToCmdH.AddDat(".rar", ZipCmd);
217  FExtToCmdH.AddDat(".zip", ZipCmd);
218  FExtToCmdH.AddDat(".cab", ZipCmd);
219  FExtToCmdH.AddDat(".arj", ZipCmd);
220  FExtToCmdH.AddDat(".bzip2", ZipCmd);
221  FExtToCmdH.AddDat(".bz2", ZipCmd);
222  }
223 }
224 
225 TStr TZipIn::GetCmd(const TStr& ZipFNm) {
227  const TStr Ext = ZipFNm.GetFExt().GetLc();
228  EAssertR(FExtToCmdH.IsKey(Ext), TStr::Fmt("Unsupported file extension '%s'", Ext.CStr()));
229  return FExtToCmdH.GetDat(Ext);
230 }
231 
232 uint64 TZipIn::GetFLen(const TStr& ZipFNm) {
233  #ifdef GLib_WIN
234  HANDLE ZipStdoutRd, ZipStdoutWr;
235  // create pipes
236  SECURITY_ATTRIBUTES saAttr;
237  saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
238  saAttr.bInheritHandle = TRUE;
239  saAttr.lpSecurityDescriptor = NULL;
240  // Create a pipe for the child process's STDOUT.
241  const int PipeBufferSz = 32*1024;
242  EAssertR(CreatePipe(&ZipStdoutRd, &ZipStdoutWr, &saAttr, PipeBufferSz), "Stdout pipe creation failed");
243  // Ensure the read handle to the pipe for STDOUT is not inherited.
244  SetHandleInformation(ZipStdoutRd, HANDLE_FLAG_INHERIT, 0);
245  //CreateZipProcess(GetCmd(FNm), FNm);
246  { const TStr CmdLine = TStr::Fmt("7z.exe l %s", ZipFNm.CStr());
247  PROCESS_INFORMATION piProcInfo;
248  STARTUPINFO siStartInfo;
249  ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION));
250  ZeroMemory( &siStartInfo, sizeof(STARTUPINFO));
251  siStartInfo.cb = sizeof(STARTUPINFO);
252  siStartInfo.hStdOutput = ZipStdoutWr;
253  siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
254  // Create the child process.
255  const BOOL FuncRetn = CreateProcess(NULL, (LPSTR) CmdLine.CStr(),
256  NULL, NULL, TRUE, 0, NULL, NULL, &siStartInfo, &piProcInfo);
257  EAssertR(FuncRetn!=0, TStr::Fmt("Can not execute '%s'", CmdLine.CStr()).CStr());
258  CloseHandle(piProcInfo.hProcess);
259  CloseHandle(piProcInfo.hThread); }
260  #else
261  const TStr CmdLine = TStr::Fmt("7za l %s", ZipFNm.CStr());
262  FILE* ZipStdoutRd = popen(CmdLine.CStr(), "r");
263  if (ZipStdoutRd == NULL) { // try using SevenZipPath
264  ZipStdoutRd = popen((TZipIn::SevenZipPath+"/"+CmdLine).CStr(), "r");
265  }
266  EAssertR(ZipStdoutRd != NULL, TStr::Fmt("Can not execute '%s'", CmdLine.CStr()).CStr());
267  #endif
268  // Read output from the child process
269  const int BfSz = 32*1024;
270  char* Bf = new char [BfSz];
271  int BfC=0, BfL=0;
272  memset(Bf, 0, BfSz);
273  #ifdef GLib_WIN
274  DWORD BytesRead;
275  EAssert(ReadFile(ZipStdoutRd, Bf, MxBfL, &BytesRead, NULL) != 0);
276  #else
277  size_t BytesRead = fread(Bf, 1, MxBfL, ZipStdoutRd);
278  EAssert(BytesRead != 0);
279  EAssert(pclose(ZipStdoutRd) != -1);
280  #endif
281  BfL = (int) BytesRead; IAssert((BfC!=0)||(BfL!=0));
282  BfC = 0; Bf[BfL] = 0;
283  // find file lenght
284  TStr Str(Bf); delete [] Bf;
285  TStrV StrV; Str.SplitOnWs(StrV);
286  int n = StrV.Len()-1;
287  while (n > 0 && ! StrV[n].IsPrefix("-----")) { n--; }
288  if (n-7 <= 0) {
289  WrNotify(TStr::Fmt("Corrupt file %s: MESSAGE:\n", ZipFNm.CStr()).CStr(), Str.CStr());
290  SaveToErrLog(TStr::Fmt("Corrupt file %s. Message:\n:%s\n", ZipFNm.CStr(), Str.CStr()).CStr());
291  return 0;
292  }
293  return StrV[n-7].GetInt64();
294 }
295 
297 // Output-File
299 const TSize TZipOut::MxBfL=4*1024;
300 
302  #ifdef GLib_WIN
303  DWORD BytesOut;
304  EAssertR(WriteFile(ZipStdinWr, Bf, DWORD(BfL), &BytesOut, NULL)!=0, "Error writting to the file '"+GetSNm()+"'.");
305  #else
306  size_t BytesOut = fwrite(Bf, 1, BfL, ZipStdinWr);
307  #endif
308  EAssert(BytesOut == BfL);
309  BfL = 0;
310 }
311 
312 void TZipOut::CreateZipProcess(const TStr& Cmd, const TStr& ZipFNm) {
313  const TStr CmdLine = TStr::Fmt("%s %s", Cmd.CStr(), ZipFNm.CStr());
314  #ifdef GLib_WIN
315  PROCESS_INFORMATION piProcInfo;
316  STARTUPINFO siStartInfo;
317  ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION));
318  ZeroMemory( &siStartInfo, sizeof(STARTUPINFO));
319  siStartInfo.cb = sizeof(STARTUPINFO);
320  siStartInfo.hStdInput = ZipStdinRd;
321  siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
322  // Create the child process.
323  const BOOL FuncRetn = CreateProcess(NULL,
324  (LPSTR) CmdLine.CStr(), // command line
325  NULL, // process security attributes
326  NULL, // primary thread security attributes
327  TRUE, // handles are inherited
328  0, // creation flags
329  NULL, // use parent's environment
330  NULL, // use parent's current directory
331  &siStartInfo, // STARTUPINFO pointer
332  &piProcInfo); // receives PROCESS_INFORMATION
333  EAssertR(FuncRetn!=0, TStr::Fmt("Can not execute '%s'", CmdLine.CStr()).CStr());
334  CloseHandle(piProcInfo.hProcess);
335  CloseHandle(piProcInfo.hThread);
336  #else
337  ZipStdinWr = popen(CmdLine.CStr(),"w");
338  if (ZipStdinWr == NULL) { // try using SevenZipPath
339  ZipStdinWr = popen((TZipIn::SevenZipPath+"/"+CmdLine).CStr(), "r");
340  }
341  EAssertR(ZipStdinWr != NULL, TStr::Fmt("Can not execute '%s'", CmdLine.CStr()).CStr());
342  #endif
343 }
344 
345 TZipOut::TZipOut(const TStr& FNm) : TSBase(FNm.CStr()), TSOut(FNm), ZipStdinRd(NULL), ZipStdinWr(NULL), Bf(NULL), BfL(0){
346  EAssertR(! FNm.Empty(), "Empty file-name.");
347  #ifdef GLib_WIN
348  // create pipes
349  SECURITY_ATTRIBUTES saAttr;
350  saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
351  saAttr.bInheritHandle = TRUE;
352  saAttr.lpSecurityDescriptor = NULL;
353  // Create a pipe for the child process's STDOUT.
354  EAssertR(CreatePipe(&ZipStdinRd, &ZipStdinWr, &saAttr, 0), "Stdout pipe creation failed");
355  // Ensure the read handle to the pipe for STDOUT is not inherited.
356  SetHandleInformation(ZipStdinWr, HANDLE_FLAG_INHERIT, 0);
357  #else
358  // no implementation necessary
359  #endif
360  CreateZipProcess(GetCmd(FNm), FNm);
361  Bf=new char[MxBfL]; BfL=0;
362 }
363 
364 PSOut TZipOut::New(const TStr& FNm){
365  return PSOut(new TZipOut(FNm));
366 }
367 
369  if (BfL!=0) { FlushBf(); }
370  #ifdef GLib_WIN
371  if (ZipStdinWr != NULL) { EAssertR(CloseHandle(ZipStdinWr), "Closing write-end of pipe failed"); }
372  if (ZipStdinRd != NULL) { EAssertR(CloseHandle(ZipStdinRd), "Closing read-end of pipe failed"); }
373  #else
374  if (ZipStdinWr != NULL) { EAssertR(pclose(ZipStdinWr) != -1, "Closing of the process failed"); }
375  #endif
376  if (Bf!=NULL) { delete[] Bf; }
377 }
378 
379 int TZipOut::PutCh(const char& Ch){
380  if (BfL==MxBfL) {FlushBf();}
381  return Bf[BfL++]=Ch;
382 }
383 
384 int TZipOut::PutBf(const void* LBf, const TSize& LBfL){
385  int LBfS=0;
386  if (BfL+LBfL>MxBfL){
387  for (TSize LBfC=0; LBfC<LBfL; LBfC++){
388  LBfS+=PutCh(((char*)LBf)[LBfC]);}
389  } else {
390  for (TSize LBfC=0; LBfC<LBfL; LBfC++){
391  LBfS+=(Bf[BfL++]=((char*)LBf)[LBfC]);}
392  }
393  return LBfS;
394 }
395 
397  FlushBf();
398  #ifdef GLib_WIN
399  EAssertR(FlushFileBuffers(ZipStdinWr)!=0, "Can not flush file '"+GetSNm()+"'.");
400  #else
401  EAssertR(fflush(ZipStdinWr)==0, "Can not flush file '"+GetSNm()+"'.");
402  #endif
403 }
404 
405 bool TZipOut::IsZipExt(const TStr& FNmExt) {
407  return FExtToCmdH.IsKey(FNmExt);
408 }
409 
411  // 7za compress: "a -y -bd -si{CompressedFNm}"
412  #ifdef GLib_WIN
413  const char* ZipCmd = "7z.exe a -y -bd -si";
414  #else
415  const char* ZipCmd = "7za a -y -bd -si";
416  #endif
417  if (FExtToCmdH.Empty()) {
418  FExtToCmdH.AddDat(".gz", ZipCmd);
419  FExtToCmdH.AddDat(".7z", ZipCmd);
420  FExtToCmdH.AddDat(".rar", ZipCmd);
421  FExtToCmdH.AddDat(".zip", ZipCmd);
422  FExtToCmdH.AddDat(".cab", ZipCmd);
423  FExtToCmdH.AddDat(".arj", ZipCmd);
424  FExtToCmdH.AddDat(".bzip2", ZipCmd);
425  FExtToCmdH.AddDat(".bz2", ZipCmd);
426  }
427 }
428 
429 TStr TZipOut::GetCmd(const TStr& ZipFNm) {
431  const TStr Ext = ZipFNm.GetFExt().GetLc();
432  EAssertR(FExtToCmdH.IsKey(Ext), TStr::Fmt("Unsupported file extension '%s'", Ext.CStr()));
433  return FExtToCmdH.GetDat(Ext)+ZipFNm.GetFMid();
434 }
bool Eof()
Definition: zipfl.h:45
int BfL
Definition: zipfl.h:28
#define IAssert(Cond)
Definition: bd.h:262
FILE * ZipStdoutWr
Definition: zipfl.h:24
~TZipOut()
Definition: zipfl.cpp:368
static TStrStrH FExtToCmdH
Definition: zipfl.h:19
static TStr GetCmd(const TStr &ZipFNm)
Return a command-line string that is executed in order to decompress a file to standard output...
Definition: zipfl.cpp:429
static TStr GetCmd(const TStr &ZipFNm)
Return a command-line string that is executed in order to decompress a file to standard output...
Definition: zipfl.cpp:225
TStr GetFMid() const
Definition: dt.cpp:1403
static void FillFExtToCmdH()
Definition: zipfl.cpp:206
int PutCh(const char &Ch)
Definition: zipfl.cpp:379
static bool Exists(const TStr &FNm)
Definition: fl.cpp:941
bool Empty() const
Definition: dt.h:260
void Clr()
Definition: dt.h:258
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
char * Bf
Definition: zipfl.h:83
uint64 CurFPos
Definition: zipfl.h:26
TSize BfL
Definition: zipfl.h:84
bool Empty() const
Definition: hash.h:185
bool GetNextLnBf(TChA &LnChA)
Definition: zipfl.cpp:161
TStr GetFExt() const
Definition: dt.cpp:1421
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
static const int MxBfL
Definition: zipfl.h:20
Definition: fl.h:40
static PSIn New(const TStr &FNm)
Definition: zipfl.cpp:124
Definition: fl.h:58
unsigned long long uint64
Definition: bd.h:38
void SaveToErrLog(const char *MsgCStr)
Definition: bd.cpp:49
size_t TSize
Definition: bd.h:58
TStr GetLc() const
Definition: dt.h:499
char * Bf
Definition: zipfl.h:27
#define EFailR(Reason)
Definition: bd.h:246
static TStr SevenZipPath
Definition: zipfl.h:17
static const TSize MxBfL
Definition: zipfl.h:76
static TStrStrH FExtToCmdH
Definition: zipfl.h:77
FILE * ZipStdoutRd
Definition: zipfl.h:24
Definition: fl.h:128
static bool IsZipExt(const TStr &FNmExt)
Check whether the file extension FNmExt is that of a compressed file (.gz, .7z, .rar, .zip, .cab, .arj. bzip2).
Definition: zipfl.cpp:201
static void FillFExtToCmdH()
Definition: zipfl.cpp:410
Definition: dt.h:201
int PutBf(const void *LBf, const TSize &LBfL)
Definition: zipfl.cpp:384
#define EAssert(Cond)
Definition: bd.h:280
static PSOut New(const TStr &FNm)
Definition: zipfl.cpp:364
void AddBf(char *NewBf, const int &BfS)
Definition: dt.h:275
Definition: dt.h:412
static bool IsZipExt(const TStr &FNmExt)
Check whether the file extension FNmExt is that of a compressed file (.gz, .7z, .rar, .zip, .cab, .arj. bzip2).
Definition: zipfl.cpp:405
bool Empty() const
Definition: dt.h:488
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
FILE * ZipStdinRd
Definition: zipfl.h:81
uint64 FLen
Definition: zipfl.h:26
void FillBf()
Definition: zipfl.cpp:51
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
void CreateZipProcess(const TStr &Cmd, const TStr &ZipFNm)
Definition: zipfl.cpp:18
virtual TStr GetSNm() const
Definition: fl.cpp:20
int BfC
Definition: zipfl.h:28
~TZipIn()
Definition: zipfl.cpp:132
TPt< TSIn > PSIn
Definition: fl.h:119
void Flush()
Definition: zipfl.cpp:396
void WrNotify(const char *CaptionCStr, const char *NotifyCStr)
Definition: bd.cpp:41
void SplitOnWs(TStrV &StrV) const
Definition: dt.cpp:972
FILE * ZipStdinWr
Definition: zipfl.h:81
uint64 GetFLen() const
Definition: zipfl.h:52
char * CStr()
Definition: dt.h:476
bool IsKey(const TKey &Key) const
Definition: hash.h:216
int GetBf(const void *LBf, const TSize &LBfL)
Definition: zipfl.cpp:145
void FlushBf()
Definition: zipfl.cpp:301
void CreateZipProcess(const TStr &Cmd, const TStr &ZipFNm)
Definition: zipfl.cpp:312
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
TPt< TSOut > PSOut
Definition: fl.h:211
int FindEol(int &BfN)
Definition: zipfl.cpp:185