1- use super :: cerror:: ErrorList ;
21use super :: Matrix ;
2+ use super :: cerror:: ErrorList ;
33use super :: { cast_const, cast_mut, cstr, map_cerr} ;
44use graphannis:: corpusstorage:: ExportFormat ;
55use graphannis:: {
6+ AnnotationGraph , CorpusStorage ,
67 corpusstorage:: {
78 CacheStrategy , CountExtra , FrequencyDefEntry , FrequencyTable , FrequencyTableRow ,
89 ImportFormat , QueryAttributeDescription , QueryLanguage , ResultOrder , SearchQuery ,
910 } ,
1011 model:: { AnnotationComponent , AnnotationComponentType } ,
1112 update:: GraphUpdate ,
12- AnnotationGraph , CorpusStorage ,
1313} ;
1414use std:: ffi:: CString ;
1515use std:: path:: PathBuf ;
@@ -22,7 +22,7 @@ use std::path::PathBuf;
2222/// - `db_dir` - The path on the filesystem where the corpus storage content is located. Must be an existing directory.
2323/// - `use_parallel_joins` - If `true` parallel joins are used by the system, using all available cores.
2424/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
25- #[ no_mangle]
25+ #[ unsafe ( no_mangle) ]
2626pub extern "C" fn annis_cs_with_auto_cache_size (
2727 db_dir : * const libc:: c_char ,
2828 use_parallel_joins : bool ,
@@ -45,7 +45,7 @@ pub extern "C" fn annis_cs_with_auto_cache_size(
4545/// - `max_cache_size` - Fixed maximum size of the cache in bytes.
4646/// - `use_parallel_joins` - If `true` parallel joins are used by the system, using all available cores.
4747/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
48- #[ no_mangle]
48+ #[ unsafe ( no_mangle) ]
4949pub extern "C" fn annis_cs_with_max_cache_size (
5050 db_dir : * const libc:: c_char ,
5151 max_cache_size : usize ,
@@ -73,13 +73,13 @@ pub extern "C" fn annis_cs_with_max_cache_size(
7373/// # Safety
7474///
7575/// This functions dereferences the pointer given as argument and is therefore unsafe.
76- #[ no_mangle]
76+ #[ unsafe ( no_mangle) ]
7777pub unsafe extern "C" fn annis_cs_free ( ptr : * mut CorpusStorage ) {
7878 if ptr. is_null ( ) {
7979 return ;
8080 }
8181 // take ownership and destroy the pointer
82- let ptr = Box :: from_raw ( ptr) ;
82+ let ptr = unsafe { Box :: from_raw ( ptr) } ;
8383 std:: mem:: drop ( ptr) ;
8484}
8585
@@ -91,7 +91,7 @@ pub unsafe extern "C" fn annis_cs_free(ptr: *mut CorpusStorage) {
9191/// - `err` - Pointer to a list of errors. If any error occurred, this list will be non-empty.
9292///
9393/// Returns the count as number.
94- #[ no_mangle]
94+ #[ unsafe ( no_mangle) ]
9595pub extern "C" fn annis_cs_count (
9696 ptr : * const CorpusStorage ,
9797 corpus_names : * const Vec < CString > ,
@@ -124,7 +124,7 @@ pub extern "C" fn annis_cs_count(
124124/// - `query` - The query as string.
125125/// - `query_language` The query language of the query (e.g. AQL).
126126/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
127- #[ no_mangle]
127+ #[ unsafe ( no_mangle) ]
128128pub extern "C" fn annis_cs_count_extra (
129129 ptr : * const CorpusStorage ,
130130 corpus_names : * const Vec < CString > ,
@@ -168,7 +168,7 @@ pub extern "C" fn annis_cs_count_extra(
168168/// # Safety
169169///
170170/// This functions dereferences the `err` pointer and is therefore unsafe.
171- #[ no_mangle]
171+ #[ unsafe ( no_mangle) ]
172172pub unsafe extern "C" fn annis_cs_find (
173173 ptr : * const CorpusStorage ,
174174 corpus_names : * const Vec < CString > ,
@@ -194,7 +194,7 @@ pub unsafe extern "C" fn annis_cs_find(
194194 timeout : None ,
195195 } ;
196196
197- let limit = if limit. is_null ( ) { None } else { Some ( * limit) } ;
197+ let limit = unsafe { if limit. is_null ( ) { None } else { Some ( * limit) } } ;
198198
199199 map_cerr ( cs. find ( search_query, offset, limit, order) , err)
200200 . map ( |result| {
@@ -221,7 +221,7 @@ pub unsafe extern "C" fn annis_cs_find(
221221/// # Safety
222222///
223223/// This functions dereferences the `err` pointer and is therefore unsafe.
224- #[ no_mangle]
224+ #[ unsafe ( no_mangle) ]
225225pub extern "C" fn annis_cs_subgraph (
226226 ptr : * const CorpusStorage ,
227227 corpus_name : * const libc:: c_char ,
@@ -262,7 +262,7 @@ pub extern "C" fn annis_cs_subgraph(
262262/// # Safety
263263///
264264/// This functions dereferences the `err` pointer and is therefore unsafe.
265- #[ no_mangle]
265+ #[ unsafe ( no_mangle) ]
266266pub extern "C" fn annis_cs_subcorpus_graph (
267267 ptr : * const CorpusStorage ,
268268 corpus_name : * const libc:: c_char ,
@@ -285,7 +285,7 @@ pub extern "C" fn annis_cs_subcorpus_graph(
285285///
286286/// - `ptr` - The corpus storage object.
287287/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
288- #[ no_mangle]
288+ #[ unsafe ( no_mangle) ]
289289pub extern "C" fn annis_cs_corpus_graph (
290290 ptr : * const CorpusStorage ,
291291 corpus_name : * const libc:: c_char ,
@@ -306,7 +306,7 @@ pub extern "C" fn annis_cs_corpus_graph(
306306/// - `query` - The query which defines included nodes.
307307/// - `query_language` - The query language of the query (e.g. AQL).
308308/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
309- #[ no_mangle]
309+ #[ unsafe ( no_mangle) ]
310310pub extern "C" fn annis_cs_subgraph_for_query (
311311 ptr : * const CorpusStorage ,
312312 corpus_name : * const libc:: c_char ,
@@ -334,7 +334,7 @@ pub extern "C" fn annis_cs_subgraph_for_query(
334334/// - `query_language` - The query language of the query (e.g. AQL).
335335/// - `component_type_filter` - Only include edges of that belong to a component of the given type.
336336/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
337- #[ no_mangle]
337+ #[ unsafe ( no_mangle) ]
338338pub extern "C" fn annis_cs_subgraph_for_query_with_ctype (
339339 ptr : * const CorpusStorage ,
340340 corpus_name : * const libc:: c_char ,
@@ -365,7 +365,7 @@ pub extern "C" fn annis_cs_subgraph_for_query_with_ctype(
365365/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
366366///
367367/// Returns a frequency table of strings.
368- #[ no_mangle]
368+ #[ unsafe ( no_mangle) ]
369369pub extern "C" fn annis_cs_frequency (
370370 ptr : * const CorpusStorage ,
371371 corpus_names : * const Vec < CString > ,
@@ -424,7 +424,7 @@ pub extern "C" fn annis_cs_frequency(
424424///
425425/// - `ptr` - The corpus storage object.
426426/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
427- #[ no_mangle]
427+ #[ unsafe ( no_mangle) ]
428428pub extern "C" fn annis_cs_list (
429429 ptr : * const CorpusStorage ,
430430 err : * mut * mut ErrorList ,
@@ -451,7 +451,7 @@ pub extern "C" fn annis_cs_list(
451451/// - `list_values` - If true include the possible values in the result.
452452/// - `only_most_frequent_values` - If both this argument and `list_values` are true, only return the most frequent value for each annotation name.
453453/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
454- #[ no_mangle]
454+ #[ unsafe ( no_mangle) ]
455455pub extern "C" fn annis_cs_list_node_annotations (
456456 ptr : * const CorpusStorage ,
457457 corpus_name : * const libc:: c_char ,
@@ -491,7 +491,7 @@ pub extern "C" fn annis_cs_list_node_annotations(
491491/// - `component_layer` - The layer of the edge component.
492492/// - `only_most_frequent_values` - If both this argument and `list_values` are true, only return the most frequent value for each annotation name.
493493/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
494- #[ no_mangle]
494+ #[ unsafe ( no_mangle) ]
495495pub extern "C" fn annis_cs_list_edge_annotations (
496496 ptr : * const CorpusStorage ,
497497 corpus_name : * const libc:: c_char ,
@@ -539,7 +539,7 @@ pub extern "C" fn annis_cs_list_edge_annotations(
539539/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
540540///
541541/// Returns `true` if valid and an error with the parser message if invalid.
542- #[ no_mangle]
542+ #[ unsafe ( no_mangle) ]
543543pub extern "C" fn annis_cs_validate_query (
544544 ptr : * const CorpusStorage ,
545545 corpus_names : * const Vec < CString > ,
@@ -568,7 +568,7 @@ pub extern "C" fn annis_cs_validate_query(
568568/// - `query` - The query to be analyzed.
569569/// - `query_language` - The query language of the query (e.g. AQL).
570570/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
571- #[ no_mangle]
571+ #[ unsafe ( no_mangle) ]
572572pub extern "C" fn annis_cs_node_descriptions (
573573 ptr : * const CorpusStorage ,
574574 query : * const libc:: c_char ,
@@ -595,7 +595,7 @@ pub extern "C" fn annis_cs_node_descriptions(
595595///
596596/// Returns the name of the imported corpus.
597597/// The returned string must be deallocated by the caller using annis_str_free()!
598- #[ no_mangle]
598+ #[ unsafe ( no_mangle) ]
599599pub extern "C" fn annis_cs_import_from_fs (
600600 ptr : * mut CorpusStorage ,
601601 path : * const libc:: c_char ,
@@ -639,7 +639,7 @@ pub extern "C" fn annis_cs_import_from_fs(
639639/// - `path` - The location on the file system where the corpus data should be written to.
640640/// - `format` - The format in which this corpus data will be stored stored.
641641/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
642- #[ no_mangle]
642+ #[ unsafe ( no_mangle) ]
643643pub extern "C" fn annis_cs_export_to_fs (
644644 ptr : * mut CorpusStorage ,
645645 corpus_names : * const Vec < CString > ,
@@ -664,7 +664,7 @@ pub extern "C" fn annis_cs_export_to_fs(
664664/// - `ptr` - The corpus storage object.
665665/// - `ctype` -Filter by the component type.
666666/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
667- #[ no_mangle]
667+ #[ unsafe ( no_mangle) ]
668668pub extern "C" fn annis_cs_list_components_by_type (
669669 ptr : * mut CorpusStorage ,
670670 corpus_name : * const libc:: c_char ,
@@ -684,7 +684,7 @@ pub extern "C" fn annis_cs_list_components_by_type(
684684///
685685/// - `ptr` - The corpus storage object.
686686/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
687- #[ no_mangle]
687+ #[ unsafe ( no_mangle) ]
688688pub extern "C" fn annis_cs_delete (
689689 ptr : * mut CorpusStorage ,
690690 corpus : * const libc:: c_char ,
@@ -700,7 +700,7 @@ pub extern "C" fn annis_cs_delete(
700700///
701701/// - `corpus` The name of the corpus to unload.
702702/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
703- #[ no_mangle]
703+ #[ unsafe ( no_mangle) ]
704704pub extern "C" fn annis_cs_unload (
705705 ptr : * mut CorpusStorage ,
706706 corpus : * const libc:: c_char ,
@@ -718,7 +718,7 @@ pub extern "C" fn annis_cs_unload(
718718/// - `err` - Pointer to a list of errors. If any error occured, this list will be non-empty.
719719///
720720/// It is ensured that the update process is atomic and that the changes are persisted to disk if the error list is empty.
721- #[ no_mangle]
721+ #[ unsafe ( no_mangle) ]
722722pub extern "C" fn annis_cs_apply_update (
723723 ptr : * mut CorpusStorage ,
724724 corpus_name : * const libc:: c_char ,
0 commit comments