cvs: pecl /lzf lzf.c

From: Date: Fri, 13 Aug 2004 14:39:48 +0000
Subject: cvs: pecl /lzf lzf.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-1642@lists.php.net to get a copy of this message
mg Fri Aug 13 10:39:48 2004 EDT Modified files: /pecl/lzf lzf.c Log: Whitespace fixes - replace spaces with tabs. http://cvs.php.net/diff.php/pecl/lzf/lzf.c?r1=1.5&r2=1.6&ty=u Index: pecl/lzf/lzf.c diff -u pecl/lzf/lzf.c:1.5 pecl/lzf/lzf.c:1.6 --- pecl/lzf/lzf.c:1.5 Wed Jan 7 16:53:50 2004 +++ pecl/lzf/lzf.c Fri Aug 13 10:39:48 2004 @@ -1,21 +1,21 @@ /* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Marcin Gibula <mg@iceni.pl> | - +----------------------------------------------------------------------+ ++----------------------------------------------------------------------+ +| PHP Version 4 | ++----------------------------------------------------------------------+ +| Copyright (c) 1997-2003 The PHP Group | ++----------------------------------------------------------------------+ +| This source file is subject to version 2.02 of the PHP license, | +| that is bundled with this package in the file LICENSE, and is | +| available at through the world-wide-web at | +| http://www.php.net/license/2_02.txt. | +| If you did not receive a copy of the PHP license and are unable to | +| obtain it through the world-wide-web, please send a note to | +| license@php.net so we can mail you a copy immediately. | ++----------------------------------------------------------------------+ +| Author: Marcin Gibula <mg@iceni.pl> | ++----------------------------------------------------------------------+ - $Id: lzf.c,v 1.5 2004/01/07 21:53:50 mg Exp $ +$Id: lzf.c,v 1.6 2004/08/13 14:39:48 mg Exp $ */ #ifdef HAVE_CONFIG_H @@ -34,9 +34,9 @@ #endif /* {{{ lzf_functions[] - * - * Every user visible function must have an entry in lzf_functions[]. - */ +* +* Every user visible function must have an entry in lzf_functions[]. +*/ function_entry lzf_functions[] = { PHP_FE(lzf_compress, NULL) PHP_FE(lzf_decompress, NULL) @@ -46,11 +46,11 @@ /* }}} */ /* {{{ lzf_module_entry - */ +*/ zend_module_entry lzf_module_entry = { -#if ZEND_MODULE_API_NO >= 20010901 + #if ZEND_MODULE_API_NO >= 20010901 STANDARD_MODULE_HEADER, -#endif + #endif "lzf", lzf_functions, NULL, @@ -58,9 +58,9 @@ NULL, NULL, PHP_MINFO(lzf), -#if ZEND_MODULE_API_NO >= 20010901 + #if ZEND_MODULE_API_NO >= 20010901 "1.2", /* Replace with version number for your extension */ -#endif + #endif STANDARD_MODULE_PROPERTIES }; /* }}} */ @@ -70,93 +70,93 @@ #endif /* {{{ PHP_MINFO_FUNCTION - */ +*/ PHP_MINFO_FUNCTION(lzf) { php_info_print_table_start(); php_info_print_table_row(2, "lzf support", "enabled"); -#if PHP_LZF_ULTRA_FAST + #if PHP_LZF_ULTRA_FAST php_info_print_table_row(2, "optimized for", "speed"); -#else + #else php_info_print_table_row(2, "optimized for", "compression quality"); -#endif + #endif php_info_print_table_end(); } /* }}} */ /* {{{ proto string lzf_compress(string arg) - Return a string compressed with LZF */ +Return a string compressed with LZF */ PHP_FUNCTION(lzf_compress) { char *retval, *arg = NULL; int arg_len, result; - + if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { WRONG_PARAM_COUNT; } - + retval = emalloc(arg_len + LZF_MARGIN); - if (!retval) { + if (!retval) { RETURN_FALSE; - } - + } + result = lzf_compress(arg, arg_len, retval, arg_len + LZF_MARGIN); - if (result == 0) { + if (result == 0) { efree(retval); - RETURN_FALSE; - } - + RETURN_FALSE; + } + retval = erealloc(retval, result + 1); - retval[result] = 0; - - RETURN_STRINGL(retval, result, 0); + retval[result] = 0; + + RETURN_STRINGL(retval, result, 0); } /* }}} */ /* {{{ proto string lzf_decompress(string arg) - Return a string decompressed with LZF */ +Return a string decompressed with LZF */ PHP_FUNCTION(lzf_decompress) { char *arg = NULL; int arg_len, result, i = 1; - char *buffer; - size_t buffer_size = 1024; - + char *buffer; + size_t buffer_size = 1024; + if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { WRONG_PARAM_COUNT; } - + buffer = emalloc(buffer_size); - if (!buffer) { + if (!buffer) { RETURN_FALSE; - } - + } + do { buffer_size *= i++; - buffer = erealloc(buffer, buffer_size); - - result = lzf_decompress(arg, arg_len, buffer, buffer_size); - } while (result == 0 && errno == E2BIG); - + buffer = erealloc(buffer, buffer_size); + + result = lzf_decompress(arg, arg_len, buffer, buffer_size); + } while (result == 0 && errno == E2BIG); + if (result == 0) { if (errno == EINVAL) { - php_error(E_WARNING, "%s LZF decompression failed, compressed data corrupted", get_active_function_name(TSRMLS_C)); + php_error(E_WARNING, "%s LZF decompression failed, compressed data corrupted", get_active_function_name(TSRMLS_C)); } - + efree(buffer); - RETURN_FALSE; - } - - buffer = erealloc(buffer, result + 1); - buffer[result] = 0; - - RETURN_STRINGL(buffer, result, 0); + RETURN_FALSE; + } + + buffer = erealloc(buffer, result + 1); + buffer[result] = 0; + + RETURN_STRINGL(buffer, result, 0); } /* }}} */ /* {{{ proto int lzf_optimized_for() - Return 1 if lzf was optimized for speed, 0 for compression */ +Return 1 if lzf was optimized for speed, 0 for compression */ PHP_FUNCTION(lzf_optimized_for) { RETURN_LONG(PHP_LZF_ULTRA_FAST); @@ -165,10 +165,10 @@ /* }}} */ /* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ +* Local variables: +* tab-width: 4 +* c-basic-offset: 4 +* End: +* vim600: noet sw=4 ts=4 fdm=marker +* vim<600: noet sw=4 ts=4 +*/

« previous php.pecl.cvs (#1642) next »