@@ -68,7 +68,7 @@ pub struct StylesheetCache {
6868
6969/// @brief Creates an instance of StylesheetCache.
7070/// @return a StylesheetCache struct
71- #[ no_mangle]
71+ #[ unsafe ( no_mangle) ]
7272pub extern "C" fn css_inliner_stylesheet_cache ( size : size_t ) -> StylesheetCache {
7373 StylesheetCache { size }
7474}
@@ -102,7 +102,7 @@ pub struct CssInlinerOptions {
102102macro_rules! inliner {
103103 ( $options: expr) => {
104104 CSSInliner :: new(
105- match InlineOptions :: try_from( match $options. as_ref( ) {
105+ match InlineOptions :: try_from( match unsafe { $options. as_ref( ) } {
106106 Some ( ptr) => ptr,
107107 None => return CssResult :: NullOptions ,
108108 } ) {
@@ -115,7 +115,7 @@ macro_rules! inliner {
115115
116116macro_rules! to_str {
117117 ( $input: expr) => {
118- match CStr :: from_ptr( $input) . to_str( ) {
118+ match unsafe { CStr :: from_ptr( $input) } . to_str( ) {
119119 Ok ( val) => val,
120120 Err ( _) => return CssResult :: InvalidInputString ,
121121 }
@@ -130,7 +130,7 @@ macro_rules! to_str {
130130/// @return a CSS_RESULT enum variant regarding if the operation was a success or an error occurred
131131#[ allow( clippy:: missing_safety_doc) ]
132132#[ must_use]
133- #[ no_mangle]
133+ #[ unsafe ( no_mangle) ]
134134pub unsafe extern "C" fn css_inline_to (
135135 options : * const CssInlinerOptions ,
136136 input : * const c_char ,
@@ -144,8 +144,10 @@ pub unsafe extern "C" fn css_inline_to(
144144 return e. into ( ) ;
145145 } ;
146146 // Null terminate the pointer
147- let ptr: * mut c_char = buffer. buffer . add ( buffer. pos ) ;
148- * ptr = 0 ;
147+ unsafe {
148+ let ptr: * mut c_char = buffer. buffer . add ( buffer. pos ) ;
149+ * ptr = 0 ;
150+ }
149151 CssResult :: Ok
150152}
151153
@@ -158,7 +160,7 @@ pub unsafe extern "C" fn css_inline_to(
158160/// @return a CSS_RESULT enum variant regarding if the operation was a success or an error occurred
159161#[ allow( clippy:: missing_safety_doc) ]
160162#[ must_use]
161- #[ no_mangle]
163+ #[ unsafe ( no_mangle) ]
162164pub unsafe extern "C" fn css_inline_fragment_to (
163165 options : * const CssInlinerOptions ,
164166 input : * const c_char ,
@@ -174,14 +176,16 @@ pub unsafe extern "C" fn css_inline_fragment_to(
174176 return e. into ( ) ;
175177 } ;
176178 // Null terminate the pointer
177- let ptr: * mut c_char = buffer. buffer . add ( buffer. pos ) ;
178- * ptr = 0 ;
179+ unsafe {
180+ let ptr: * mut c_char = buffer. buffer . add ( buffer. pos ) ;
181+ * ptr = 0 ;
182+ }
179183 CssResult :: Ok
180184}
181185
182186/// @brief Creates an instance of CssInlinerOptions with the default parameters.
183187/// @return a CssInlinerOptions struct
184- #[ no_mangle]
188+ #[ unsafe ( no_mangle) ]
185189pub extern "C" fn css_inliner_default_options ( ) -> CssInlinerOptions {
186190 CssInlinerOptions {
187191 inline_style_tags : true ,
0 commit comments