You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@locus.apache.org on 2000/10/14 00:47:38 UTC

cvs commit: xml-xerces/c/tests/DOM/DOMMemTest DOMMemTest.cpp

andyh       00/10/13 15:47:38

  Modified:    c/tests/DOM/DOMMemTest DOMMemTest.cpp
  Log:
  Fix bug (failure to null-terminate result) in XMLString::trim().
  Patch contributed by Nadav Aharoni
  
  Revision  Changes    Path
  1.23      +27 -6     xml-xerces/c/tests/DOM/DOMMemTest/DOMMemTest.cpp
  
  Index: DOMMemTest.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/tests/DOM/DOMMemTest/DOMMemTest.cpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- DOMMemTest.cpp	2000/05/09 00:22:48	1.22
  +++ DOMMemTest.cpp	2000/10/13 22:47:37	1.23
  @@ -66,6 +66,10 @@
   
   /*
    * $Log: DOMMemTest.cpp,v $
  + * Revision 1.23  2000/10/13 22:47:37  andyh
  + * Fix bug (failure to null-terminate result) in XMLString::trim().
  + * Patch contributed by Nadav Aharoni
  + *
    * Revision 1.22  2000/05/09 00:22:48  andyh
    * Memory Cleanup.  XMLPlatformUtils::Terminate() deletes all lazily
    * allocated memory; memory leak checking tools will no longer report
  @@ -568,6 +572,27 @@
       }
       TESTEPILOG;
   
  +
  +    //
  +    //  String bug submitted by Nadav Aharoni
  +    //
  +    TESTPROLOG;
  +    {
  +        char testString[] = "            ";
  +        testString[4] = 0;
  +        testString[5] = 'x';
  +        char *origString = testString;
  +        XMLString::trim(testString);
  +        TASSERT(strlen(testString) == 0);
  +        TASSERT(testString[5] == 'x');
  +
  +        strcpy(testString, "  Hello  ");
  +        XMLString::trim(testString);
  +        TASSERT(strcmp(testString, "Hello") == 0);
  +    }
  +    TESTEPILOG;
  +
  +
   }
   
   
  @@ -1634,12 +1659,6 @@
       //
       // 
       //
  -    TESTPROLOG;
  -    {
  -
  -
  -    }
  -    TESTEPILOG;
   
   }