Skip to content

Commit 0b6cd90

Browse files
committed
Fix test_inverse_attr3 failure
This fixes the failure in test_inverse_attr3 seen on travis ci's osx build. Actually, only the change to sectionReader::getRealInstance is needed to fix the test, but as the reason that 'unget' can fail is unclear, I changed all instances of 'unget' to use the 'seekg' + arithmetic method instead. I failed to find a reason why 'unget' could fail in this way, or reports of macos-specific failures in 'unget', but I was not enlightened. I do not know whether test_inverse_attr3 would *consistently* hang on Appveyor, but after this change (and modifying .appveyor.yml to not skip test_inverse_attr3) it did succeed on the first try.
1 parent a96336a commit 0b6cd90

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/cllazyfile/sectionReader.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ std::streampos sectionReader::findNormalString( const std::string & str, bool se
4747
}
4848
if( c == '\'' ) {
4949
//push past string
50-
_file.unget();
50+
_file.seekg( _file.tellg() - std::streampos(1) );
5151
GetLiteralStr( _file, _lazyFile->getInstMgr()->getErrorDesc() );
5252
}
5353
if( ( c == '/' ) && ( _file.peek() == '*' ) ) {
@@ -129,7 +129,7 @@ std::streampos sectionReader::seekInstanceEnd( instanceRefs ** refs ) {
129129
}
130130
break;
131131
case '\'':
132-
_file.unget();
132+
_file.seekg( _file.tellg() - std::streampos(1) );
133133
GetLiteralStr( _file, _lazyFile->getInstMgr()->getErrorDesc() );
134134
break;
135135
case '=':
@@ -155,7 +155,7 @@ std::streampos sectionReader::seekInstanceEnd( instanceRefs ** refs ) {
155155
if( _file.get() == ';' ) {
156156
return _file.tellg();
157157
} else {
158-
_file.unget();
158+
_file.seekg( _file.tellg() - std::streampos(1) );
159159
}
160160
}
161161
default:
@@ -186,7 +186,7 @@ instanceID sectionReader::readInstanceNumber() {
186186
if( ( c == '/' ) && ( _file.peek() == '*' ) ) {
187187
findNormalString( "*/" );
188188
} else {
189-
_file.unget();
189+
_file.seekg( _file.tellg() - std::streampos(1) );
190190
}
191191
skipWS();
192192
c = _file.get();
@@ -210,7 +210,7 @@ instanceID sectionReader::readInstanceNumber() {
210210
digits++;
211211

212212
} else {
213-
_file.unget();
213+
_file.seekg( _file.tellg() - std::streampos(1) );
214214
break;
215215
}
216216

@@ -309,7 +309,7 @@ SDAI_Application_instance * sectionReader::getRealInstance( const Registry * reg
309309
assert( inst->getEDesc() );
310310
_file.seekg( begin );
311311
findNormalString( "(" );
312-
_file.unget();
312+
_file.seekg( _file.tellg() - std::streampos(1) );
313313
sev = inst->STEPread( instance, 0, _lazyFile->getInstMgr()->getAdapter(), _file, sName, true, false );
314314
//TODO do something with 'sev'
315315
inst->InitIAttrs();

0 commit comments

Comments
 (0)