You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2004/03/02 18:35:46 UTC

cvs commit: xml-xerces/c/src/xercesc/com XMLDOMDocument.cpp

amassari    2004/03/02 09:35:46

  Modified:    c/src/xercesc/com XMLDOMDocument.cpp
  Log:
  Check for errors when saving a document to a file (bug# 2594)
  
  Revision  Changes    Path
  1.7       +10 -7     xml-xerces/c/src/xercesc/com/XMLDOMDocument.cpp
  
  Index: XMLDOMDocument.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/com/XMLDOMDocument.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XMLDOMDocument.cpp	27 Feb 2004 13:23:02 -0000	1.6
  +++ XMLDOMDocument.cpp	2 Mar 2004 17:35:46 -0000	1.7
  @@ -1496,15 +1496,18 @@
   		return E_FAIL;
   	}
   
  -	FILE* fp;
  -	if ((fp = _tfopen(file, "wt")) == NULL) {
  +	FILE* fp = _tfopen(file, "wt");
  +	if (fp == NULL)
   		return E_FAIL;
  -	}
   
  -	if(text.length()>0)
  -		_fputts(text, fp);
  +	if(text.length()>0 && _fputts(text, fp)<0)
  +    {
  +        fclose(fp);
  +        return E_FAIL;
  +    }
   	
  -	fclose(fp);
  +	if(fclose(fp)!=0)
  +        return E_FAIL;
   
   	return S_OK;
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org