Skip to content

Commit 92d83ef

Browse files
committed
Merge pull request #137 from mpictor/review/embarcadero_fixes
Review/embarcadero fixes
2 parents 6e6fb81 + 572e9ad commit 92d83ef

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

src/cleditor/STEPfile.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,11 +2228,6 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
22282228

22292229
SetFileIdIncrement();
22302230
int total_insts = 0, valid_insts = 0;
2231-
#if defined(__MSVC__) || defined(__BORLAND__)
2232-
int exchange_file = -1;
2233-
#else
2234-
__attribute__( ( unused ) ) int exchange_file = -1;
2235-
#endif
22362231

22372232
ReadTokenSeparator( *in );
22382233
std::string keywd = GetKeyword( *in, "; #", _error );
@@ -2242,11 +2237,9 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
22422237

22432238
if( !strncmp( const_cast<char *>( keywd.c_str() ), "ISO-10303-21",
22442239
strlen( const_cast<char *>( keywd.c_str() ) ) ) ) {
2245-
exchange_file = 1;
22462240
SetFileType( VERSION_CURRENT );
22472241
} else if( !strncmp( const_cast<char *>( keywd.c_str() ), "STEP_WORKING_SESSION",
22482242
strlen( const_cast<char *>( keywd.c_str() ) ) ) ) {
2249-
exchange_file = 0;
22502243
if( _fileType != WORKING_SESSION ) {
22512244
_error.AppendToUserMsg(
22522245
"Warning: Reading in file as Working Session file.\n" );

src/clutils/Str.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,23 @@ const char * StrToConstant( const char * word, std::string & s ) {
9696
return const_cast<char *>( s.c_str() );
9797
}
9898

99+
/**************************************************************//**
100+
** \fn StrCmpIns (const char * str1, const char * str2)
101+
** \returns Comparison result
102+
** Compares two strings case insensitive (lowercase).
103+
** Returns < 0 when str1 less then str2
104+
** == 0 when str1 equals str2
105+
** > 0 when str1 greater then str2
106+
******************************************************************/
107+
int StrCmpIns( const char * str1, const char * str2 ) {
108+
char c1, c2;
109+
while ((c1 = tolower(*str1)) == (c2 = tolower(*str2)) && c1 != '\0') {
110+
str1++;
111+
str2++;
112+
}
113+
return c1 - c2;
114+
}
115+
99116
/**************************************************************//**
100117
** \fn PrettyTmpName (char * oldname)
101118
** \returns a new capitalized name in a static buffer

src/clutils/Str.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,13 @@
2121
#include <string.h>
2222
#include <errordesc.h>
2323

24-
25-
//StrCmpIns - case-insensitive string compare. Original fct (replaced Sep 2011)
26-
//called PrettyTmpName(). Not doing so may affect sort order but that shouldn't hurt
27-
#if defined(__MSVC__)
28-
#define StrCmpIns(a,b) _stricmp(a,b)
29-
#elif defined(__BORLAND__)
30-
#define StrCmpIns(a,b) stricmp(a,b)
31-
#else
32-
#define StrCmpIns(a,b) strcasecmp(a,b)
33-
#endif
34-
3524
SCL_UTILS_EXPORT char ToLower( const char c );
3625
SCL_UTILS_EXPORT char ToUpper( const char c );
3726
SCL_UTILS_EXPORT char * StrToLower( const char *, char * );
3827
SCL_UTILS_EXPORT const char * StrToLower( const char * word, std::string & s );
3928
SCL_UTILS_EXPORT const char * StrToUpper( const char * word, std::string & s );
4029
SCL_UTILS_EXPORT const char * StrToConstant( const char * word, std::string & s );
30+
SCL_UTILS_EXPORT int StrCmpIns( const char *str1, const char *str2 );
4131
SCL_UTILS_EXPORT const char * PrettyTmpName( const char * oldname );
4232
SCL_UTILS_EXPORT char * PrettyNewName( const char * oldname );
4333
SCL_UTILS_EXPORT char * EntityClassName( char * oldname );

src/test/p21read/p21read.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ int main( int argc, char * argv[] ) {
152152
sfile.ReadExchangeFile( flnm );
153153
sfile.Error().PrintContents( cout );
154154

155+
if ( sfile.Error().severity() <= SEVERITY_INCOMPLETE )
156+
exit(1);
157+
155158
checkSchemaName( registry, sfile, ignoreErr );
156159

157160
Severity readSev = sfile.Error().severity(); //otherwise, errors from reading will be wiped out by sfile.WriteExchangeFile()

0 commit comments

Comments
 (0)