strlen returns 'size_t'
this is unsinged and on 64bit Linux (LP64) 64bit
This commit is contained in:
parent
4389ba25f2
commit
58c905d318
|
@ -86,7 +86,7 @@ void inflate_c(const uLong *s_deflated, const uLong *s_inflated, const Byte defl
|
|||
}
|
||||
|
||||
#ifdef FYAML
|
||||
void to_flow_c(char **flow, int* length_flow, const char *mixed){
|
||||
void to_flow_c(char **flow, long* length_flow, const char *mixed){
|
||||
struct fy_document *fyd = NULL;
|
||||
enum fy_emitter_cfg_flags emit_flags = FYECF_MODE_FLOW_ONELINE | FYECF_STRIP_LABELS | FYECF_STRIP_TAGS |FYECF_STRIP_DOC;
|
||||
|
||||
|
@ -102,7 +102,7 @@ void to_flow_c(char **flow, int* length_flow, const char *mixed){
|
|||
}
|
||||
|
||||
*flow = fy_emit_document_to_string(fyd,emit_flags);
|
||||
*length_flow = strlen(*flow);
|
||||
*length_flow = (long) strlen(*flow);
|
||||
|
||||
fy_document_destroy(fyd);
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@ module YAML_parse
|
|||
interface
|
||||
|
||||
subroutine to_flow_C(flow,length_flow,mixed) bind(C)
|
||||
use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR, C_PTR
|
||||
use, intrinsic :: ISO_C_Binding, only: C_LONG, C_CHAR, C_PTR
|
||||
implicit none(type,external)
|
||||
|
||||
type(C_PTR), intent(out) :: flow
|
||||
integer(C_INT), intent(out) :: length_flow
|
||||
integer(C_LONG), intent(out) :: length_flow
|
||||
character(kind=C_CHAR), dimension(*), intent(in) :: mixed
|
||||
end subroutine to_flow_C
|
||||
|
||||
|
@ -216,7 +216,7 @@ function to_flow(mixed) result(flow)
|
|||
character(:,C_CHAR), allocatable :: flow
|
||||
|
||||
type(C_PTR) :: str_ptr
|
||||
integer(C_INT) :: strlen
|
||||
integer(C_LONG) :: strlen
|
||||
|
||||
|
||||
call to_flow_C(str_ptr,strlen,f_c_string(mixed))
|
||||
|
@ -226,7 +226,7 @@ function to_flow(mixed) result(flow)
|
|||
block
|
||||
character(len=strlen,kind=c_char), pointer :: s
|
||||
call c_f_pointer(str_ptr,s)
|
||||
flow = s(:len(s)-1)
|
||||
flow = s(:len(s,pI64)-1_pI64)
|
||||
end block
|
||||
|
||||
call free_C(str_ptr)
|
||||
|
|
Loading…
Reference in New Issue