Commit a2c68a6f authored by peastman's avatar peastman
Browse files

Merge pull request #319 from swails/master

Fix segfaults in GCC when using the C-API
parents a6524f94 fd1bb3d2
......@@ -550,6 +550,8 @@ class CSourceGenerator(WrapperGenerator):
unwrappedType = type[:-1].strip()
if unwrappedType in self.classesByShortName:
unwrappedType = self.classesByShortName[unwrappedType]
if unwrappedType == 'const std::string':
return 'std::string(%s)' % value
return '*'+self.unwrapValue(unwrappedType+'*', value)
if type in self.classesByShortName:
return 'static_cast<%s>(%s)' % (self.classesByShortName[type], value)
......
......@@ -624,6 +624,8 @@ class CSourceGenerator(WrapperGenerator):
unwrappedType = type[:-1].strip()
if unwrappedType in self.classesByShortName:
unwrappedType = self.classesByShortName[unwrappedType]
if unwrappedType == 'const std::string':
return 'std::string(%s)' % value
return '*'+self.unwrapValue(unwrappedType+'*', value)
if type in self.classesByShortName:
return 'static_cast<%s>(%s)' % (self.classesByShortName[type], value)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment