Loading src/FileType_PNG.f90 +2 −2 Original line number Diff line number Diff line Loading @@ -489,9 +489,9 @@ SUBROUTINE readImageData_PNGFileType(this,image) ENDSUBROUTINE C_png_read_image !Destroy PNG read structure SUBROUTINE C_png_destroy_read_struct(png_ptr,info_ptr_ptr,end_info_ptr_ptr) BIND(C,NAME="png_destroy_read_struct") SUBROUTINE C_png_destroy_read_struct(png_ptr_ptr,info_ptr_ptr,end_info_ptr_ptr) BIND(C,NAME="png_destroy_read_struct") IMPORT :: C_PTR TYPE(C_PTR),VALUE :: png_ptr TYPE(C_PTR) :: png_ptr_ptr TYPE(C_PTR) :: info_ptr_ptr TYPE(C_PTR) :: end_info_ptr_ptr ENDSUBROUTINE C_png_destroy_read_struct Loading unit_tests/testTPLPNG/testTPLPNGf.f90 +12 −3 Original line number Diff line number Diff line Loading @@ -96,9 +96,9 @@ PROGRAM testTPLPNGf ! Declare variables INTEGER :: i,j INTEGER :: ioerr TYPE(C_PTR) :: png_ptr,info_ptr,fp TYPE(C_PTR) :: png_ptr,info_ptr,fp,ver_ptr TYPE(C_PTR),POINTER :: row_pointers(:) CHARACTER(LEN=1),POINTER :: image(:,:,:) CHARACTER(KIND=C_CHAR,LEN=1),POINTER :: image(:,:,:),png_ver(:) ! Allocate memory for the image (3 bytes per pixel for RGB) ALLOCATE(image(3,width,height)) Loading @@ -112,8 +112,17 @@ PROGRAM testTPLPNGf ENDDO ENDDO ver_ptr=C_png_get_libpng_ver(C_NULL_PTR) CALL C_F_POINTER(ver_ptr,png_ver,(/16/)) !This is for the length of the version string !16 is chosen as it should always be !long enough !7 is more likely, but going to 16 !doesn't seem !cause an issue. ! Create the PNG write structure png_ptr=C_png_create_write_struct("1.6.37"//C_NULL_CHAR,C_NULL_PTR,C_NULL_PTR,C_NULL_PTR) png_ptr=C_png_create_write_struct(png_ver,C_NULL_PTR,C_NULL_PTR,C_NULL_PTR) IF(C_ASSOCIATED(png_ptr,C_NULL_PTR)) THEN WRITE(ERROR_UNIT,*) "Error creating PNG write struct!" STOP -1 Loading Loading
src/FileType_PNG.f90 +2 −2 Original line number Diff line number Diff line Loading @@ -489,9 +489,9 @@ SUBROUTINE readImageData_PNGFileType(this,image) ENDSUBROUTINE C_png_read_image !Destroy PNG read structure SUBROUTINE C_png_destroy_read_struct(png_ptr,info_ptr_ptr,end_info_ptr_ptr) BIND(C,NAME="png_destroy_read_struct") SUBROUTINE C_png_destroy_read_struct(png_ptr_ptr,info_ptr_ptr,end_info_ptr_ptr) BIND(C,NAME="png_destroy_read_struct") IMPORT :: C_PTR TYPE(C_PTR),VALUE :: png_ptr TYPE(C_PTR) :: png_ptr_ptr TYPE(C_PTR) :: info_ptr_ptr TYPE(C_PTR) :: end_info_ptr_ptr ENDSUBROUTINE C_png_destroy_read_struct Loading
unit_tests/testTPLPNG/testTPLPNGf.f90 +12 −3 Original line number Diff line number Diff line Loading @@ -96,9 +96,9 @@ PROGRAM testTPLPNGf ! Declare variables INTEGER :: i,j INTEGER :: ioerr TYPE(C_PTR) :: png_ptr,info_ptr,fp TYPE(C_PTR) :: png_ptr,info_ptr,fp,ver_ptr TYPE(C_PTR),POINTER :: row_pointers(:) CHARACTER(LEN=1),POINTER :: image(:,:,:) CHARACTER(KIND=C_CHAR,LEN=1),POINTER :: image(:,:,:),png_ver(:) ! Allocate memory for the image (3 bytes per pixel for RGB) ALLOCATE(image(3,width,height)) Loading @@ -112,8 +112,17 @@ PROGRAM testTPLPNGf ENDDO ENDDO ver_ptr=C_png_get_libpng_ver(C_NULL_PTR) CALL C_F_POINTER(ver_ptr,png_ver,(/16/)) !This is for the length of the version string !16 is chosen as it should always be !long enough !7 is more likely, but going to 16 !doesn't seem !cause an issue. ! Create the PNG write structure png_ptr=C_png_create_write_struct("1.6.37"//C_NULL_CHAR,C_NULL_PTR,C_NULL_PTR,C_NULL_PTR) png_ptr=C_png_create_write_struct(png_ver,C_NULL_PTR,C_NULL_PTR,C_NULL_PTR) IF(C_ASSOCIATED(png_ptr,C_NULL_PTR)) THEN WRITE(ERROR_UNIT,*) "Error creating PNG write struct!" STOP -1 Loading