@@ -77,55 +77,67 @@ impl ReportCollection {
77
77
}
78
78
}
79
79
80
- pub fn add_text ( & self , view : & BinaryView , title : & str , contents : & str ) {
80
+ pub fn add_text ( & self , view : Option < & BinaryView > , title : & str , contents : & str ) {
81
81
let title = title. to_cstr ( ) ;
82
82
let contents = contents. to_cstr ( ) ;
83
83
unsafe {
84
84
BNAddPlainTextReportToCollection (
85
85
self . handle . as_ptr ( ) ,
86
- view. handle ,
86
+ view. map ( |v| v . handle ) . unwrap_or ( std :: ptr :: null_mut ( ) ) ,
87
87
title. as_ptr ( ) ,
88
88
contents. as_ptr ( ) ,
89
89
)
90
90
}
91
91
}
92
92
93
- pub fn add_markdown ( & self , view : & BinaryView , title : & str , contents : & str , plaintext : & str ) {
93
+ pub fn add_markdown (
94
+ & self ,
95
+ view : Option < & BinaryView > ,
96
+ title : & str ,
97
+ contents : & str ,
98
+ plaintext : & str ,
99
+ ) {
94
100
let title = title. to_cstr ( ) ;
95
101
let contents = contents. to_cstr ( ) ;
96
102
let plaintext = plaintext. to_cstr ( ) ;
97
103
unsafe {
98
104
BNAddMarkdownReportToCollection (
99
105
self . handle . as_ptr ( ) ,
100
- view. handle ,
106
+ view. map ( |v| v . handle ) . unwrap_or ( std :: ptr :: null_mut ( ) ) ,
101
107
title. as_ptr ( ) ,
102
108
contents. as_ptr ( ) ,
103
109
plaintext. as_ptr ( ) ,
104
110
)
105
111
}
106
112
}
107
113
108
- pub fn add_html ( & self , view : & BinaryView , title : & str , contents : & str , plaintext : & str ) {
114
+ pub fn add_html (
115
+ & self ,
116
+ view : Option < & BinaryView > ,
117
+ title : & str ,
118
+ contents : & str ,
119
+ plaintext : & str ,
120
+ ) {
109
121
let title = title. to_cstr ( ) ;
110
122
let contents = contents. to_cstr ( ) ;
111
123
let plaintext = plaintext. to_cstr ( ) ;
112
124
unsafe {
113
125
BNAddHTMLReportToCollection (
114
126
self . handle . as_ptr ( ) ,
115
- view. handle ,
127
+ view. map ( |v| v . handle ) . unwrap_or ( std :: ptr :: null_mut ( ) ) ,
116
128
title. as_ptr ( ) ,
117
129
contents. as_ptr ( ) ,
118
130
plaintext. as_ptr ( ) ,
119
131
)
120
132
}
121
133
}
122
134
123
- pub fn add_graph ( & self , view : & BinaryView , title : & str , graph : & FlowGraph ) {
135
+ pub fn add_graph ( & self , view : Option < & BinaryView > , title : & str , graph : & FlowGraph ) {
124
136
let title = title. to_cstr ( ) ;
125
137
unsafe {
126
138
BNAddGraphReportToCollection (
127
139
self . handle . as_ptr ( ) ,
128
- view. handle ,
140
+ view. map ( |v| v . handle ) . unwrap_or ( std :: ptr :: null_mut ( ) ) ,
129
141
title. as_ptr ( ) ,
130
142
graph. handle ,
131
143
)
0 commit comments