Hi Jimmy,

A few suggestions:

1.in your function void X(CString setting, CString changeval) ,
Passing parameters by object is usually not a good idea. Unless, of course
you want to make  copies and leave the masters intact.( CString's copy
constructor, however, will share the master's buffer if the LPCTSTR() cast
is not used.)

2. Notice that CString's internal buffer is of type "TCAR" rather than the
intrinsic c type "char". It will change into "wchar_t" if someone compiles
your program with a "UNICODE" directive. I'd preffer  std::string in this
case. But in your program I did not see any necessity to use a string
object. A simple "const char*" pointer will work just fine.

3. AFAIK XercesDOMParser will delete it's internal document in it's
destructor. So if you delete the parser in ParseDocument(), the
"DOMDocument"pointer you returned will be invalid and cause a protection
fault if you try to use the object. On the other hand if you don't delete
it, there will be a memory leak. So your program can either:
     keep a pointer to the parser when you use "new" to create it. Make sure
the parser lives long enough until you've finished using it's internal
document object.             and then delete the parser.
or
      make a copy of the parser's internal document and delete the parser in
ParseDocument();

remember in C++ every object created with "new" should be destructed with
"delete", and it's up to you to keep those objects valid.



regards

Lei



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to