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