strlen returns 'size_t'

this is unsinged and on 64bit Linux (LP64) 64bit
This commit is contained in:
Martin Diehl 2023-02-08 08:37:10 +01:00
parent 4389ba25f2
commit 58c905d318
2 changed files with 6 additions and 6 deletions

View File

@ -86,7 +86,7 @@ void inflate_c(const uLong *s_deflated, const uLong *s_inflated, const Byte defl
} }
#ifdef FYAML #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; 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; 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); *flow = fy_emit_document_to_string(fyd,emit_flags);
*length_flow = strlen(*flow); *length_flow = (long) strlen(*flow);
fy_document_destroy(fyd); fy_document_destroy(fyd);
} }

View File

@ -24,11 +24,11 @@ module YAML_parse
interface interface
subroutine to_flow_C(flow,length_flow,mixed) bind(C) 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) implicit none(type,external)
type(C_PTR), intent(out) :: flow 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 character(kind=C_CHAR), dimension(*), intent(in) :: mixed
end subroutine to_flow_C end subroutine to_flow_C
@ -216,7 +216,7 @@ function to_flow(mixed) result(flow)
character(:,C_CHAR), allocatable :: flow character(:,C_CHAR), allocatable :: flow
type(C_PTR) :: str_ptr type(C_PTR) :: str_ptr
integer(C_INT) :: strlen integer(C_LONG) :: strlen
call to_flow_C(str_ptr,strlen,f_c_string(mixed)) call to_flow_C(str_ptr,strlen,f_c_string(mixed))
@ -226,7 +226,7 @@ function to_flow(mixed) result(flow)
block block
character(len=strlen,kind=c_char), pointer :: s character(len=strlen,kind=c_char), pointer :: s
call c_f_pointer(str_ptr,s) call c_f_pointer(str_ptr,s)
flow = s(:len(s)-1) flow = s(:len(s,pI64)-1_pI64)
end block end block
call free_C(str_ptr) call free_C(str_ptr)