@@ -15,7 +15,7 @@ use std::sync::atomic::{AtomicU64, Ordering};
1515// ============================================================================
1616
1717#[ link( wasm_import_module = "cortex" ) ]
18- extern "C" {
18+ unsafe extern "C" {
1919 /// Log a message at the specified level.
2020 /// level: 0=trace, 1=debug, 2=info, 3=warn, 4=error
2121 fn log ( level : i32 , msg_ptr : i32 , msg_len : i32 ) ;
@@ -273,7 +273,7 @@ fn record_file_deleted(lines: u64) {
273273/// # Returns
274274/// - `0` on success
275275/// - Non-zero on failure
276- #[ no_mangle]
276+ #[ unsafe ( no_mangle) ]
277277pub extern "C" fn init ( ) -> i32 {
278278 log_info ( "Code Stats plugin initializing..." ) ;
279279
@@ -303,7 +303,7 @@ pub extern "C" fn init() -> i32 {
303303/// # Returns
304304/// - `0` on success
305305/// - Non-zero on failure
306- #[ no_mangle]
306+ #[ unsafe ( no_mangle) ]
307307pub extern "C" fn shutdown ( ) -> i32 {
308308 log_info ( "Code Stats plugin shutting down" ) ;
309309
@@ -330,7 +330,7 @@ pub extern "C" fn shutdown() -> i32 {
330330/// # Returns
331331/// - `0` on success
332332/// - Non-zero on failure
333- #[ no_mangle]
333+ #[ unsafe ( no_mangle) ]
334334pub extern "C" fn cmd_stats ( ) -> i32 {
335335 log_debug ( "Stats command executed" ) ;
336336
@@ -354,7 +354,7 @@ pub extern "C" fn cmd_stats() -> i32 {
354354/// # Returns
355355/// - `0` on success
356356/// - Non-zero on failure
357- #[ no_mangle]
357+ #[ unsafe ( no_mangle) ]
358358pub extern "C" fn cmd_stats_reset ( ) -> i32 {
359359 log_debug ( "Stats reset command executed" ) ;
360360
@@ -378,7 +378,7 @@ pub extern "C" fn cmd_stats_reset() -> i32 {
378378/// # Returns
379379/// - `0` on success
380380/// - Non-zero on failure
381- #[ no_mangle]
381+ #[ unsafe ( no_mangle) ]
382382pub extern "C" fn cmd_stats_export ( ) -> i32 {
383383 log_debug ( "Stats export command executed" ) ;
384384
@@ -412,7 +412,7 @@ pub extern "C" fn cmd_stats_export() -> i32 {
412412/// - `0` to continue normally
413413/// - `1` to skip further processing
414414/// - `2` to abort the operation chain
415- #[ no_mangle]
415+ #[ unsafe ( no_mangle) ]
416416pub extern "C" fn hook_file_operation_after ( ) -> i32 {
417417 log_debug ( "File operation hook triggered" ) ;
418418
@@ -446,7 +446,7 @@ pub extern "C" fn hook_file_operation_after() -> i32 {
446446/// - `0` to continue normally
447447/// - `1` to skip further processing
448448/// - `2` to abort
449- #[ no_mangle]
449+ #[ unsafe ( no_mangle) ]
450450pub extern "C" fn hook_session_end ( ) -> i32 {
451451 log_info ( "Session end hook triggered - saving statistics" ) ;
452452
@@ -469,7 +469,7 @@ pub extern "C" fn hook_session_end() -> i32 {
469469/// - `0` to continue normally
470470/// - `1` to skip
471471/// - `2` to abort
472- #[ no_mangle]
472+ #[ unsafe ( no_mangle) ]
473473pub extern "C" fn hook_widget_register ( ) -> i32 {
474474 log_debug ( "Widget registration hook triggered" ) ;
475475
@@ -493,7 +493,7 @@ pub extern "C" fn hook_widget_register() -> i32 {
493493/// # Returns
494494/// - `0` on success
495495/// - Non-zero on failure
496- #[ no_mangle]
496+ #[ unsafe ( no_mangle) ]
497497pub extern "C" fn widget_render_code_stats ( ) -> i32 {
498498 // Get compact stats for status bar display
499499 let added = LINES_ADDED . load ( Ordering :: Relaxed ) ;
@@ -519,7 +519,7 @@ pub extern "C" fn widget_render_code_stats() -> i32 {
519519///
520520/// # Returns
521521/// - `0` on success
522- #[ no_mangle]
522+ #[ unsafe ( no_mangle) ]
523523pub extern "C" fn api_record_file_created ( ) -> i32 {
524524 // In real implementation, read line count from shared buffer
525525 let lines: u64 = 0 ; // Placeholder - would be read from buffer
@@ -536,7 +536,7 @@ pub extern "C" fn api_record_file_created() -> i32 {
536536///
537537/// # Returns
538538/// - `0` on success
539- #[ no_mangle]
539+ #[ unsafe ( no_mangle) ]
540540pub extern "C" fn api_record_file_deleted ( ) -> i32 {
541541 // In real implementation, read line count from shared buffer
542542 let lines: u64 = 0 ; // Placeholder - would be read from buffer
@@ -551,7 +551,7 @@ pub extern "C" fn api_record_file_deleted() -> i32 {
551551/// # Returns
552552/// - Length of JSON string on success
553553/// - Negative value on failure
554- #[ no_mangle]
554+ #[ unsafe ( no_mangle) ]
555555pub extern "C" fn api_get_stats_json ( ) -> i64 {
556556 let json = get_stats_json ( ) ;
557557 json. len ( ) as i64
0 commit comments