@@ -113,7 +113,7 @@ namespace NMR {
113
113
m_ZIPError.sys_err = 0 ;
114
114
m_ZIPError.zip_err = 0 ;
115
115
m_ZIParchive = nullptr ;
116
- m_ZIPsource = nullptr ;
116
+ zip_source_t * pZIPsource = nullptr ;
117
117
118
118
try {
119
119
// determine stream size
@@ -129,20 +129,20 @@ namespace NMR {
129
129
bool bUseCallback = true ;
130
130
if (bUseCallback) {
131
131
// read ZIP from callback: faster and requires less memory
132
- m_ZIPsource = zip_source_function_create (custom_zip_source_callback, pImportStream.get (), &m_ZIPError);
132
+ pZIPsource = zip_source_function_create (custom_zip_source_callback, pImportStream.get (), &m_ZIPError);
133
133
}
134
134
else {
135
135
// read ZIP into memory
136
136
m_Buffer.resize ((size_t )nStreamSize);
137
137
pImportStream->readBuffer (&m_Buffer[0 ], nStreamSize, true );
138
- m_ZIPsource = zip_source_buffer_create (&m_Buffer[0 ], (size_t )nStreamSize, 0 , &m_ZIPError);
138
+ pZIPsource = zip_source_buffer_create (&m_Buffer[0 ], (size_t )nStreamSize, 0 , &m_ZIPError);
139
139
}
140
- if (m_ZIPsource == nullptr )
140
+ if (pZIPsource == nullptr )
141
141
throw CNMRException (NMR_ERROR_COULDNOTREADZIPFILE);
142
142
143
- m_ZIParchive = zip_open_from_source (m_ZIPsource , ZIP_RDONLY | ZIP_CHECKCONS, &m_ZIPError);
143
+ m_ZIParchive = zip_open_from_source (pZIPsource , ZIP_RDONLY | ZIP_CHECKCONS, &m_ZIPError);
144
144
if (m_ZIParchive == nullptr ) {
145
- m_ZIParchive = zip_open_from_source (m_ZIPsource , ZIP_RDONLY, &m_ZIPError);
145
+ m_ZIParchive = zip_open_from_source (pZIPsource , ZIP_RDONLY, &m_ZIPError);
146
146
if (m_ZIParchive == nullptr )
147
147
throw CNMRException (NMR_ERROR_COULDNOTREADZIPFILE);
148
148
else
@@ -215,13 +215,9 @@ namespace NMR {
215
215
if (m_ZIParchive != nullptr )
216
216
zip_close (m_ZIParchive);
217
217
218
- if (m_ZIPsource != nullptr )
219
- zip_source_close (m_ZIPsource);
220
-
221
218
zip_error_fini (&m_ZIPError);
222
219
m_Buffer.resize (0 );
223
220
224
- m_ZIPsource = nullptr ;
225
221
m_ZIParchive = nullptr ;
226
222
}
227
223
0 commit comments