diff --git a/EgtGeneral.rc b/EgtGeneral.rc
index 56cf11d..ebfeca2 100644
Binary files a/EgtGeneral.rc and b/EgtGeneral.rc differ
diff --git a/EgtGeneral.vcxproj b/EgtGeneral.vcxproj
index f5164f1..8c8d15f 100644
--- a/EgtGeneral.vcxproj
+++ b/EgtGeneral.vcxproj
@@ -136,6 +136,8 @@ copy $(TargetPath) \EgtProg\Dll64
true
true
WIN32;I_AM_EGN;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ Speed
+ AnySuitable
Windows
@@ -160,6 +162,8 @@ copy $(TargetPath) \EgtProg\Dll32
true
true
WIN32;I_AM_EGN;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ AnySuitable
+ Speed
Windows
diff --git a/FileCompare.cpp b/FileCompare.cpp
index 5040704..05ba79e 100644
--- a/FileCompare.cpp
+++ b/FileCompare.cpp
@@ -17,6 +17,7 @@
#include "/EgtDEv/Include/EgnFileCompare.h"
#include "/EgtDEv/Include/EGnStringConverter.h"
#include "/EgtDEv/Include/EGnScan.h"
+#include
#include
using namespace std ;
diff --git a/Scan.cpp b/Scan.cpp
index de8424f..db8f911 100644
--- a/Scan.cpp
+++ b/Scan.cpp
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2014
//----------------------------------------------------------------------------
-// File : Scan.cpp Data : 17.04.14 Versione : 1.5d
+// File : Scan.cpp Data : 17.06.14 Versione : 1.5f3
// Contenuto : Implementazione della classe Scanner.
// Scansione di file di testo con codifica UTF-8 (anche con BOM)
// e quindi anche ASCII.
@@ -10,6 +10,7 @@
// Modifiche : 30.09.13 DS Creazione modulo.
// 06.03.14 DS Aggiunta UngetLine.
// 17.04.14 DS Aggiunto parametro bSkipEmptyLine a Init.
+// 17.06.14 DS Lettura di file compressi con formato gzip.
//
//----------------------------------------------------------------------------
@@ -18,16 +19,20 @@
#include "/EgtDEv/Include/EGnScan.h"
#include "/EgtDEv/Include/EGnStringUtils.h"
#include "/EgtDEv/Include/EGnStringConverter.h"
+#include "/EgtDev/Extern/Zlib/Include/zlib.h"
using namespace std ;
-
//----------------------------------------------------------------------------
bool
Scanner::Init( const std::string& sFile, const char* szRemInit, bool bSkipEmptyLine)
{
// apertura del file di ingresso
- m_InFile.open( stringtoW( sFile), ios::in) ;
+ m_InFile = gzopen_w( stringtoW( sFile), "rb") ;
+ if ( m_InFile != nullptr) {
+ const int DIM_BUFFER = 65536 ;
+ gzbuffer( m_InFile, DIM_BUFFER) ;
+ }
// reset vari
m_nLineNbr = 0 ;
@@ -47,15 +52,18 @@ Scanner::Init( const std::string& sFile, const char* szRemInit, bool bSkipEmptyL
// assegno flag per saltare linee vuote
m_bSkipEmptyLine = bSkipEmptyLine ;
- return ( ! m_InFile.fail()) ;
+ return ( m_InFile != nullptr) ;
}
//----------------------------------------------------------------------------
bool
Scanner::Terminate( void)
{
- if ( m_InFile.is_open())
- m_InFile.close() ;
+ if ( m_InFile != nullptr) {
+ bool bOk = ( gzclose( m_InFile) == Z_OK) ;
+ m_InFile = nullptr ;
+ return bOk ;
+ }
return true ;
}
@@ -64,7 +72,7 @@ Scanner::Terminate( void)
bool
Scanner::GetLine( string& sLine)
{
- if ( ! m_InFile.is_open())
+ if ( m_InFile == nullptr)
return false ;
if ( m_bUnget) {
@@ -74,12 +82,15 @@ Scanner::GetLine( string& sLine)
}
else {
int nOldLineNbr = m_nLineNbr ;
+ const int DIM_BUFF = 512 ;
+ char szBuffer[DIM_BUFF] ;
do {
- if ( ! getline( m_InFile, sLine)) {
+ if ( gzgets( m_InFile, szBuffer, DIM_BUFF) == nullptr) {
sLine = "" ;
m_nDeltaLineUnget = m_nLineNbr - nOldLineNbr ;
return false ;
}
+ sLine = szBuffer ;
if ( m_nLineNbr == 0)
TrimUtf8Bom( sLine) ;
Trim( sLine) ;
diff --git a/stdafx.h b/stdafx.h
index 6ef2a5b..246c468 100644
--- a/stdafx.h
+++ b/stdafx.h
@@ -25,3 +25,7 @@
#else
#define _SECURE_SCL 0
#endif
+
+#include "/EgtDev/Include/EgtLibVer.h"
+
+#pragma comment(lib, EGTEXTDIR "zlib/lib/zlib" EGTLIBVER ".lib")