@@ -13,31 +13,34 @@ module zlib
13
13
14
14
interface
15
15
16
- subroutine inflate_C (s_deflated ,s_inflated ,deflated ,inflated ) bind(C)
17
- use , intrinsic :: ISO_C_Binding, only: C_SIGNED_CHAR, C_INT64_T
16
+ subroutine inflate_C (s_deflated ,s_inflated ,deflated ,inflated , stat ) bind(C)
17
+ use , intrinsic :: ISO_C_Binding, only: C_SIGNED_CHAR, C_INT64_T, C_INT
18
18
implicit none (type,external )
19
19
20
20
integer (C_INT64_T), intent (in ) :: s_deflated,s_inflated
21
- integer (C_SIGNED_CHAR), dimension (s_deflated), intent (in ) :: deflated
22
- integer (C_SIGNED_CHAR), dimension (s_inflated), intent (out ) :: inflated
21
+ integer (C_SIGNED_CHAR), dimension (s_deflated), intent (in ) :: deflated ! ok for unsigned char
22
+ integer (C_SIGNED_CHAR), dimension (s_inflated), intent (out ) :: inflated ! ok for unsigned char
23
+ integer (C_INT), intent (out ) :: stat
23
24
end subroutine inflate_C
24
25
25
26
end interface
26
27
27
28
contains
28
29
29
30
!- -------------------------------------------------------------------------------------------------
30
- ! > @brief Inflate byte-wise representation
31
+ ! > @brief Inflate byte-wise representation.
31
32
!- -------------------------------------------------------------------------------------------------
32
33
function zlib_inflate (deflated ,size_inflated )
33
34
34
35
integer (C_SIGNED_CHAR), dimension (:), intent (in ) :: deflated
35
36
integer (pI64), intent (in ) :: size_inflated
36
-
37
37
integer (C_SIGNED_CHAR), dimension (size_inflated) :: zlib_inflate
38
38
39
+ integer (C_INT) :: stat
40
+
39
41
40
- call inflate_C(size (deflated,kind= C_INT64_T),int (size_inflated,C_INT64_T),deflated,zlib_inflate)
42
+ call inflate_C(size (deflated,kind= C_INT64_T),int (size_inflated,C_INT64_T),deflated,zlib_inflate,stat)
43
+ if (stat /= 0 ) error stop ' inflate failed'
41
44
42
45
end function zlib_inflate
43
46
0 commit comments