Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
3.3 KiB

  1. ----------------------------------------------------------------
  2. -- ZLib for Ada thick binding. --
  3. -- --
  4. -- Copyright (C) 2002-2003 Dmitriy Anisimkov --
  5. -- --
  6. -- Open source license information is in the zlib.ads file. --
  7. ----------------------------------------------------------------
  8. -- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $
  9. package body ZLib.Thin is
  10. ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
  11. Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
  12. --------------
  13. -- Avail_In --
  14. --------------
  15. function Avail_In (Strm : in Z_Stream) return UInt is
  16. begin
  17. return Strm.Avail_In;
  18. end Avail_In;
  19. ---------------
  20. -- Avail_Out --
  21. ---------------
  22. function Avail_Out (Strm : in Z_Stream) return UInt is
  23. begin
  24. return Strm.Avail_Out;
  25. end Avail_Out;
  26. ------------------
  27. -- Deflate_Init --
  28. ------------------
  29. function Deflate_Init
  30. (strm : Z_Streamp;
  31. level : Int;
  32. method : Int;
  33. windowBits : Int;
  34. memLevel : Int;
  35. strategy : Int)
  36. return Int is
  37. begin
  38. return deflateInit2
  39. (strm,
  40. level,
  41. method,
  42. windowBits,
  43. memLevel,
  44. strategy,
  45. ZLIB_VERSION,
  46. Z_Stream_Size);
  47. end Deflate_Init;
  48. ------------------
  49. -- Inflate_Init --
  50. ------------------
  51. function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
  52. begin
  53. return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
  54. end Inflate_Init;
  55. ------------------------
  56. -- Last_Error_Message --
  57. ------------------------
  58. function Last_Error_Message (Strm : in Z_Stream) return String is
  59. use Interfaces.C.Strings;
  60. begin
  61. if Strm.msg = Null_Ptr then
  62. return "";
  63. else
  64. return Value (Strm.msg);
  65. end if;
  66. end Last_Error_Message;
  67. ------------
  68. -- Set_In --
  69. ------------
  70. procedure Set_In
  71. (Strm : in out Z_Stream;
  72. Buffer : in Voidp;
  73. Size : in UInt) is
  74. begin
  75. Strm.Next_In := Buffer;
  76. Strm.Avail_In := Size;
  77. end Set_In;
  78. ------------------
  79. -- Set_Mem_Func --
  80. ------------------
  81. procedure Set_Mem_Func
  82. (Strm : in out Z_Stream;
  83. Opaque : in Voidp;
  84. Alloc : in alloc_func;
  85. Free : in free_func) is
  86. begin
  87. Strm.opaque := Opaque;
  88. Strm.zalloc := Alloc;
  89. Strm.zfree := Free;
  90. end Set_Mem_Func;
  91. -------------
  92. -- Set_Out --
  93. -------------
  94. procedure Set_Out
  95. (Strm : in out Z_Stream;
  96. Buffer : in Voidp;
  97. Size : in UInt) is
  98. begin
  99. Strm.Next_Out := Buffer;
  100. Strm.Avail_Out := Size;
  101. end Set_Out;
  102. --------------
  103. -- Total_In --
  104. --------------
  105. function Total_In (Strm : in Z_Stream) return ULong is
  106. begin
  107. return Strm.Total_In;
  108. end Total_In;
  109. ---------------
  110. -- Total_Out --
  111. ---------------
  112. function Total_Out (Strm : in Z_Stream) return ULong is
  113. begin
  114. return Strm.Total_Out;
  115. end Total_Out;
  116. end ZLib.Thin;