mirror of https://github.com/ecmwf/eccodes.git
Bug fixes
This commit is contained in:
parent
f2bad02f68
commit
437597f413
|
@ -848,17 +848,18 @@ class FunctionConverter:
|
|||
return None
|
||||
|
||||
if cpp_container_arg.is_const():
|
||||
debug.line("transform_container_cppvariable_access", f"Removed len assignment for const variable [{cpp_container_arg.name}]")
|
||||
debug.line("transform_cpp_container_assignment", f"Removed len assignment for const variable [{cpp_container_arg.name}]")
|
||||
return f"// [length assignment removed - var is const] " + cpp_container_arg.name + match_token.as_string() + post_match_string
|
||||
|
||||
# First, check for malloc
|
||||
# Note: Group 2 (\()? and group 5 (\)) ensure we match the correct number of braces (grib_X()) vs grib_X()
|
||||
m = re.search(r"\s*(\([^\)]+\))?(\()?grib_context_malloc(_\w+)?\([^,]+,(.+)\)(\))[,;]", post_match_string)
|
||||
# Note: Group 2 (\()? and group 6 (\)) ensure we match the correct number of braces (grib_X()) vs grib_X()
|
||||
# Note: Group 4 ([^,]+,)? is an optional match for the first param (usually c) which we discard, but may have already been removed!
|
||||
m = re.search(r"\s*(\([^\)]+\))?(\()?grib_context_malloc(_\w+)?\(([^,]+,)?(.+)\)(\))[,;]", post_match_string)
|
||||
|
||||
if m:
|
||||
match_string = m.group(4)
|
||||
match_string = m.group(5)
|
||||
if not m.group(2):
|
||||
match_string += m.group(5)
|
||||
match_string += m.group(6)
|
||||
|
||||
# Check if we're creating (new arg) or resizing (existing arg)
|
||||
if cpp_container_arg in self._new_cppargs_list:
|
||||
|
|
|
@ -203,6 +203,8 @@ class GribAccessorConverter:
|
|||
converter = self._converters[Converter.PRIVATE_METHOD_FUNCSIG](func.func_sig)
|
||||
mapping = converter.create_funcsig_mapping(self._transforms)
|
||||
self._transforms.add_to_private_funcsig_mappings(mapping)
|
||||
# Add Accessor-specific private mappings
|
||||
|
||||
|
||||
for func in self._grib_accessor.static_functions:
|
||||
converter = self._converters[Converter.STATIC_FUNC_FUNCSIG](func.func_sig)
|
||||
|
|
|
@ -84,7 +84,7 @@ class MethodConverter(FunctionConverter):
|
|||
|
||||
if cstruct_arg.name in ["super", "self", "a"]:
|
||||
# Find member functions
|
||||
conversions_list = self.predefined_conversions_list()
|
||||
conversions_list = self.method_conversions_list()
|
||||
|
||||
for conversions in conversions_list:
|
||||
for mapping in conversions:
|
||||
|
@ -325,8 +325,7 @@ class MethodConverter(FunctionConverter):
|
|||
|
||||
cppfuncname = transformed_cparams = None
|
||||
|
||||
# Need to use the full list in case the current method's local mappings don't support it!
|
||||
conversions_list = self.predefined_conversions_list()
|
||||
conversions_list = self.method_conversions_list()
|
||||
|
||||
for conversions in conversions_list:
|
||||
cppfuncname, transformed_cparams = self.transform_cfunction_call_from_conversions(cmethod_name, cparams, conversions)
|
||||
|
@ -344,6 +343,7 @@ class MethodConverter(FunctionConverter):
|
|||
return super().transform_cfunction_call(cfuncname, cparams)
|
||||
|
||||
# Return a list of all pre-defined conversions
|
||||
def predefined_conversions_list(self):
|
||||
def method_conversions_list(self):
|
||||
# Need to use the full inherited list in case the current method's local mappings don't support it!
|
||||
return [inherited_method_funcsig_conv.InheritedMethodFuncSigConverter.inherited_method_conversions,
|
||||
private_method_funcsig_conv.PrivateMethodFuncSigConverter.private_method_conversions]
|
||||
self._transforms.private_funcsig_mappings]
|
|
@ -208,3 +208,5 @@ class Transforms:
|
|||
def add_to_other_funcsig_mappings(self, mapping):
|
||||
assert not self.funcsig_mapping_for(mapping.cfuncsig.name), f"add_to_other_funcsig_mappings: Mapping for [{mapping.cfuncsig.name}] already exists!"
|
||||
self._other_funcsig_mappings.append(mapping)
|
||||
|
||||
|
|
@ -6,6 +6,6 @@
|
|||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
unsigned long gribDecodeUnsignedLong(AccessorDataBuffer::const_pointer input, long& bitPos, long numBits);
|
||||
unsigned long gribDecodeUnsignedLong(DataPointer input, long& bitPos, long numBits);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue