You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/10/09 14:19:30 UTC
cvs commit: xml-xerces/c/src/util/MsgLoaders/MsgFile MsgLoader.cpp
tng 01/10/09 05:19:30
Modified: c/src/util/MsgLoaders/MsgFile MsgLoader.cpp
Log:
Leak fix: can call transcode directly instead of using copyString.
Revision Changes Path
1.6 +21 -21 xml-xerces/c/src/util/MsgLoaders/MsgFile/MsgLoader.cpp
Index: MsgLoader.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/MsgLoaders/MsgFile/MsgLoader.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MsgLoader.cpp 2000/09/28 22:42:44 1.5
+++ MsgLoader.cpp 2001/10/09 12:19:30 1.6
@@ -1,37 +1,37 @@
/*
* The Apache Software License, Version 1.1
- *
+ *
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
+ * notice, this list of conditions and the following disclaimer.
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache\@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -45,7 +45,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
- *
+ *
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
@@ -55,7 +55,7 @@
*/
/*
- * $Id: MsgLoader.cpp,v 1.5 2000/09/28 22:42:44 aruna1 Exp $
+ * $Id: MsgLoader.cpp,v 1.6 2001/10/09 12:19:30 tng Exp $
*/
// ---------------------------------------------------------------------------
@@ -84,13 +84,13 @@
fCatalogHandle(0)
, fMsgDomain(0)
{
-
+
fMsgDomain = XMLString::replicate(msgDomain);
}
MsgCatalogLoader::~MsgCatalogLoader()
{
-
+
delete fMsgDomain;
}
@@ -106,8 +106,8 @@
char *buffer; // Allocate just what we need
char* anchor;
char temp[2];
-
+
reps[0] = (char*)repText1;
reps[1] = (char*)repText2;
reps[2] = (char*)repText3;
@@ -121,10 +121,10 @@
totalsize += sizes[i]+2;
count++;
}
-
+
buffer = (char*)malloc(totalsize); // Allocate just what we need
anchor = buffer;
-
+
for(i = 0; i < count; i++) // Stuff everything into the buffer
{
@@ -173,7 +173,7 @@
memset(&message, 0, sizeof(message.mdata)); /* Clear the message area */
message.mtext[0]='\0'; /* Null Text String */
-
+
int len = sizeof(message);
for(int i = 0; i < 1024; i++)
message.mtext[i] = '\0';
@@ -187,7 +187,7 @@
// char msgString[100];
// char* catMessage = catgets( fCatalogHandle, msgSet, (int)msgToLoad, msgString);
- XMLString::copyString((XMLCh*)toFill, XMLString::transcode(message.mtext));
+ XMLString::transcode(message.mtext, toFill, maxChars);
return true;
}
@@ -248,8 +248,8 @@
// Call the other version to load up the message
if (!localMsg(msgId, toFill, maxChars, repTexts, size))
return false;
+
-
return true;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org