From 5c82c6036e04936e253d2031f73f8218bbed06aa Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Fri, 3 Sep 2021 11:12:56 -0400 Subject: Commonize _to_core_struct/_from_core_struct Improve implementation of immutable_copy/mutable_copy --- python/flowgraph.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'python/flowgraph.py') diff --git a/python/flowgraph.py b/python/flowgraph.py index 2fe4545a..65287f19 100644 --- a/python/flowgraph.py +++ b/python/flowgraph.py @@ -64,7 +64,7 @@ class EdgeStyle: self.width = width if width is not None else 0 self.color = theme_color if theme_color is not None else ThemeColor.AddressColor - def _get_core_struct(self): + def _to_core_struct(self) -> core.BNEdgeStyle: result = core.BNEdgeStyle() result.style = self.style result.width = self.width @@ -245,7 +245,7 @@ class FlowGraphNode: raise ValueError("Specified color is not one of HighlightStandardColor, highlight.HighlightColor") if isinstance(color, HighlightStandardColor): color = highlight.HighlightColor(color) - line_buf[i].highlight = color._get_core_struct() + line_buf[i].highlight = color._to_core_struct() line_buf[i].count = len(line.tokens) line_buf[i].tokens = function.InstructionTextToken._get_core_struct(line.tokens) core.BNSetFlowGraphNodeLines(self.handle, line_buf, len(lines)) @@ -307,7 +307,7 @@ class FlowGraphNode: raise ValueError("Specified color is not one of HighlightStandardColor, highlight.HighlightColor") if isinstance(color, HighlightStandardColor): color = highlight.HighlightColor(color) - core.BNSetFlowGraphNodeHighlight(self.handle, color._get_core_struct()) + core.BNSetFlowGraphNodeHighlight(self.handle, color._to_core_struct()) def add_outgoing_edge(self, edge_type, target, style=None): """ @@ -325,7 +325,7 @@ class FlowGraphNode: elif not isinstance(style, EdgeStyle): raise AttributeError("style must be of type EdgeStyle") - core.BNAddFlowGraphNodeOutgoingEdge(self.handle, edge_type, target.handle, style._get_core_struct()) + core.BNAddFlowGraphNodeOutgoingEdge(self.handle, edge_type, target.handle, style._to_core_struct()) def is_valid_for_graph(self, graph): return core.BNIsNodeValidForFlowGraph(graph.handle, self.handle) -- cgit v1.3.1