Skip to content

Commit

Permalink
Squashed 'externals/coda-oss/' changes from bbf8be1..eba1450
Browse files Browse the repository at this point in the history
eba1450 Merge pull request ngageoint#259 from mdaus/xmlLeak
5640dcf Fix comment
a6b53f4 Fix memory leak on error reading
8499ef8 Merge pull request ngageoint#258 from mdaus/solarisC99
d9c0160 Compile solaris with c99

git-subtree-dir: externals/coda-oss
git-subtree-split: eba14502fe83c9ef21163a698b4b616ebef84ece
  • Loading branch information
JonathanMeans committed May 17, 2018
1 parent 27677c5 commit f4c8148
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 3 additions & 1 deletion build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,9 @@ def configureCompilerOptions(self):
config['cc']['optz_fastest'] = '-xO5'
self.env['CFLAGS_cshlib'] = ['-KPIC', '-DPIC']

self.env.append_value('CFLAGS', '-KPIC'.split())
# C99 is required for Solaris to be compatible with
# macros that openjpeg sets
self.env.append_value('CFLAGS', ['-KPIC', '-xc99=all'])
self.env.append_value('CFLAGS_THREAD', '-mt')

elif re.match(winRegex, sys_platform):
Expand Down
11 changes: 5 additions & 6 deletions modules/c++/xml.lite/source/XMLReaderXerces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

#include "xml/lite/XMLReader.h"
#include <mem/ScopedArray.h>

#if defined(USE_XERCES)

Expand All @@ -39,18 +40,16 @@ void xml::lite::XMLReaderXerces::parse(io::InputStream & is, int size)
{
throw xml::lite::XMLParseException(Ctxt("No stream available"));
}
sys::byte* buffer = new sys::byte[available];
oss.read(buffer, available);
mem::ScopedArray<sys::byte> buffer(new sys::byte[available]);
oss.read(buffer.get(), available);

// Adopt my buffer, and delete it for me
MemBufInputSource memBuffer((const unsigned char *)buffer,
// Does not take ownership
MemBufInputSource memBuffer((const unsigned char *)buffer.get(),
available,
XMLReaderXerces::MEM_BUFFER_ID(),
false);

mNative->parse(memBuffer);

delete [] buffer;
}

// This function creates the parser
Expand Down
6 changes: 3 additions & 3 deletions modules/c++/xml.lite/wscript
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NAME = 'xml.lite'
MAINTAINER = '[email protected]'
VERSION = '1.2'
MODULE_DEPS = 'io mt logging'
MODULE_DEPS = 'io mem mt logging'
USELIB_CHECK = 'XML'
TEST_FILTER = 'MMParserTest1.cpp MinidomParserTest2.cpp'
TEST_DEPS = 'cli'
Expand All @@ -20,8 +20,8 @@ def configure(conf):
conf.define('USE_LIBXML', '', quote=False)
elif Options.options.xml_layer == 'xerces':
conf.define('USE_XERCES', '', quote=False)

writeConfig(conf, xml_lite_callback, NAME)

def build(bld):
bld.module(**globals())

0 comments on commit f4c8148

Please sign in to comment.