[OCaml] Eliminate use of -Wno-write-strings
Don't convert string literals to char * in the strings_test example. In constantWrapper(), use SwigType_str() instead of SwigType_lstr() in order to keep const qualifiers.
This commit is contained in:
parent
7118e4ef1e
commit
4ca7cd7b27
7 changed files with 20 additions and 27 deletions
|
|
@ -19,7 +19,7 @@ void takes_char_ptr( char *p ) {
|
|||
cout << "takes_char_ptr( \"" << p << "\" );" << endl;
|
||||
}
|
||||
|
||||
char *gives_char_ptr() {
|
||||
const char *gives_const_char_ptr() {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
|
|
@ -28,8 +28,8 @@ void takes_and_gives_std_string( std::string &inout ) {
|
|||
inout.insert( inout.end(), ']' );
|
||||
}
|
||||
|
||||
void takes_and_gives_char_ptr( char *&inout ) {
|
||||
char *pout = strchr( inout, '.' );
|
||||
void takes_and_gives_const_char_ptr( const char *&inout ) {
|
||||
const char *pout = strchr( inout, '.' );
|
||||
if( pout ) inout = pout + 1;
|
||||
else inout = "foo";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ let _ = print_endline
|
|||
("_gives_std_string <<" ^ (get_string (_gives_std_string C_void)) ^ " >>")
|
||||
let _ = _takes_char_ptr (C_string "bar")
|
||||
let _ = print_endline
|
||||
("_gives_char_ptr << " ^ (get_string (_gives_char_ptr C_void)) ^ " >>")
|
||||
("_gives_const_char_ptr << " ^ (get_string (_gives_const_char_ptr C_void)) ^ " >>")
|
||||
let _ = print_endline
|
||||
("_takes_and_gives_std_string << " ^
|
||||
(get_string (_takes_and_gives_std_string (C_string "foo"))) ^ " >>")
|
||||
let _ = print_endline
|
||||
("_takes_and_gives_char_ptr << " ^
|
||||
(get_string (_takes_and_gives_char_ptr (C_string "bar.bar"))) ^ " >>")
|
||||
("_takes_and_gives_const_char_ptr << " ^
|
||||
(get_string (_takes_and_gives_const_char_ptr (C_string "bar.bar"))) ^ " >>")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue