Kaynağa Gözat

clean up some warnings

Lee Thomason 13 yıl önce
ebeveyn
işleme
a3efec0449
4 değiştirilmiş dosya ile 10 ekleme ve 4 silme
  1. 1 1
      CMakeLists.txt
  2. 1 1
      dox
  3. 6 1
      tinyxml2.cpp
  4. 2 1
      tinyxml2.h

+ 1 - 1
CMakeLists.txt

@@ -10,7 +10,7 @@ include(GNUInstallDirs)
 ################################
 # set lib version here
 
-set(GENERIC_LIB_VERSION "1.0.2")
+set(GENERIC_LIB_VERSION "1.0.3")
 set(GENERIC_LIB_SOVERSION "1")
 
 

+ 1 - 1
dox

@@ -32,7 +32,7 @@ PROJECT_NAME           = "TinyXML-2"
 # This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
-PROJECT_NUMBER = 1.0.2
+PROJECT_NUMBER = 1.0.3
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer

+ 6 - 1
tinyxml2.cpp

@@ -1394,7 +1394,12 @@ int XMLDocument::LoadFile( FILE* fp )
 	}
 
 	charBuffer = new char[size+1];
-	fread( charBuffer, size, 1, fp );
+	size_t read = fread( charBuffer, 1, size, fp );
+	if ( read != size ) {
+		SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
+		return errorID;
+	}
+	
 	charBuffer[size] = 0;
 
 	const char* p = charBuffer;

+ 2 - 1
tinyxml2.h

@@ -85,7 +85,7 @@ distribution.
 
 static const int TIXML2_MAJOR_VERSION = 1;
 static const int TIXML2_MINOR_VERSION = 0;
-static const int TIXML2_PATCH_VERSION = 2;
+static const int TIXML2_PATCH_VERSION = 3;
 
 namespace tinyxml2
 {
@@ -727,6 +727,7 @@ enum {
 
 	XML_ERROR_FILE_NOT_FOUND,
 	XML_ERROR_FILE_COULD_NOT_BE_OPENED,
+	XML_ERROR_FILE_READ_ERROR,
 	XML_ERROR_ELEMENT_MISMATCH,
 	XML_ERROR_PARSING_ELEMENT,
 	XML_ERROR_PARSING_ATTRIBUTE,