]> OCCT Git - occt.git/commitdiff
0032442: Application Framework - Problems of testing on MacOS arm64 platform IR-2022-03-18
authormpv <mpv@opencascade.com>
Thu, 10 Mar 2022 08:57:41 +0000 (11:57 +0300)
committersmoskvin <smoskvin@opencascade.com>
Fri, 18 Mar 2022 14:53:47 +0000 (17:53 +0300)
Fixed the problem of reading XML files on MacOS. 'errno' was not reseted
even the 'strtol' function produced a good value. So, now it is erased
forcibly before the call.

src/LDOM/LDOMBasicString.cxx
src/OSD/OSD_Directory.cxx

index 09843e7330235d7c1ba330d2f33ea5f7365d03ef..7fa4fec88ff227e5753a409fee4338e0ec88d271 100644 (file)
@@ -184,6 +184,7 @@ Standard_Boolean LDOMBasicString::equals (const LDOMBasicString& anOther) const
     case LDOM_AsciiDocClear:
     case LDOM_AsciiHashed:
       {
+        errno = 0;
         long aLongOther = strtol ((const char *) anOther.myVal.ptr, NULL, 10);
         return (errno == 0 && aLongOther == long(myVal.i));
       }
@@ -197,6 +198,7 @@ Standard_Boolean LDOMBasicString::equals (const LDOMBasicString& anOther) const
     {
     case LDOM_Integer:
       {
+        errno = 0;
         long aLong = strtol ((const char *) myVal.ptr, NULL, 10);
         return (errno == 0 && aLong == long(anOther.myVal.i));
       }
@@ -273,6 +275,7 @@ LDOMBasicString::operator TCollection_ExtendedString () const
       buf[1] = ptr[1];
       buf[2] = ptr[2];
       buf[3] = ptr[3];
+      errno = 0;
       aResult[j++] = Standard_ExtCharacter (strtol (&buf[0], NULL, 16));
       if (errno) {
         delete [] aResult;
@@ -306,6 +309,7 @@ Standard_Boolean LDOMBasicString::GetInteger (Standard_Integer& aResult) const
   case LDOM_AsciiHashed:
     {
       char * ptr;
+      errno = 0;
       long aValue = strtol ((const char *)myVal.ptr, &ptr, 10);
       if (ptr == myVal.ptr || errno == ERANGE || errno == EINVAL)
         return Standard_False;
index 589e5eac06f04f49e4bb17604981bc4feb195fbf..af5b7e13f400c63895c233a54d882a570d742e31 100644 (file)
@@ -114,6 +114,7 @@ void OSD_Directory::Build (const OSD_Protection& theProtect)
     _osd_wnt_set_error (myError, OSD_WDirectory);
   }
 #else
+  errno = 0;
   TCollection_AsciiString aBuffer;
   mode_t anInternalProt = (mode_t )theProtect.Internal();
   myPath.SystemName (aBuffer);