瀏覽代碼

Filled out with more helpful content.

woollybah 8 年之前
父節點
當前提交
5e8fcf8691
共有 1 個文件被更改,包括 24 次插入6 次删除
  1. 24 6
      reference/functions/zlib/func_zlib_compress2.rst

+ 24 - 6
reference/functions/zlib/func_zlib_compress2.rst

@@ -4,24 +4,43 @@
 compress2
 =========
 
-compress2 - 
+compress2 - Compress data at a specified level.
 
 Description
 ===========
 
 .. code-block:: blitzmax
 
-    compress2( dest:Byte Ptr,dest_len Var,source:Byte Ptr,source_len,level )
+    ?win32 Or ptr32
+        Function compress2:Int( dest:Byte Ptr, dest_len:UInt Var, source:Byte Ptr, source_len:UInt, level:Int )
+    ?ptr64 And Not win32
+        Function compress2:Int( dest:Byte Ptr, dest_len:ULong Var, source:Byte Ptr, source_len:ULong, level:Int )
+    ?
 
-Compress a block of data at specified compression level
+Attempts to compress ``source_len`` bytes of data in the buffer ``source``, placing the result in the buffer ``dest``, at the
+level described by ``level``. The level supplied should be a value between 0 and 9.
+A level of 1 requests the highest speed, while a level of 9 requests the highest compression. A level of 0 indicates
+that no compression should be used, and the output shall be the same as the input.
+
+On entry, ``dest_len`` should point to a value describing the size of the ``dest`` buffer. The application should
+ensure that this value be at least ``(source_len * 1.001) + 12``. On successful exit, the variable referenced by
+``dest_len`` will be updated to hold the length of compressed data in dest.
 
 Parameters
 ==========
 
+* ``dest``:``Byte Ptr`` - The destination buffer.
+* ``dest_len``:``UInt Var`` - The size of the destination buffer. On exit, will hold the actual size of the compressed data.
+* ``source``:``Byte Ptr`` - The source buffer.
+* ``source_len``:``UInt`` - The size of the source data.
+* ``level``:``Int`` - The required compression level, 0 to 9, where 0 is none, 9 is maximum.
+
+
+
 Return Values
 =============
 
-Nothing.
+On success, returns 0. Otherwise a value to indicate the error.
 
 Examples
 ========
@@ -29,5 +48,4 @@ Examples
 See Also
 ========
 
-
-
+:ref:`func_zlib_compress`