mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-10 10:40:50 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28a2ff8d47 |
No files matched your search
@@ -1,192 +1,11 @@
|
||||
PHP 4 NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
31 Aug 2004, Version 4.3.9RC2
|
||||
- Implemented periodic PCRE compiled regexp cache cleanup, to avoid memory
|
||||
exhaustion. (Andrei)
|
||||
- Fixed bug with raw_post_data not getting set (Brian)
|
||||
- Fixed a file-descriptor leak with phpinfo() and other 'special' URLs (Zeev)
|
||||
- Fixed bug #29753 (mcal_fetch_event() allows 2nd argument to be optional).
|
||||
(Ilia, Vrana)
|
||||
- Fixed bug #29727 (Added missing CURL authentication directives). (Ilia)
|
||||
- Fixed bug #29719 (fgetcsv() has problem parsing strings ending with escaped
|
||||
enclosures). (Ilia)
|
||||
- Fixed bug #29599 (domxml_error segfaults another apache module). (Rob)
|
||||
- Fixed bug #29594 (Use PHP's own tmpfile() implementation). (Ilia)
|
||||
|
||||
11 Aug 2004, Version 4.3.9RC1
|
||||
- Rewritten UNIX and Windows install help files. (Documentation Team)
|
||||
- Updated PCRE to provide better error handling in certain cases. (Andrei)
|
||||
- NSAPI: added "bucket" parameter to list of non-php.ini-keys of php4_execute
|
||||
for doing performance stats without warnings in server-log. (Uwe Schindler)
|
||||
- Fixed bug #29882 (isset crashes on arrays). (Marcus)
|
||||
- Fixed bug #29607 (highlighting code with HEREDOC produces invalid
|
||||
output). (Ilia)
|
||||
- Fixed bug #29581 (Typo inside php.ini comments for mysql.trace_mode). (Ilia)
|
||||
- Fixed bug #29493 (extract(array, EXTR_REFS) misbehaves with elements
|
||||
referred twice or more times). (Moriyoshi)
|
||||
- Fixed bug #29443 (Sanity check for wbmp detection). (Ilia)
|
||||
- Fixed bug #29369 (Uploaded files with ' or " in their names get their names
|
||||
truncated at those characters). (Ilia)
|
||||
- Fixed bug #29349 (imagecreatefromstring() crashes with external GD library).
|
||||
(Ilia, adconrad at debian dot org)
|
||||
- Fixed bug #29333 (output_buffering+trans_sess_id can corrupt output). (Ilia)
|
||||
- Fixed bug #29226 (ctype_* functions missing validation of numeric string
|
||||
representations). (Ilia)
|
||||
- Fixed bug #29209 (imap_fetchbody() doesn't check message index). (Ilia,
|
||||
tony2001 at phpclub dot net)
|
||||
- Fixed bug #29116 (Zend constant warning uses memory after free). (Marcus,
|
||||
jdolecek at NetBSD dot org)
|
||||
- Fixed bug #29114 (Potential double free in php_stat). (Sara)
|
||||
- Fixed bug #29075 (strnatcmp() incorrectly handles whitespace). (Curt, Ilia)
|
||||
- Fixed bug #29049 (array sorting via user function/method does not validate
|
||||
it). (Ilia)
|
||||
- Fixed bug #29038 (extract() with EXTR_PREFIX_SAME prefixes empty strings).
|
||||
(Andrey)
|
||||
- Fixed bug #29034 (wordwrap() returns a boolean when passed empty string).
|
||||
(Ilia)
|
||||
- Fixed bug #28974 (overflow in array_slice(), array_splice(), substr,
|
||||
substr_replace(), strspn(), strcspn()). (Andrey)
|
||||
- Fixed bug #28897 (ibase: -1 returned as -0.000 for 64-bit scaled int). (Ard)
|
||||
- Fixed bug #28879 (Implicit/Explicit array creation inconsistency when using
|
||||
Resources, Arrays, or Objects as indices). (Sara)
|
||||
- Fixed bug #28878 (Setting of inikey's in obj.conf fails). (Uwe Schindler)
|
||||
- Fixed bug #28868 (Internal wrapper registry not thread safe). (Sara)
|
||||
- Fixed bug #28818 (Apache 2 sapis do not export st_dev).
|
||||
(xuefer at 21cn dot com, Ilia).
|
||||
- Fixed bug #28800 (strings beginning with "inf" improperly converted). (Ilia)
|
||||
- Fixed bug #28723 (Fixed mbstring config.m4 to work on OSes where test
|
||||
command does not support -e parameter). (Ilia)
|
||||
- Fixed bug #28692 (\0 in Authenticate header passed via safe_mode). (Ilia)
|
||||
- Fixed bug #28670 (WWW-Authentication header mangling with PCRE in safe_mode
|
||||
adds extra spaces). (Ilia)
|
||||
- Fixed bug #28668 (glob() does not work with relative paths on Windows).
|
||||
(Ilia)
|
||||
- Fixed bug #28649 (Proper glob() return value on Linux when there are no
|
||||
matches). (Ilia)
|
||||
- Fixed bug #28633 (sprintf incorrectly adding padding to floats). (Ilia)
|
||||
- Fixed bug #28627 (When multiple MySQL links are used default link is leaked).
|
||||
(gavin at ipalsoftware dot com, Ilia)
|
||||
- Fixed bug #28525 (gmp_powm() does not work with hexadecimal string modulo
|
||||
represented as a string). (pickett at sumu dot org, Ilia)
|
||||
- Fixed bug #28512 (Allocate enough space to store MSSQL data). (Frank)
|
||||
- Fixed bug #28466 (mbstring_convert_variables() array separation problem).
|
||||
(Moriyoshi)
|
||||
- Fixed bug #28175 (Allow bundled GD to compile against freetype 2.1.2).
|
||||
(Elf, Ilia)
|
||||
- Fixed leap year checking with idate(). (Christian Schneider, Derick)
|
||||
- Fixed strip_tags() to correctly handle '\0' characters. (Stefan)
|
||||
- Fixed funny forking effect in FastCGI when PHP_FCGI_CHILDREN was not set.
|
||||
|
||||
14 Jul 2004, Version 4.3.8
|
||||
- Fixed strip_tags() to correctly handle '\0' characters. (Stefan)
|
||||
- Fixed memory_limit during request startup. (Stefan)
|
||||
- Replace alloca() with emalloc() for better stack protection. (Ilia)
|
||||
- Added missing safe_mode checks inside ftok and itpc. (Ilia)
|
||||
- Fixed bug #28963 (Missing space for \0 in address allocation in IMAP). (Ilia)
|
||||
- Fixed bug #28632 (Prevent open_basedir bypass via MySQL's LOAD DATA LOCAL).
|
||||
(Ilia)
|
||||
|
||||
03 Jun 2004, Version 4.3.7
|
||||
- Upgraded bundled GD library to 2.0.23. (Ilia)
|
||||
- Changed user error handler mechanism to relay to built-in error handler if it
|
||||
returns false. (Andrei)
|
||||
- Fixed command line escaping routines for win32. (Ilia)
|
||||
- Fixed problems with *printf() functions and '%f' formatting. (Marcus)
|
||||
- Fixed possible crash inside pg_copy_(to|from) function if delimiter is more
|
||||
then 1 character long. (Ilia)
|
||||
- Fixed crash inside cpdf_place_inline_image() when working with truecolor
|
||||
images. (Ilia)
|
||||
- Fixed handling of return values from storred procedures in mssql_execute()
|
||||
with multiple result sets returned. (Frank)
|
||||
- Fixed logic bug in session_register() which allowed registering _SESSION
|
||||
and/or HTTP_SESSION_VARS. (Sara)
|
||||
- Fixed bug #28597 (xmlrpc_encode_request() incorrectly encodes chars in
|
||||
200-210 range). (fernando dot nemec at folha dot com dot br, Ilia)
|
||||
- Fixed bug #28569 (informix connection id is not thread safe).
|
||||
(novicky at aarongroup dot cz, Ard)
|
||||
- Fixed bug #28564 (Problem building informix as a shared extension).
|
||||
(roques at mti dot ag, Ilia)
|
||||
- Fixed bug #28508 (Do not make hypot() available if not supported by libc).
|
||||
(Ilia)
|
||||
- Fixed bug #28506 (Allow negative start angle in imagearc and imagefilledarc.
|
||||
(Pierre)
|
||||
- Fixed bug #28456 (Problem with enclosed / in uploaded files). (Antony)
|
||||
- Fixed bug #28386 (wordwrap() wraps lines 1 character too soon). (Ilia)
|
||||
- Fixed bug #28374 (Possible unterminated loop inside
|
||||
_php_pgsql_trim_message()). (Ilia)
|
||||
- Fixed bug #28355 (glob() does not return error on Linux when it does not
|
||||
have permission to open the directory). (Ilia)
|
||||
- Fixed bug #28289 (incorrect resolving of relative paths by glob() in
|
||||
windows). (Ilia)
|
||||
- Fixed bug #28229 (run-tests tripped up by spaces in names). (Marcus)
|
||||
- Fixed bug #28228 (number_format() does not allow empty decimal separator).
|
||||
(Ilia)
|
||||
- Fixed bug #28196 (missing error constants in cURL extension). (Ilia)
|
||||
- Fixed bug #28187 (parse_url() not handling embedded IPv6 in URLs). (Sara)
|
||||
- Fixed bug #28175 (build problem for people using FreeType 2.1.0-2.1.2).
|
||||
(Ilia)
|
||||
- Fixed bug #28147 (Crash with drawing anti-aliased lines). (Derick)
|
||||
- Fixed bug #28122 (dba_open db3: Permission denied). (Marcus)
|
||||
- Fixed bug #28112 (sqlite_query() crashing apache on malformed query). (Ilia,
|
||||
Marcus)
|
||||
- Fixed bug #28055 (timeout duration too long in feof()/pfsockopen() liveness
|
||||
checks). (Wez)
|
||||
- Fixed bug #28087 (Do not force mysql.trace_mode to 0 on every request).
|
||||
(Ilia)
|
||||
- Fixed bug #28042 (greek letters in html to entitity mapping not correct).
|
||||
(Derick)
|
||||
- Fixed bug #28007 (compile mssql extension with old versions of FreeTDS
|
||||
fails). (Frank)
|
||||
- Fixed bug #27995 (imagefilltoborder() stops the fill process prematurely).
|
||||
(Ilia)
|
||||
- Fixed bug #27810 (don't use php's pemalloc in ext/pcre). (Joe Orton)
|
||||
- Fixed bug #23220 (SSL: fatal protocol error when talking to IIS). (Wez)
|
||||
|
||||
15 Apr 2004, Version 4.3.6
|
||||
- Updated bundled PDFLib library to version 5.0.3p1 in Windows distribution.
|
||||
(Edin)
|
||||
- Fixed a crash in multi-threaded environments when a thread is shutdown by
|
||||
the web server. (Stas)
|
||||
- Fixed a bug that prevented building of the GD extension against external GD
|
||||
lib 1.X. (Ilia, Edin, Nick Talbott).
|
||||
- Synchronized bundled GD library with GD 2.0.22. (Ilia)
|
||||
- Fixed bug #27963 (Session lifetime setting may leak between requests). (Ilia)
|
||||
- Fixed bug #27849 (configure craps out on trivial syntax error). (Derick)
|
||||
- Fixed bug #27822 (is_resource() returns TRUE for closed resources). (Derick)
|
||||
- Fixed bug #27819 (problems returning reference to a reference parameter).
|
||||
(Ilia)
|
||||
- Fixed bug #27809 (ftp_systype returns null on some ftp servers). (Ilia)
|
||||
- Fixed bug #27802 (default number of children to 8 when PHP_FCGI_CHILDREN is
|
||||
not defined). (Ilia)
|
||||
- Fixed bug #27780 (strtotime(+1 xxx) returns a wrong date/time). (Derick)
|
||||
- Fixed bug #27769 (domxml_xmltree crashes). (Rob)
|
||||
- Fixed bug #27764 (Get return value from a stored procedure not returning any
|
||||
result sets). (Frank)
|
||||
- Fixed bug #27762 (SCO Openserver doesn't have S_ISSOCK). (Wez)
|
||||
- Fixed bug #27743 (Make sure Money types are converted and returned
|
||||
correctly). (Frank)
|
||||
- Fixed bug #27732 (Fixed compilation bug inside php_sab_info.h). (Ilia)
|
||||
- Fixed bug #27731 (error_reporting() inside @ block fails to set
|
||||
error_reporting level). (Ilia)
|
||||
- Fixed bug #27719 (mktime issues on and around DST changeover). (Rasmus)
|
||||
- Fixed bug #27717 (Test Failures when compiled on 64-bit mode). (Ard, Derick)
|
||||
- Fixed bug #27687 (Bug Adding Default Charset to 'text/*' Content-Type
|
||||
Header). (Marcus)
|
||||
- Fixed bug #27663 (compile failure with cURL 7.11.1). (Ilia)
|
||||
- Fixed bug #27646 (Cannot serialize/unserialize non-finite numeric values).
|
||||
(Marcus)
|
||||
- Fixed bug #26757 (session.save_path default is bogus for win32). (Wez)
|
||||
- Fixed bug #26589 (Crash inside mssql extension when selecting many columns
|
||||
of type money). (Frank)
|
||||
- Fixed bug #25547 (error_handler and array index with function call).
|
||||
(cschneid at cschneid dot com)
|
||||
|
||||
26 Mar 2004, Version 4.3.5
|
||||
?? Mar 2004, Version 4.3.5
|
||||
- Fixed possible crash using an invalid color index with a palette image in
|
||||
imagecolortransparent. (Pierre)
|
||||
imagecolortransparent (Pierre)
|
||||
- Fixed php-cgi to not ignore command-line switches when run in a web context.
|
||||
This fixes our test cases allowing INI with GET sections to work. (Rasmus)
|
||||
- Fixed getopt() so it works without $_SERVER. (Rasmus, bfrance)
|
||||
This fixes our test cases allowing INI with GET sections to work (Rasmus)
|
||||
- Fixed getopt() so it works without $_SERVER (Rasmus, bfrance)
|
||||
- Fixed crash in php_ini_scanned_files() when no additional INI files were
|
||||
actually parsed. (Jon)
|
||||
- Fixed possible crashes inside socket extension, due to missing check inside
|
||||
@@ -200,7 +19,7 @@ PHP 4 NEWS
|
||||
. Added "sybct.packet_size" php.ini option.
|
||||
. Changed "sybct.login_timeout" php.ini option changeable at runtime.
|
||||
. Fixed memory leak in sybase_set_message_handler().
|
||||
- Synchronized bundled GD library with GD 2.0.17. (Ilia)
|
||||
- Synchronized bundled GD library with GD 2.0.17
|
||||
- Upgraded PCRE library to version 4.5. (Andrei)
|
||||
- Updated bundled PostgreSQL library to version 7.4 in Windows distribution.
|
||||
(Edin)
|
||||
|
||||
+18
-10
@@ -37,11 +37,8 @@ The next few rules are more of a technical nature.
|
||||
messages every day. Woe be to those who attempt to mess with it.
|
||||
|
||||
2. All news updates intended for public viewing, such as new features,
|
||||
bug fixes, improvements, etc., should go into the NEWS file.
|
||||
|
||||
NB! Lines, starting with @ will go automagically into NEWS file, but
|
||||
this is NOT recommended, though. Please, add news entries directly to
|
||||
NEWS file and don't forget to keep them adjusted and sorted.
|
||||
bug fixes, improvements, etc., should go into the NEWS file. Also see
|
||||
the note below about automatically updating NEWS in your commit message.
|
||||
|
||||
3. Do not commit multiple file and dump all messages in one commit. If you
|
||||
modified several unrelated files, commit each group separately and
|
||||
@@ -62,10 +59,14 @@ The next few rules are more of a technical nature.
|
||||
The format of the commit messages is pretty simple.
|
||||
|
||||
If a line begins with #, it is taken to be a comment and will not appear
|
||||
in the ChangeLog. Everything else goes into the ChangeLog.
|
||||
in the ChangeLog. If the line begins with @, it will be redirected to the
|
||||
NEWS file. Everything else goes into the ChangeLog.
|
||||
|
||||
It is important to note that if your comment or news logline spans multiple
|
||||
lines, you have to put # at the beginning of _every_ such line.
|
||||
lines, you have to put # or @ at the beginning of _every_ such line. Every
|
||||
entry in NEWS has to have a name after it, so if you did it with someone's
|
||||
help, put both your names there. Your name WILL NOT be automatically put
|
||||
at the end of the NEWS entry - so, please provide it yourself.
|
||||
|
||||
Example. Say you modified two files, datetime.c and string.c. In datetime.c
|
||||
you added a new format option for date() function, and in string.c you fixed
|
||||
@@ -77,12 +78,17 @@ For datetime.c:
|
||||
|
||||
(PHP date) Added new 'K' format modifier for printing out number of
|
||||
days until New Year's Eve.
|
||||
@- Added new 'K' format modifier that will output the number of days
|
||||
@ until New Year's Eve. (Bob)
|
||||
|
||||
For string.c:
|
||||
(php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
|
||||
# Man, that thing was leaking all over the place!
|
||||
@- Fixed memory leak in trim(). (Bob)
|
||||
|
||||
The # lines will be omitted from the ChangeLog automagically.
|
||||
The lines above marked with @ will go into NEWS file automagically, and the
|
||||
# lines will be omitted from the ChangeLog. Alternatively, you might want
|
||||
to modify NEWS file directly and not use the @ lines.
|
||||
|
||||
If you fix some bugs, you should note the bug ID numbers in your
|
||||
commit message. Bug ID should be prefixed by "#" for easier access to
|
||||
@@ -91,10 +97,12 @@ bug report when developers are browsing CVS via. LXR or Bonsai.
|
||||
Example:
|
||||
|
||||
Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
@ Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
|
||||
If you don't see your messages in ChangeLog right away, don't worry!
|
||||
If you don't see your messages in ChangeLog and NEWS right away, don't worry!
|
||||
These files are updated once a day, so your stuff will not show up until
|
||||
somewhat later.
|
||||
somewhat later. Don't go adding stuff to NEWS by hand if you already put @
|
||||
lines in the commit message.
|
||||
|
||||
You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
|
||||
to look at PHP CVS repository in various ways.
|
||||
|
||||
@@ -158,15 +158,9 @@ TSRM_API void tsrm_shutdown(void)
|
||||
|
||||
next_p = p->next;
|
||||
for (j=0; j<p->count; j++) {
|
||||
/* Disabled - calling dtors in tsrm_shutdown makes
|
||||
modules registering TSRM ids to crash, if they have
|
||||
dtors, since the module is unloaded before tsrm_shutdown
|
||||
is called. Can be re-enabled after tsrm_free_id is
|
||||
implemented.
|
||||
if (resource_types_table && resource_types_table[j].dtor) {
|
||||
resource_types_table[j].dtor(p->storage[j], &p->storage);
|
||||
}
|
||||
*/
|
||||
free(p->storage[j]);
|
||||
}
|
||||
free(p->storage);
|
||||
|
||||
+7
-7
@@ -40,8 +40,8 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
|
||||
MAJOR_VERSION=4
|
||||
MINOR_VERSION=3
|
||||
RELEASE_VERSION=9
|
||||
EXTRA_VERSION="RC2"
|
||||
RELEASE_VERSION=5
|
||||
EXTRA_VERSION=""
|
||||
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
|
||||
|
||||
dnl Define where extension directories are located in the configure context
|
||||
@@ -857,15 +857,15 @@ if test "$PHP_PEAR" != "no"; then
|
||||
dnl
|
||||
if test "$PHP_SAPI_CLI" = "no"; then
|
||||
pear_error_msg="$pear_error_msg
|
||||
PEAR requires CLI to be enabled. Add --enable-cli to the configure line. (or --disable-pear)"
|
||||
PEAR requires CLI to be enabled. Add --enable-cli to the configure line."
|
||||
fi
|
||||
if test "$PHP_PCRE_REGEX" = "no"; then
|
||||
pear_error_msg="$pear_error_msg
|
||||
PEAR requires PCRE to be enabled. Add --with-pcre-regex to the configure line. (or --disable-pear)"
|
||||
PEAR requires PCRE to be enabled. Add --with-pcre-regex to the configure line."
|
||||
fi
|
||||
if test "$PHP_XML" = "no"; then
|
||||
pear_error_msg="$pear_error_msg
|
||||
PEAR requires XML to be enabled. Add --enable-xml to the configure line. (or --disable-pear)"
|
||||
PEAR requires XML to be enabled. Add --enable-xml to the configure line."
|
||||
fi
|
||||
|
||||
dnl
|
||||
@@ -873,7 +873,7 @@ dnl ext/xmlrpc is not really there yet to be a requirement..
|
||||
dnl
|
||||
dnl if test "$PHP_XMLRPC" = "no"; then
|
||||
dnl pear_error_msg="$pear_error_msg
|
||||
dnl PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line. (or --disable-pear)"
|
||||
dnl PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line."
|
||||
dnl fi
|
||||
dnl
|
||||
|
||||
@@ -1407,7 +1407,7 @@ cat <<X
|
||||
| If your application relies on register_globals being ON, you |
|
||||
| should explicitly set it to on in your php.ini file. |
|
||||
| Note that you are strongly encouraged to read |
|
||||
| http://www.php.net/manual/en/security.globals.php |
|
||||
| http://www.php.net/manual/en/security.registerglobals.php |
|
||||
| about the implications of having register_globals set to on, and |
|
||||
| avoid using it if possible. |
|
||||
+--------------------------------------------------------------------+
|
||||
|
||||
+1
-1
@@ -185,7 +185,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
|
||||
|
||||
if (bz_file == NULL) {
|
||||
/* that didn't work, so try and get something from the network/wrapper */
|
||||
stream = php_stream_open_wrapper(path, mode, options | STREAM_WILL_CAST, opened_path);
|
||||
stream = php_stream_open_wrapper(path, mode, options, opened_path);
|
||||
|
||||
if (stream) {
|
||||
int fd;
|
||||
|
||||
+2
-2
@@ -1849,7 +1849,7 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
|
||||
|
||||
obj = obj_prop;
|
||||
php_COM_set(obj, &V_DISPATCH(var_result), TRUE TSRMLS_CC);
|
||||
VariantInit(var_result); /* to protect C_DISPATCH(obj) from being freed when var_result is destructed */
|
||||
VariantInit(var_result); // to protect C_DISPATCH(obj) from being freed when var_result is destructed
|
||||
} else {
|
||||
php_variant_to_pval(var_result, &retval, codepage TSRMLS_CC);
|
||||
|
||||
@@ -1934,7 +1934,7 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
VariantInit(var_result); /* to protect C_DISPATCH(obj) from being freed when var_result is destructed */
|
||||
VariantInit(var_result); // to protect C_DISPATCH(obj) from being freed when var_result is destructed
|
||||
zval_dtor(&overloaded_property->element);
|
||||
}
|
||||
FREE_VARIANT(var_result);
|
||||
|
||||
+1
-1
@@ -181,7 +181,7 @@ static pval php_VARIANT_get_property_handler(zend_property_reference *property_r
|
||||
|
||||
case OE_IS_OBJECT:
|
||||
if (!strcmp(Z_STRVAL(overloaded_property->element), "value")) {
|
||||
/* var_arg can't be an idispatch, so we don't care for the implicit AddRef() call here */
|
||||
// var_arg can't be an idispatch, so we don't care for the implicit AddRef() call here
|
||||
php_variant_to_pval(var_arg, &result, codepage TSRMLS_CC);
|
||||
} else if (!strcmp(Z_STRVAL(overloaded_property->element), "type")) {
|
||||
ZVAL_LONG(&result, V_VT(var_arg))
|
||||
|
||||
@@ -119,7 +119,7 @@ PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, VARTYPE ty
|
||||
var_arg = V_VARIANTREF(var_arg); /* put the array in that VARIANT */
|
||||
}
|
||||
if (!type) {
|
||||
/* if no type is given we take the variant type */
|
||||
// if no type is given we take the variant type
|
||||
type = VT_VARIANT;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -280,7 +280,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
|
||||
ZVAL_NULL(zarg);
|
||||
}
|
||||
} else {
|
||||
/* arg can't be an idispatch, so we don't care for the implicit AddRef() call here */
|
||||
// arg can't be an idispatch, so we don't care for the implicit AddRef() call here
|
||||
if (FAILURE == php_variant_to_pval(arg, zarg, codepage TSRMLS_CC)) {
|
||||
trace("failed to convert arg %d to zval\n", i);
|
||||
ZVAL_NULL(zarg);
|
||||
|
||||
+6
-20
@@ -2522,30 +2522,16 @@ PHP_FUNCTION(cpdf_place_inline_image)
|
||||
}
|
||||
|
||||
count = 3 * im->sx * im->sy;
|
||||
buffer = (unsigned char *) safe_emalloc(3 * im->sx, im->sy, 0);
|
||||
if(NULL == (buffer = (unsigned char *) emalloc(count)))
|
||||
RETURN_FALSE;
|
||||
|
||||
ptr = buffer;
|
||||
for(i=0; i<im->sy; i++) {
|
||||
for(j=0; j<im->sx; j++) {
|
||||
#if HAVE_LIBGD20
|
||||
if(gdImageTrueColor(im)) {
|
||||
if (im->tpixels && gdImageBoundsSafe(im, j, i)) {
|
||||
color = gdImageTrueColorPixel(im, j, i);
|
||||
*ptr++ = (color >> 16) & 0xFF;
|
||||
*ptr++ = (color >> 8) & 0xFF;
|
||||
*ptr++ = color & 0xFF;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
if (im->pixels && gdImageBoundsSafe(im, j, i)) {
|
||||
color = im->pixels[i][j];
|
||||
*ptr++ = im->red[color];
|
||||
*ptr++ = im->green[color];
|
||||
*ptr++ = im->blue[color];
|
||||
}
|
||||
#if HAVE_LIBGD20
|
||||
}
|
||||
#endif
|
||||
color = im->pixels[i][j];
|
||||
*ptr++ = im->red[color];
|
||||
*ptr++ = im->green[color];
|
||||
*ptr++ = im->blue[color];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-7
@@ -97,13 +97,7 @@ PHP_MINFO_FUNCTION(ctype)
|
||||
return; \
|
||||
switch (Z_TYPE_P(c)) { \
|
||||
case IS_LONG: \
|
||||
if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
|
||||
} else if (Z_LVAL_P(c) >= -128) { \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
|
||||
} \
|
||||
SEPARATE_ZVAL(&c); \
|
||||
convert_to_string(c); \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
|
||||
case IS_STRING: \
|
||||
{ \
|
||||
char *p; \
|
||||
|
||||
+3
-72
@@ -22,10 +22,6 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
|
||||
#if HAVE_CURL
|
||||
@@ -34,17 +30,13 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#include <winsock.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <curl/easy.h>
|
||||
|
||||
/* As of curl 7.11.1 this is no longer defined inside curl.h */
|
||||
#ifndef HttpPost
|
||||
#define HttpPost curl_httppost
|
||||
#endif
|
||||
|
||||
#define SMART_STR_PREALLOC 4096
|
||||
|
||||
#include "ext/standard/php_smart_str.h"
|
||||
@@ -141,9 +133,7 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FOLLOWLOCATION);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FTPASCII);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PUT);
|
||||
#if CURLOPT_MUTE != 0
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_MUTE);
|
||||
#endif
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_USERPWD);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXYUSERPWD);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_RANGE);
|
||||
@@ -201,28 +191,10 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE_DEFAULT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_CRLF);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFMODSINCE);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFUNMODSINCE);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_LASTMOD);
|
||||
#if LIBCURL_VERSION_NUM >= 0x070a00
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_ENCODING);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_HTTPAUTH);
|
||||
/* http authentication options */
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_BASIC);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_DIGEST);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_GSSNEGOTIATE);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_NTLM);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_ANY);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_ANYSAFE);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM > 0x070a06 /* CURLOPT_PROXYAUTH is available since curl 7.10.7 */
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXYAUTH);
|
||||
#endif
|
||||
|
||||
/* Constants effecting the way CURLOPT_CLOSEPOLICY works */
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_TRAFFIC);
|
||||
@@ -305,35 +277,6 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLE_TELNET_OPTION_SYNTAX);
|
||||
REGISTER_CURL_CONSTANT(CURLE_OBSOLETE);
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_PEER_CERTIFICATE);
|
||||
REGISTER_CURL_CONSTANT(CURLE_GOT_NOTHING);
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_ENGINE_NOTFOUND);
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_ENGINE_SETFAILED);
|
||||
REGISTER_CURL_CONSTANT(CURLE_SEND_ERROR);
|
||||
REGISTER_CURL_CONSTANT(CURLE_RECV_ERROR);
|
||||
#ifdef CURLE_SHARE_IN_USE
|
||||
REGISTER_CURL_CONSTANT(CURLE_SHARE_IN_USE);
|
||||
#endif
|
||||
#ifdef CURLE_SSL_CERTPROBLEM
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_CERTPROBLEM);
|
||||
#endif
|
||||
#ifdef CURLE_SSL_CIPHER
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_CIPHER);
|
||||
#endif
|
||||
#ifdef CURLE_SSL_CACERT
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_CACERT);
|
||||
#endif
|
||||
#ifdef CURLE_BAD_CONTENT_ENCODING
|
||||
REGISTER_CURL_CONSTANT(CURLE_BAD_CONTENT_ENCODING);
|
||||
#endif
|
||||
#ifdef CURLE_LDAP_INVALID_URL
|
||||
REGISTER_CURL_CONSTANT(CURLE_LDAP_INVALID_URL);
|
||||
#endif
|
||||
#ifdef CURLE_FILESIZE_EXCEEDED
|
||||
REGISTER_CURL_CONSTANT(CURLE_FILESIZE_EXCEEDED);
|
||||
#endif
|
||||
#ifdef CURLE_FTP_SSL_FAILED
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_SSL_FAILED);
|
||||
#endif
|
||||
|
||||
REGISTER_CURL_CONSTANT(CURL_NETRC_OPTIONAL);
|
||||
REGISTER_CURL_CONSTANT(CURL_NETRC_IGNORED);
|
||||
@@ -563,7 +506,6 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if CURLOPT_PASSWDFUNCTION != 0
|
||||
/* {{{ curl_passwd
|
||||
*/
|
||||
static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
|
||||
@@ -610,7 +552,6 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
/* {{{ curl_free_string
|
||||
*/
|
||||
@@ -756,9 +697,7 @@ PHP_FUNCTION(curl_setopt)
|
||||
case CURLOPT_NETRC:
|
||||
case CURLOPT_FOLLOWLOCATION:
|
||||
case CURLOPT_PUT:
|
||||
#if CURLOPT_MUTE != 0
|
||||
case CURLOPT_MUTE:
|
||||
#endif
|
||||
case CURLOPT_MUTE:
|
||||
case CURLOPT_TIMEOUT:
|
||||
case CURLOPT_FTP_USE_EPSV:
|
||||
case CURLOPT_LOW_SPEED_LIMIT:
|
||||
@@ -782,12 +721,6 @@ PHP_FUNCTION(curl_setopt)
|
||||
case CURLOPT_HTTPGET:
|
||||
case CURLOPT_HTTP_VERSION:
|
||||
case CURLOPT_CRLF:
|
||||
#if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
|
||||
case CURLOPT_HTTPAUTH:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM > 0x070a06 /* CURLOPT_PROXYAUTH is available since curl 7.10.7 */
|
||||
case CURLOPT_PROXYAUTH:
|
||||
#endif
|
||||
convert_to_long_ex(zvalue);
|
||||
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
|
||||
break;
|
||||
@@ -909,7 +842,6 @@ PHP_FUNCTION(curl_setopt)
|
||||
ch->handlers->write_header->func = *zvalue;
|
||||
ch->handlers->write_header->method = PHP_CURL_USER;
|
||||
break;
|
||||
#if CURLOPT_PASSWDFUNCTION != 0
|
||||
case CURLOPT_PASSWDFUNCTION:
|
||||
if (ch->handlers->passwd) {
|
||||
zval_ptr_dtor(&ch->handlers->passwd);
|
||||
@@ -919,7 +851,6 @@ PHP_FUNCTION(curl_setopt)
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDFUNCTION, curl_passwd);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDDATA, (void *) ch);
|
||||
break;
|
||||
#endif
|
||||
case CURLOPT_POSTFIELDS:
|
||||
if (Z_TYPE_PP(zvalue) == IS_ARRAY || Z_TYPE_PP(zvalue) == IS_OBJECT) {
|
||||
zval **current;
|
||||
@@ -962,7 +893,7 @@ PHP_FUNCTION(curl_setopt)
|
||||
error = curl_formadd(&first, &last,
|
||||
CURLFORM_COPYNAME, string_key,
|
||||
CURLFORM_NAMELENGTH, string_key_len - 1,
|
||||
CURLFORM_COPYCONTENTS, postval,
|
||||
(ZVAL_REFCOUNT(*zvalue) > 1 ? CURLFORM_PTRCONTENTS : CURLFORM_COPYCONTENTS), postval,
|
||||
CURLFORM_CONTENTSLENGTH, Z_STRLEN_PP(current),
|
||||
CURLFORM_END);
|
||||
}
|
||||
|
||||
@@ -53,10 +53,6 @@ DBA_OPEN_FUNC(db2)
|
||||
struct stat check_stat;
|
||||
int s = VCWD_STAT(info->path, &check_stat);
|
||||
|
||||
if (!s && !check_stat.st_size) {
|
||||
info->mode = DBA_TRUNC; /* force truncate */
|
||||
}
|
||||
|
||||
type = info->mode == DBA_READER ? DB_UNKNOWN :
|
||||
info->mode == DBA_TRUNC ? DB_BTREE :
|
||||
s ? DB_BTREE : DB_UNKNOWN;
|
||||
|
||||
+2
-6
@@ -62,13 +62,9 @@ DBA_OPEN_FUNC(db3)
|
||||
struct stat check_stat;
|
||||
int s = VCWD_STAT(info->path, &check_stat);
|
||||
|
||||
if (!s && !check_stat.st_size) {
|
||||
info->mode = DBA_TRUNC; /* force truncate */
|
||||
}
|
||||
|
||||
type = info->mode == DBA_READER ? DB_UNKNOWN :
|
||||
type = info->mode == DBA_READER ? DB_UNKNOWN :
|
||||
info->mode == DBA_TRUNC ? DB_BTREE :
|
||||
s ? DB_BTREE : DB_UNKNOWN;
|
||||
s? DB_BTREE : DB_UNKNOWN;
|
||||
|
||||
gmode = info->mode == DBA_READER ? DB_RDONLY :
|
||||
(info->mode == DBA_CREAT && s) ? DB_CREATE :
|
||||
|
||||
+2
-6
@@ -62,13 +62,9 @@ DBA_OPEN_FUNC(db4)
|
||||
struct stat check_stat;
|
||||
int s = VCWD_STAT(info->path, &check_stat);
|
||||
|
||||
if (!s && !check_stat.st_size) {
|
||||
info->mode = DBA_TRUNC; /* force truncate */
|
||||
}
|
||||
|
||||
type = info->mode == DBA_READER ? DB_UNKNOWN :
|
||||
type = info->mode == DBA_READER ? DB_UNKNOWN :
|
||||
info->mode == DBA_TRUNC ? DB_BTREE :
|
||||
s ? DB_BTREE : DB_UNKNOWN;
|
||||
s? DB_BTREE : DB_UNKNOWN;
|
||||
|
||||
gmode = info->mode == DBA_READER ? DB_RDONLY :
|
||||
(info->mode == DBA_CREAT && s) ? DB_CREATE :
|
||||
|
||||
@@ -14,7 +14,7 @@ magic_quotes_runtime=1
|
||||
require_once('test.inc');
|
||||
echo "database handler: $handler\n";
|
||||
// print md5 checksum of test.cdb which is generated by cdb_make program
|
||||
var_dump(md5_file(dirname(__FILE__).'/test.cdb'));
|
||||
var_dump(md5(implode('',file(dirname(__FILE__).'/test.cdb'))));
|
||||
if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) {
|
||||
dba_insert("1", "1", $db_make);
|
||||
dba_insert("2", "2", $db_make);
|
||||
@@ -26,7 +26,7 @@ magic_quotes_runtime=1
|
||||
// dba_replace cdb_make doesn't know replace
|
||||
dba_close($db_make);
|
||||
// write md5 checksum of generated database file
|
||||
var_dump(md5_file($db_file));
|
||||
var_dump(md5(implode('',file($db_file))));
|
||||
// no need to test created database: this is done by dba_cdb_read.phpt
|
||||
} else {
|
||||
echo "Error creating database\n";
|
||||
@@ -34,5 +34,5 @@ magic_quotes_runtime=1
|
||||
?>
|
||||
--EXPECT--
|
||||
database handler: cdb_make
|
||||
string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5"
|
||||
string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5"
|
||||
string(32) "723d19f39c1b15b3b455dd64323148d1"
|
||||
string(32) "723d19f39c1b15b3b455dd64323148d1"
|
||||
@@ -199,11 +199,6 @@ PHP_FUNCTION(dio_read)
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
|
||||
|
||||
if (bytes <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
data = emalloc(bytes + 1);
|
||||
res = read(f->fd, data, bytes);
|
||||
if (res <= 0) {
|
||||
@@ -232,12 +227,6 @@ PHP_FUNCTION(dio_write)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (trunc_len <= 0 || trunc_len > data_len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater then zero and less then the length of specified string.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
|
||||
|
||||
res = write(f->fd, data, trunc_len ? trunc_len : data_len);
|
||||
|
||||
+13
-28
@@ -540,8 +540,8 @@ zend_module_entry domxml_module_entry = {
|
||||
domxml_functions,
|
||||
PHP_MINIT(domxml),
|
||||
PHP_MSHUTDOWN(domxml),
|
||||
PHP_RINIT(domxml),
|
||||
PHP_RSHUTDOWN(domxml),
|
||||
NULL,
|
||||
NULL,
|
||||
PHP_MINFO(domxml),
|
||||
DOMXML_API_VERSION, /* Extension versionnumber */
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
@@ -1510,24 +1510,6 @@ static void domxml_error_validate(void *ctx, const char *msg, ...)
|
||||
|
||||
}
|
||||
|
||||
PHP_RINIT_FUNCTION(domxml)
|
||||
{
|
||||
xmlSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
|
||||
#if HAVE_DOMXSLT
|
||||
xsltSetGenericErrorFunc(xsltGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_RSHUTDOWN_FUNCTION(domxml)
|
||||
{
|
||||
xmlSetGenericErrorFunc(xmlGenericErrorContext, NULL);
|
||||
#if HAVE_DOMXSLT
|
||||
xsltSetGenericErrorFunc(xsltGenericErrorContext, NULL);
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_MSHUTDOWN_FUNCTION(domxml)
|
||||
{
|
||||
#if HAVE_DOMXSLT
|
||||
@@ -1686,9 +1668,15 @@ PHP_MINIT_FUNCTION(domxml)
|
||||
REGISTER_LONG_CONSTANT("DOMXML_LOAD_SUBSTITUTE_ENTITIES", DOMXML_LOAD_SUBSTITUTE_ENTITIES, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DOMXML_LOAD_COMPLETE_ATTRS",DOMXML_LOAD_COMPLETE_ATTRS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DOMXML_LOAD_DONT_KEEP_BLANKS",DOMXML_LOAD_DONT_KEEP_BLANKS, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
#if HAVE_DOMXSLT && HAVE_DOMEXSLT
|
||||
xmlSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
|
||||
#if (defined(LIBXML_THREAD_ENABLED) && LIBXML_VERSION >= 20511)
|
||||
xmlThrDefSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
|
||||
#endif
|
||||
#if HAVE_DOMXSLT
|
||||
xsltSetGenericErrorFunc(xsltGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
|
||||
#if HAVE_DOMEXSLT
|
||||
exsltRegisterAll();
|
||||
#endif
|
||||
#endif
|
||||
xmlInitParser();
|
||||
return SUCCESS;
|
||||
@@ -4815,17 +4803,15 @@ PHP_FUNCTION(domxml_xmltree)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
DOMXML_DOMOBJ_NEW(rv, (xmlNodePtr) docp, &ret);
|
||||
DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret);
|
||||
|
||||
/* The root itself maybe an array. Though you may not have two Elements
|
||||
as root, you may have a comment, pi and and element as root.
|
||||
Thanks to Paul DuBois for pointing me at this.
|
||||
*/
|
||||
if (node_children(&children, root TSRMLS_CC) >= 0) {
|
||||
zend_hash_update(Z_OBJPROP_P(rv), "children",sizeof("children"), (void *) &children, sizeof(zval *), NULL);
|
||||
zend_hash_update(Z_OBJPROP_P(return_value), "children",sizeof("children"), (void *) &children, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
DOMXML_RET_ZVAL(rv);
|
||||
/* xmlFreeDoc(docp); */
|
||||
}
|
||||
/* }}} */
|
||||
@@ -5372,8 +5358,7 @@ PHP_FUNCTION(domxml_xslt_process)
|
||||
xmlDocPtr xmldocp;
|
||||
xmlDocPtr docp;
|
||||
char **params = NULL;
|
||||
int ret;
|
||||
long clone = -1;
|
||||
int ret, clone = -1;
|
||||
char *filename;
|
||||
int filename_len = 0;
|
||||
FILE *f;
|
||||
|
||||
@@ -75,8 +75,6 @@ PHPAPI zval *php_domobject_new(xmlNodePtr obj, int *found, zval* in TSRMLS_DC);
|
||||
/* directory functions */
|
||||
PHP_MINIT_FUNCTION(domxml);
|
||||
PHP_MSHUTDOWN_FUNCTION(domxml);
|
||||
PHP_RINIT_FUNCTION(domxml);
|
||||
PHP_RSHUTDOWN_FUNCTION(domxml);
|
||||
PHP_MINFO_FUNCTION(domxml);
|
||||
PHP_FUNCTION(domxml_version);
|
||||
PHP_FUNCTION(xmldoc);
|
||||
|
||||
@@ -1213,12 +1213,7 @@ PHP_FUNCTION(fbsql_database)
|
||||
if (phpLink->databaseName) free(phpLink->databaseName);
|
||||
phpLink->databaseName = strdup(Z_STRVAL_PP(dbname));
|
||||
}
|
||||
if (phpLink->databaseName) {
|
||||
RETURN_STRING(phpLink->databaseName, 1);
|
||||
}
|
||||
else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_STRING(phpLink->databaseName, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -721,10 +721,6 @@ PHP_FUNCTION(fdf_set_file)
|
||||
return;
|
||||
}
|
||||
|
||||
if (php_check_open_basedir(filename TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(filename, "wb+", CHECKUID_CHECK_MODE_PARAM))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
|
||||
|
||||
err = FDFSetFile(fdf, filename);
|
||||
@@ -1485,10 +1481,6 @@ PHP_FUNCTION(fdf_get_attachment) {
|
||||
|
||||
ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
|
||||
|
||||
if (php_check_open_basedir(savepath TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(savepath, "wb+", CHECKUID_CHECK_MODE_PARAM))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
strncpy(pathbuf , savepath, MAXPATHLEN-1);
|
||||
pathbuf[MAXPATHLEN-1] = '\0';
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <fribidi/fribidi.h>
|
||||
|
||||
/* The fribidi guys dont believe in BC */
|
||||
#ifndef FRIBIDI_MICRO_VERSION_STR
|
||||
#ifdef FRIBIDI_CHAR_SET_UTF8
|
||||
#define FRIBIDI_CHARSET_UTF8 FRIBIDI_CHAR_SET_UTF8
|
||||
#define FRIBIDI_CHARSET_ISO8859_6 FRIBIDI_CHAR_SET_ISO8859_6
|
||||
#define FRIBIDI_CHARSET_ISO8859_8 FRIBIDI_CHAR_SET_ISO8859_8
|
||||
@@ -212,11 +212,7 @@ PHP_FUNCTION(fribidi_log2vis)
|
||||
|
||||
out_string = (char *) emalloc(sizeof(char)*alloc_len);
|
||||
|
||||
#if FRIBIDI_MAJOR_VERSION == 0 && FRIBIDI_MINOR_VERSION <= 10
|
||||
fribidi_log2vis(u_logical_str, len, &base_dir, u_visual_str, position_L_to_V_list, position_V_to_L_list, embedding_level_list);
|
||||
#else
|
||||
fribidi_log2vis(NULL, u_logical_str, len, &base_dir, u_visual_str, position_L_to_V_list, position_V_to_L_list, embedding_level_list);
|
||||
#endif
|
||||
|
||||
/* convert back to original char set */
|
||||
switch(Z_LVAL_PP(charset)) {
|
||||
|
||||
@@ -362,9 +362,6 @@ ftp_syst(ftpbuf_t *ftp)
|
||||
return NULL;
|
||||
|
||||
syst = ftp->inbuf;
|
||||
while (*syst == ' ') {
|
||||
syst++;
|
||||
}
|
||||
if ((end = strchr(syst, ' ')))
|
||||
*end = 0;
|
||||
ftp->syst = estrdup(syst);
|
||||
|
||||
+1
-4
@@ -258,7 +258,6 @@ AC_DEFUN(PHP_GD_CHECK_VERSION,[
|
||||
PHP_CHECK_LIBRARY(gd, gdImageGifCtx, [AC_DEFINE(HAVE_GD_GIF_CTX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdCacheCreate, [AC_DEFINE(HAVE_GD_CACHE_CREATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdFontCacheShutdown, [AC_DEFINE(HAVE_GD_THREAD_SAFE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdNewDynamicCtxEx, [AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
])
|
||||
|
||||
dnl
|
||||
@@ -272,7 +271,7 @@ if test "$PHP_GD" = "yes"; then
|
||||
libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c libgd/gdfontmb.c libgd/gdfontl.c \
|
||||
libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c libgd/gdcache.c libgd/gdkanji.c \
|
||||
libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c libgd/gd_topal.c libgd/gd_gif_in.c \
|
||||
libgd/xbm.c libgd/gd_gif_out.c "
|
||||
libgd/xbm.c"
|
||||
|
||||
dnl check for fabsf and floorf which are available since C99
|
||||
AC_CHECK_FUNCS(fabsf floorf)
|
||||
@@ -306,9 +305,7 @@ dnl These are always available with bundled library
|
||||
AC_DEFINE(HAVE_GD_XBM, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_BUNDLED, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_GIF_CREATE, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_IMAGEELLIPSE, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX, 1, [ ])
|
||||
|
||||
dnl Make sure the libgd/ is first in the include path
|
||||
GDLIB_CFLAGS="-DHAVE_LIBPNG"
|
||||
|
||||
+5
-17
@@ -35,7 +35,6 @@
|
||||
#include "SAPI.h"
|
||||
#include "php_gd.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_open_temporary_file.h"
|
||||
|
||||
#if HAVE_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
@@ -108,10 +107,6 @@ extern int gdImageColorResolve(gdImagePtr, int, int, int);
|
||||
int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GD_DYNAMIC_CTX_EX
|
||||
#define gdNewDynamicCtxEx(len, data, val) gdNewDynamicCtx(len, data)
|
||||
#endif
|
||||
|
||||
static gdImagePtr _php_image_create_from_string (zval **Data, char *tn, gdImagePtr (*ioctx_func_p)() TSRMLS_DC);
|
||||
static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)());
|
||||
static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)());
|
||||
@@ -395,7 +390,7 @@ PHP_RSHUTDOWN_FUNCTION(gd)
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_GD_BUNDLED
|
||||
#define PHP_GD_VERSION_STRING "bundled (2.0.28 compatible)"
|
||||
#define PHP_GD_VERSION_STRING "bundled (2.0.17 compatible)"
|
||||
#elif HAVE_LIBGD20
|
||||
#define PHP_GD_VERSION_STRING "2.0 or higher"
|
||||
#elif HAVE_GDIMAGECOLORRESOLVE
|
||||
@@ -653,7 +648,6 @@ PHP_FUNCTION(imageloadfont)
|
||||
if (body_size != body_size_check) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error reading font");
|
||||
efree(font);
|
||||
php_stream_close(stream);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1247,7 +1241,7 @@ static int _php_image_type (char data[8])
|
||||
#ifdef HAVE_GD_WBMP
|
||||
else {
|
||||
gdIOCtx *io_ctx;
|
||||
io_ctx = gdNewDynamicCtxEx (8, data, 0);
|
||||
io_ctx = gdNewDynamicCtx (8, data);
|
||||
if (io_ctx) {
|
||||
if (getmbi((int(*)(void*))gdGetC, io_ctx) == 0 && skipheader((int(*)(void*))gdGetC, io_ctx) == 0 ) {
|
||||
#if HAVE_LIBGD204
|
||||
@@ -1279,7 +1273,7 @@ gdImagePtr _php_image_create_from_string(zval **data, char *tn, gdImagePtr (*ioc
|
||||
gdImagePtr im;
|
||||
gdIOCtx *io_ctx;
|
||||
|
||||
io_ctx = gdNewDynamicCtxEx(Z_STRLEN_PP(data), Z_STRVAL_PP(data), 0);
|
||||
io_ctx = gdNewDynamicCtx (Z_STRLEN_PP(data), Z_STRVAL_PP(data));
|
||||
|
||||
if (!io_ctx) {
|
||||
return NULL;
|
||||
@@ -1433,7 +1427,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
io_ctx = gdNewDynamicCtxEx(buff_size, buff, 0);
|
||||
io_ctx = gdNewDynamicCtx(buff_size, buff);
|
||||
if(!io_ctx) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot allocate GD IO context");
|
||||
goto out_err;
|
||||
@@ -1622,7 +1616,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
}
|
||||
|
||||
switch(image_type) {
|
||||
#ifdef HAVE_GD_WBMP
|
||||
case PHP_GDIMG_CONVERT_WBM:
|
||||
if (q == -1) {
|
||||
q = 0;
|
||||
@@ -1632,7 +1625,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
}
|
||||
gdImageWBMP(im, q, fp);
|
||||
break;
|
||||
#endif
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
(*func_p)(im, fp, q);
|
||||
break;
|
||||
@@ -1664,14 +1656,13 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
FILE *tmp;
|
||||
char buf[4096];
|
||||
|
||||
tmp = php_open_temporary_file("", "", NULL TSRMLS_CC);
|
||||
tmp = tmpfile();
|
||||
if (tmp == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open temporary file");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
switch(image_type) {
|
||||
#ifdef HAVE_GD_WBMP
|
||||
case PHP_GDIMG_CONVERT_WBM:
|
||||
if (q == -1) {
|
||||
q = 0;
|
||||
@@ -1681,7 +1672,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
}
|
||||
gdImageWBMP(im, q, tmp);
|
||||
break;
|
||||
#endif
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
(*func_p)(im, tmp, q);
|
||||
break;
|
||||
@@ -3645,11 +3635,9 @@ static void _php_image_bw_convert( gdImagePtr im_org, gdIOCtx *out, int threshol
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAVE_LIBGD20
|
||||
if (im_org->trueColor) {
|
||||
gdImageTrueColorToPalette(im_org, 1, 256);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (y = 0; y < dest_height; y++) {
|
||||
for (x = 0; x < dest_width; x++) {
|
||||
|
||||
+4
-8
@@ -43,8 +43,8 @@ RSC=rc.exe
|
||||
# PROP Intermediate_Dir "Release_TS"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
@@ -73,8 +73,8 @@ LINK32=link.exe
|
||||
# PROP Intermediate_Dir "Debug_TS"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
@@ -231,10 +231,6 @@ SOURCE=.\libgd\gd_gif_in.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\libgd\gd_gif_out.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\libgd\gd_io.c
|
||||
|
||||
!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
|
||||
|
||||
+17
-34
@@ -1290,9 +1290,7 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
|
||||
inc = (dy * 65536) / dx;
|
||||
while ((x >> 16) < x2) {
|
||||
gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF);
|
||||
if ((y >> 16) + 1 < im->sy) {
|
||||
gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF);
|
||||
}
|
||||
gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF);
|
||||
x += (1 << 16);
|
||||
y += inc;
|
||||
}
|
||||
@@ -1312,9 +1310,7 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
|
||||
inc = (dx * 65536) / dy;
|
||||
while ((y>>16) < y2) {
|
||||
gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF);
|
||||
if ((x >> 16) + 1 < im->sx) {
|
||||
gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF);
|
||||
}
|
||||
gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF);
|
||||
x += inc;
|
||||
y += (1<<16);
|
||||
}
|
||||
@@ -1607,14 +1603,9 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
|
||||
int lx = 0, ly = 0;
|
||||
int fx = 0, fy = 0;
|
||||
|
||||
while (s<0) {
|
||||
s += 360;
|
||||
}
|
||||
|
||||
while (e < s) {
|
||||
e += 360;
|
||||
}
|
||||
|
||||
for (i = s; i <= e; i++) {
|
||||
int x, y;
|
||||
x = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
|
||||
@@ -1879,18 +1870,13 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc)
|
||||
int l, x1, x2, dy;
|
||||
int oc; /* old pixel value */
|
||||
int wx2,wy2;
|
||||
int alphablending_bak;
|
||||
/* stack of filled segments */
|
||||
/* struct seg stack[FILL_MAX],*sp = stack;; */
|
||||
//struct seg stack[FILL_MAX],*sp = stack;;
|
||||
struct seg *stack;
|
||||
struct seg *sp;
|
||||
|
||||
alphablending_bak = im->alphaBlendingFlag;
|
||||
im->alphaBlendingFlag = 0;
|
||||
|
||||
if (nc==gdTiled){
|
||||
_gdImageFillTiled(im,x,y,nc);
|
||||
im->alphaBlendingFlag = alphablending_bak;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1936,7 +1922,6 @@ skip: for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++);
|
||||
} while (x<=x2);
|
||||
}
|
||||
efree(stack);
|
||||
im->alphaBlendingFlag = alphablending_bak;
|
||||
}
|
||||
|
||||
void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
|
||||
@@ -2307,8 +2292,7 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
|
||||
int tmp = gdImageGetPixel (src, x, y);
|
||||
mapTo = gdImageGetTrueColorPixel (src, x, y);
|
||||
if (gdImageGetTransparent (src) == tmp) {
|
||||
/* 2.0.21, TK: not tox++ */
|
||||
tox += stx[x - srcX];
|
||||
tox++;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
@@ -2316,8 +2300,7 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
|
||||
mapTo = gdImageGetTrueColorPixel (src, x, y);
|
||||
/* Added 7/24/95: support transparent copies */
|
||||
if (gdImageGetTransparent (src) == mapTo) {
|
||||
/* 2.0.21, TK: not tox++ */
|
||||
tox += stx[x - srcX];
|
||||
tox++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2373,24 +2356,22 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
|
||||
void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)
|
||||
{
|
||||
int x, y;
|
||||
double sy1, sy2, sx1, sx2;
|
||||
if (!dst->trueColor) {
|
||||
gdImageCopyResized (dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
|
||||
return;
|
||||
}
|
||||
for (y = dstY; (y < dstY + dstH); y++) {
|
||||
sy1 = ((double) y - (double) dstY) * (double) srcH / (double) dstH;
|
||||
sy2 = ((double) (y + 1) - (double) dstY) * (double) srcH / (double) dstH;
|
||||
for (x = dstX; (x < dstX + dstW); x++) {
|
||||
double sx, sy;
|
||||
double spixels = 0;
|
||||
double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
|
||||
double alpha_factor, alpha_sum = 0.0, contrib_sum = 0.0;
|
||||
sx1 = ((double) x - (double) dstX) * (double) srcW / dstW;
|
||||
sx2 = ((double) (x + 1) - (double) dstX) * (double) srcW / dstW;
|
||||
float sy1, sy2, sx1, sx2;
|
||||
float sx, sy;
|
||||
float spixels = 0.0f;
|
||||
float red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f;
|
||||
float alpha_factor, alpha_sum = 0.0f, contrib_sum = 0.0f;
|
||||
sy1 = ((float)(y - dstY)) * (float)srcH / (float)dstH;
|
||||
sy2 = ((float)(y + 1 - dstY)) * (float) srcH / (float) dstH;
|
||||
sy = sy1;
|
||||
do {
|
||||
double yportion;
|
||||
float yportion;
|
||||
if (floor_cast(sy) == floor_cast(sy1)) {
|
||||
yportion = 1.0f - (sy - floor_cast(sy));
|
||||
if (yportion > sy2 - sy1) {
|
||||
@@ -2402,10 +2383,12 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i
|
||||
} else {
|
||||
yportion = 1.0f;
|
||||
}
|
||||
sx1 = ((float)(x - dstX)) * (float) srcW / dstW;
|
||||
sx2 = ((float)(x + 1 - dstX)) * (float) srcW / dstW;
|
||||
sx = sx1;
|
||||
do {
|
||||
double xportion;
|
||||
double pcontribution;
|
||||
float xportion;
|
||||
float pcontribution;
|
||||
int p;
|
||||
if (floorf(sx) == floor_cast(sx1)) {
|
||||
xportion = 1.0f - (sx - floor_cast(sx));
|
||||
|
||||
+30
-76
@@ -11,7 +11,7 @@ extern "C" {
|
||||
#define PATHSEPARATOR ":"
|
||||
#else
|
||||
/* default fontpath for windows systems */
|
||||
#define DEFAULT_FONTPATH "c:\\winnt\\fonts;c:\\windows\\fonts;."
|
||||
#define DEFAULT_FONTPATH "c:\\winnt\\fonts;."
|
||||
#define PATHSEPARATOR ";"
|
||||
#endif
|
||||
|
||||
@@ -21,8 +21,8 @@ extern "C" {
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation. This software is provided "AS IS." Thomas Boutell and
|
||||
* Boutell.Com, Inc. disclaim all warranties, either express or implied,
|
||||
* including but not limited to implied warranties of merchantability and
|
||||
* Boutell.Com, Inc. disclaim all warranties, either express or implied,
|
||||
* including but not limited to implied warranties of merchantability and
|
||||
* fitness for a particular purpose, with respect to this code and accompanying
|
||||
* documentation. */
|
||||
|
||||
@@ -43,19 +43,19 @@ void php_gd_error(const char *format, ...);
|
||||
|
||||
/* Image type. See functions below; you will not need to change
|
||||
the elements directly. Use the provided macros to
|
||||
access sx, sy, the color table, and colorsTotal for
|
||||
access sx, sy, the color table, and colorsTotal for
|
||||
read-only purposes. */
|
||||
|
||||
/* If 'truecolor' is set true, the image is truecolor;
|
||||
/* If 'truecolor' is set true, the image is truecolor;
|
||||
pixels are represented by integers, which
|
||||
must be 32 bits wide or more.
|
||||
must be 32 bits wide or more.
|
||||
|
||||
True colors are repsented as follows:
|
||||
|
||||
ARGB
|
||||
|
||||
Where 'A' (alpha channel) occupies only the
|
||||
LOWER 7 BITS of the MSB. This very small
|
||||
LOWER 7 BITS of the MSB. This very small
|
||||
loss of alpha channel resolution allows gd 2.x
|
||||
to keep backwards compatibility by allowing
|
||||
signed integers to be used to represent colors,
|
||||
@@ -78,7 +78,7 @@ void php_gd_error(const char *format, ...);
|
||||
#define gdEffectOverlay 3
|
||||
|
||||
|
||||
/* This function accepts truecolor pixel values only. The
|
||||
/* This function accepts truecolor pixel values only. The
|
||||
source color is composited with the destination color
|
||||
based on the alpha channel value of the source color.
|
||||
The resulting color is opaque. */
|
||||
@@ -96,11 +96,11 @@ typedef struct gdImageStruct {
|
||||
int colorsTotal;
|
||||
int red[gdMaxColors];
|
||||
int green[gdMaxColors];
|
||||
int blue[gdMaxColors];
|
||||
int blue[gdMaxColors];
|
||||
int open[gdMaxColors];
|
||||
/* For backwards compatibility, this is set to the
|
||||
first palette entry with 100% transparency,
|
||||
and is also set and reset by the
|
||||
and is also set and reset by the
|
||||
gdImageColorTransparent function. Newer
|
||||
applications can allocate palette entries
|
||||
with any desired level of transparency; however,
|
||||
@@ -112,7 +112,7 @@ typedef struct gdImageStruct {
|
||||
int *polyInts;
|
||||
int polyAllocated;
|
||||
struct gdImageStruct *brush;
|
||||
struct gdImageStruct *tile;
|
||||
struct gdImageStruct *tile;
|
||||
int brushColorMap[gdMaxColors];
|
||||
int tileColorMap[gdMaxColors];
|
||||
int styleLength;
|
||||
@@ -126,10 +126,10 @@ typedef struct gdImageStruct {
|
||||
really support multiple levels of transparency in
|
||||
palettes, to my knowledge, as of 2/15/01. Most
|
||||
common browsers will display 100% opaque and
|
||||
100% transparent correctly, and do something
|
||||
100% transparent correctly, and do something
|
||||
unpredictable and/or undesirable for levels
|
||||
in between. TBB */
|
||||
int alpha[gdMaxColors];
|
||||
int alpha[gdMaxColors];
|
||||
/* Truecolor flag and pixels. New 2.0 fields appear here at the
|
||||
end to minimize breakage of existing object code. */
|
||||
int trueColor;
|
||||
@@ -137,7 +137,7 @@ typedef struct gdImageStruct {
|
||||
/* Should alpha channel be copied, or applied, each time a
|
||||
pixel is drawn? This applies to truecolor images only.
|
||||
No attempt is made to alpha-blend in palette images,
|
||||
even if semitransparent palette entries exist.
|
||||
even if semitransparent palette entries exist.
|
||||
To do that, build your image as a truecolor image,
|
||||
then quantize down to 8 bits. */
|
||||
int alphaBlendingFlag;
|
||||
@@ -147,7 +147,7 @@ typedef struct gdImageStruct {
|
||||
PNG at the moment; other future formats may also
|
||||
have that capability. JPEG doesn't. */
|
||||
int saveAlphaFlag;
|
||||
|
||||
|
||||
|
||||
/* 2.0.12: anti-aliased globals */
|
||||
int AA;
|
||||
@@ -156,7 +156,7 @@ typedef struct gdImageStruct {
|
||||
unsigned char **AA_opacity;
|
||||
int AA_polygon;
|
||||
/* Stored and pre-computed variables for determining the perpendicular
|
||||
* distance from a point to the anti-aliased line being drawn:
|
||||
* distance from a point to the anti-aliased line being drawn:
|
||||
*/
|
||||
int AAL_x1;
|
||||
int AAL_y1;
|
||||
@@ -230,7 +230,7 @@ gdImagePtr gdImageCreateTrueColor(int sx, int sy);
|
||||
gdImagePtr gdImageCreateFromPng(FILE *fd);
|
||||
gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in);
|
||||
gdImagePtr gdImageCreateFromWBMP(FILE *inFile);
|
||||
gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile);
|
||||
gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile);
|
||||
gdImagePtr gdImageCreateFromJpeg(FILE *infile);
|
||||
gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile);
|
||||
|
||||
@@ -256,7 +256,6 @@ gdImagePtr gdImageCreateFromGd2Part(FILE *in, int srcx, int srcy, int w, int h);
|
||||
gdImagePtr gdImageCreateFromGd2PartCtx(gdIOCtxPtr in, int srcx, int srcy, int w, int h);
|
||||
|
||||
gdImagePtr gdImageCreateFromXbm(FILE *fd);
|
||||
void gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out);
|
||||
|
||||
gdImagePtr gdImageCreateFromXpm (char *filename);
|
||||
|
||||
@@ -264,11 +263,11 @@ void gdImageDestroy(gdImagePtr im);
|
||||
|
||||
/* Replaces or blends with the background depending on the
|
||||
most recent call to gdImageAlphaBlending and the
|
||||
alpha channel value of 'color'; default is to overwrite.
|
||||
alpha channel value of 'color'; default is to overwrite.
|
||||
Tiling and line styling are also implemented
|
||||
here. All other gd drawing functions pass through this call,
|
||||
here. All other gd drawing functions pass through this call,
|
||||
allowing for many useful effects. */
|
||||
|
||||
|
||||
void gdImageSetPixel(gdImagePtr im, int x, int y, int color);
|
||||
|
||||
int gdImageGetPixel(gdImagePtr im, int x, int y);
|
||||
@@ -296,9 +295,9 @@ void gdImageString16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s
|
||||
void gdImageStringUp16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color);
|
||||
|
||||
/* 2.0.16: for thread-safe use of gdImageStringFT and friends,
|
||||
* call this before allowing any thread to call gdImageStringFT.
|
||||
* call this before allowing any thread to call gdImageStringFT.
|
||||
* Otherwise it is invoked by the first thread to invoke
|
||||
* gdImageStringFT, with a very small but real risk of a race condition.
|
||||
* gdImageStringFT, with a very small but real risk of a race condition.
|
||||
* Return 0 on success, nonzero on failure to initialize freetype.
|
||||
*/
|
||||
int gdFontCacheSetup(void);
|
||||
@@ -321,14 +320,11 @@ typedef struct {
|
||||
gdFTEX_Shift_JIS, or gdFTEX_Big5;
|
||||
when not specified, maps are searched
|
||||
for in the above order. */
|
||||
int hdpi;
|
||||
int vdpi;
|
||||
}
|
||||
gdFTStringExtra, *gdFTStringExtraPtr;
|
||||
|
||||
#define gdFTEX_LINESPACE 1
|
||||
#define gdFTEX_CHARMAP 2
|
||||
#define gdFTEX_RESOLUTION 4
|
||||
|
||||
/* These are NOT flags; set one in 'charmap' if you set the gdFTEX_CHARMAP bit in 'flags'. */
|
||||
#define gdFTEX_Unicode 0
|
||||
@@ -350,7 +346,7 @@ typedef struct {
|
||||
void gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c);
|
||||
void gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
|
||||
|
||||
/* These functions still work with truecolor images,
|
||||
/* These functions still work with truecolor images,
|
||||
for which they never return error. */
|
||||
int gdImageColorAllocate(gdImagePtr im, int r, int g, int b);
|
||||
/* gd 2.0: palette entries with non-opaque transparency are permitted. */
|
||||
@@ -407,11 +403,8 @@ void gdImageColorDeallocate(gdImagePtr im, int color);
|
||||
conversion to palette is not great (for small images
|
||||
it can be negative) and the quality loss is ugly. */
|
||||
|
||||
gdImagePtr gdImageCreatePaletteFromTrueColor (gdImagePtr im, int ditherFlag, int colorsWanted);
|
||||
|
||||
void gdImageTrueColorToPalette(gdImagePtr im, int ditherFlag, int colorsWanted);
|
||||
|
||||
|
||||
/* An attempt at getting the results of gdImageTrueColorToPalette
|
||||
to look a bit more like the original (im1 is the original
|
||||
and im2 is the palette version */
|
||||
@@ -431,12 +424,10 @@ void gdImageColorTransparent(gdImagePtr im, int color);
|
||||
void gdImagePaletteCopy(gdImagePtr dst, gdImagePtr src);
|
||||
void gdImagePng(gdImagePtr im, FILE *out);
|
||||
void gdImagePngCtx(gdImagePtr im, gdIOCtx *out);
|
||||
void gdImageGif(gdImagePtr im, FILE *out);
|
||||
void gdImageGifCtx(gdImagePtr im, gdIOCtx *out);
|
||||
/* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
|
||||
* 1 is FASTEST but produces larger files, 9 provides the best
|
||||
* compression (smallest files) but takes a long time to compress, and
|
||||
* -1 selects the default compiled into the zlib library.
|
||||
* -1 selects the default compiled into the zlib library.
|
||||
*/
|
||||
void gdImagePngEx(gdImagePtr im, FILE * out, int level);
|
||||
void gdImagePngCtxEx(gdImagePtr im, gdIOCtx * out, int level);
|
||||
@@ -494,7 +485,7 @@ void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int c);
|
||||
gdArc and gdChord are mutually exclusive;
|
||||
gdChord just connects the starting and ending
|
||||
angles with a straight line, while gdArc produces
|
||||
a rounded edge. gdPie is a synonym for gdArc.
|
||||
a rounded edge. gdPie is a synonym for gdArc.
|
||||
gdNoFill indicates that the arc or chord should be
|
||||
outlined, not filled. gdEdged, used together with
|
||||
gdNoFill, indicates that the beginning and ending
|
||||
@@ -513,7 +504,7 @@ void gdImageFilledEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color
|
||||
void gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color);
|
||||
void gdImageFill(gdImagePtr im, int x, int y, int color);
|
||||
void gdImageCopy(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h);
|
||||
void gdImageCopyMerge(gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
|
||||
void gdImageCopyMerge(gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
|
||||
int srcX, int srcY, int w, int h, int pct);
|
||||
void gdImageCopyMergeGray(gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
|
||||
int srcX, int srcY, int w, int h, int pct);
|
||||
@@ -529,8 +520,8 @@ void gdImageCopyResized(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
|
||||
destination pixel, taking into account what portion of the
|
||||
destination pixel each source pixel represents. This is a
|
||||
floating point operation, but this is not a performance issue
|
||||
on modern hardware, except for some embedded devices. If the
|
||||
destination is a palette image, gdImageCopyResized is
|
||||
on modern hardware, except for some embedded devices. If the
|
||||
destination is a palette image, gdImageCopyResized is
|
||||
substituted automatically. */
|
||||
void gdImageCopyResampled(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH);
|
||||
|
||||
@@ -545,7 +536,7 @@ void gdImageSetTile(gdImagePtr im, gdImagePtr tile);
|
||||
void gdImageSetAntiAliased(gdImagePtr im, int c);
|
||||
void gdImageSetAntiAliasedDontBlend(gdImagePtr im, int c, int dont_blend);
|
||||
void gdImageSetStyle(gdImagePtr im, int *style, int noOfPixels);
|
||||
/* Line thickness (defaults to 1). Affects lines, ellipses,
|
||||
/* Line thickness (defaults to 1). Affects lines, ellipses,
|
||||
rectangles, polygons and so forth. */
|
||||
void gdImageSetThickness(gdImagePtr im, int thickness);
|
||||
/* On or off (1 or 0) for all three of these. */
|
||||
@@ -587,11 +578,10 @@ void gdImageSaveAlpha(gdImagePtr im, int saveAlphaArg);
|
||||
|
||||
gdIOCtx* gdNewFileCtx(FILE*);
|
||||
gdIOCtx* gdNewDynamicCtx(int, void*);
|
||||
gdIOCtx *gdNewDynamicCtxEx(int size, void *data, int freeFlag);
|
||||
gdIOCtx* gdNewSSCtx(gdSourcePtr in, gdSinkPtr out);
|
||||
void* gdDPExtractData(struct gdIOCtx* ctx, int *size);
|
||||
|
||||
#define GD2_CHUNKSIZE 128
|
||||
#define GD2_CHUNKSIZE 128
|
||||
#define GD2_CHUNKSIZE_MIN 64
|
||||
#define GD2_CHUNKSIZE_MAX 4096
|
||||
|
||||
@@ -600,42 +590,6 @@ void* gdDPExtractData(struct gdIOCtx* ctx, int *size);
|
||||
#define GD2_FMT_RAW 1
|
||||
#define GD2_FMT_COMPRESSED 2
|
||||
|
||||
|
||||
/* filters section
|
||||
*
|
||||
* Negate the imag src, white becomes black,
|
||||
* The red, green, and blue intensities of an image are negated.
|
||||
* White becomes black, yellow becomes blue, etc.
|
||||
*/
|
||||
int gdImageNegate(gdImagePtr src);
|
||||
|
||||
/* Convert the image src to a grayscale image */
|
||||
int gdImageGrayScale(gdImagePtr src);
|
||||
|
||||
/* Set the brightness level <brightness> for the image src */
|
||||
int gdImageBrightness(gdImagePtr src, int brightness);
|
||||
|
||||
/* Set the contrast level <contrast> for the image <src> */
|
||||
int gdImageContrast(gdImagePtr src, double contrast);
|
||||
|
||||
/* Simply adds or substracts respectively red, green or blue to a pixel */
|
||||
int gdImageColor(gdImagePtr src, int red, int green, int blue);
|
||||
|
||||
/* Image convolution by a 3x3 custom matrix */
|
||||
int gdImageConvolution(gdImagePtr src, float ft[3][3], float filter_div, float offset);
|
||||
|
||||
int gdImageEdgeDetectQuick(gdImagePtr src);
|
||||
|
||||
int gdImageGaussianBlur(gdImagePtr im);
|
||||
|
||||
int gdImageSelectiveBlur( gdImagePtr src);
|
||||
|
||||
int gdImageEmboss(gdImagePtr im);
|
||||
|
||||
int gdImageMeanRemoval(gdImagePtr im);
|
||||
|
||||
int gdImageSmooth(gdImagePtr im, float weight);
|
||||
|
||||
/* Image comparison definitions */
|
||||
int gdImageCompare(gdImagePtr im1, gdImagePtr im2);
|
||||
|
||||
|
||||
@@ -147,16 +147,6 @@ gdImagePtr gdImageCreateFromGd (FILE * inFile)
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGdPtr (int size, void *data)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromGdCtx(in);
|
||||
in->gd_free(in);
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGdCtx (gdIOCtxPtr in)
|
||||
{
|
||||
int sx, sy;
|
||||
|
||||
@@ -237,16 +237,6 @@ gdImagePtr gdImageCreateFromGd2 (FILE * inFile)
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGd2Ptr (int size, void *data)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromGd2Ctx(in);
|
||||
in->gd_free(in);
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
|
||||
{
|
||||
int sx, sy;
|
||||
@@ -388,16 +378,6 @@ fail2:
|
||||
return 0;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy, int w, int h)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromGd2PartCtx(in, srcx, srcy, w, h);
|
||||
in->gd_free(in);
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h)
|
||||
{
|
||||
gdImagePtr im;
|
||||
|
||||
@@ -1,759 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "gd.h"
|
||||
|
||||
/* Code drawn from ppmtogif.c, from the pbmplus package
|
||||
**
|
||||
** Based on GIFENCOD by David Rowley <mgardi@watdscu.waterloo.edu>. A
|
||||
** Lempel-Zim compression based on "compress".
|
||||
**
|
||||
** Modified by Marcel Wijkstra <wijkstra@fwi.uva.nl>
|
||||
**
|
||||
** Copyright (C) 1989 by Jef Poskanzer.
|
||||
**
|
||||
** Permission to use, copy, modify, and distribute this software and its
|
||||
** documentation for any purpose and without fee is hereby granted, provided
|
||||
** that the above copyright notice appear in all copies and that both that
|
||||
** copyright notice and this permission notice appear in supporting
|
||||
** documentation. This software is provided "as is" without express or
|
||||
** implied warranty.
|
||||
**
|
||||
** The Graphics Interchange Format(c) is the Copyright property of
|
||||
** CompuServe Incorporated. GIF(sm) is a Service Mark property of
|
||||
** CompuServe Incorporated.
|
||||
*/
|
||||
|
||||
/*
|
||||
* a code_int must be able to hold 2**GIFBITS values of type int, and also -1
|
||||
*/
|
||||
typedef int code_int;
|
||||
|
||||
#ifdef SIGNED_COMPARE_SLOW
|
||||
typedef unsigned long int count_int;
|
||||
typedef unsigned short int count_short;
|
||||
#else /*SIGNED_COMPARE_SLOW*/
|
||||
typedef long int count_int;
|
||||
#endif /*SIGNED_COMPARE_SLOW*/
|
||||
|
||||
/* 2.0.28: threadsafe */
|
||||
|
||||
#define maxbits GIFBITS
|
||||
|
||||
/* should NEVER generate this code */
|
||||
#define maxmaxcode ((code_int)1 << GIFBITS)
|
||||
|
||||
#define HSIZE 5003 /* 80% occupancy */
|
||||
#define hsize HSIZE /* Apparently invariant, left over from
|
||||
compress */
|
||||
|
||||
typedef struct {
|
||||
int Width, Height;
|
||||
int curx, cury;
|
||||
long CountDown;
|
||||
int Pass;
|
||||
int Interlace;
|
||||
int n_bits; /* number of bits/code */
|
||||
code_int maxcode; /* maximum code, given n_bits */
|
||||
count_int htab [HSIZE];
|
||||
unsigned short codetab [HSIZE];
|
||||
code_int free_ent; /* first unused entry */
|
||||
/*
|
||||
* block compression parameters -- after all codes are used up,
|
||||
* and compression rate changes, start over.
|
||||
*/
|
||||
int clear_flg;
|
||||
int offset;
|
||||
long int in_count; /* length of input */
|
||||
long int out_count; /* # of codes output (for debugging) */
|
||||
|
||||
int g_init_bits;
|
||||
gdIOCtx * g_outfile;
|
||||
|
||||
int ClearCode;
|
||||
int EOFCode;
|
||||
unsigned long cur_accum;
|
||||
int cur_bits;
|
||||
/*
|
||||
* Number of characters so far in this 'packet'
|
||||
*/
|
||||
int a_count;
|
||||
/*
|
||||
* Define the storage for the packet accumulator
|
||||
*/
|
||||
char accum[ 256 ];
|
||||
} GifCtx;
|
||||
|
||||
static int gifPutWord(int w, gdIOCtx *out);
|
||||
static int colorstobpp(int colors);
|
||||
static void BumpPixel (GifCtx *ctx);
|
||||
static int GIFNextPixel (gdImagePtr im, GifCtx *ctx);
|
||||
static void GIFEncode (gdIOCtxPtr fp, int GWidth, int GHeight, int GInterlace, int Background, int Transparent, int BitsPerPixel, int *Red, int *Green, int *Blue, gdImagePtr im);
|
||||
static void compress (int init_bits, gdIOCtx *outfile, gdImagePtr im, GifCtx *ctx);
|
||||
static void output (code_int code, GifCtx *ctx);
|
||||
static void cl_block (GifCtx *ctx);
|
||||
static void cl_hash (register count_int chsize, GifCtx *ctx);
|
||||
static void char_init (GifCtx *ctx);
|
||||
static void char_out (int c, GifCtx *ctx);
|
||||
static void flush_char (GifCtx *ctx);
|
||||
void * gdImageGifPtr (gdImagePtr im, int *size)
|
||||
{
|
||||
void *rv;
|
||||
gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
|
||||
gdImageGifCtx (im, out);
|
||||
rv = gdDPExtractData (out, size);
|
||||
out->gd_free (out);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void gdImageGif (gdImagePtr im, FILE * outFile)
|
||||
{
|
||||
gdIOCtx *out = gdNewFileCtx (outFile);
|
||||
gdImageGifCtx (im, out);
|
||||
out->gd_free (out);
|
||||
}
|
||||
|
||||
void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
|
||||
{
|
||||
gdImagePtr pim = 0, tim = im;
|
||||
int interlace, transparent, BitsPerPixel;
|
||||
interlace = im->interlace;
|
||||
transparent = im->transparent;
|
||||
if (im->trueColor) {
|
||||
/* Expensive, but the only way that produces an
|
||||
acceptable result: mix down to a palette
|
||||
based temporary image. */
|
||||
pim = gdImageCreatePaletteFromTrueColor(im, 1, 256);
|
||||
if (!pim) {
|
||||
return;
|
||||
}
|
||||
tim = pim;
|
||||
}
|
||||
BitsPerPixel = colorstobpp(tim->colorsTotal);
|
||||
/* All set, let's do it. */
|
||||
GIFEncode(
|
||||
out, tim->sx, tim->sy, interlace, 0, transparent, BitsPerPixel,
|
||||
tim->red, tim->green, tim->blue, tim);
|
||||
if (pim) {
|
||||
/* Destroy palette based temporary image. */
|
||||
gdImageDestroy( pim);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
colorstobpp(int colors)
|
||||
{
|
||||
int bpp = 0;
|
||||
|
||||
if ( colors <= 2 )
|
||||
bpp = 1;
|
||||
else if ( colors <= 4 )
|
||||
bpp = 2;
|
||||
else if ( colors <= 8 )
|
||||
bpp = 3;
|
||||
else if ( colors <= 16 )
|
||||
bpp = 4;
|
||||
else if ( colors <= 32 )
|
||||
bpp = 5;
|
||||
else if ( colors <= 64 )
|
||||
bpp = 6;
|
||||
else if ( colors <= 128 )
|
||||
bpp = 7;
|
||||
else if ( colors <= 256 )
|
||||
bpp = 8;
|
||||
return bpp;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* GIFENCODE.C - GIF Image compression interface
|
||||
*
|
||||
* GIFEncode( FName, GHeight, GWidth, GInterlace, Background, Transparent,
|
||||
* BitsPerPixel, Red, Green, Blue, gdImagePtr )
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
/*
|
||||
* Bump the 'curx' and 'cury' to point to the next pixel
|
||||
*/
|
||||
static void
|
||||
BumpPixel(GifCtx *ctx)
|
||||
{
|
||||
/*
|
||||
* Bump the current X position
|
||||
*/
|
||||
++(ctx->curx);
|
||||
|
||||
/*
|
||||
* If we are at the end of a scan line, set curx back to the beginning
|
||||
* If we are interlaced, bump the cury to the appropriate spot,
|
||||
* otherwise, just increment it.
|
||||
*/
|
||||
if( ctx->curx == ctx->Width ) {
|
||||
ctx->curx = 0;
|
||||
|
||||
if( !ctx->Interlace )
|
||||
++(ctx->cury);
|
||||
else {
|
||||
switch( ctx->Pass ) {
|
||||
|
||||
case 0:
|
||||
ctx->cury += 8;
|
||||
if( ctx->cury >= ctx->Height ) {
|
||||
++(ctx->Pass);
|
||||
ctx->cury = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ctx->cury += 8;
|
||||
if( ctx->cury >= ctx->Height ) {
|
||||
++(ctx->Pass);
|
||||
ctx->cury = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ctx->cury += 4;
|
||||
if( ctx->cury >= ctx->Height ) {
|
||||
++(ctx->Pass);
|
||||
ctx->cury = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ctx->cury += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the next pixel from the image
|
||||
*/
|
||||
static int
|
||||
GIFNextPixel(gdImagePtr im, GifCtx *ctx)
|
||||
{
|
||||
int r;
|
||||
|
||||
if( ctx->CountDown == 0 )
|
||||
return EOF;
|
||||
|
||||
--(ctx->CountDown);
|
||||
|
||||
r = gdImageGetPixel(im, ctx->curx, ctx->cury);
|
||||
|
||||
BumpPixel(ctx);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* public */
|
||||
|
||||
static void
|
||||
GIFEncode(gdIOCtxPtr fp, int GWidth, int GHeight, int GInterlace, int Background, int Transparent, int BitsPerPixel, int *Red, int *Green, int *Blue, gdImagePtr im)
|
||||
{
|
||||
int B;
|
||||
int RWidth, RHeight;
|
||||
int LeftOfs, TopOfs;
|
||||
int Resolution;
|
||||
int ColorMapSize;
|
||||
int InitCodeSize;
|
||||
int i;
|
||||
GifCtx ctx;
|
||||
ctx.Interlace = GInterlace;
|
||||
ctx.in_count = 1;
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
ColorMapSize = 1 << BitsPerPixel;
|
||||
|
||||
RWidth = ctx.Width = GWidth;
|
||||
RHeight = ctx.Height = GHeight;
|
||||
LeftOfs = TopOfs = 0;
|
||||
|
||||
Resolution = BitsPerPixel;
|
||||
|
||||
/*
|
||||
* Calculate number of bits we are expecting
|
||||
*/
|
||||
ctx.CountDown = (long)ctx.Width * (long)ctx.Height;
|
||||
|
||||
/*
|
||||
* Indicate which pass we are on (if interlace)
|
||||
*/
|
||||
ctx.Pass = 0;
|
||||
|
||||
/*
|
||||
* The initial code size
|
||||
*/
|
||||
if( BitsPerPixel <= 1 )
|
||||
InitCodeSize = 2;
|
||||
else
|
||||
InitCodeSize = BitsPerPixel;
|
||||
|
||||
/*
|
||||
* Set up the current x and y position
|
||||
*/
|
||||
ctx.curx = ctx.cury = 0;
|
||||
|
||||
/*
|
||||
* Write the Magic header
|
||||
*/
|
||||
gdPutBuf(Transparent < 0 ? "GIF87a" : "GIF89a", 6, fp );
|
||||
|
||||
/*
|
||||
* Write out the screen width and height
|
||||
*/
|
||||
gifPutWord( RWidth, fp );
|
||||
gifPutWord( RHeight, fp );
|
||||
|
||||
/*
|
||||
* Indicate that there is a global colour map
|
||||
*/
|
||||
B = 0x80; /* Yes, there is a color map */
|
||||
|
||||
/*
|
||||
* OR in the resolution
|
||||
*/
|
||||
B |= (Resolution - 1) << 5;
|
||||
|
||||
/*
|
||||
* OR in the Bits per Pixel
|
||||
*/
|
||||
B |= (BitsPerPixel - 1);
|
||||
|
||||
/*
|
||||
* Write it out
|
||||
*/
|
||||
gdPutC( B, fp );
|
||||
|
||||
/*
|
||||
* Write out the Background colour
|
||||
*/
|
||||
gdPutC( Background, fp );
|
||||
|
||||
/*
|
||||
* Byte of 0's (future expansion)
|
||||
*/
|
||||
gdPutC( 0, fp );
|
||||
|
||||
/*
|
||||
* Write out the Global Colour Map
|
||||
*/
|
||||
for( i=0; i<ColorMapSize; ++i ) {
|
||||
gdPutC( Red[i], fp );
|
||||
gdPutC( Green[i], fp );
|
||||
gdPutC( Blue[i], fp );
|
||||
}
|
||||
|
||||
/*
|
||||
* Write out extension for transparent colour index, if necessary.
|
||||
*/
|
||||
if ( Transparent >= 0 ) {
|
||||
gdPutC( '!', fp );
|
||||
gdPutC( 0xf9, fp );
|
||||
gdPutC( 4, fp );
|
||||
gdPutC( 1, fp );
|
||||
gdPutC( 0, fp );
|
||||
gdPutC( 0, fp );
|
||||
gdPutC( (unsigned char) Transparent, fp );
|
||||
gdPutC( 0, fp );
|
||||
}
|
||||
|
||||
/*
|
||||
* Write an Image separator
|
||||
*/
|
||||
gdPutC( ',', fp );
|
||||
|
||||
/*
|
||||
* Write the Image header
|
||||
*/
|
||||
|
||||
gifPutWord( LeftOfs, fp );
|
||||
gifPutWord( TopOfs, fp );
|
||||
gifPutWord( ctx.Width, fp );
|
||||
gifPutWord( ctx.Height, fp );
|
||||
|
||||
/*
|
||||
* Write out whether or not the image is interlaced
|
||||
*/
|
||||
if( ctx.Interlace )
|
||||
gdPutC( 0x40, fp );
|
||||
else
|
||||
gdPutC( 0x00, fp );
|
||||
|
||||
/*
|
||||
* Write out the initial code size
|
||||
*/
|
||||
gdPutC( InitCodeSize, fp );
|
||||
|
||||
/*
|
||||
* Go and actually compress the data
|
||||
*/
|
||||
compress( InitCodeSize+1, fp, im, &ctx );
|
||||
|
||||
/*
|
||||
* Write out a Zero-length packet (to end the series)
|
||||
*/
|
||||
gdPutC( 0, fp );
|
||||
|
||||
/*
|
||||
* Write the GIF file terminator
|
||||
*/
|
||||
gdPutC( ';', fp );
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* GIFCOMPR.C - GIF Image compression routines
|
||||
*
|
||||
* Lempel-Ziv compression based on 'compress'. GIF modifications by
|
||||
* David Rowley (mgardi@watdcsu.waterloo.edu)
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* General DEFINEs
|
||||
*/
|
||||
|
||||
#define GIFBITS 12
|
||||
|
||||
#ifdef NO_UCHAR
|
||||
typedef char char_type;
|
||||
#else /*NO_UCHAR*/
|
||||
typedef unsigned char char_type;
|
||||
#endif /*NO_UCHAR*/
|
||||
|
||||
/*
|
||||
*
|
||||
* GIF Image compression - modified 'compress'
|
||||
*
|
||||
* Based on: compress.c - File compression ala IEEE Computer, June 1984.
|
||||
*
|
||||
* By Authors: Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
|
||||
* Jim McKie (decvax!mcvax!jim)
|
||||
* Steve Davies (decvax!vax135!petsd!peora!srd)
|
||||
* Ken Turkowski (decvax!decwrl!turtlevax!ken)
|
||||
* James A. Woods (decvax!ihnp4!ames!jaw)
|
||||
* Joe Orost (decvax!vax135!petsd!joe)
|
||||
*
|
||||
*/
|
||||
#include <ctype.h>
|
||||
|
||||
#define ARGVAL() (*++(*argv) || (--argc && *++argv))
|
||||
|
||||
#ifdef COMPATIBLE /* But wrong! */
|
||||
# define MAXCODE(n_bits) ((code_int) 1 << (n_bits) - 1)
|
||||
#else /*COMPATIBLE*/
|
||||
# define MAXCODE(n_bits) (((code_int) 1 << (n_bits)) - 1)
|
||||
#endif /*COMPATIBLE*/
|
||||
|
||||
#define HashTabOf(i) ctx->htab[i]
|
||||
#define CodeTabOf(i) ctx->codetab[i]
|
||||
|
||||
|
||||
/*
|
||||
* To save much memory, we overlay the table used by compress() with those
|
||||
* used by decompress(). The tab_prefix table is the same size and type
|
||||
* as the codetab. The tab_suffix table needs 2**GIFBITS characters. We
|
||||
* get this from the beginning of htab. The output stack uses the rest
|
||||
* of htab, and contains characters. There is plenty of room for any
|
||||
* possible stack (stack used to be 8000 characters).
|
||||
*/
|
||||
|
||||
#define tab_prefixof(i) CodeTabOf(i)
|
||||
#define tab_suffixof(i) ((char_type*)(htab))[i]
|
||||
#define de_stack ((char_type*)&tab_suffixof((code_int)1<<GIFBITS))
|
||||
|
||||
/*
|
||||
* compress stdin to stdout
|
||||
*
|
||||
* Algorithm: use open addressing double hashing (no chaining) on the
|
||||
* prefix code / next character combination. We do a variant of Knuth's
|
||||
* algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
|
||||
* secondary probe. Here, the modular division first probe is gives way
|
||||
* to a faster exclusive-or manipulation. Also do block compression with
|
||||
* an adaptive reset, whereby the code table is cleared when the compression
|
||||
* ratio decreases, but after the table fills. The variable-length output
|
||||
* codes are re-sized at this point, and a special CLEAR code is generated
|
||||
* for the decompressor. Late addition: construct the table according to
|
||||
* file size for noticeable speed improvement on small files. Please direct
|
||||
* questions about this implementation to ames!jaw.
|
||||
*/
|
||||
|
||||
static void
|
||||
output(code_int code, GifCtx *ctx);
|
||||
|
||||
static void
|
||||
compress(int init_bits, gdIOCtxPtr outfile, gdImagePtr im, GifCtx *ctx)
|
||||
{
|
||||
register long fcode;
|
||||
register code_int i /* = 0 */;
|
||||
register int c;
|
||||
register code_int ent;
|
||||
register code_int disp;
|
||||
register code_int hsize_reg;
|
||||
register int hshift;
|
||||
|
||||
/*
|
||||
* Set up the globals: g_init_bits - initial number of bits
|
||||
* g_outfile - pointer to output file
|
||||
*/
|
||||
ctx->g_init_bits = init_bits;
|
||||
ctx->g_outfile = outfile;
|
||||
|
||||
/*
|
||||
* Set up the necessary values
|
||||
*/
|
||||
ctx->offset = 0;
|
||||
ctx->out_count = 0;
|
||||
ctx->clear_flg = 0;
|
||||
ctx->in_count = 1;
|
||||
ctx->maxcode = MAXCODE(ctx->n_bits = ctx->g_init_bits);
|
||||
|
||||
ctx->ClearCode = (1 << (init_bits - 1));
|
||||
ctx->EOFCode = ctx->ClearCode + 1;
|
||||
ctx->free_ent = ctx->ClearCode + 2;
|
||||
|
||||
char_init(ctx);
|
||||
|
||||
ent = GIFNextPixel( im, ctx );
|
||||
|
||||
hshift = 0;
|
||||
for ( fcode = (long) hsize; fcode < 65536L; fcode *= 2L )
|
||||
++hshift;
|
||||
hshift = 8 - hshift; /* set hash code range bound */
|
||||
|
||||
hsize_reg = hsize;
|
||||
cl_hash( (count_int) hsize_reg, ctx ); /* clear hash table */
|
||||
|
||||
output( (code_int)ctx->ClearCode, ctx );
|
||||
|
||||
#ifdef SIGNED_COMPARE_SLOW
|
||||
while ( (c = GIFNextPixel( im )) != (unsigned) EOF ) {
|
||||
#else /*SIGNED_COMPARE_SLOW*/
|
||||
while ( (c = GIFNextPixel( im, ctx )) != EOF ) { /* } */
|
||||
#endif /*SIGNED_COMPARE_SLOW*/
|
||||
|
||||
++(ctx->in_count);
|
||||
|
||||
fcode = (long) (((long) c << maxbits) + ent);
|
||||
i = (((code_int)c << hshift) ^ ent); /* xor hashing */
|
||||
|
||||
if ( HashTabOf (i) == fcode ) {
|
||||
ent = CodeTabOf (i);
|
||||
continue;
|
||||
} else if ( (long)HashTabOf (i) < 0 ) /* empty slot */
|
||||
goto nomatch;
|
||||
disp = hsize_reg - i; /* secondary hash (after G. Knott) */
|
||||
if ( i == 0 )
|
||||
disp = 1;
|
||||
probe:
|
||||
if ( (i -= disp) < 0 )
|
||||
i += hsize_reg;
|
||||
|
||||
if ( HashTabOf (i) == fcode ) {
|
||||
ent = CodeTabOf (i);
|
||||
continue;
|
||||
}
|
||||
if ( (long)HashTabOf (i) > 0 )
|
||||
goto probe;
|
||||
nomatch:
|
||||
output ( (code_int) ent, ctx );
|
||||
++(ctx->out_count);
|
||||
ent = c;
|
||||
#ifdef SIGNED_COMPARE_SLOW
|
||||
if ( (unsigned) ctx->free_ent < (unsigned) maxmaxcode) {
|
||||
#else /*SIGNED_COMPARE_SLOW*/
|
||||
if ( ctx->free_ent < maxmaxcode ) { /* } */
|
||||
#endif /*SIGNED_COMPARE_SLOW*/
|
||||
CodeTabOf (i) = ctx->free_ent++; /* code -> hashtable */
|
||||
HashTabOf (i) = fcode;
|
||||
} else
|
||||
cl_block(ctx);
|
||||
}
|
||||
/*
|
||||
* Put out the final code.
|
||||
*/
|
||||
output( (code_int)ent, ctx );
|
||||
++(ctx->out_count);
|
||||
output( (code_int) ctx->EOFCode, ctx );
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* TAG( output )
|
||||
*
|
||||
* Output the given code.
|
||||
* Inputs:
|
||||
* code: A n_bits-bit integer. If == -1, then EOF. This assumes
|
||||
* that n_bits =< (long)wordsize - 1.
|
||||
* Outputs:
|
||||
* Outputs code to the file.
|
||||
* Assumptions:
|
||||
* Chars are 8 bits long.
|
||||
* Algorithm:
|
||||
* Maintain a GIFBITS character long buffer (so that 8 codes will
|
||||
* fit in it exactly). Use the VAX insv instruction to insert each
|
||||
* code in turn. When the buffer fills up empty it and start over.
|
||||
*/
|
||||
|
||||
static unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F,
|
||||
0x001F, 0x003F, 0x007F, 0x00FF,
|
||||
0x01FF, 0x03FF, 0x07FF, 0x0FFF,
|
||||
0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
|
||||
|
||||
static void
|
||||
output(code_int code, GifCtx *ctx)
|
||||
{
|
||||
ctx->cur_accum &= masks[ ctx->cur_bits ];
|
||||
|
||||
if( ctx->cur_bits > 0 )
|
||||
ctx->cur_accum |= ((long)code << ctx->cur_bits);
|
||||
else
|
||||
ctx->cur_accum = code;
|
||||
|
||||
ctx->cur_bits += ctx->n_bits;
|
||||
|
||||
while( ctx->cur_bits >= 8 ) {
|
||||
char_out( (unsigned int)(ctx->cur_accum & 0xff), ctx );
|
||||
ctx->cur_accum >>= 8;
|
||||
ctx->cur_bits -= 8;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the next entry is going to be too big for the code size,
|
||||
* then increase it, if possible.
|
||||
*/
|
||||
if ( ctx->free_ent > ctx->maxcode || ctx->clear_flg ) {
|
||||
|
||||
if( ctx->clear_flg ) {
|
||||
|
||||
ctx->maxcode = MAXCODE (ctx->n_bits = ctx->g_init_bits);
|
||||
ctx->clear_flg = 0;
|
||||
|
||||
} else {
|
||||
|
||||
++(ctx->n_bits);
|
||||
if ( ctx->n_bits == maxbits )
|
||||
ctx->maxcode = maxmaxcode;
|
||||
else
|
||||
ctx->maxcode = MAXCODE(ctx->n_bits);
|
||||
}
|
||||
}
|
||||
|
||||
if( code == ctx->EOFCode ) {
|
||||
/*
|
||||
* At EOF, write the rest of the buffer.
|
||||
*/
|
||||
while( ctx->cur_bits > 0 ) {
|
||||
char_out( (unsigned int)(ctx->cur_accum & 0xff), ctx);
|
||||
ctx->cur_accum >>= 8;
|
||||
ctx->cur_bits -= 8;
|
||||
}
|
||||
|
||||
flush_char(ctx);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear out the hash table
|
||||
*/
|
||||
static void
|
||||
cl_block (GifCtx *ctx) /* table clear for block compress */
|
||||
{
|
||||
|
||||
cl_hash ( (count_int) hsize, ctx );
|
||||
ctx->free_ent = ctx->ClearCode + 2;
|
||||
ctx->clear_flg = 1;
|
||||
|
||||
output( (code_int)ctx->ClearCode, ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
cl_hash(register count_int chsize, GifCtx *ctx) /* reset code table */
|
||||
|
||||
{
|
||||
|
||||
register count_int *htab_p = ctx->htab+chsize;
|
||||
|
||||
register long i;
|
||||
register long m1 = -1;
|
||||
|
||||
i = chsize - 16;
|
||||
do { /* might use Sys V memset(3) here */
|
||||
*(htab_p-16) = m1;
|
||||
*(htab_p-15) = m1;
|
||||
*(htab_p-14) = m1;
|
||||
*(htab_p-13) = m1;
|
||||
*(htab_p-12) = m1;
|
||||
*(htab_p-11) = m1;
|
||||
*(htab_p-10) = m1;
|
||||
*(htab_p-9) = m1;
|
||||
*(htab_p-8) = m1;
|
||||
*(htab_p-7) = m1;
|
||||
*(htab_p-6) = m1;
|
||||
*(htab_p-5) = m1;
|
||||
*(htab_p-4) = m1;
|
||||
*(htab_p-3) = m1;
|
||||
*(htab_p-2) = m1;
|
||||
*(htab_p-1) = m1;
|
||||
htab_p -= 16;
|
||||
} while ((i -= 16) >= 0);
|
||||
|
||||
for ( i += 16; i > 0; --i )
|
||||
*--htab_p = m1;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* GIF Specific routines
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Set up the 'byte output' routine
|
||||
*/
|
||||
static void
|
||||
char_init(GifCtx *ctx)
|
||||
{
|
||||
ctx->a_count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a character to the end of the current packet, and if it is 254
|
||||
* characters, flush the packet to disk.
|
||||
*/
|
||||
static void
|
||||
char_out(int c, GifCtx *ctx)
|
||||
{
|
||||
ctx->accum[ ctx->a_count++ ] = c;
|
||||
if( ctx->a_count >= 254 )
|
||||
flush_char(ctx);
|
||||
}
|
||||
|
||||
/*
|
||||
* Flush the packet to disk, and reset the accumulator
|
||||
*/
|
||||
static void
|
||||
flush_char(GifCtx *ctx)
|
||||
{
|
||||
if( ctx->a_count > 0 ) {
|
||||
gdPutC( ctx->a_count, ctx->g_outfile );
|
||||
gdPutBuf( ctx->accum, ctx->a_count, ctx->g_outfile );
|
||||
ctx->a_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int gifPutWord(int w, gdIOCtx *out)
|
||||
{
|
||||
/* Byte order is little-endian */
|
||||
gdPutC(w & 0xFF, out);
|
||||
gdPutC((w >> 8) & 0xFF, out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+6
-24
@@ -33,7 +33,6 @@ typedef struct dpStruct
|
||||
int realSize;
|
||||
int dataGood;
|
||||
int pos;
|
||||
int freeOK;
|
||||
}
|
||||
dynamicPtr;
|
||||
|
||||
@@ -53,7 +52,7 @@ static int appendDynamic (dynamicPtr * dp, const void *src, int size);
|
||||
static int gdReallocDynamic (dynamicPtr * dp, int required);
|
||||
static int trimDynamic (dynamicPtr * dp);
|
||||
static void gdFreeDynamicCtx (struct gdIOCtx *ctx);
|
||||
static dynamicPtr *newDynamic (int initialSize, void *data, int freeOKFlag);
|
||||
static dynamicPtr *newDynamic (int initialSize, void *data);
|
||||
|
||||
static int dynamicPutbuf (struct gdIOCtx *, const void *, int);
|
||||
static void dynamicPutchar (struct gdIOCtx *, int a);
|
||||
@@ -67,11 +66,6 @@ static long dynamicTell (struct gdIOCtx *);
|
||||
/* return data as a dynamic pointer */
|
||||
gdIOCtx *
|
||||
gdNewDynamicCtx (int initialSize, void *data)
|
||||
{
|
||||
return gdNewDynamicCtxEx(initialSize, data, 1);
|
||||
}
|
||||
|
||||
gdIOCtx * gdNewDynamicCtxEx (int initialSize, void *data, int freeOKFlag)
|
||||
{
|
||||
dpIOCtx *ctx;
|
||||
dynamicPtr *dp;
|
||||
@@ -82,7 +76,7 @@ gdIOCtx * gdNewDynamicCtxEx (int initialSize, void *data, int freeOKFlag)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dp = newDynamic (initialSize, data, freeOKFlag);
|
||||
dp = newDynamic (initialSize, data);
|
||||
if (!dp)
|
||||
{
|
||||
gdFree (ctx);
|
||||
@@ -126,7 +120,7 @@ gdDPExtractData (struct gdIOCtx *ctx, int *size)
|
||||
{
|
||||
*size = 0;
|
||||
data = NULL;
|
||||
if (dp->data != NULL && dp->freeOK)
|
||||
if (dp->data != NULL)
|
||||
{
|
||||
gdFree (dp->data);
|
||||
}
|
||||
@@ -183,10 +177,6 @@ dynamicSeek (struct gdIOCtx *ctx, const int pos)
|
||||
bytesNeeded = pos;
|
||||
if (bytesNeeded > dp->realSize)
|
||||
{
|
||||
/* 2.0.21 */
|
||||
if (!dp->freeOK) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!gdReallocDynamic (dp, dp->realSize * 2))
|
||||
{
|
||||
dp->dataGood = FALSE;
|
||||
@@ -209,7 +199,8 @@ dynamicSeek (struct gdIOCtx *ctx, const int pos)
|
||||
}
|
||||
|
||||
/* return data as a dynamic pointer */
|
||||
static dynamicPtr * newDynamic (int initialSize, void *data, int freeOKFlag)
|
||||
static dynamicPtr *
|
||||
newDynamic (int initialSize, void *data)
|
||||
{
|
||||
dynamicPtr *dp;
|
||||
dp = (dynamicPtr *) gdMalloc (sizeof (dynamicPtr));
|
||||
@@ -222,7 +213,6 @@ static dynamicPtr * newDynamic (int initialSize, void *data, int freeOKFlag)
|
||||
return NULL;
|
||||
|
||||
dp->pos = 0;
|
||||
dp->freeOK = freeOKFlag;
|
||||
|
||||
return dp;
|
||||
}
|
||||
@@ -358,10 +348,6 @@ appendDynamic (dynamicPtr * dp, const void *src, int size)
|
||||
|
||||
if (bytesNeeded > dp->realSize)
|
||||
{
|
||||
/* 2.0.21 */
|
||||
if (!dp->freeOK) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!gdReallocDynamic (dp, bytesNeeded * 2))
|
||||
{
|
||||
dp->dataGood = FALSE;
|
||||
@@ -421,9 +407,5 @@ gdReallocDynamic (dynamicPtr * dp, int required)
|
||||
static int
|
||||
trimDynamic (dynamicPtr * dp)
|
||||
{
|
||||
/* 2.0.21: we don't reallocate memory we don't own */
|
||||
if (!dp->freeOK) {
|
||||
return FALSE;
|
||||
}
|
||||
return gdReallocDynamic (dp, dp->logicalSize);
|
||||
return gdReallocDynamic (dp, dp->logicalSize);
|
||||
}
|
||||
+17
-87
@@ -221,20 +221,8 @@ gdImagePtr gdImageCreateFromJpeg (FILE * inFile)
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromJpegPtr (int size, void *data)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromJpegCtx(in);
|
||||
in->gd_free(in);
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile);
|
||||
|
||||
static int CMYKToRGB(int c, int m, int y, int k, int inverted);
|
||||
|
||||
/*
|
||||
* Create a gd-format image from the JPEG-format INFILE. Returns the
|
||||
* image, or NULL upon error.
|
||||
@@ -251,8 +239,6 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
unsigned int i, j;
|
||||
int retval;
|
||||
JDIMENSION nrows;
|
||||
int channels = 3;
|
||||
int inverted = 0;
|
||||
|
||||
memset (&cinfo, 0, sizeof (cinfo));
|
||||
memset (&jerr, 0, sizeof (jerr));
|
||||
@@ -276,9 +262,6 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
|
||||
jpeg_gdIOCtx_src (&cinfo, infile);
|
||||
|
||||
/* 2.0.22: save the APP14 marker to check for Adobe Photoshop CMYK files with inverted components. */
|
||||
jpeg_save_markers(&cinfo, JPEG_APP0 + 14, 256);
|
||||
|
||||
retval = jpeg_read_header (&cinfo, TRUE);
|
||||
if (retval != JPEG_HEADER_OK) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: warning: jpeg_read_header returned %d, expected %d", retval, JPEG_HEADER_OK);
|
||||
@@ -298,14 +281,8 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* 2.0.22: very basic support for reading CMYK colorspace files. Nice for
|
||||
* thumbnails but there's no support for fussy adjustment of the
|
||||
* assumed properties of inks and paper. */
|
||||
if ((cinfo.jpeg_color_space == JCS_CMYK) || (cinfo.jpeg_color_space == JCS_YCCK)) {
|
||||
cinfo.out_color_space = JCS_CMYK;
|
||||
} else {
|
||||
cinfo.out_color_space = JCS_RGB;
|
||||
}
|
||||
/* Force the image into RGB colorspace, but don't reduce the number of colors anymore (GD 2.0) */
|
||||
cinfo.out_color_space = JCS_RGB;
|
||||
|
||||
if (jpeg_start_decompress (&cinfo) != TRUE) {
|
||||
php_gd_error("gd-jpeg: warning: jpeg_start_decompress reports suspended data source");
|
||||
@@ -324,29 +301,8 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
gdImageInterlace (im, cinfo.progressive_mode != 0);
|
||||
#endif
|
||||
|
||||
if (cinfo.out_color_space == JCS_RGB) {
|
||||
if (cinfo.output_components != 3) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: JPEG color quantization request resulted in output_components == %d (expected 3 for RGB)", cinfo.output_components);
|
||||
goto error;
|
||||
}
|
||||
channels = 3;
|
||||
} else if (cinfo.out_color_space == JCS_CMYK) {
|
||||
jpeg_saved_marker_ptr marker;
|
||||
if (cinfo.output_components != 4) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: JPEG color quantization request resulted in output_components == %d (expected 4 for CMYK)", cinfo.output_components);
|
||||
goto error;
|
||||
}
|
||||
channels = 4;
|
||||
marker = cinfo.marker_list;
|
||||
while (marker) {
|
||||
if ((marker->marker == (JPEG_APP0 + 14)) && (marker->data_length >= 12) && (!strncmp((const char *) marker->data, "Adobe", 5))) {
|
||||
inverted = 1;
|
||||
break;
|
||||
}
|
||||
marker = marker->next;
|
||||
}
|
||||
} else {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: unexpected colorspace.");
|
||||
if (cinfo.output_components != 3) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: JPEG color quantization request resulted in output_components == %d (expected 3)", cinfo.output_components);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -355,37 +311,22 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
goto error;
|
||||
#endif /* BITS_IN_JSAMPLE == 12 */
|
||||
|
||||
row = safe_emalloc(cinfo.output_width * channels, sizeof(JSAMPLE), 0);
|
||||
memset(row, 0, cinfo.output_width * channels * sizeof(JSAMPLE));
|
||||
row = safe_emalloc(cinfo.output_width * 3, sizeof(JSAMPLE), 0);
|
||||
memset(row, 0, cinfo.output_width * 3 * sizeof(JSAMPLE));
|
||||
rowptr[0] = row;
|
||||
|
||||
if (cinfo.out_color_space == JCS_CMYK) {
|
||||
for (i = 0; i < cinfo.output_height; i++) {
|
||||
register JSAMPROW currow = row;
|
||||
register int *tpix = im->tpixels[i];
|
||||
nrows = jpeg_read_scanlines (&cinfo, rowptr, 1);
|
||||
if (nrows != 1) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: jpeg_read_scanlines returns %u, expected 1", nrows);
|
||||
goto error;
|
||||
}
|
||||
for (j = 0; j < cinfo.output_width; j++, currow += 4, tpix++) {
|
||||
*tpix = CMYKToRGB (currow[0], currow[1], currow[2], currow[3], inverted);
|
||||
}
|
||||
for (i = 0; i < cinfo.output_height; i++) {
|
||||
register JSAMPROW currow = row;
|
||||
register int *tpix = im->tpixels[i];
|
||||
nrows = jpeg_read_scanlines (&cinfo, rowptr, 1);
|
||||
if (nrows != 1) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: jpeg_read_scanlines returns %u, expected 1", nrows);
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < cinfo.output_height; i++) {
|
||||
register JSAMPROW currow = row;
|
||||
register int *tpix = im->tpixels[i];
|
||||
nrows = jpeg_read_scanlines (&cinfo, rowptr, 1);
|
||||
if (nrows != 1) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: jpeg_read_scanlines returns %u, expected 1", nrows);
|
||||
goto error;
|
||||
}
|
||||
for (j = 0; j < cinfo.output_width; j++, currow += 3, tpix++) {
|
||||
*tpix = gdTrueColor (currow[0], currow[1], currow[2]);
|
||||
}
|
||||
for (j = 0; j < cinfo.output_width; j++, currow += 3, tpix++) {
|
||||
*tpix = gdTrueColor (currow[0], currow[1], currow[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (jpeg_finish_decompress (&cinfo) != TRUE) {
|
||||
php_gd_error("gd-jpeg: warning: jpeg_finish_decompress reports suspended data source");
|
||||
@@ -412,19 +353,8 @@ error:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* A very basic conversion approach, TBB */
|
||||
static int CMYKToRGB(int c, int m, int y, int k, int inverted)
|
||||
{
|
||||
if (inverted) {
|
||||
c = 255 - c;
|
||||
m = 255 - m;
|
||||
y = 255 - y;
|
||||
k = 255 - k;
|
||||
}
|
||||
return gdTrueColor((255 - c) * (255 - k) / 255, (255 - m) * (255 - k) / 255, (255 - y) * (255 - k) / 255);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
* gdIOCtx JPEG data sources and sinks, T. Boutell
|
||||
* almost a simple global replace from T. Lane's stdio versions.
|
||||
*
|
||||
|
||||
@@ -93,14 +93,6 @@ gdImagePtr gdImageCreateFromPng (FILE * inFile)
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromPngPtr (int size, void *data)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromPngCtx(in);
|
||||
in->gd_free(in);
|
||||
return im;
|
||||
}
|
||||
|
||||
/* This routine is based in part on the Chapter 13 demo code in "PNG: The
|
||||
* Definitive Guide" (http://www.cdrom.com/pub/png/pngbook.html).
|
||||
|
||||
+1110
-1306
File diff suppressed because it is too large.
Load diff
@@ -192,15 +192,6 @@ gdImageCreateFromWBMP (FILE * inFile)
|
||||
return (im);
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromWBMPPtr (int size, void *data)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromWBMPCtx(in);
|
||||
in->gd_free(in);
|
||||
return im;
|
||||
}
|
||||
|
||||
/* gdImageWBMP
|
||||
** -----------
|
||||
*/
|
||||
|
||||
@@ -4381,9 +4381,4 @@ gdFont gdFontGiantRep =
|
||||
|
||||
gdFontPtr gdFontGiant = &gdFontGiantRep;
|
||||
|
||||
gdFontPtr gdFontGetGiant(void)
|
||||
{
|
||||
return gdFontGiant;
|
||||
}
|
||||
|
||||
/* This file has not been truncated. */
|
||||
@@ -20,7 +20,6 @@ extern "C" {
|
||||
#include "gd.h"
|
||||
|
||||
extern gdFontPtr gdFontGiant;
|
||||
extern gdFontPtr gdFontGetGiant(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -4638,9 +4638,4 @@ gdFont gdFontLargeRep =
|
||||
|
||||
gdFontPtr gdFontLarge = &gdFontLargeRep;
|
||||
|
||||
gdFontPtr gdFontGetLarge(void)
|
||||
{
|
||||
return gdFontLarge;
|
||||
}
|
||||
|
||||
/* This file has not been truncated. */
|
||||
@@ -21,7 +21,6 @@ extern "C" {
|
||||
#include "gd.h"
|
||||
|
||||
extern gdFontPtr gdFontLarge;
|
||||
extern gdFontPtr gdFontGetLarge(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -3868,9 +3868,4 @@ gdFont gdFontMediumBoldRep =
|
||||
|
||||
gdFontPtr gdFontMediumBold = &gdFontMediumBoldRep;
|
||||
|
||||
gdFontPtr gdFontGetMediumBold(void)
|
||||
{
|
||||
return gdFontMediumBold;
|
||||
}
|
||||
|
||||
/* This file has not been truncated. */
|
||||
@@ -19,7 +19,6 @@ extern "C" {
|
||||
#include "gd.h"
|
||||
|
||||
extern gdFontPtr gdFontMediumBold;
|
||||
extern gdFontPtr gdFontGetMediumBold(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -3868,9 +3868,4 @@ gdFont gdFontSmallRep =
|
||||
|
||||
gdFontPtr gdFontSmall = &gdFontSmallRep;
|
||||
|
||||
gdFontPtr gdFontGetSmall(void)
|
||||
{
|
||||
return gdFontSmall;
|
||||
}
|
||||
|
||||
/* This file has not been truncated. */
|
||||
@@ -19,7 +19,6 @@ extern "C" {
|
||||
#include "gd.h"
|
||||
|
||||
extern gdFontPtr gdFontSmall;
|
||||
extern gdFontPtr gdFontGetSmall(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -2589,9 +2589,4 @@ gdFont gdFontTinyRep =
|
||||
|
||||
gdFontPtr gdFontTiny = &gdFontTinyRep;
|
||||
|
||||
gdFontPtr gdFontGetTiny(void)
|
||||
{
|
||||
return gdFontTiny;
|
||||
}
|
||||
|
||||
/* This file has not been truncated. */
|
||||
@@ -20,7 +20,6 @@ extern "C" {
|
||||
#include "gd.h"
|
||||
|
||||
extern gdFontPtr gdFontTiny;
|
||||
extern gdFontPtr gdFontGetTiny(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+7
-26
@@ -79,9 +79,9 @@ gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
|
||||
|
||||
/*
|
||||
* The character (space) used to separate alternate fonts in the
|
||||
* fontlist parameter to gdImageStringFT. 2.0.18: space was a oor choice for this.
|
||||
* fontlist parameter to gdImageStringFT.
|
||||
*/
|
||||
#define LISTSEPARATOR ";"
|
||||
#define LISTSEPARATOR " "
|
||||
|
||||
/*
|
||||
* DEFAULT_FONTPATH and PATHSEPARATOR are host type dependent and
|
||||
@@ -473,7 +473,7 @@ static void *fontFetch (char **error, void *key)
|
||||
encoding = charmap->encoding_id;
|
||||
|
||||
/* EAM DEBUG - Newer versions of libfree2 make it easier by defining encodings */
|
||||
#if (defined(FREETYPE_MAJOR) && ((FREETYPE_MAJOR == 2 && ((FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 3) || FREETYPE_MINOR > 1) || FREETYPE_MAJOR > 2)))
|
||||
#ifdef FT_ENCODING_MS_SYMBOL
|
||||
if (charmap->encoding == FT_ENCODING_MS_SYMBOL
|
||||
|| charmap->encoding == FT_ENCODING_ADOBE_CUSTOM
|
||||
|| charmap->encoding == FT_ENCODING_ADOBE_STANDARD) {
|
||||
@@ -482,7 +482,7 @@ static void *fontFetch (char **error, void *key)
|
||||
a->face->charmap = charmap;
|
||||
return (void *)a;
|
||||
}
|
||||
#endif /* Freetype 2.1.3 or better */
|
||||
#endif /* FT_ENCODING_MS_SYMBOL */
|
||||
/* EAM DEBUG */
|
||||
|
||||
if ((platform == 3 && encoding == 1) /* Windows Unicode */
|
||||
@@ -777,11 +777,6 @@ void gdFontCacheShutdown()
|
||||
FT_Done_FreeType(library);
|
||||
}
|
||||
}
|
||||
|
||||
void gdFreeFontCache()
|
||||
{
|
||||
gdFontCacheShutdown();
|
||||
}
|
||||
|
||||
int gdFontCacheSetup(void)
|
||||
{
|
||||
@@ -843,8 +838,6 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
* colorindexes. -- 27.06.2001 <krisku@arrak.fi>
|
||||
*/
|
||||
gdCache_head_t *tc_cache;
|
||||
/* Tuneable horizontal and vertical resolution in dots per inch */
|
||||
int hdpi, vdpi;
|
||||
|
||||
if (strex && ((strex->flags & gdFTEX_LINESPACE) == gdFTEX_LINESPACE)) {
|
||||
linespace = strex->linespacing;
|
||||
@@ -874,19 +867,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
face = font->face; /* shortcut */
|
||||
slot = face->glyph; /* shortcut */
|
||||
|
||||
/*
|
||||
* Added hdpi and vdpi to support images at non-screen resolutions, i.e. 300 dpi TIFF,
|
||||
* or 100h x 50v dpi FAX format. 2.0.23.
|
||||
* 2004/02/27 Mark Shackelford, mark.shackelford@acs-inc.com
|
||||
*/
|
||||
hdpi = GD_RESOLUTION;
|
||||
vdpi = GD_RESOLUTION;
|
||||
if (strex && (strex->flags & gdFTEX_RESOLUTION)) {
|
||||
hdpi = strex->hdpi;
|
||||
vdpi = strex->vdpi;
|
||||
}
|
||||
|
||||
if (FT_Set_Char_Size(face, 0, (FT_F26Dot6) (ptsize * 64), hdpi, vdpi)) {
|
||||
if (FT_Set_Char_Size (face, 0, (FT_F26Dot6) (ptsize * 64), GD_RESOLUTION, GD_RESOLUTION)) {
|
||||
gdCacheDelete(tc_cache);
|
||||
gdMutexUnlock(gdFontCacheMutex);
|
||||
return "Could not set character size";
|
||||
@@ -984,7 +965,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
}
|
||||
|
||||
/* EAM DEBUG */
|
||||
#if (defined(FREETYPE_MAJOR) && ((FREETYPE_MAJOR == 2 && ((FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 3) || FREETYPE_MINOR > 1) || FREETYPE_MAJOR > 2)))
|
||||
#ifdef FT_ENCODING_MS_SYMBOL
|
||||
if (font->face->charmap->encoding == FT_ENCODING_MS_SYMBOL) {
|
||||
/* I do not know the significance of the constant 0xf000.
|
||||
* It was determined by inspection of the character codes
|
||||
@@ -994,7 +975,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
ch |= 0xf000;
|
||||
next += len;
|
||||
} else
|
||||
#endif /* Freetype 2.1 or better */
|
||||
#endif /* FT_ENCODING_MS_SYMBOL */
|
||||
/* EAM DEBUG */
|
||||
|
||||
switch (m) {
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
--TEST--
|
||||
Bug #24594 (Filling an area using tiles).
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) {
|
||||
die("skip gd extension not available\n");
|
||||
}
|
||||
if (!GD_BUNDLED) {
|
||||
die('skip external GD libraries may fail');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* $id */
|
||||
/*
|
||||
* This test segfaults with the current imagefilltoborder
|
||||
* implementation. A rewrite of this function is required
|
||||
* to fix it. The algorithm used in gdImageFill (and the
|
||||
* privat function for tiled fill) may help here. pierre.
|
||||
*/
|
||||
$tile = imagecreate(36,36);
|
||||
$base = imagecreate(150,150);
|
||||
$white = imagecolorallocate($tile,255,255,255);
|
||||
$black = imagecolorallocate($tile,0,0,0);
|
||||
$white = imagecolorallocate($base,255,255,255);
|
||||
$black = imagecolorallocate($base,0,0,0);
|
||||
|
||||
/* create the dots pattern */
|
||||
for ($x=0;$x<36;$x+=2) {
|
||||
for ($y=0;$y<36;$y+=2) {
|
||||
imagesetpixel($tile,$x,$y,$black);
|
||||
}
|
||||
}
|
||||
|
||||
imagesettile($base,$tile);
|
||||
imagerectangle($base, 9,9,139,139,$black);
|
||||
imageline($base, 9,9,139,139,$black);
|
||||
imagefill($base,11,12,IMG_COLOR_TILED);
|
||||
|
||||
$res = imagecolorat($base,0,10)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,20)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,30)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,40)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,50)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,60)==$black?'1':'0';
|
||||
|
||||
$res .= imagecolorat($base,11,12)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,12,13)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,13,14)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,14,15)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,15,16)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,16,17)==$white?'1':'0';
|
||||
|
||||
$res .= imagecolorat($base,10,12)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,11,13)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,12,14)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,13,15)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,14,16)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,15,17)==$black?'1':'0';
|
||||
echo "$res\n";
|
||||
|
||||
imagefilledrectangle($base,0,0,149,149,$white);
|
||||
imagerectangle($base, 9,9,139,139,$black);
|
||||
imageline($base, 9,9,139,139,$black);
|
||||
imagefilltoborder($base,0,0,$black,IMG_COLOR_TILED);
|
||||
|
||||
$res = imagecolorat($base,0,10)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,20)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,30)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,40)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,50)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,60)==$black?'1':'0';
|
||||
|
||||
$res .= imagecolorat($base,11,12)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,12,13)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,13,14)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,14,15)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,15,16)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,16,17)==$white?'1':'0';
|
||||
|
||||
$res .= imagecolorat($base,0,16)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,2,42)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,4,44)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,146,146)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,148,146)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,0)==$black?'1':'0';
|
||||
|
||||
echo "$res\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
000000111111101010
|
||||
111111111111111111
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Bug #28147 (Crash with anti-aliased line)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
if (!GD_BUNDLED) die('skip external GD libraries always fail');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
//
|
||||
// This script will generate a Seg Fault on Linux
|
||||
//
|
||||
$im = imagecreatetruecolor(300, 300);
|
||||
$w = imagecolorallocate($im, 255, 255, 255);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
|
||||
imagefilledrectangle($im,0,0,299,299,$w);
|
||||
|
||||
imageantialias($im,true);
|
||||
imageline($im, 299, 299, 0, 299, $red);
|
||||
|
||||
imagedestroy($im);
|
||||
|
||||
echo "Alive\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Alive
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
Bug #28984 (imagefill segfault using a transparent color).
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) {
|
||||
die("skip gd extension not available\n");
|
||||
}
|
||||
if (!GD_BUNDLED) {
|
||||
die('skip external GD libraries may fail');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(100,100);
|
||||
imagealphablending($im, false);
|
||||
#$alpha = imagecolorallocatealpha($im, 255, 0, 255,0);
|
||||
$alpha = imagecolorallocate($im, 255, 0, 0);
|
||||
imagefill($im, 2, 2, $alpha);
|
||||
#imagesavealpha($im, true);
|
||||
imagepng($im, '1.png');
|
||||
imagedestroy($im);
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Done
|
||||
@@ -54,7 +54,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
|
||||
# ADD LINK32 php4ts.lib libintl.lib iconv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
|
||||
# ADD LINK32 php4ts.lib libintl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
|
||||
|
||||
!ELSEIF "$(CFG)" == "gettext - Win32 Debug_TS"
|
||||
|
||||
@@ -81,7 +81,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
|
||||
# ADD LINK32 php4ts_debug.lib libintl.lib iconv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
|
||||
# ADD LINK32 php4ts_debug.lib libintl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
--TEST--
|
||||
Gettext basic test
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("gettext")) {
|
||||
die("skip\n");
|
||||
}
|
||||
if (!setlocale(LC_ALL, 'fi_FI')) {
|
||||
die("skip fi_FI locale not supported.");
|
||||
}
|
||||
?>
|
||||
<?php if (!extension_loaded("gettext")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php // $Id$
|
||||
|
||||
|
||||
+2
-1
@@ -830,7 +830,8 @@ ZEND_FUNCTION(gmp_powm)
|
||||
}
|
||||
FETCH_GMP_ZVAL(gmpnum_mod, mod_arg);
|
||||
|
||||
if (!mpz_cmp_ui(*gmpnum_mod, 0)) {
|
||||
convert_to_long_ex(mod_arg);
|
||||
if (!Z_LVAL_PP(mod_arg)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 php4ts.lib iconv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_iconv.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\iconv\lib"
|
||||
# ADD LINK32 php4ts.lib iconv-1.3.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_iconv.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\iconv\lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "iconv - Win32 Debug_TS"
|
||||
|
||||
@@ -79,7 +79,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 php4ts_debug.lib iconv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_iconv.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\iconv\lib"
|
||||
# ADD LINK32 php4ts_debug.lib iconv-1.3.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_iconv.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\iconv\lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
+44
-41
@@ -112,7 +112,7 @@ function_entry imap_functions[] = {
|
||||
PHP_FE(imap_qprint, NULL)
|
||||
PHP_FE(imap_8bit, NULL)
|
||||
PHP_FE(imap_binary, NULL)
|
||||
PHP_FE(imap_utf8, NULL)
|
||||
PHP_FE(imap_utf8, NULL)
|
||||
PHP_FE(imap_status, NULL)
|
||||
PHP_FE(imap_mailboxmsginfo, NULL)
|
||||
PHP_FE(imap_setflag_full, NULL)
|
||||
@@ -131,7 +131,7 @@ function_entry imap_functions[] = {
|
||||
PHP_FE(imap_utf7_encode, NULL)
|
||||
PHP_FE(imap_mime_header_decode, NULL)
|
||||
PHP_FE(imap_thread, NULL)
|
||||
PHP_FE(imap_timeout, NULL)
|
||||
PHP_FE(imap_timeout, NULL)
|
||||
|
||||
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
|
||||
PHP_FE(imap_get_quota, NULL)
|
||||
@@ -142,12 +142,12 @@ function_entry imap_functions[] = {
|
||||
|
||||
PHP_FE(imap_mail, NULL)
|
||||
|
||||
PHP_FALIAS(imap_header, imap_headerinfo, NULL)
|
||||
PHP_FALIAS(imap_listmailbox, imap_list, NULL)
|
||||
PHP_FALIAS(imap_getmailboxes, imap_list_full, NULL)
|
||||
PHP_FALIAS(imap_scanmailbox, imap_listscan, NULL)
|
||||
PHP_FALIAS(imap_listsubscribed, imap_lsub, NULL)
|
||||
PHP_FALIAS(imap_getsubscribed, imap_lsub_full, NULL)
|
||||
PHP_FALIAS(imap_header, imap_headerinfo, NULL)
|
||||
PHP_FALIAS(imap_listmailbox, imap_list, NULL)
|
||||
PHP_FALIAS(imap_getmailboxes, imap_list_full, NULL)
|
||||
PHP_FALIAS(imap_scanmailbox, imap_listscan, NULL)
|
||||
PHP_FALIAS(imap_listsubscribed, imap_lsub, NULL)
|
||||
PHP_FALIAS(imap_getsubscribed, imap_lsub_full, NULL)
|
||||
PHP_FALIAS(imap_fetchtext, imap_body, NULL)
|
||||
PHP_FALIAS(imap_scan, imap_listscan, NULL)
|
||||
PHP_FALIAS(imap_create, imap_createmailbox, NULL)
|
||||
@@ -181,12 +181,6 @@ ZEND_GET_MODULE(imap)
|
||||
/* True globals, no need for thread safety */
|
||||
static int le_imap;
|
||||
|
||||
#define PHP_IMAP_CHECK_MSGNO(msgindex) \
|
||||
if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number"); \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
|
||||
/* {{{ mail_close_it
|
||||
*/
|
||||
static void mail_close_it(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
@@ -1320,7 +1314,7 @@ PHP_FUNCTION(imap_list_full)
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
delim = safe_emalloc(2, sizeof(char), 0);
|
||||
delim = emalloc(2 * sizeof(char));
|
||||
cur=IMAPG(imap_folder_objects);
|
||||
while (cur != NIL) {
|
||||
MAKE_STD_ZVAL(mboxob);
|
||||
@@ -1491,7 +1485,10 @@ PHP_FUNCTION(imap_headerinfo)
|
||||
convert_to_string_ex(defaulthost);
|
||||
}
|
||||
|
||||
PHP_IMAP_CHECK_MSGNO(Z_LVAL_PP(msgno));
|
||||
if (!Z_LVAL_PP(msgno) || Z_LVAL_PP(msgno) < 1 || (unsigned) Z_LVAL_PP(msgno) > imap_le_struct->imap_stream->nmsgs) {
|
||||
php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (mail_fetchstructure(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL)) {
|
||||
cache = mail_elt(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
|
||||
@@ -1638,7 +1635,6 @@ PHP_FUNCTION(imap_lsub_full)
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
delim = safe_emalloc(2, sizeof(char), 0);
|
||||
cur=IMAPG(imap_sfolder_objects);
|
||||
while (cur != NIL) {
|
||||
MAKE_STD_ZVAL(mboxob);
|
||||
@@ -1740,8 +1736,10 @@ PHP_FUNCTION(imap_fetchstructure)
|
||||
} else {
|
||||
msgindex = Z_LVAL_PP(msgno);
|
||||
}
|
||||
|
||||
PHP_IMAP_CHECK_MSGNO(msgindex);
|
||||
if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
|
||||
php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
mail_fetchstructure_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), &body , myargc == 3 ? Z_LVAL_PP(flags) : NIL);
|
||||
|
||||
@@ -1775,12 +1773,7 @@ PHP_FUNCTION(imap_fetchbody)
|
||||
if (myargc == 4) {
|
||||
convert_to_long_ex(flags);
|
||||
}
|
||||
|
||||
if (myargc < 4 || !(Z_LVAL_PP(flags) & FT_UID)) {
|
||||
/* only perform the check if the msgno is a message number and not a UID */
|
||||
PHP_IMAP_CHECK_MSGNO(Z_LVAL_PP(msgno));
|
||||
}
|
||||
|
||||
|
||||
body = mail_fetchbody_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_STRVAL_PP(sec), &len, myargc==4 ? Z_LVAL_PP(flags) : NIL);
|
||||
|
||||
if (!body) {
|
||||
@@ -2484,7 +2477,10 @@ PHP_FUNCTION(imap_fetchheader)
|
||||
msgindex = Z_LVAL_PP(msgno);
|
||||
}
|
||||
|
||||
PHP_IMAP_CHECK_MSGNO(msgindex);
|
||||
if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
|
||||
php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETVAL_STRING(mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, NIL, (myargc == 3 ? Z_LVAL_PP(flags) : NIL)), 1);
|
||||
}
|
||||
@@ -3194,9 +3190,6 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
bufferLen += strlen(cc) + 6;
|
||||
}
|
||||
|
||||
#define PHP_IMAP_CLEAN if (bufferTo) efree(bufferTo); if (bufferCc) efree(bufferCc); if (bufferBcc) efree(bufferBcc); if (bufferHeader) efree(bufferHeader);
|
||||
#define PHP_IMAP_BAD_DEST PHP_IMAP_CLEAN; efree(tempMailTo); return (BAD_MSG_DESTINATION);
|
||||
|
||||
bufferHeader = (char *)emalloc(bufferLen);
|
||||
memset(bufferHeader, 0, bufferLen);
|
||||
if (to && *to) {
|
||||
@@ -3209,9 +3202,9 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
addr = NULL;
|
||||
rfc822_parse_adrlist(&addr, tempMailTo, NULL);
|
||||
while (addr) {
|
||||
if (strcmp(addr->host, ERRHOST) == 0) {
|
||||
PHP_IMAP_BAD_DEST;
|
||||
} else {
|
||||
if (strcmp(addr->host, ERRHOST) == 0)
|
||||
return (BAD_MSG_DESTINATION);
|
||||
else {
|
||||
offset += sprintf(bufferTo + offset, "%s@%s,", addr->mailbox, addr->host);
|
||||
}
|
||||
addr = addr->next;
|
||||
@@ -3232,9 +3225,9 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
addr = NULL;
|
||||
rfc822_parse_adrlist(&addr, tempMailTo, NULL);
|
||||
while (addr) {
|
||||
if (strcmp(addr->host, ERRHOST) == 0) {
|
||||
PHP_IMAP_BAD_DEST;
|
||||
} else {
|
||||
if (strcmp(addr->host, ERRHOST) == 0)
|
||||
return (BAD_MSG_DESTINATION);
|
||||
else {
|
||||
offset += sprintf(bufferCc + offset, "%s@%s,", addr->mailbox, addr->host);
|
||||
}
|
||||
addr = addr->next;
|
||||
@@ -3252,9 +3245,9 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
addr = NULL;
|
||||
rfc822_parse_adrlist(&addr, tempMailTo, NULL);
|
||||
while (addr) {
|
||||
if (strcmp(addr->host, ERRHOST) == 0) {
|
||||
PHP_IMAP_BAD_DEST;
|
||||
} else {
|
||||
if (strcmp(addr->host, ERRHOST) == 0)
|
||||
return (BAD_MSG_DESTINATION);
|
||||
else {
|
||||
offset += sprintf(bufferBcc + offset, "%s@%s,", addr->mailbox, addr->host);
|
||||
}
|
||||
addr = addr->next;
|
||||
@@ -3276,10 +3269,20 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
} else {
|
||||
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), GetSMErrorText(tsm_err));
|
||||
}
|
||||
PHP_IMAP_CLEAN;
|
||||
return 0;
|
||||
}
|
||||
PHP_IMAP_CLEAN;
|
||||
if (bufferTo) {
|
||||
efree(bufferTo);
|
||||
}
|
||||
if (bufferCc) {
|
||||
efree(bufferCc);
|
||||
}
|
||||
if (bufferBcc) {
|
||||
efree(bufferBcc);
|
||||
}
|
||||
if (bufferHeader) {
|
||||
efree(bufferHeader);
|
||||
}
|
||||
#else
|
||||
if (!INI_STR("sendmail_path")) {
|
||||
return 0;
|
||||
@@ -3686,7 +3689,7 @@ static void _php_imap_parse_address (ADDRESS *addresslist, char **fulladdress, z
|
||||
addresstmp = addresslist;
|
||||
|
||||
if ((len = _php_imap_address_size(addresstmp))) {
|
||||
tmpstr = (char *) malloc(len + 1);
|
||||
tmpstr = (char *) malloc (len);
|
||||
tmpstr[0] = '\0';
|
||||
rfc822_write_address(tmpstr, addresstmp);
|
||||
*fulladdress = tmpstr;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
OVERALL_TARGET += $(srcdir)/ifx.c
|
||||
|
||||
$(srcdir)/ifx.c: $(srcdir)/ifx.ec $(builddir)/libphpifx.a
|
||||
(if test -d $(INFORMIXDIR); then \
|
||||
THREADLIB=POSIX $(INFORMIXDIR)/bin/esql -e $(IFX_ESQL_FLAGS) $(srcdir)/ifx.ec; mv ifx.c $@; \
|
||||
THREADLIB=POSIX $(INFORMIXDIR)/bin/esql -e $(IFX_ESQL_FLAGS) $(srcdir)/ifx.ec; \
|
||||
mv ifx.c $@ || true; \
|
||||
else \
|
||||
touch $@; \
|
||||
fi)
|
||||
|
||||
+45
-125
@@ -37,10 +37,6 @@
|
||||
/* prevent mod_ssl.h's header file from being included. */
|
||||
#define AP_HOOK_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include "php_globals.h"
|
||||
#include "ext/standard/php_standard.h"
|
||||
@@ -54,12 +50,6 @@
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
#define IFX_THRD_ID tsrm_thread_id()
|
||||
#else
|
||||
#define IFX_THRD_ID 0
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
@@ -132,10 +122,8 @@ typedef char IFX[128];
|
||||
#define PHP_IFX_CHECK_CONNECTION(ifx) \
|
||||
{ \
|
||||
if (ifx_check() < 0) { \
|
||||
char *ifx_err = ifx_error(ifx); \
|
||||
IFXG(sv_sqlcode) = SQLCODE; \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails (%s)", ifx, ifx_err); \
|
||||
efree(ifx_err); \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails (%s)", ifx, ifx_error(ifx)); \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
}
|
||||
@@ -295,7 +283,6 @@ EXEC SQL BEGIN DECLARE SECTION;
|
||||
PARAMETER char *link;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
{
|
||||
char *ifx_err = NULL;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
EXEC SQL SET CONNECTION :link;
|
||||
@@ -312,7 +299,7 @@ EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL DISCONNECT :link;
|
||||
if (ifx_check() < 0) {
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s after Automatic Rollback fails (%s)", link, (ifx_err = ifx_error(link)));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s after Automatic Rollback fails (%s)", link, ifx_error(link));
|
||||
}
|
||||
}
|
||||
if (ifx_check() < 0) {
|
||||
@@ -320,23 +307,20 @@ EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL CLOSE DATABASE;
|
||||
if (ifx_check() < 0) {
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Close database fails %s (%s)", link, (ifx_err = ifx_error(link)));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Close database fails %s (%s)", link, ifx_error(link));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (SQLCODE < 0) {
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s fails (%s)", link, (ifx_err = ifx_error(link)));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s fails (%s)", link, ifx_error(link));
|
||||
}
|
||||
}
|
||||
else {
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails (%s)", link, (ifx_err = ifx_error(link)));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails (%s)", link, ifx_error(link));
|
||||
}
|
||||
|
||||
if (ifx_err) {
|
||||
efree(ifx_err);
|
||||
}
|
||||
}
|
||||
|
||||
static void _close_ifx_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
@@ -548,15 +532,13 @@ EXEC SQL END DECLARE SECTION;
|
||||
/* create the link */
|
||||
ifx = (char *) malloc(sizeof(IFX));
|
||||
IFXG(connectionid)++;
|
||||
sprintf(ifx, "%s%x_%x", SAFE_STRING(user), IFX_THRD_ID,IFXG(connectionid));
|
||||
sprintf(ifx, "%s%x", SAFE_STRING(user), IFXG(connectionid));
|
||||
|
||||
EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
|
||||
|
||||
if (ifx_check() == IFX_ERROR) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ifx_error(ifx));
|
||||
free(ifx);
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
@@ -584,11 +566,9 @@ EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
|
||||
|
||||
if (ifx_check() == IFX_ERROR) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link to server lost, unable to reconnect (%s)", ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link to server lost, unable to reconnect (%s)", ifx_error(ifx));
|
||||
zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length + 1);
|
||||
efree(ifx_err);
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -624,12 +604,10 @@ EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
|
||||
|
||||
if (ifx_check() == IFX_ERROR) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect (%s)", ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect (%s)", ifx_error(ifx));
|
||||
zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length + 1);
|
||||
efree(hashed_details);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -651,15 +629,13 @@ EXEC SQL END DECLARE SECTION;
|
||||
|
||||
ifx = (char *) emalloc(sizeof(IFX));
|
||||
IFXG(connectionid)++;
|
||||
sprintf(ifx, "connec%x_%x", IFX_THRD_ID, IFXG(connectionid));
|
||||
sprintf(ifx, "connec%x", IFXG(connectionid));
|
||||
|
||||
EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
|
||||
|
||||
if (ifx_check() == IFX_ERROR) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ifx_error(ifx));
|
||||
efree(hashed_details);
|
||||
efree(ifx);
|
||||
RETURN_FALSE;
|
||||
@@ -824,20 +800,18 @@ EXEC SQL END DECLARE SECTION;
|
||||
statement = Z_STRVAL_PP(query);
|
||||
|
||||
IFXG(cursorid)++;
|
||||
sprintf(statemid, "statem%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(cursorid, "cursor%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(descrpid, "descrp%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(i_descrpid, "i_descrp%x_%x", IFX_THRD_ID,IFXG(cursorid));
|
||||
sprintf(statemid, "statem%x", IFXG(cursorid));
|
||||
sprintf(cursorid, "cursor%x", IFXG(cursorid));
|
||||
sprintf(descrpid, "descrp%x", IFXG(cursorid));
|
||||
sprintf(i_descrpid, "i_descrp%x", IFXG(cursorid));
|
||||
|
||||
EXEC SQL set connection :ifx;
|
||||
PHP_IFX_CHECK_CONNECTION(ifx);
|
||||
|
||||
EXEC SQL PREPARE :statemid FROM :statement;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails (%s)", ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails (%s)", ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -868,12 +842,10 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (!php_intifx_alloc_ibind(Ifx_Result, num_params TSRMLS_CC)) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate i_desciptor <%s> fails (%s)", i_descrpid, ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate i_desciptor <%s> fails (%s)", i_descrpid, ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -884,22 +856,18 @@ EXEC SQL END DECLARE SECTION;
|
||||
|
||||
EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX :desc_count;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate desciptor <%s> fails (%s)", descrpid, ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx));
|
||||
EXEC SQL free :statemid;
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Describe fails (%s)", ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Describe fails (%s)", ifx_error(ifx));
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -999,13 +967,11 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails : %s", ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails : %s", ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1026,15 +992,13 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
if (Ifx_Result->numicols > 0) {
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
|
||||
}
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails : %s", ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails : %s", ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
|
||||
@@ -1071,13 +1035,11 @@ EXEC SQL END DECLARE SECTION;
|
||||
|
||||
EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not get descriptor %s (%s)", descrpid, ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not get descriptor %s (%s)", descrpid, ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1110,26 +1072,22 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Declare cursor fails (%s)", ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Declare cursor fails (%s)", ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
EXEC SQL OPEN :cursorid;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
EXEC SQL free :cursorid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Open cursor fails (%s)", ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Open cursor fails (%s)", ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1248,10 +1206,10 @@ EXEC SQL END DECLARE SECTION;
|
||||
statement = Z_STRVAL_PP(query);
|
||||
|
||||
IFXG(cursorid)++;
|
||||
sprintf(statemid, "statem%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(cursorid, "cursor%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(descrpid, "descrp%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(i_descrpid, "i_descrp%x_%x", IFX_THRD_ID,IFXG(cursorid));
|
||||
sprintf(statemid, "statem%x", IFXG(cursorid));
|
||||
sprintf(cursorid, "cursor%x", IFXG(cursorid));
|
||||
sprintf(descrpid, "descrp%x", IFXG(cursorid));
|
||||
sprintf(i_descrpid, "i_descrp%x", IFXG(cursorid));
|
||||
|
||||
EXEC SQL set connection :ifx;
|
||||
PHP_IFX_CHECK_CONNECTION(ifx);
|
||||
@@ -1292,12 +1250,10 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (!php_intifx_alloc_ibind(Ifx_Result, num_params TSRMLS_CC)) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate i_desciptor <%s> fails (%s)", i_descrpid, ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate i_desciptor <%s> fails (%s)", i_descrpid, ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1308,22 +1264,18 @@ EXEC SQL END DECLARE SECTION;
|
||||
|
||||
EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX :desc_count;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate desciptor <%s> fails (%s)", descrpid, ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx));
|
||||
EXEC SQL free :statemid;
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Describe fails (%s)", ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Describe fails (%s)", ifx_error(ifx));
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1425,13 +1377,11 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails : %s", ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails : %s", ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1484,13 +1434,11 @@ EXEC SQL END DECLARE SECTION;
|
||||
|
||||
EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err;
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not get descriptor %s (%s)", descrpid, (ifx_err = ifx_error(ifx)));
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not get descriptor %s (%s)", descrpid, ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
Ifx_Result->numcols = fieldcount;
|
||||
@@ -1576,10 +1524,8 @@ EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL EXECUTE :statemid;
|
||||
}
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails: %s", ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails: %s", ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
|
||||
@@ -1602,19 +1548,15 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Declare cursor fails (%s)", ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Declare cursor fails (%s)", ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
EXEC SQL OPEN :cursorid;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Open cursor fails (%s)", ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Open cursor fails (%s)", ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1951,12 +1893,8 @@ EXEC SQL END DECLARE SECTION;
|
||||
switch (ifx_check()) {
|
||||
case IFX_ERROR:
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
{
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch row on cursor %s (%s)", ifx_err, cursorid);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch row on cursor %s (%s)", ifx_error(ifx), cursorid);
|
||||
RETURN_FALSE;
|
||||
break;
|
||||
case IFX_NODATA:
|
||||
RETURN_FALSE;
|
||||
@@ -1979,10 +1917,8 @@ EXEC SQL END DECLARE SECTION;
|
||||
:indicator = INDICATOR;
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2307,11 +2243,7 @@ EXEC SQL END DECLARE SECTION;
|
||||
switch (ifx_check()) {
|
||||
case IFX_ERROR:
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
{
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_err, cursorid);
|
||||
efree(ifx_err);
|
||||
}
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), cursorid);
|
||||
RETURN_FALSE;
|
||||
break;
|
||||
case IFX_NODATA:
|
||||
@@ -2340,10 +2272,8 @@ EXEC SQL END DECLARE SECTION;
|
||||
for (i = 1; i <= num_fields; i++) {
|
||||
EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2369,10 +2299,8 @@ EXEC SQL END DECLARE SECTION;
|
||||
:indicator = INDICATOR;
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2543,11 +2471,7 @@ $endif;
|
||||
switch (ifx_check()) {
|
||||
case IFX_ERROR:
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
{
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_err, cursorid);
|
||||
efree(ifx_err);
|
||||
}
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), cursorid);
|
||||
RETURN_FALSE;
|
||||
break;
|
||||
case IFX_NODATA:
|
||||
@@ -2621,10 +2545,8 @@ EXEC SQL END DECLARE SECTION;
|
||||
for (i = 1; i <= num_fields; i++) {
|
||||
EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME, :fieldtype = TYPE;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2786,10 +2708,8 @@ EXEC SQL END DECLARE SECTION;
|
||||
:isnullable = NULLABLE;
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_err);
|
||||
efree(ifx_err);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -541,7 +541,6 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
} else { /* already open persistent connection */
|
||||
|
||||
if (Z_TYPE_P(le) != le_ii_plink) {
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* here we should ensure that the link did not die */
|
||||
|
||||
+11
-11
@@ -1201,7 +1201,7 @@ static int _php_ibase_blob_add(zval **string_arg, ibase_blob_handle *ib_blob TSR
|
||||
|
||||
/* {{{ _php_ibase_bind()
|
||||
Bind parameter placeholders in a previously prepared query */
|
||||
static int _php_ibase_bind(XSQLDA *sqlda, zval ***b_vars, BIND_BUF *buf, ibase_query *ib_query TSRMLS_DC)
|
||||
static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf, ibase_query *ib_query TSRMLS_DC)
|
||||
{
|
||||
|
||||
int i , rv = SUCCESS;
|
||||
@@ -1209,7 +1209,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval ***b_vars, BIND_BUF *buf, ibase_q
|
||||
|
||||
for (i = 0; i < sqlda->sqld; ++var, ++i) { /* bound vars */
|
||||
|
||||
zval *b_var = *b_vars[i];
|
||||
zval *b_var = b_vars[i];
|
||||
|
||||
var->sqlind = &buf[i].sqlind;
|
||||
|
||||
@@ -1425,17 +1425,17 @@ static void _php_ibase_alloc_xsqlda(XSQLDA *sqlda)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _php_ibase_exec() */
|
||||
static int _php_ibase_exec(ibase_result **ib_resultp, ibase_query *ib_query, int argc, zval ***args TSRMLS_DC)
|
||||
static int _php_ibase_exec(ibase_result **ib_resultp, ibase_query *ib_query, int argc, zval **args TSRMLS_DC)
|
||||
{
|
||||
#define IB_RESULT (*ib_resultp)
|
||||
XSQLDA *in_sqlda = NULL, *out_sqlda = NULL;
|
||||
BIND_BUF *bind_buf = NULL;
|
||||
int i, rv = FAILURE;
|
||||
int rv = FAILURE;
|
||||
|
||||
IB_RESULT = NULL;
|
||||
|
||||
for (i = 0; i < argc; ++i) {
|
||||
SEPARATE_ZVAL(args[i]);
|
||||
if (argc > 0 && args != NULL) {
|
||||
SEPARATE_ZVAL(args);
|
||||
}
|
||||
|
||||
/* allocate sqlda and output buffers */
|
||||
@@ -1699,7 +1699,7 @@ PHP_FUNCTION(ibase_rollback)
|
||||
Execute a query */
|
||||
PHP_FUNCTION(ibase_query)
|
||||
{
|
||||
zval ***args, ***bind_args = NULL, **dummy = NULL;
|
||||
zval ***args, **bind_args = NULL, **dummy = NULL;
|
||||
int i, link_id = 0, trans_n = 0, bind_n = 0, trans_id = 0;
|
||||
char *query;
|
||||
ibase_db_link *ib_link;
|
||||
@@ -1742,7 +1742,7 @@ PHP_FUNCTION(ibase_query)
|
||||
absolutely no sense if not using a prepared SQL statement.
|
||||
*/
|
||||
bind_n = ZEND_NUM_ARGS() - i;
|
||||
bind_args = &args[i];
|
||||
bind_args = args[i];
|
||||
}
|
||||
|
||||
/* open default transaction */
|
||||
@@ -1856,7 +1856,7 @@ static int _php_ibase_var_zval(zval *val, void *data, int type, int len, int sca
|
||||
if (n >= 0) {
|
||||
Z_STRLEN_P(val) = sprintf (string_data,
|
||||
"%" ISC_INT64_FORMAT "d.%0*" ISC_INT64_FORMAT "d", n / f, -scale, n % f);
|
||||
} else if (n <= -f) {
|
||||
} else if (n < -f) {
|
||||
Z_STRLEN_P(val) = sprintf (string_data,
|
||||
"%" ISC_INT64_FORMAT "d.%0*" ISC_INT64_FORMAT "d", n / f, -scale, -n % f);
|
||||
} else {
|
||||
@@ -2323,7 +2323,7 @@ PHP_FUNCTION(ibase_prepare)
|
||||
Execute a previously prepared query */
|
||||
PHP_FUNCTION(ibase_execute)
|
||||
{
|
||||
zval ***args, ***bind_args = NULL;
|
||||
zval ***args, **bind_args = NULL;
|
||||
ibase_query *ib_query;
|
||||
ibase_result *ib_result;
|
||||
|
||||
@@ -2342,7 +2342,7 @@ PHP_FUNCTION(ibase_execute)
|
||||
ZEND_FETCH_RESOURCE(ib_query, ibase_query *, args[0], -1, "InterBase query", le_query);
|
||||
|
||||
if (ZEND_NUM_ARGS() > 1) { /* have variables to bind */
|
||||
bind_args = &args[1];
|
||||
bind_args = args[1];
|
||||
}
|
||||
|
||||
/* Have we used this cursor before and it's still open? */
|
||||
|
||||
@@ -293,10 +293,12 @@ PHP_MINFO_FUNCTION(ldap)
|
||||
} else {
|
||||
snprintf(tmp, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links));
|
||||
}
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "Total Links", tmp);
|
||||
|
||||
#ifdef LDAP_API_VERSION
|
||||
snprintf(tmp, 31, "%d", LDAP_API_VERSION);
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "API Version", tmp);
|
||||
#endif
|
||||
|
||||
@@ -306,22 +308,27 @@ PHP_MINFO_FUNCTION(ldap)
|
||||
|
||||
#ifdef LDAP_VENDOR_VERSION
|
||||
snprintf(tmp, 31, "%d", LDAP_VENDOR_VERSION);
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "Vendor Version", tmp);
|
||||
#endif
|
||||
|
||||
#if HAVE_NSLDAP
|
||||
SDKVersion = ldap_version( &ver );
|
||||
snprintf(tmp, 31, "%f", SDKVersion/100.0 );
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "SDK Version", tmp );
|
||||
|
||||
snprintf(tmp, 31, "%f", ver.protocol_version/100.0 );
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "Highest LDAP Protocol Supported", tmp );
|
||||
|
||||
snprintf(tmp, 31, "%f", ver.SSL_version/100.0 );
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "SSL Level Supported", tmp );
|
||||
|
||||
if ( ver.security_level != LDAP_SECURITY_NONE ) {
|
||||
snprintf(tmp, 31, "%d", ver.security_level );
|
||||
tmp[31] = '\0';
|
||||
} else {
|
||||
strcpy(tmp, "SSL not enabled" );
|
||||
}
|
||||
|
||||
@@ -34,14 +34,10 @@ AC_DEFUN([PHP_MBSTRING_EXTENSION], [
|
||||
PHP_ADD_BUILD_DIR([$ext_builddir/$dir])
|
||||
done
|
||||
|
||||
if test "$ext_shared" = "no"; then
|
||||
if test "$ext_shared" = "no" || ! test -e "$ext_builddir/config.h.in"; then
|
||||
out="php_config.h"
|
||||
else
|
||||
if test -f "$ext_builddir/config.h.in"; then
|
||||
out="$abs_builddir/config.h"
|
||||
else
|
||||
out="php_config.h"
|
||||
fi
|
||||
out="$abs_builddir/config.h"
|
||||
fi
|
||||
|
||||
for cfg in $PHP_MBSTRING_EXTRA_CONFIG_HEADERS; do
|
||||
|
||||
@@ -3273,7 +3273,6 @@ detect_end:
|
||||
stack[stack_level] = var;
|
||||
stack_level++;
|
||||
var = hash_entry;
|
||||
SEPARATE_ZVAL(hash_entry);
|
||||
target_hash = HASH_OF(*var);
|
||||
if (target_hash != NULL) {
|
||||
zend_hash_internal_pointer_reset(target_hash);
|
||||
|
||||
@@ -33,7 +33,7 @@ unset($c);
|
||||
$a = "あいうえお";
|
||||
$b = array(&$a);
|
||||
$c = $b;
|
||||
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
|
||||
mb_convert_variables("euc-jp", "shift_jis", $c);
|
||||
debug_zval_dump($b);
|
||||
debug_zval_dump($c);
|
||||
unset($a);
|
||||
@@ -43,7 +43,7 @@ unset($c);
|
||||
$a = "あいうえお";
|
||||
$b = array($a);
|
||||
$c = &$b;
|
||||
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
|
||||
mb_convert_variables("euc-jp", "shift_jis", $c);
|
||||
debug_zval_dump($b);
|
||||
debug_zval_dump($c);
|
||||
unset($a);
|
||||
@@ -53,17 +53,7 @@ unset($c);
|
||||
$a = "あいうえお";
|
||||
$b = array(&$a);
|
||||
$c = &$b;
|
||||
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
|
||||
debug_zval_dump($b);
|
||||
debug_zval_dump($c);
|
||||
unset($a);
|
||||
unset($b);
|
||||
unset($c);
|
||||
|
||||
$a = array(array("�����"));
|
||||
$b = $a;
|
||||
$c = $b;
|
||||
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
|
||||
mb_convert_variables("euc-jp", "shift_jis", $c);
|
||||
debug_zval_dump($b);
|
||||
debug_zval_dump($c);
|
||||
unset($a);
|
||||
@@ -107,17 +97,4 @@ array(1) refcount(1){
|
||||
[0]=>
|
||||
string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
|
||||
}
|
||||
array(1) refcount(3){
|
||||
[0]=>
|
||||
array(1) refcount(1){
|
||||
[0]=>
|
||||
string(10) "�����" refcount(1)
|
||||
}
|
||||
}
|
||||
array(1) refcount(2){
|
||||
[0]=>
|
||||
array(1) refcount(1){
|
||||
[0]=>
|
||||
string(10) "丐中丹尹云" refcount(1)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -459,7 +459,7 @@ PHP_FUNCTION(mcal_fetch_event)
|
||||
CALEVENT *myevent;
|
||||
int myargcount=ZEND_NUM_ARGS();
|
||||
|
||||
if (myargcount < 2 || myargcount > 3 || zend_get_parameters_ex(myargcount, &streamind, &eventid, &options) == FAILURE) {
|
||||
if (myargcount < 1 || myargcount > 3 || zend_get_parameters_ex(myargcount, &streamind, &eventid, &options) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(streamind);
|
||||
|
||||
+5
-33
@@ -1,19 +1,16 @@
|
||||
dnl config.m4 for PHP4 MCVE Extension
|
||||
|
||||
PHP_ARG_WITH(mcve, for MCVE support,
|
||||
[ --with-mcve[=DIR] Include MCVE support. libmcve >= 3.2.2 or libmonetra >= 4.0 required])
|
||||
[ --with-mcve[=DIR] Include MCVE support. libmcve >= 3.2.2 required])
|
||||
|
||||
PHP_ARG_WITH(openssl-dir,OpenSSL dir for MCVE,
|
||||
[ --with-openssl-dir[=DIR] MCVE: openssl install prefix.], no, no)
|
||||
|
||||
if test "$PHP_MCVE" != "no"; then
|
||||
dnl properly set EGREP for AC_EGREP_CPP later on
|
||||
AC_CHECK_PROG(EGREP, egrep, grep -E)
|
||||
AC_SUBST(EGREP)
|
||||
|
||||
if test "$PHP_OPENSSL_DIR" != "no"; then
|
||||
PHP_OPENSSL=$PHP_OPENSSL_DIR
|
||||
PHP_SETUP_OPENSSL(MCVE_SHARED_LIBADD, [], [
|
||||
PHP_SETUP_OPENSSL(SNMP_SHARED_LIBADD, [], [
|
||||
AC_MSG_ERROR([MCVE: OpenSSL check failed. Please check config.log for more information.])
|
||||
])
|
||||
else
|
||||
@@ -56,41 +53,16 @@ yes
|
||||
PHP_ADD_INCLUDE($MCVE_DIR/include)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(mcve, $MCVE_DIR/lib, MCVE_SHARED_LIBADD)
|
||||
|
||||
dnl Build test. Check for libmcve or libmonetra
|
||||
dnl libmonetra_compat.h handle's MCVE_ -> M_ conversion
|
||||
dnl so it is API compatible
|
||||
|
||||
has_mcve=0
|
||||
dnl check for libmcve
|
||||
dnl Build test
|
||||
PHP_CHECK_LIBRARY(mcve, MCVE_DestroyEngine,
|
||||
[
|
||||
has_mcve=1
|
||||
AC_DEFINE(HAVE_MCVE, 1, [ ])
|
||||
], [
|
||||
has_mcve=0
|
||||
AC_MSG_ERROR([MCVE: Sanity check failed. Please check config.log for more information.])
|
||||
], [
|
||||
$MCVE_SHARED_LIBADD
|
||||
])
|
||||
|
||||
dnl check for libmonetra if no proper libmcve
|
||||
dnl symlink named libmcve is created to libmonetra
|
||||
dnl during libmonetra install, so this is valid
|
||||
if test "$has_mcve" = "0" ; then
|
||||
PHP_CHECK_LIBRARY(mcve, M_DestroyEngine,
|
||||
[
|
||||
has_mcve=1
|
||||
], [
|
||||
has_mcve=0
|
||||
], [
|
||||
$MCVE_SHARED_LIBADD
|
||||
])
|
||||
fi
|
||||
|
||||
if test "$has_mcve" = "1" ; then
|
||||
AC_DEFINE(HAVE_MCVE, 1, [ ])
|
||||
else
|
||||
AC_MSG_ERROR([MCVE: Sanity check failed. Please check config.log for more information.])
|
||||
fi
|
||||
|
||||
PHP_NEW_EXTENSION(mcve, mcve.c, $ext_shared)
|
||||
PHP_SUBST(MCVE_SHARED_LIBADD)
|
||||
fi
|
||||
+181
-379
File diff suppressed because it is too large.
Load diff
+1
-86
@@ -26,96 +26,13 @@ extern zend_module_entry mcve_module_entry;
|
||||
#define mcve_module_ptr &mcve_module_entry
|
||||
#define phpext_mcve_ptr mcve_module_ptr
|
||||
|
||||
#define PHP_MCVE_VERSION "4.0"
|
||||
#define PHP_MCVE_VERSION "3.2"
|
||||
|
||||
#define MCVE_CONST (CONST_CS | CONST_PERSISTENT)
|
||||
|
||||
#define M_map_function(newname, oldname) \
|
||||
PHP_FUNCTION(oldname) { \
|
||||
PHP_FN(newname)(INTERNAL_FUNCTION_PARAM_PASSTHRU); \
|
||||
}
|
||||
|
||||
PHP_MINIT_FUNCTION(mcve);
|
||||
PHP_MINFO_FUNCTION(mcve);
|
||||
|
||||
PHP_FUNCTION(m_initengine);
|
||||
PHP_FUNCTION(m_initconn);
|
||||
PHP_FUNCTION(m_deleteresponse);
|
||||
PHP_FUNCTION(m_destroyconn);
|
||||
PHP_FUNCTION(m_setdropfile);
|
||||
PHP_FUNCTION(m_setip);
|
||||
PHP_FUNCTION(m_setssl);
|
||||
PHP_FUNCTION(m_setssl_files);
|
||||
PHP_FUNCTION(m_setblocking);
|
||||
PHP_FUNCTION(m_settimeout);
|
||||
PHP_FUNCTION(m_verifyconnection);
|
||||
PHP_FUNCTION(m_verifysslcert);
|
||||
PHP_FUNCTION(m_maxconntimeout);
|
||||
PHP_FUNCTION(m_connectionerror);
|
||||
PHP_FUNCTION(m_deletetrans);
|
||||
PHP_FUNCTION(m_connect);
|
||||
PHP_FUNCTION(m_transnew);
|
||||
PHP_FUNCTION(m_transparam);
|
||||
PHP_FUNCTION(m_transsend);
|
||||
PHP_FUNCTION(m_ping);
|
||||
PHP_FUNCTION(m_responseparam);
|
||||
PHP_FUNCTION(m_returnstatus);
|
||||
PHP_FUNCTION(m_returncode);
|
||||
PHP_FUNCTION(m_transactionssent);
|
||||
PHP_FUNCTION(m_transactionitem);
|
||||
PHP_FUNCTION(m_transactionbatch);
|
||||
PHP_FUNCTION(m_transactionid);
|
||||
PHP_FUNCTION(m_transactionauth);
|
||||
PHP_FUNCTION(m_transactionavs);
|
||||
PHP_FUNCTION(m_transactioncv);
|
||||
PHP_FUNCTION(m_transactiontext);
|
||||
PHP_FUNCTION(m_getuserparam);
|
||||
PHP_FUNCTION(m_monitor);
|
||||
PHP_FUNCTION(m_transinqueue);
|
||||
PHP_FUNCTION(m_checkstatus);
|
||||
PHP_FUNCTION(m_completeauthorizations);
|
||||
PHP_FUNCTION(m_sale);
|
||||
PHP_FUNCTION(m_preauth);
|
||||
PHP_FUNCTION(m_override);
|
||||
PHP_FUNCTION(m_void);
|
||||
PHP_FUNCTION(m_preauthcompletion);
|
||||
PHP_FUNCTION(m_force);
|
||||
PHP_FUNCTION(m_return);
|
||||
PHP_FUNCTION(m_iscommadelimited);
|
||||
PHP_FUNCTION(m_parsecommadelimited);
|
||||
PHP_FUNCTION(m_getcommadelimited);
|
||||
PHP_FUNCTION(m_getcell);
|
||||
PHP_FUNCTION(m_getcellbynum);
|
||||
PHP_FUNCTION(m_numcolumns);
|
||||
PHP_FUNCTION(m_numrows);
|
||||
PHP_FUNCTION(m_getheader);
|
||||
PHP_FUNCTION(m_destroyengine);
|
||||
PHP_FUNCTION(m_settle);
|
||||
PHP_FUNCTION(m_qc);
|
||||
PHP_FUNCTION(m_gut);
|
||||
PHP_FUNCTION(m_gft);
|
||||
PHP_FUNCTION(m_ub);
|
||||
PHP_FUNCTION(m_gl);
|
||||
PHP_FUNCTION(m_chkpwd);
|
||||
PHP_FUNCTION(m_bt);
|
||||
PHP_FUNCTION(m_uwait);
|
||||
PHP_FUNCTION(m_text_code);
|
||||
PHP_FUNCTION(m_text_avs);
|
||||
PHP_FUNCTION(m_text_cv);
|
||||
PHP_FUNCTION(m_chngpwd);
|
||||
PHP_FUNCTION(m_listusers);
|
||||
PHP_FUNCTION(m_adduser);
|
||||
PHP_FUNCTION(m_enableuser);
|
||||
PHP_FUNCTION(m_disableuser);
|
||||
PHP_FUNCTION(m_getuserarg);
|
||||
PHP_FUNCTION(m_adduserarg);
|
||||
PHP_FUNCTION(m_deleteusersetup);
|
||||
PHP_FUNCTION(m_initusersetup);
|
||||
PHP_FUNCTION(m_deluser);
|
||||
PHP_FUNCTION(m_edituser);
|
||||
PHP_FUNCTION(m_liststats);
|
||||
|
||||
/* prototypes for compatability functions */
|
||||
PHP_FUNCTION(mcve_initengine);
|
||||
PHP_FUNCTION(mcve_initconn);
|
||||
PHP_FUNCTION(mcve_deleteresponse);
|
||||
@@ -192,8 +109,6 @@ PHP_FUNCTION(mcve_initusersetup);
|
||||
PHP_FUNCTION(mcve_deluser);
|
||||
PHP_FUNCTION(mcve_edituser);
|
||||
PHP_FUNCTION(mcve_liststats);
|
||||
|
||||
|
||||
#endif /* _PHP_MCVE_H */
|
||||
|
||||
/*
|
||||
|
||||
@@ -47,7 +47,7 @@ PHP_ARG_WITH(mnogosearch,for mnoGoSearch support,
|
||||
|
||||
AC_DEFINE(HAVE_MNOGOSEARCH,1,[ ])
|
||||
|
||||
PHP_NEW_EXTENSION(mnogosearch, php_mnogo.c, $ext_shared)
|
||||
PHP_SUBST(MNOGOSEARCH_SHARED_LIBADD)
|
||||
PHP_NEW_EXTENSION(mnogosearch, php_mnogo.c, $ext_shared)
|
||||
|
||||
fi
|
||||
@@ -1266,7 +1266,7 @@ PS_OPEN_FUNC(msession)
|
||||
{
|
||||
int port;
|
||||
int len = strlen(save_path)+1;
|
||||
char * path = emalloc(len);
|
||||
char * path = alloca(len);
|
||||
char * szport;
|
||||
|
||||
strcpy(path, save_path);
|
||||
@@ -1285,13 +1285,7 @@ PS_OPEN_FUNC(msession)
|
||||
|
||||
ELOG( "ps_open_msession");
|
||||
PS_SET_MOD_DATA((void *)1); /* session.c needs a non-zero here! */
|
||||
if (PHPMsessionConnect(path, port)) {
|
||||
efree(path);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
efree(path);
|
||||
return FAILURE;
|
||||
}
|
||||
return PHPMsessionConnect(path, port) ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
PS_CLOSE_FUNC(msession)
|
||||
|
||||
+9
-32
@@ -336,7 +336,7 @@ PHP_RINIT_FUNCTION(mssql)
|
||||
dbsetlogintime(MS_SQL_G(connect_timeout));
|
||||
if (MS_SQL_G(timeout) < 0) MS_SQL_G(timeout) = 60;
|
||||
dbsettime(MS_SQL_G(timeout));
|
||||
dbsetmaxprocs((TDS_SHORT)MS_SQL_G(max_procs));
|
||||
dbsetmaxprocs((SHORT)MS_SQL_G(max_procs));
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -344,7 +344,6 @@ PHP_RINIT_FUNCTION(mssql)
|
||||
PHP_RSHUTDOWN_FUNCTION(mssql)
|
||||
{
|
||||
STR_FREE(MS_SQL_G(appname));
|
||||
MS_SQL_G(appname) = NULL;
|
||||
if (MS_SQL_G(server_message)) {
|
||||
STR_FREE(MS_SQL_G(server_message));
|
||||
MS_SQL_G(server_message) = NULL;
|
||||
@@ -797,19 +796,13 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off
|
||||
Z_TYPE_P(result) = IS_STRING;
|
||||
break;
|
||||
}
|
||||
case SQLMONEY4:
|
||||
case SQLFLT4:
|
||||
Z_DVAL_P(result) = (double) floatcol4(offset);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
break;
|
||||
case SQLMONEY:
|
||||
case SQLMONEY4:
|
||||
case SQLMONEYN: {
|
||||
DBFLT8 res_buf;
|
||||
dbconvert(NULL, column_type, dbdata(mssql_ptr->link,offset), 8, SQLFLT8, (LPBYTE)&res_buf, -1);
|
||||
Z_DVAL_P(result) = res_buf;
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
}
|
||||
break;
|
||||
case SQLMONEYN:
|
||||
case SQLFLT8:
|
||||
Z_DVAL_P(result) = (double) floatcol8(offset);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
@@ -848,21 +841,8 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off
|
||||
|
||||
if ((column_type != SQLDATETIME && column_type != SQLDATETIM4) || MS_SQL_G(datetimeconvert)) {
|
||||
|
||||
switch (column_type) {
|
||||
case SQLDATETIM4 :
|
||||
res_length += 14;
|
||||
break;
|
||||
case SQLDATETIME :
|
||||
res_length += 10;
|
||||
break;
|
||||
case SQLMONEY :
|
||||
case SQLMONEY4 :
|
||||
case SQLMONEYN :
|
||||
case SQLDECIMAL :
|
||||
case SQLNUMERIC :
|
||||
res_length += 5;
|
||||
break;
|
||||
}
|
||||
if (column_type == SQLDATETIM4) res_length += 14;
|
||||
if (column_type == SQLDATETIME) res_length += 10;
|
||||
|
||||
res_buf = (unsigned char *) emalloc(res_length+1);
|
||||
res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,res_buf,-1);
|
||||
@@ -931,8 +911,6 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int
|
||||
case SQLMONEY :
|
||||
case SQLMONEY4 :
|
||||
case SQLMONEYN :
|
||||
case SQLDECIMAL :
|
||||
case SQLNUMERIC :
|
||||
res_length += 5;
|
||||
break;
|
||||
}
|
||||
@@ -1106,7 +1084,7 @@ static int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int r
|
||||
result->lastresult = retvalue;
|
||||
}
|
||||
efree(column_types);
|
||||
if (result->statement && (retvalue == NO_MORE_RESULTS || retvalue == NO_MORE_RPC_RESULTS)) {
|
||||
if (result->statement) {
|
||||
_mssql_get_sp_result(mssql_ptr, result->statement TSRMLS_CC);
|
||||
}
|
||||
return i;
|
||||
@@ -1836,9 +1814,6 @@ PHP_FUNCTION(mssql_next_result)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
else if (retvalue == NO_MORE_RESULTS || retvalue == NO_MORE_RPC_RESULTS) {
|
||||
if (result->statement) {
|
||||
_mssql_get_sp_result(mssql_ptr, result->statement TSRMLS_CC);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
else {
|
||||
@@ -2149,6 +2124,8 @@ PHP_FUNCTION(mssql_execute)
|
||||
dbcanquery(mssql_ptr->link);
|
||||
retval_results = dbresults(mssql_ptr->link);
|
||||
} while (retval_results == SUCCEED);
|
||||
|
||||
_mssql_get_sp_result(mssql_ptr, statement TSRMLS_CC);
|
||||
}
|
||||
else {
|
||||
/* Skip results not returning any columns */
|
||||
@@ -2171,7 +2148,7 @@ PHP_FUNCTION(mssql_execute)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (retval_results == NO_MORE_RESULTS || retval_results == NO_MORE_RPC_RESULTS) {
|
||||
else if (retval_results == NO_MORE_RESULTS || retval_results == NO_MORE_RPC_RESULTS) {
|
||||
_mssql_get_sp_result(mssql_ptr, statement TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "sqlfront.h"
|
||||
#include "sqldb.h"
|
||||
|
||||
typedef short TDS_SHORT;
|
||||
#if HAVE_FREETDS
|
||||
#define SQLTEXT SYBTEXT
|
||||
#define SQLCHAR SYBCHAR
|
||||
|
||||
@@ -259,9 +259,6 @@ static void _free_mysql_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
*/
|
||||
static void php_mysql_set_default_link(int id TSRMLS_DC)
|
||||
{
|
||||
if (MySG(default_link) != -1) {
|
||||
zend_list_delete(MySG(default_link));
|
||||
}
|
||||
MySG(default_link) = id;
|
||||
zend_list_addref(id);
|
||||
}
|
||||
@@ -428,6 +425,7 @@ PHP_RINIT_FUNCTION(mysql)
|
||||
/* Reset connect error/errno on every request */
|
||||
MySG(connect_error) = NULL;
|
||||
MySG(connect_errno) =0;
|
||||
MySG(trace_mode) = 0;
|
||||
MySG(result_allocated) = 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -593,7 +591,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
break;
|
||||
}
|
||||
/* disable local infile option for open_basedir */
|
||||
if (PG(open_basedir) && strlen(PG(open_basedir)) && (client_flags & CLIENT_LOCAL_FILES)) {
|
||||
if (PG(open_basedir) && strlen(PG(open_basedir))) {
|
||||
client_flags ^= CLIENT_LOCAL_FILES;
|
||||
}
|
||||
|
||||
|
||||
@@ -1421,7 +1421,7 @@ PHP_FUNCTION(ncurses_mvdelch)
|
||||
{
|
||||
long y,x;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll",&y,&x)==FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls",&y,&x)==FAILURE) {
|
||||
return;
|
||||
}
|
||||
IS_NCURSES_INITIALIZED();
|
||||
@@ -1436,7 +1436,7 @@ PHP_FUNCTION(ncurses_mvgetch)
|
||||
{
|
||||
long y,x;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll",&y,&x)==FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls",&y,&x)==FAILURE) {
|
||||
return;
|
||||
}
|
||||
IS_NCURSES_INITIALIZED();
|
||||
@@ -1450,7 +1450,7 @@ PHP_FUNCTION(ncurses_mvinch)
|
||||
{
|
||||
long y,x;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll",&y,&x)==FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls",&y,&x)==FAILURE) {
|
||||
return;
|
||||
}
|
||||
IS_NCURSES_INITIALIZED();
|
||||
|
||||
@@ -1912,14 +1912,14 @@ PHP_FUNCTION(notes_search)
|
||||
pNoteID = (NOTEID *) (((char *) pSearchResults)
|
||||
+ sizeof(FT_SEARCH_RESULTS));
|
||||
|
||||
/* pSearchResults->NumHits */
|
||||
//pSearchResults->NumHits
|
||||
array_init(return_value);
|
||||
|
||||
pScores = (BYTE *) (pNoteID + pSearchResults->NumHits);
|
||||
for (i = 0; i < pSearchResults->NumHits; i++, pNoteID++, pScores++){
|
||||
|
||||
add_next_index_long(return_value, (long) *pNoteID );
|
||||
/* RETVAL_LONG( (long) *pNoteID ); */
|
||||
//RETVAL_LONG( (long) *pNoteID );
|
||||
}
|
||||
|
||||
OSUnlockObject (SearchResults_handle);
|
||||
|
||||
+1
-1
@@ -2982,7 +2982,7 @@ break;
|
||||
}
|
||||
|
||||
memset((void*)&bind,0,sizeof(oci_bind));
|
||||
zend_hash_update(statement->binds, Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, &bind, sizeof(oci_bind), (void **)&bindp);
|
||||
zend_hash_next_index_insert(statement->binds,&bind,sizeof(oci_bind),(void **)&bindp);
|
||||
|
||||
bindp->descr = mydescr;
|
||||
bindp->pStmt = mystmt;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "oci8"=.\oci8.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
+2
-6
@@ -1008,15 +1008,11 @@ PHP_FUNCTION(odbc_execute)
|
||||
|
||||
/* Check for safe mode. */
|
||||
if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
|
||||
efree(filename);
|
||||
efree(params);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* Check the basedir */
|
||||
if (php_check_open_basedir(filename TSRMLS_CC)) {
|
||||
efree(filename);
|
||||
efree(params);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -386,7 +386,7 @@ PHP_FUNCTION(pcntl_exec)
|
||||
args_hash = HASH_OF(args);
|
||||
argc = zend_hash_num_elements(args_hash);
|
||||
|
||||
argv = safe_emalloc((argc + 2), sizeof(char *), 0);
|
||||
argv = alloca((argc+2) * sizeof(char *));
|
||||
*argv = path;
|
||||
for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1;
|
||||
(argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) == SUCCESS));
|
||||
@@ -397,7 +397,7 @@ PHP_FUNCTION(pcntl_exec)
|
||||
}
|
||||
*(current_arg) = NULL;
|
||||
} else {
|
||||
argv = emalloc(2 * sizeof(char *));
|
||||
argv = alloca(2 * sizeof(char *));
|
||||
*argv = path;
|
||||
*(argv+1) = NULL;
|
||||
}
|
||||
@@ -407,13 +407,13 @@ PHP_FUNCTION(pcntl_exec)
|
||||
envs_hash = HASH_OF(envs);
|
||||
envc = zend_hash_num_elements(envs_hash);
|
||||
|
||||
envp = safe_emalloc((envc + 1), sizeof(char *), 0);
|
||||
envp = alloca((envc+1) * sizeof(char *));
|
||||
for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp;
|
||||
(envi < envc && (zend_hash_get_current_data(envs_hash, (void **) &element) == SUCCESS));
|
||||
(envi++, pair++, zend_hash_move_forward(envs_hash)) ) {
|
||||
switch (return_val = zend_hash_get_current_key_ex(envs_hash, &key, &key_length, &key_num, 0, NULL)) {
|
||||
case HASH_KEY_IS_LONG:
|
||||
key = emalloc(101);
|
||||
key = alloca(101);
|
||||
snprintf(key, 100, "%ld", key_num);
|
||||
key_length = strlen(key);
|
||||
break;
|
||||
@@ -432,7 +432,7 @@ PHP_FUNCTION(pcntl_exec)
|
||||
strlcat(*pair, Z_STRVAL_PP(element), pair_length);
|
||||
|
||||
/* Cleanup */
|
||||
if (return_val == HASH_KEY_IS_LONG) efree(key);
|
||||
if (return_val == HASH_KEY_IS_LONG) free_alloca(key);
|
||||
}
|
||||
*(pair) = NULL;
|
||||
}
|
||||
@@ -445,10 +445,10 @@ PHP_FUNCTION(pcntl_exec)
|
||||
/* Cleanup */
|
||||
if (envp != NULL) {
|
||||
for (pair = envp; *pair != NULL; pair++) efree(*pair);
|
||||
efree(envp);
|
||||
free_alloca(envp);
|
||||
}
|
||||
|
||||
efree(argv);
|
||||
free_alloca(argv);
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
+31
-73
@@ -47,6 +47,20 @@
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(pcre)
|
||||
|
||||
|
||||
static void *php_pcre_malloc(size_t size)
|
||||
{
|
||||
return pemalloc(size, 1);
|
||||
}
|
||||
|
||||
|
||||
static void php_pcre_free(void *ptr)
|
||||
{
|
||||
if (ptr)
|
||||
pefree(ptr, 1);
|
||||
}
|
||||
|
||||
|
||||
static void php_free_pcre_cache(void *data)
|
||||
{
|
||||
pcre_cache_entry *pce = (pcre_cache_entry *) data;
|
||||
@@ -93,6 +107,14 @@ static PHP_MINIT_FUNCTION(pcre)
|
||||
REGISTER_LONG_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
pcre_malloc = php_pcre_malloc;
|
||||
pcre_free = php_pcre_free;
|
||||
|
||||
#ifdef NO_RECURSE
|
||||
pcre_stack_malloc = php_pcre_malloc;
|
||||
pcre_stack_free = php_pcre_free;
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -108,22 +130,6 @@ static PHP_MSHUTDOWN_FUNCTION(pcre)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define PCRE_CACHE_SIZE 4096
|
||||
|
||||
/* {{{ static pcre_clean_cache */
|
||||
static int pcre_clean_cache(void *data, void *arg TSRMLS_DC)
|
||||
{
|
||||
int *num_clean = (int *)arg;
|
||||
|
||||
if (*num_clean > 0) {
|
||||
(*num_clean)--;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ pcre_get_compiled_regex
|
||||
*/
|
||||
PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_options) {
|
||||
@@ -295,16 +301,6 @@ PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_
|
||||
|
||||
efree(pattern);
|
||||
|
||||
/*
|
||||
* If we reached cache limit, clean out the items from the head of the list;
|
||||
* these are supposedly the oldest ones (but not necessarily the least used
|
||||
* ones).
|
||||
*/
|
||||
if (zend_hash_num_elements(&PCRE_G(pcre_cache)) == PCRE_CACHE_SIZE) {
|
||||
int num_clean = PCRE_CACHE_SIZE / 8;
|
||||
zend_hash_apply_with_argument(&PCRE_G(pcre_cache), pcre_clean_cache, &num_clean TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* Store the compiled pattern and extra info in the cache. */
|
||||
new_entry.re = re;
|
||||
new_entry.extra = *extra;
|
||||
@@ -373,7 +369,7 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
|
||||
const char **stringlist; /* Holds list of subpatterns */
|
||||
char *match; /* The current match */
|
||||
char **subpat_names = NULL;/* Array for named subpatterns */
|
||||
int i, rc;
|
||||
int i;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ((global) ? "ssz|ll" : "ss|zll"), ®ex, ®ex_len,
|
||||
&subject, &subject_len, &subpats, &flags, &start_offset) == FAILURE) {
|
||||
@@ -419,12 +415,7 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
|
||||
}
|
||||
|
||||
/* Calculate the size of the offsets array, and allocate memory for it. */
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats);
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats);
|
||||
num_subpats++;
|
||||
size_offsets = num_subpats * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
@@ -441,22 +432,10 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
|
||||
char *name_table;
|
||||
unsigned short name_idx;
|
||||
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_NAMECOUNT, &name_cnt);
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
pcre_fullinfo(re, extra, PCRE_INFO_NAMECOUNT, &name_cnt);
|
||||
if (name_cnt > 0) {
|
||||
int rc1, rc2;
|
||||
rc1 = pcre_fullinfo(re, extra, PCRE_INFO_NAMETABLE, &name_table);
|
||||
rc2 = pcre_fullinfo(re, extra, PCRE_INFO_NAMEENTRYSIZE, &name_size);
|
||||
rc = rc2 ? rc2 : rc1;
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
pcre_fullinfo(re, extra, PCRE_INFO_NAMETABLE, &name_table);
|
||||
pcre_fullinfo(re, extra, PCRE_INFO_NAMEENTRYSIZE, &name_size);
|
||||
|
||||
while (ni++ < name_cnt) {
|
||||
name_idx = 0xff * name_table[0] + name_table[1];
|
||||
@@ -569,7 +548,7 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
|
||||
}
|
||||
}
|
||||
|
||||
pcre_free((void *) stringlist);
|
||||
php_pcre_free((void *) stringlist);
|
||||
}
|
||||
}
|
||||
else { /* Failed to match */
|
||||
@@ -825,7 +804,6 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len,
|
||||
*replace_end=NULL, /* End of replacement string */
|
||||
*eval_result, /* Result of eval or custom function */
|
||||
walk_last; /* Last walked character */
|
||||
int rc;
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((re = pcre_get_compiled_regex(regex, &extra, &preg_options)) == NULL) {
|
||||
@@ -845,13 +823,7 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len,
|
||||
}
|
||||
|
||||
/* Calculate the size of the offsets array, and allocate memory for it. */
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &size_offsets);
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
return NULL;
|
||||
}
|
||||
size_offsets = (size_offsets + 1) * 3;
|
||||
size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
alloc_len = 2 * subject_len + 1;
|
||||
@@ -1215,7 +1187,6 @@ PHP_FUNCTION(preg_split)
|
||||
int g_notempty = 0; /* If the match should not be empty */
|
||||
char *match, /* The current match */
|
||||
*last_match; /* Location of last match */
|
||||
int rc;
|
||||
|
||||
/* Get function parameters and do error checking */
|
||||
argc = ZEND_NUM_ARGS();
|
||||
@@ -1250,13 +1221,7 @@ PHP_FUNCTION(preg_split)
|
||||
array_init(return_value);
|
||||
|
||||
/* Calculate the size of the offsets array, and allocate memory for it. */
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &size_offsets);
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
size_offsets = (size_offsets + 1) * 3;
|
||||
size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
/* Start at the beginning of the string */
|
||||
@@ -1463,7 +1428,6 @@ PHP_FUNCTION(preg_grep)
|
||||
ulong num_key;
|
||||
zend_bool invert = 0; /* Whether to return non-matching
|
||||
entries */
|
||||
int rc;
|
||||
|
||||
/* Get arguments and do error checking */
|
||||
|
||||
@@ -1493,13 +1457,7 @@ PHP_FUNCTION(preg_grep)
|
||||
}
|
||||
|
||||
/* Calculate the size of the offsets array, and allocate memory for it. */
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &size_offsets);
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
size_offsets = (size_offsets + 1) * 3;
|
||||
size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
/* Initialize return array */
|
||||
|
||||
+4
-4
@@ -328,14 +328,14 @@ PHP_FUNCTION(pfpro_process)
|
||||
args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS());
|
||||
|
||||
if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
|
||||
efree(args);
|
||||
php_error(E_ERROR, "Unable to read parameters in pfpro_process()");
|
||||
efree(args);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (Z_TYPE_PP(args[0]) != IS_ARRAY) {
|
||||
efree(args);
|
||||
php_error(E_ERROR, "First parameter to pfpro_process() must be an array");
|
||||
efree(args);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -418,11 +418,11 @@ PHP_FUNCTION(pfpro_process)
|
||||
break;
|
||||
|
||||
default:
|
||||
php_error(E_ERROR, "pfpro_process() array keys must be strings or integers");
|
||||
if (parmlist) {
|
||||
efree(parmlist);
|
||||
}
|
||||
efree(args);
|
||||
php_error(E_ERROR, "pfpro_process() array keys must be strings or integers");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -464,11 +464,11 @@ PHP_FUNCTION(pfpro_process)
|
||||
break;
|
||||
|
||||
default:
|
||||
php_error(E_ERROR, "pfpro_process() array values must be strings, ints or floats");
|
||||
if (parmlist) {
|
||||
efree(parmlist);
|
||||
}
|
||||
efree(args);
|
||||
php_error(E_ERROR, "pfpro_process() array values must be strings, ints or floats");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_hash_move_forward(target_hash);
|
||||
|
||||
+5
-5
@@ -222,7 +222,7 @@ static char * _php_pgsql_trim_message(const char *message, int *len)
|
||||
if (i>1 && (message[i-1] == '\r' || message[i-1] == '\n') && message[i] == '.') {
|
||||
--i;
|
||||
}
|
||||
while (i>0 && (message[i] == '\r' || message[i] == '\n')) {
|
||||
while (i && (message[i] == '\r' || message[i] == '\n')) {
|
||||
--i;
|
||||
}
|
||||
++i;
|
||||
@@ -2515,8 +2515,8 @@ PHP_FUNCTION(pg_copy_to)
|
||||
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
|
||||
|
||||
query = (char *)emalloc(strlen(query_template) + strlen(table_name) + strlen(pg_null_as) + 1);
|
||||
sprintf(query, "COPY \"%s\" TO STDOUT DELIMITERS '%c' WITH NULL AS '%s'",
|
||||
table_name, *pg_delim, pg_null_as);
|
||||
sprintf(query, "COPY \"%s\" TO STDOUT DELIMITERS '%s' WITH NULL AS '%s'",
|
||||
table_name, pg_delim, pg_null_as);
|
||||
|
||||
while ((pgsql_result = PQgetResult(pgsql))) {
|
||||
PQclear(pgsql_result);
|
||||
@@ -2625,8 +2625,8 @@ PHP_FUNCTION(pg_copy_from)
|
||||
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
|
||||
|
||||
query = (char *)emalloc(strlen(query_template) + strlen(table_name) + strlen(pg_null_as) + 1);
|
||||
sprintf(query, "COPY \"%s\" FROM STDIN DELIMITERS '%c' WITH NULL AS '%s'",
|
||||
table_name, *pg_delim, pg_null_as);
|
||||
sprintf(query, "COPY \"%s\" FROM STDIN DELIMITERS '%s' WITH NULL AS '%s'",
|
||||
table_name, pg_delim, pg_null_as);
|
||||
while ((pgsql_result = PQgetResult(pgsql))) {
|
||||
PQclear(pgsql_result);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "php_session.h"
|
||||
#include "mod_files.h"
|
||||
#include "ext/standard/flock_compat.h"
|
||||
#include "php_open_temporary_file.h"
|
||||
|
||||
#define FILE_PREFIX "sess_"
|
||||
|
||||
@@ -235,10 +234,6 @@ PS_OPEN_FUNC(files)
|
||||
data = ecalloc(sizeof(*data), 1);
|
||||
PS_SET_MOD_DATA(data);
|
||||
|
||||
if (*save_path == '\0') {
|
||||
save_path = php_get_temporary_directory();
|
||||
}
|
||||
|
||||
data->fd = -1;
|
||||
if ((p = strchr(save_path, ';'))) {
|
||||
errno = 0;
|
||||
|
||||
@@ -264,7 +264,7 @@ PHP_MINIT_FUNCTION(ps_mm)
|
||||
return FAILURE;
|
||||
|
||||
/* Directory + '/' + File + Module Name + Effective UID + \0 */
|
||||
ps_mm_path = emalloc(save_path_len+1+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1);
|
||||
ps_mm_path = do_alloca(save_path_len+1+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1);
|
||||
|
||||
memcpy(ps_mm_path, PS(save_path), save_path_len + 1);
|
||||
if (save_path_len > 0 && ps_mm_path[save_path_len - 1] != DEFAULT_SLASH) {
|
||||
@@ -277,7 +277,7 @@ PHP_MINIT_FUNCTION(ps_mm)
|
||||
|
||||
ret = ps_mm_initialize(ps_mm_instance, ps_mm_path);
|
||||
|
||||
efree(ps_mm_path);
|
||||
free_alloca(ps_mm_path);
|
||||
|
||||
if (ret != SUCCESS) {
|
||||
free(ps_mm_instance);
|
||||
|
||||
+22
-27
@@ -120,11 +120,7 @@ static PHP_INI_MH(OnUpdateSerializer)
|
||||
PHP_INI_BEGIN()
|
||||
STD_PHP_INI_BOOLEAN("session.bug_compat_42", "1", PHP_INI_ALL, OnUpdateBool, bug_compat, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_BOOLEAN("session.bug_compat_warn", "1", PHP_INI_ALL, OnUpdateBool, bug_compat_warn, php_ps_globals, ps_globals)
|
||||
#ifdef PHP_WIN32
|
||||
STD_PHP_INI_ENTRY("session.save_path", "", PHP_INI_ALL, OnUpdateString, save_path, php_ps_globals, ps_globals)
|
||||
#else
|
||||
STD_PHP_INI_ENTRY("session.save_path", "/tmp", PHP_INI_ALL, OnUpdateString, save_path, php_ps_globals, ps_globals)
|
||||
#endif
|
||||
STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateString, session_name, php_ps_globals, ps_globals)
|
||||
PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, OnUpdateSaveHandler)
|
||||
STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_ALL, OnUpdateBool, auto_start, php_ps_globals, ps_globals)
|
||||
@@ -503,16 +499,13 @@ break_outer_loop:
|
||||
|
||||
static void php_session_track_init(TSRMLS_D)
|
||||
{
|
||||
zval *session_vars = NULL;
|
||||
|
||||
/* Unconditionally destroy existing arrays -- possible dirty data */
|
||||
zend_hash_del(&EG(symbol_table), "HTTP_SESSION_VARS",
|
||||
sizeof("HTTP_SESSION_VARS"));
|
||||
zend_hash_del(&EG(symbol_table), "_SESSION", sizeof("_SESSION"));
|
||||
|
||||
MAKE_STD_ZVAL(session_vars);
|
||||
array_init(session_vars);
|
||||
PS(http_session_vars) = session_vars;
|
||||
MAKE_STD_ZVAL(PS(http_session_vars));
|
||||
array_init(PS(http_session_vars));
|
||||
|
||||
ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 2, 1);
|
||||
ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 2, 1);
|
||||
@@ -870,7 +863,7 @@ static void php_session_send_cookie(TSRMLS_D)
|
||||
t = tv.tv_sec + PS(cookie_lifetime);
|
||||
|
||||
if (t > 0) {
|
||||
date_fmt = php_std_date(t TSRMLS_CC);
|
||||
date_fmt = php_std_date(t);
|
||||
smart_str_appends(&ncookie, COOKIE_EXPIRES);
|
||||
smart_str_appends(&ncookie, date_fmt);
|
||||
efree(date_fmt);
|
||||
@@ -933,9 +926,8 @@ static void php_session_reset_id(TSRMLS_D)
|
||||
{
|
||||
int module_number = PS(module_number);
|
||||
|
||||
if (PS(use_cookies) && PS(send_cookie)) {
|
||||
if (PS(use_cookies)) {
|
||||
php_session_send_cookie(TSRMLS_C);
|
||||
PS(send_cookie) = 0;
|
||||
}
|
||||
|
||||
/* if the SID constant exists, destroy it. */
|
||||
@@ -1114,8 +1106,8 @@ PHP_FUNCTION(session_set_cookie_params)
|
||||
zend_get_parameters_ex(ZEND_NUM_ARGS(), &lifetime, &path, &domain, &secure) == FAILURE)
|
||||
WRONG_PARAM_COUNT;
|
||||
|
||||
convert_to_string_ex(lifetime);
|
||||
zend_alter_ini_entry("session.cookie_lifetime", sizeof("session.cookie_lifetime"), Z_STRVAL_PP(lifetime), Z_STRLEN_PP(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
convert_to_long_ex(lifetime);
|
||||
PS(cookie_lifetime) = Z_LVAL_PP(lifetime);
|
||||
|
||||
if (ZEND_NUM_ARGS() > 1) {
|
||||
convert_to_string_ex(path);
|
||||
@@ -1178,28 +1170,32 @@ PHP_FUNCTION(session_module_name)
|
||||
{
|
||||
zval **p_name;
|
||||
int ac = ZEND_NUM_ARGS();
|
||||
char *old;
|
||||
|
||||
if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
|
||||
WRONG_PARAM_COUNT;
|
||||
|
||||
old = safe_estrdup(PS(mod)->s_name);
|
||||
|
||||
if (ac == 1) {
|
||||
ps_module *tempmod;
|
||||
|
||||
convert_to_string_ex(p_name);
|
||||
if (!_php_find_ps_module(Z_STRVAL_PP(p_name) TSRMLS_CC)) {
|
||||
tempmod = _php_find_ps_module(Z_STRVAL_PP(p_name) TSRMLS_CC);
|
||||
if (tempmod) {
|
||||
if (PS(mod_data))
|
||||
PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
|
||||
PS(mod) = tempmod;
|
||||
PS(mod_data) = NULL;
|
||||
} else {
|
||||
efree(old);
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot find named PHP session module (%s)",
|
||||
Z_STRVAL_PP(p_name));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (PS(mod_data)) {
|
||||
PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
|
||||
}
|
||||
PS(mod_data) = NULL;
|
||||
|
||||
RETVAL_STRING(safe_estrdup(PS(mod)->s_name), 0);
|
||||
|
||||
zend_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
} else {
|
||||
RETURN_STRING(safe_estrdup(PS(mod)->s_name), 0);
|
||||
}
|
||||
|
||||
RETVAL_STRING(old, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1287,7 +1283,6 @@ PHP_FUNCTION(session_regenerate_id)
|
||||
|
||||
PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);
|
||||
|
||||
PS(send_cookie) = 1;
|
||||
php_session_reset_id(TSRMLS_C);
|
||||
|
||||
RETURN_TRUE;
|
||||
@@ -1355,7 +1350,7 @@ static void php_register_var(zval** entry TSRMLS_DC)
|
||||
} else {
|
||||
convert_to_string_ex(entry);
|
||||
|
||||
if ((strcmp(Z_STRVAL_PP(entry), "HTTP_SESSION_VARS") != 0) &&
|
||||
if ((strcmp(Z_STRVAL_PP(entry), "HTTP_SESSION_VARS") != 0) ||
|
||||
(strcmp(Z_STRVAL_PP(entry), "_SESSION") != 0)) {
|
||||
PS_ADD_VARL(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry));
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ Bug #26862 (ob_flush() before output_reset_rewrite_vars() results in data loss)
|
||||
--INI--
|
||||
register_globals=0
|
||||
html_errors=0
|
||||
session.use_trans_sid=0
|
||||
--FILE--
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
@@ -7,13 +7,4 @@ if (!extension_loaded("session") && ini_get("enable_dl")) {
|
||||
if (!extension_loaded("session")) {
|
||||
die("skip\n");
|
||||
}
|
||||
$save_path = ini_get("session.save_path");
|
||||
if (!@is_writable($save_path)) {
|
||||
if (($p = strpos($save_path, ';')) !== false) {
|
||||
$save_path = substr($save_path, ++$p);
|
||||
}
|
||||
if (!@is_writable($save_path)) {
|
||||
die("skip\n");
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -350,7 +350,7 @@ static char *php_strerror(int error TSRMLS_DC)
|
||||
buf = hstrerror(error);
|
||||
#else
|
||||
{
|
||||
spprintf(&(SOCKETS_G(strerror_buf)), 0, "Host lookup error %d", error);
|
||||
sprintf(SOCKETS_G(strerror_buf), "Host lookup error %d", error);
|
||||
buf = SOCKETS_G(strerror_buf);
|
||||
}
|
||||
#endif
|
||||
@@ -364,7 +364,7 @@ static char *php_strerror(int error TSRMLS_DC)
|
||||
|
||||
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &tmp, 0, NULL)) {
|
||||
SOCKETS_G(strerror_buf) = estrdup(tmp);
|
||||
strlcpy(SOCKETS_G(strerror_buf), (char *) tmp, 10000);
|
||||
LocalFree(tmp);
|
||||
|
||||
buf = SOCKETS_G(strerror_buf);
|
||||
@@ -483,18 +483,18 @@ PHP_MINFO_FUNCTION(sockets)
|
||||
/* {{{ PHP_RINIT_FUNCTION */
|
||||
PHP_RINIT_FUNCTION(sockets)
|
||||
{
|
||||
return SUCCESS;
|
||||
if ((SOCKETS_G(strerror_buf) = emalloc(16384)))
|
||||
return SUCCESS;
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_RSHUTDOWN_FUNCTION */
|
||||
PHP_RSHUTDOWN_FUNCTION(sockets)
|
||||
{
|
||||
if (SOCKETS_G(strerror_buf)) {
|
||||
efree(SOCKETS_G(strerror_buf));
|
||||
SOCKETS_G(strerror_buf) = NULL;
|
||||
}
|
||||
|
||||
efree(SOCKETS_G(strerror_buf));
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+6
-26
@@ -543,14 +543,6 @@ static int array_user_compare(const void *a, const void *b TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
/* check is comparison function is valid */
|
||||
#define PHP_ARRAY_CMP_FUNC_CHECK(func_name) \
|
||||
if (!zend_is_callable(*func_name, 0, NULL)) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid comparison function."); \
|
||||
BG(user_compare_func_name) = old_compare_func; \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
|
||||
/* {{{ proto bool usort(array array_arg, string cmp_function)
|
||||
Sort an array by values using a user-defined comparison function */
|
||||
PHP_FUNCTION(usort)
|
||||
@@ -570,9 +562,6 @@ PHP_FUNCTION(usort)
|
||||
BG(user_compare_func_name) = old_compare_func;
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ARRAY_CMP_FUNC_CHECK(BG(user_compare_func_name))
|
||||
|
||||
if (zend_hash_sort(target_hash, zend_qsort, array_user_compare, 1 TSRMLS_CC) == FAILURE) {
|
||||
BG(user_compare_func_name) = old_compare_func;
|
||||
RETURN_FALSE;
|
||||
@@ -601,9 +590,6 @@ PHP_FUNCTION(uasort)
|
||||
BG(user_compare_func_name) = old_compare_func;
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ARRAY_CMP_FUNC_CHECK(BG(user_compare_func_name))
|
||||
|
||||
if (zend_hash_sort(target_hash, zend_qsort, array_user_compare, 0 TSRMLS_CC) == FAILURE) {
|
||||
BG(user_compare_func_name) = old_compare_func;
|
||||
RETURN_FALSE;
|
||||
@@ -679,9 +665,6 @@ PHP_FUNCTION(uksort)
|
||||
BG(user_compare_func_name) = old_compare_func;
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ARRAY_CMP_FUNC_CHECK(BG(user_compare_func_name))
|
||||
|
||||
if (zend_hash_sort(target_hash, zend_qsort, array_user_key_compare, 0 TSRMLS_CC) == FAILURE) {
|
||||
BG(user_compare_func_name) = old_compare_func;
|
||||
RETURN_FALSE;
|
||||
@@ -1260,7 +1243,7 @@ PHP_FUNCTION(extract)
|
||||
/* break omitted intentionally */
|
||||
|
||||
case EXTR_PREFIX_ALL:
|
||||
if (final_name.len == 0 && var_name_len != 0) {
|
||||
if (final_name.len == 0) {
|
||||
smart_str_appendl(&final_name, Z_STRVAL_PP(prefix), Z_STRLEN_PP(prefix));
|
||||
smart_str_appendc(&final_name, '_');
|
||||
smart_str_appendl(&final_name, var_name, var_name_len);
|
||||
@@ -1290,16 +1273,13 @@ PHP_FUNCTION(extract)
|
||||
if (extract_refs) {
|
||||
zval **orig_var;
|
||||
|
||||
SEPARATE_ZVAL_TO_MAKE_IS_REF(entry);
|
||||
zval_add_ref(entry);
|
||||
|
||||
if (zend_hash_find(EG(active_symbol_table), final_name.c, final_name.len+1, (void **) &orig_var) == SUCCESS) {
|
||||
zval_ptr_dtor(orig_var);
|
||||
|
||||
SEPARATE_ZVAL_TO_MAKE_IS_REF(entry);
|
||||
zval_add_ref(entry);
|
||||
|
||||
*orig_var = *entry;
|
||||
} else {
|
||||
(*entry)->is_ref = 1;
|
||||
zval_add_ref(entry);
|
||||
zend_hash_update(EG(active_symbol_table), final_name.c, final_name.len+1, (void **) entry, sizeof(zval *), NULL);
|
||||
}
|
||||
} else {
|
||||
@@ -1586,7 +1566,7 @@ HashTable* php_splice(HashTable *in_hash, int offset, int length,
|
||||
/* ..and the length */
|
||||
if (length < 0) {
|
||||
length = num_in-offset+length;
|
||||
} else if (((unsigned) offset + (unsigned) length) > num_in) {
|
||||
} else if (offset+length > num_in) {
|
||||
length = num_in-offset;
|
||||
}
|
||||
|
||||
@@ -1963,7 +1943,7 @@ PHP_FUNCTION(array_slice)
|
||||
/* ..and the length */
|
||||
if (length_val < 0) {
|
||||
length_val = num_in-offset_val+length_val;
|
||||
} else if (((unsigned) offset_val + (unsigned)length_val) > num_in) {
|
||||
} else if (offset_val+length_val > num_in) {
|
||||
length_val = num_in-offset_val;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,10 +32,6 @@
|
||||
#include "ext/session/php_session.h"
|
||||
#include "zend_operators.h"
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#include "win32/php_win32_globals.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
@@ -498,9 +494,7 @@ function_entry basic_functions[] = {
|
||||
PHP_FE(log, NULL)
|
||||
PHP_FE(log10, NULL)
|
||||
PHP_FE(sqrt, NULL)
|
||||
#ifdef HAVE_HYPOT
|
||||
PHP_FE(hypot, NULL)
|
||||
#endif
|
||||
PHP_FE(deg2rad, NULL)
|
||||
PHP_FE(rad2deg, NULL)
|
||||
PHP_FE(bindec, NULL)
|
||||
@@ -1002,53 +996,12 @@ static void basic_globals_dtor(php_basic_globals *basic_globals_p TSRMLS_DC)
|
||||
}
|
||||
|
||||
|
||||
#define PHP_DOUBLE_INFINITY_HIGH 0x7ff00000
|
||||
#define PHP_DOUBLE_QUIET_NAN_HIGH 0xfff80000
|
||||
|
||||
PHPAPI double php_get_nan(void)
|
||||
{
|
||||
#if HAVE_HUGE_VAL_NAN
|
||||
return HUGE_VAL + -HUGE_VAL;
|
||||
#elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha)
|
||||
double val = 0.0;
|
||||
((php_uint32*)&val)[1] = PHP_DOUBLE_QUIET_NAN_HIGH;
|
||||
((php_uint32*)&val)[0] = 0;
|
||||
return val;
|
||||
#elif HAVE_ATOF_ACCEPTS_NAN
|
||||
return atof("NAN");
|
||||
#else
|
||||
return 0.0/0.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
PHPAPI double php_get_inf(void)
|
||||
{
|
||||
#if HAVE_HUGE_VAL_INF
|
||||
return HUGE_VAL;
|
||||
#elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha)
|
||||
double val = 0.0;
|
||||
((php_uint32*)&val)[1] = PHP_DOUBLE_INFINITY_HIGH;
|
||||
((php_uint32*)&val)[0] = 0;
|
||||
return val;
|
||||
#elif HAVE_ATOF_ACCEPTS_INF
|
||||
return atof("INF");
|
||||
#else
|
||||
return 1.0/0.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
PHP_MINIT_FUNCTION(basic)
|
||||
{
|
||||
#ifdef ZTS
|
||||
ts_allocate_id(&basic_globals_id, sizeof(php_basic_globals), (ts_allocate_ctor) basic_globals_ctor, (ts_allocate_dtor) basic_globals_dtor);
|
||||
#ifdef PHP_WIN32
|
||||
ts_allocate_id(&php_win32_core_globals_id, sizeof(php_win32_core_globals), (ts_allocate_ctor)php_win32_core_globals_ctor, NULL);
|
||||
#endif
|
||||
#else
|
||||
basic_globals_ctor(&basic_globals TSRMLS_CC);
|
||||
#ifdef PHP_WIN32
|
||||
php_win32_core_globals_ctor(&php_win32_core_globals TSRMLS_CC);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -1074,8 +1027,6 @@ PHP_MINIT_FUNCTION(basic)
|
||||
REGISTER_MATH_CONSTANT(M_2_SQRTPI);
|
||||
REGISTER_MATH_CONSTANT(M_SQRT2);
|
||||
REGISTER_MATH_CONSTANT(M_SQRT1_2);
|
||||
REGISTER_DOUBLE_CONSTANT("INF", php_get_inf(), CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_DOUBLE_CONSTANT("NAN", php_get_nan(), CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
#if ENABLE_TEST_CLASS
|
||||
test_class_startup();
|
||||
@@ -1135,9 +1086,6 @@ PHP_MSHUTDOWN_FUNCTION(basic)
|
||||
{
|
||||
#ifdef ZTS
|
||||
ts_free_id(basic_globals_id);
|
||||
#ifdef PHP_WIN32
|
||||
ts_free_id(php_win32_core_globals_id);
|
||||
#endif
|
||||
#else
|
||||
basic_globals_dtor(&basic_globals TSRMLS_CC);
|
||||
#endif
|
||||
@@ -1201,9 +1149,6 @@ PHP_RINIT_FUNCTION(basic)
|
||||
/* Reset magic_quotes_runtime */
|
||||
PG(magic_quotes_runtime) = INI_BOOL("magic_quotes_runtime");
|
||||
|
||||
/* Default to global wrappers only */
|
||||
FG(stream_wrappers) = NULL;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1227,12 +1172,6 @@ PHP_RSHUTDOWN_FUNCTION(basic)
|
||||
}
|
||||
STR_FREE(BG(locale_string));
|
||||
|
||||
if (FG(stream_wrappers)) {
|
||||
zend_hash_destroy(FG(stream_wrappers));
|
||||
efree(FG(stream_wrappers));
|
||||
FG(stream_wrappers) = NULL;
|
||||
}
|
||||
|
||||
PHP_RSHUTDOWN(fsock) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
|
||||
PHP_RSHUTDOWN(filestat) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
|
||||
PHP_RSHUTDOWN(syslog) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
|
||||
|
||||
@@ -211,7 +211,4 @@ typedef struct {
|
||||
#define SAFE_MODE_PROTECTED_ENV_VARS "LD_LIBRARY_PATH"
|
||||
#define SAFE_MODE_ALLOWED_ENV_VARS "PHP_"
|
||||
|
||||
PHPAPI double php_get_nan();
|
||||
PHPAPI double php_get_inf();
|
||||
|
||||
#endif /* BASIC_FUNCTIONS_H */
|
||||
@@ -263,137 +263,6 @@ if test "$PHP_SAPI" = "cgi" -o "$PHP_SAPI" = "cli" -o "$PHP_SAPI" = "embed"; the
|
||||
AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function])
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(fpclass isinf isnan)
|
||||
|
||||
AC_CACHE_CHECK(whether atof() accepts NAN, ac_cv_atof_accept_nan,[
|
||||
AC_TRY_RUN([
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_ISNAN
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
#else
|
||||
#define zend_isnan(a) 0
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
return zend_isnan(atof("NAN")) ? 0 : 1;
|
||||
}
|
||||
],[
|
||||
ac_cv_atof_accept_nan=yes
|
||||
],[
|
||||
ac_cv_atof_accept_nan=no
|
||||
],[
|
||||
ac_cv_atof_accept_nan=no
|
||||
])
|
||||
])
|
||||
if test "$ac_cv_atof_accept_nan" = "yes"; then
|
||||
AC_DEFINE([HAVE_ATOF_ACCEPTS_NAN], 1, [whether atof() accepts NAN])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether atof() accepts INF, ac_cv_atof_accept_inf,[
|
||||
AC_TRY_RUN([
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
#define zend_isinf(a) (((a)==INFINITY)?1:0)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
|
||||
#else
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
return zend_isinf(atof("INF")) && zend_isinf(atof("-INF")) ? 0 : 1;
|
||||
}
|
||||
],[
|
||||
ac_cv_atof_accept_inf=yes
|
||||
],[
|
||||
ac_cv_atof_accept_inf=no
|
||||
],[
|
||||
ac_cv_atof_accept_inf=no
|
||||
])
|
||||
])
|
||||
if test "$ac_cv_atof_accept_inf" = "yes"; then
|
||||
AC_DEFINE([HAVE_ATOF_ACCEPTS_INF], 1, [whether atof() accepts INF])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether HUGE_VAL == INF, ac_cv_huge_val_inf,[
|
||||
AC_TRY_RUN([
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
#define zend_isinf(a) (((a)==INFINITY)?1:0)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
|
||||
#else
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
return zend_isinf(HUGE_VAL) ? 0 : 1;
|
||||
}
|
||||
],[
|
||||
ac_cv_huge_val_inf=yes
|
||||
],[
|
||||
ac_cv_huge_val_inf=no
|
||||
],[
|
||||
ac_cv_huge_val_inf=yes
|
||||
])
|
||||
])
|
||||
dnl This is the most probable fallback so we assume yes in case of cross compile.
|
||||
if test "$ac_cv_huge_val_inf" = "yes"; then
|
||||
AC_DEFINE([HAVE_HUGE_VAL_INF], 1, [whether HUGE_VAL == INF])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether HUGE_VAL + -HUGEVAL == NAN, ac_cv_huge_val_nan,[
|
||||
AC_TRY_RUN([
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_ISNAN
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
#else
|
||||
#define zend_isnan(a) 0
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
#if defined(__sparc__) && !(__GNUC__ >= 3)
|
||||
/* prevent bug #27830 */
|
||||
return 1;
|
||||
#else
|
||||
return zend_isnan(HUGE_VAL + -HUGE_VAL) ? 0 : 1;
|
||||
#endif
|
||||
}
|
||||
],[
|
||||
ac_cv_huge_val_nan=yes
|
||||
],[
|
||||
ac_cv_huge_val_nan=no
|
||||
],[
|
||||
ac_cv_huge_val_nan=yes
|
||||
])
|
||||
])
|
||||
dnl This is the most probable fallback so we assume yes in case of cross compile.
|
||||
if test "$ac_cv_huge_val_nan" = "yes"; then
|
||||
AC_DEFINE([HAVE_HUGE_VAL_NAN], 1, [whether HUGE_VAL + -HUGEVAL == NAN])
|
||||
fi
|
||||
|
||||
PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \
|
||||
cyr_convert.c datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \
|
||||
flock_compat.c formatted_print.c fsock.c head.c html.c image.c \
|
||||
|
||||
@@ -87,11 +87,9 @@ PHPAPI void php_print_credits(int flag)
|
||||
|
||||
if (flag & PHP_CREDITS_DOCS) {
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_colspan_header(2, "PHP Documentation");
|
||||
CREDIT_LINE("Authors", "Mehdi Achour, Friedhelm Betz, Antony Dovgal, Nuno Lopes, Philip Olson, Georg Richter, Damien Seguy, Jakub Vrana");
|
||||
CREDIT_LINE("Editor", "Gabor Hojtsy");
|
||||
CREDIT_LINE("User Note Maintainers", "Mehdi Achour, Friedhelm Betz, Vincent Gevers, Aidan Lister, Nuno Lopes, Tom Sommer");
|
||||
CREDIT_LINE("Other Contributors", "Previously active authors, editors and other contributors are listed in the manual.");
|
||||
php_info_print_table_header(1, "PHP Documentation Team");
|
||||
php_info_print_table_row(1, "Jouni Ahto, Alexander Aulbach, Stig Bakken, Rasmus Lerdorf, Egon Schmid, Lars Torben Wilson, Jim Winstead");
|
||||
php_info_print_table_row(1, "Edited by: Stig Bakken and Egon Schmid");
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ CREDIT_LINE("HyperWave", "Uwe Steinmann");
|
||||
CREDIT_LINE("IMAP", "Rex Logan, Mark Musone, Brian Wang, Kaj-Michael Lang, Antoni Pamies Olive, Rasmus Lerdorf, Andrew Skalski, Chuck Hagenbuch, Daniel R Kalowsky");
|
||||
CREDIT_LINE("Informix", "Danny Heijl, Christian Cartus, Corne' Cornelius");
|
||||
CREDIT_LINE("Ingres II", "David Hénot");
|
||||
CREDIT_LINE("InterBase", "Jouni Ahto, Andrew Avdeev, Ard Biesheuvel");
|
||||
CREDIT_LINE("InterBase", "Jouni Ahto, Andrew Avdeev");
|
||||
CREDIT_LINE("IRCG", "Sascha Schumann");
|
||||
CREDIT_LINE("Java", "Sam Ruby");
|
||||
CREDIT_LINE("LDAP", "Amitay Isaacs, Eric Warnke, Rasmus Lerdorf, Gerrit Thomson, Stig Venaas");
|
||||
|
||||
+40
-49
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
| 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 |
|
||||
@@ -18,8 +18,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
#include "php.h"
|
||||
#include "zend_operators.h"
|
||||
#include "datetime.h"
|
||||
@@ -33,21 +35,22 @@
|
||||
|
||||
#include "php_parsedate.h"
|
||||
|
||||
char *mon_full_names[] = {
|
||||
char *mon_full_names[] =
|
||||
{
|
||||
"January", "February", "March", "April",
|
||||
"May", "June", "July", "August",
|
||||
"September", "October", "November", "December"
|
||||
};
|
||||
|
||||
char *mon_short_names[] = {
|
||||
char *mon_short_names[] =
|
||||
{
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
char *day_full_names[] = {
|
||||
char *day_full_names[] =
|
||||
{
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
};
|
||||
|
||||
char *day_short_names[] = {
|
||||
char *day_short_names[] =
|
||||
{
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||
};
|
||||
|
||||
@@ -59,12 +62,13 @@ extern time_t timezone;
|
||||
extern int daylight;
|
||||
#endif
|
||||
|
||||
static int phpday_tab[2][12] = {
|
||||
static int phpday_tab[2][12] =
|
||||
{
|
||||
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
|
||||
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
|
||||
};
|
||||
|
||||
#define isleap(year) ((((year) % 4) == 0 && ((year) % 100) != 0) || ((year) % 400)==0)
|
||||
#define isleap(year) (((year%4) == 0 && (year%100)!=0) || (year%400)==0)
|
||||
#define YEAR_BASE 1900
|
||||
|
||||
/* {{{ proto int time(void)
|
||||
@@ -83,8 +87,7 @@ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
struct tm *ta, tmbuf;
|
||||
time_t t, seconds;
|
||||
int i, gmadjust, arg_count = ZEND_NUM_ARGS();
|
||||
int is_dst = -1, chgsecs = 0;
|
||||
long val;
|
||||
int is_dst = -1, val, chgsecs = 0;
|
||||
|
||||
if (arg_count > 7 || zend_get_parameters_array_ex(arg_count, arguments) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -189,14 +192,14 @@ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
/* fall-through */
|
||||
case 1: /* hour */
|
||||
val = (*arguments[0])->value.lval;
|
||||
/*
|
||||
We avoid midnight and a couple of hours after midnight here to work around
|
||||
various OS-level bugs in mktime and specifically daylight savings time issues
|
||||
in many mktime implementation.
|
||||
See bugs #27533 and #27719 for more info.
|
||||
/*
|
||||
We don't use 1 here to work around problems in some mktime implementations
|
||||
when it comes to daylight savings time. Setting it to 2 and working back from
|
||||
there with the chgsecs offset makes us immune to these problems.
|
||||
See http://bugs.php.net/27533 for more info.
|
||||
*/
|
||||
if (val < 4) {
|
||||
chgsecs += (4-val) * 60*60; val = 4;
|
||||
if (val < 2) {
|
||||
chgsecs += (2-val) * 60*60; val = 2;
|
||||
}
|
||||
ta->tm_hour = val;
|
||||
/* fall-through */
|
||||
@@ -215,26 +218,16 @@ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
|
||||
seconds = t - chgsecs;
|
||||
|
||||
/*
|
||||
Here we check to see if the chgsecs fuzz factor we applied caused us to
|
||||
move from dst to non-dst or vice-versa. If so we adjust accordingly to
|
||||
avoid being off by an hour on the dst changeover date.
|
||||
*/
|
||||
if (is_dst == -1) {
|
||||
struct tm t1, t2;
|
||||
t1 = *localtime(&t);
|
||||
t2 = *localtime(&seconds);
|
||||
|
||||
if (t1.tm_isdst != t2.tm_isdst) {
|
||||
if(t1.tm_isdst != t2.tm_isdst) {
|
||||
seconds += (t1.tm_isdst == 1) ? 3600 : -3600;
|
||||
ta = localtime(&seconds);
|
||||
}
|
||||
|
||||
/*
|
||||
If the user didn't specify whether the timestamp passed in was dst or not
|
||||
then we fill it in based on the dst setting at the evaluated timestamp
|
||||
at the current TZ
|
||||
*/
|
||||
is_dst = ta->tm_isdst;
|
||||
}
|
||||
|
||||
@@ -281,7 +274,8 @@ PHP_FUNCTION(gmmktime)
|
||||
|
||||
/* {{{ php_date
|
||||
*/
|
||||
static void php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
static void
|
||||
php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
{
|
||||
pval **format, **timestamp;
|
||||
time_t the_time;
|
||||
@@ -404,7 +398,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
size += 2;
|
||||
break;
|
||||
case '\\':
|
||||
if (i < Z_STRLEN_PP(format) - 1) {
|
||||
if(i < Z_STRLEN_PP(format)-1) {
|
||||
i++;
|
||||
}
|
||||
size ++;
|
||||
@@ -424,9 +418,9 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
for (i = 0; i < Z_STRLEN_PP(format); i++) {
|
||||
switch (Z_STRVAL_PP(format)[i]) {
|
||||
case '\\':
|
||||
if (i < Z_STRLEN_PP(format) - 1) {
|
||||
if(i < Z_STRLEN_PP(format)-1) {
|
||||
char ch[2];
|
||||
ch[0]=Z_STRVAL_PP(format)[i + 1];
|
||||
ch[0]=Z_STRVAL_PP(format)[i+1];
|
||||
ch[1]='\0';
|
||||
strcat(Z_STRVAL_P(return_value), ch);
|
||||
i++;
|
||||
@@ -578,8 +572,8 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'r':
|
||||
#if HAVE_TM_GMTOFF
|
||||
sprintf(tmp_buff, "%3s, %2d %3s %04d %02d:%02d:%02d %c%02d%02d",
|
||||
#if HAVE_TM_GMTOFF
|
||||
sprintf(tmp_buff, "%3s, %2d %3s %04d %02d:%02d:%02d %c%02d%02d",
|
||||
day_short_names[ta->tm_wday],
|
||||
ta->tm_mday,
|
||||
mon_short_names[ta->tm_mon],
|
||||
@@ -592,7 +586,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
abs( (ta->tm_gmtoff % 3600) / 60 )
|
||||
);
|
||||
#else
|
||||
sprintf(tmp_buff, "%3s, %2d %3s %04d %02d:%02d:%02d %c%02d%02d",
|
||||
sprintf(tmp_buff, "%3s, %2d %3s %04d %02d:%02d:%02d %c%02d%02d",
|
||||
day_short_names[ta->tm_wday],
|
||||
ta->tm_mday,
|
||||
mon_short_names[ta->tm_mon],
|
||||
@@ -608,7 +602,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
strcat(Z_STRVAL_P(return_value), tmp_buff);
|
||||
break;
|
||||
case 'W': /* ISO-8601 week number of year, weeks starting on Monday */
|
||||
wd = ta->tm_wday == 0 ? 6 : ta->tm_wday - 1; /* weekday */
|
||||
wd = ta->tm_wday==0 ? 6 : ta->tm_wday-1;/* weekday */
|
||||
yd = ta->tm_yday + 1; /* days since January 1st */
|
||||
|
||||
fd = (7 + wd - yd % 7+ 1) % 7; /* weekday (1st January) */
|
||||
@@ -765,10 +759,11 @@ PHP_FUNCTION(getdate)
|
||||
|
||||
/* {{{ php_std_date
|
||||
Return date string in standard format for http headers */
|
||||
char *php_std_date(time_t t TSRMLS_DC)
|
||||
char *php_std_date(time_t t)
|
||||
{
|
||||
struct tm *tm1, tmbuf;
|
||||
char *str;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
tm1 = php_gmtime_r(&t, &tmbuf);
|
||||
str = emalloc(81);
|
||||
@@ -777,18 +772,18 @@ char *php_std_date(time_t t TSRMLS_DC)
|
||||
day_short_names[tm1->tm_wday],
|
||||
tm1->tm_mday,
|
||||
mon_short_names[tm1->tm_mon],
|
||||
tm1->tm_year + 1900,
|
||||
tm1->tm_year+1900,
|
||||
tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
|
||||
} else {
|
||||
snprintf(str, 80, "%s, %02d-%s-%02d %02d:%02d:%02d GMT",
|
||||
day_short_names[tm1->tm_wday],
|
||||
tm1->tm_mday,
|
||||
mon_short_names[tm1->tm_mon],
|
||||
((tm1->tm_year) % 100),
|
||||
((tm1->tm_year)%100),
|
||||
tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
|
||||
}
|
||||
|
||||
str[79] = 0;
|
||||
str[79]=0;
|
||||
return (str);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -845,11 +840,9 @@ void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
if (Z_STRLEN_PP(format_arg)==0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#ifdef PHP_WIN32
|
||||
if (timestamp < 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#endif
|
||||
format = Z_STRVAL_PP(format_arg);
|
||||
if (gm) {
|
||||
ta = php_gmtime_r(×tamp, &tmbuf);
|
||||
@@ -861,13 +854,11 @@ void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
while ((real_len=strftime(buf, buf_len, format, ta))==buf_len || real_len==0) {
|
||||
buf_len *= 2;
|
||||
buf = (char *) erealloc(buf, buf_len);
|
||||
if (!--max_reallocs) {
|
||||
break;
|
||||
}
|
||||
if(!--max_reallocs) break;
|
||||
}
|
||||
|
||||
if (real_len && real_len != buf_len) {
|
||||
buf = (char *) erealloc(buf, real_len + 1);
|
||||
if(real_len && real_len != buf_len) {
|
||||
buf = (char *) erealloc(buf, real_len+1);
|
||||
RETURN_STRINGL(buf, real_len, 0);
|
||||
}
|
||||
efree(buf);
|
||||
|
||||
@@ -36,7 +36,7 @@ PHP_FUNCTION(gmstrftime);
|
||||
#endif
|
||||
PHP_FUNCTION(strtotime);
|
||||
|
||||
extern char *php_std_date(time_t t TSRMLS_DC);
|
||||
extern char *php_std_date(time_t t);
|
||||
void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm);
|
||||
#if HAVE_STRFTIME
|
||||
void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
|
||||
|
||||
+2
-7
@@ -370,13 +370,12 @@ PHP_FUNCTION(glob)
|
||||
if (!result) {
|
||||
cwd[0] = '\0';
|
||||
}
|
||||
cwd_skip = strlen(cwd)+1;
|
||||
#ifdef PHP_WIN32
|
||||
if (IS_SLASH(*pattern)) {
|
||||
if (IS_SLASH(cwd[0]) && !IS_UNC_PATH(pattern, pattern_len)) {
|
||||
cwd[2] = '\0';
|
||||
}
|
||||
#endif
|
||||
cwd_skip = strlen(cwd)+1;
|
||||
|
||||
snprintf(work_pattern, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, pattern);
|
||||
pattern = work_pattern;
|
||||
}
|
||||
@@ -390,12 +389,8 @@ PHP_FUNCTION(glob)
|
||||
* doesn't. This ensure that if no match is found, an empty array
|
||||
* is always returned so it can be used without worrying in e.g.
|
||||
* foreach() */
|
||||
#ifndef __linux__
|
||||
RETURN_FALSE;
|
||||
#else
|
||||
array_init(return_value);
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
RETURN_FALSE;
|
||||
|
||||
+1
-11
@@ -410,7 +410,6 @@ char *php_escape_shell_cmd(char *str) {
|
||||
switch (str[x]) {
|
||||
case '"':
|
||||
case '\'':
|
||||
#ifndef PHP_WIN32
|
||||
if (!p && (p = memchr(str + x + 1, str[x], l - x - 1))) {
|
||||
/* noop */
|
||||
} else if (p && *p == str[x]) {
|
||||
@@ -420,7 +419,6 @@ char *php_escape_shell_cmd(char *str) {
|
||||
}
|
||||
cmd[y++] = str[x];
|
||||
break;
|
||||
#endif
|
||||
case '#': /* This is character-set independent */
|
||||
case '&':
|
||||
case ';':
|
||||
@@ -442,12 +440,6 @@ char *php_escape_shell_cmd(char *str) {
|
||||
case '\\':
|
||||
case '\x0A': /* excluding these two */
|
||||
case '\xFF':
|
||||
#ifdef PHP_WIN32
|
||||
/* since Windows does not allow us to escape these chars, just remove them */
|
||||
case '%':
|
||||
cmd[y++] = ' ';
|
||||
break;
|
||||
#endif
|
||||
cmd[y++] = '\\';
|
||||
/* fall-through */
|
||||
default:
|
||||
@@ -480,9 +472,7 @@ char *php_escape_shell_arg(char *str) {
|
||||
switch (str[x]) {
|
||||
#ifdef PHP_WIN32
|
||||
case '"':
|
||||
case '%':
|
||||
cmd[y++] = ' ';
|
||||
break;
|
||||
cmd[y++] = '\\';
|
||||
#else
|
||||
case '\'':
|
||||
cmd[y++] = '\'';
|
||||
|
||||
+64
-66
@@ -179,7 +179,7 @@ PHP_MINIT_FUNCTION(file)
|
||||
#endif
|
||||
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
|
||||
REGISTER_LONG_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -196,11 +196,11 @@ PHP_MINIT_FUNCTION(file)
|
||||
REGISTER_LONG_CONSTANT("STREAM_NOTIFY_REDIRECTED", PHP_STREAM_NOTIFY_REDIRECTED, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("STREAM_NOTIFY_PROGRESS", PHP_STREAM_NOTIFY_PROGRESS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FAILURE", PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
|
||||
REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_INFO", PHP_STREAM_NOTIFY_SEVERITY_INFO, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_WARN", PHP_STREAM_NOTIFY_SEVERITY_WARN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_ERR", PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
|
||||
#ifdef HAVE_FNMATCH
|
||||
REGISTER_LONG_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FNM_PATHNAME", FNM_PATHNAME, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -267,7 +267,7 @@ PHP_FUNCTION(flock)
|
||||
Z_LVAL_PP(arg3) = 1;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
@@ -396,7 +396,7 @@ PHP_FUNCTION(get_meta_tags)
|
||||
/* For BC */
|
||||
php_strtolower(name, strlen(name));
|
||||
if (have_content) {
|
||||
add_assoc_string(return_value, name, value, 0);
|
||||
add_assoc_string(return_value, name, value, 0);
|
||||
} else {
|
||||
add_assoc_string(return_value, name, empty_string, 0);
|
||||
}
|
||||
@@ -407,7 +407,7 @@ PHP_FUNCTION(get_meta_tags)
|
||||
}
|
||||
|
||||
name = value = NULL;
|
||||
|
||||
|
||||
/* Reset all of our flags */
|
||||
in_tag = looking_for_val = 0;
|
||||
have_name = saw_name = 0;
|
||||
@@ -445,7 +445,7 @@ PHP_FUNCTION(file_get_contents)
|
||||
return;
|
||||
}
|
||||
|
||||
stream = php_stream_open_wrapper(filename, "rb",
|
||||
stream = php_stream_open_wrapper(filename, "rb",
|
||||
(use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS,
|
||||
NULL);
|
||||
if (!stream) {
|
||||
@@ -472,7 +472,7 @@ PHP_FUNCTION(file_get_contents)
|
||||
}
|
||||
|
||||
php_stream_close(stream);
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -498,7 +498,7 @@ PHP_FUNCTION(file)
|
||||
return;
|
||||
}
|
||||
|
||||
stream = php_stream_open_wrapper(filename, "rb",
|
||||
stream = php_stream_open_wrapper(filename, "rb",
|
||||
(use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS,
|
||||
NULL);
|
||||
if (!stream) {
|
||||
@@ -511,16 +511,16 @@ PHP_FUNCTION(file)
|
||||
if ((target_len = php_stream_copy_to_mem(stream, &target_buf, PHP_STREAM_COPY_ALL, 0))) {
|
||||
s = target_buf;
|
||||
e = target_buf + target_len;
|
||||
|
||||
|
||||
if (!(p = php_stream_locate_eol(stream, target_buf, target_len TSRMLS_CC))) {
|
||||
p = e;
|
||||
goto parse_eol;
|
||||
}
|
||||
|
||||
|
||||
if (stream->flags & PHP_STREAM_FLAG_EOL_MAC) {
|
||||
eol_marker = '\r';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
do {
|
||||
p++;
|
||||
parse_eol:
|
||||
@@ -533,7 +533,7 @@ parse_eol:
|
||||
}
|
||||
s = p;
|
||||
} while ((p = memchr(p, eol_marker, (e-p))));
|
||||
|
||||
|
||||
/* handle any left overs of files without new lines */
|
||||
if (s != e) {
|
||||
p = e;
|
||||
@@ -543,7 +543,7 @@ parse_eol:
|
||||
|
||||
if (target_buf) {
|
||||
efree(target_buf);
|
||||
}
|
||||
}
|
||||
php_stream_close(stream);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -567,7 +567,7 @@ PHP_FUNCTION(tempnam)
|
||||
if (php_check_open_basedir(Z_STRVAL_PP(arg1) TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
d = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1));
|
||||
strlcpy(p, Z_STRVAL_PP(arg2), sizeof(p));
|
||||
|
||||
@@ -586,7 +586,7 @@ PHP_FUNCTION(tempnam)
|
||||
PHP_NAMED_FUNCTION(php_if_tmpfile)
|
||||
{
|
||||
php_stream *stream;
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() != 0) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
@@ -616,7 +616,7 @@ PHP_FUNCTION(stream_get_meta_data)
|
||||
PHP_STREAM_TO_ZVAL(stream, arg1);
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
|
||||
if (stream->wrapperdata) {
|
||||
MAKE_STD_ZVAL(newval);
|
||||
*newval = *(stream->wrapperdata);
|
||||
@@ -632,19 +632,19 @@ PHP_FUNCTION(stream_get_meta_data)
|
||||
|
||||
if (stream->filterhead) {
|
||||
php_stream_filter *filter;
|
||||
|
||||
|
||||
MAKE_STD_ZVAL(newval);
|
||||
array_init(newval);
|
||||
|
||||
|
||||
for (filter = stream->filterhead; filter != NULL; filter = filter->next) {
|
||||
add_next_index_string(newval, (char *)filter->fops->label, 1);
|
||||
}
|
||||
|
||||
add_assoc_zval(return_value, "filters", newval);
|
||||
}
|
||||
|
||||
|
||||
add_assoc_long(return_value, "unread_bytes", stream->writepos - stream->readpos);
|
||||
|
||||
|
||||
if (php_stream_is(stream, PHP_STREAM_IS_SOCKET)) {
|
||||
php_netstream_data_t *sock = PHP_NETSTREAM_DATA_FROM_STREAM(stream);
|
||||
|
||||
@@ -705,7 +705,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
|
||||
|
||||
ALLOC_HASHTABLE(new_hash);
|
||||
zend_hash_init(new_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
|
||||
|
||||
for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array));
|
||||
zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS;
|
||||
zend_hash_move_forward(Z_ARRVAL_P(stream_array))) {
|
||||
@@ -714,7 +714,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
|
||||
if (stream == NULL)
|
||||
continue;
|
||||
|
||||
/* get the fd
|
||||
/* get the fd
|
||||
* NB: Most other code will NOT use the PHP_STREAM_CAST_INTERNAL flag
|
||||
* when casting. It is only used here so that the buffered data warning
|
||||
* is not displayed.
|
||||
@@ -736,7 +736,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
|
||||
|
||||
zend_hash_internal_pointer_reset(new_hash);
|
||||
Z_ARRVAL_P(stream_array) = new_hash;
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -752,7 +752,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array TSRMLS_DC)
|
||||
|
||||
ALLOC_HASHTABLE(new_hash);
|
||||
zend_hash_init(new_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
|
||||
|
||||
for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array));
|
||||
zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS;
|
||||
zend_hash_move_forward(Z_ARRVAL_P(stream_array))) {
|
||||
@@ -787,7 +787,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array TSRMLS_DC)
|
||||
zend_hash_destroy(new_hash);
|
||||
FREE_HASHTABLE(new_hash);
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -844,7 +844,7 @@ PHP_FUNCTION(stream_select)
|
||||
RETURN_LONG(retval);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
retval = select(max_fd+1, &rfds, &wfds, &efds, tv_p);
|
||||
|
||||
if (retval == -1) {
|
||||
@@ -871,13 +871,13 @@ static void user_space_stream_notifier(php_stream_context *context, int notifyco
|
||||
zval *ps[6];
|
||||
zval **ptps[6];
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
INIT_ZVAL(zvs[i]);
|
||||
ps[i] = &zvs[i];
|
||||
ptps[i] = &ps[i];
|
||||
}
|
||||
|
||||
|
||||
ZVAL_LONG(ps[0], notifycode);
|
||||
ZVAL_LONG(ps[1], severity);
|
||||
if (xmsg) {
|
||||
@@ -912,7 +912,7 @@ static int parse_context_options(php_stream_context *context, zval *options)
|
||||
int wkey_len, okey_len;
|
||||
int ret = SUCCESS;
|
||||
ulong num_key;
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(options), &pos);
|
||||
while (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_P(options), (void**)&wval, &pos)) {
|
||||
if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(options), &wkey, &wkey_len, &num_key, 0, &pos)
|
||||
@@ -942,7 +942,7 @@ static int parse_context_params(php_stream_context *context, zval *params)
|
||||
zval **tmp;
|
||||
|
||||
if ((ret = zend_hash_find(Z_ARRVAL_P(params), "notification", sizeof("notification"), (void**)&tmp)) == SUCCESS) {
|
||||
|
||||
|
||||
if (context->notifier) {
|
||||
php_stream_notification_free(context->notifier);
|
||||
context->notifier = NULL;
|
||||
@@ -1069,12 +1069,12 @@ PHP_FUNCTION(stream_context_create)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a", ¶ms) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
context = php_stream_context_alloc();
|
||||
|
||||
|
||||
if (params)
|
||||
parse_context_options(context, params);
|
||||
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, context, le_stream_context);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1094,7 +1094,7 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS)
|
||||
}
|
||||
|
||||
PHP_STREAM_TO_ZVAL(stream, &zstream);
|
||||
|
||||
|
||||
filter = php_stream_filter_create(filtername, filterparams, filterparamslen, php_stream_is_persistent(stream) TSRMLS_CC);
|
||||
if (filter == NULL)
|
||||
RETURN_FALSE;
|
||||
@@ -1142,7 +1142,7 @@ PHP_NAMED_FUNCTION(php_if_fopen)
|
||||
if (zcontext) {
|
||||
ZEND_FETCH_RESOURCE(context, php_stream_context*, &zcontext, -1, "stream-context", le_stream_context);
|
||||
}
|
||||
|
||||
|
||||
stream = php_stream_open_wrapper_ex(filename, mode,
|
||||
(use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS,
|
||||
NULL, context);
|
||||
@@ -1191,7 +1191,7 @@ PHP_FUNCTION(popen)
|
||||
char *p, *tmp = NULL;
|
||||
char *b, buf[1024];
|
||||
php_stream *stream;
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
@@ -1224,7 +1224,6 @@ PHP_FUNCTION(popen)
|
||||
|
||||
if (!fp) {
|
||||
php_error_docref2(NULL TSRMLS_CC, buf, p, E_WARNING, "%s", strerror(errno));
|
||||
efree(p);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
@@ -1254,7 +1253,7 @@ PHP_FUNCTION(pclose)
|
||||
{
|
||||
zval **arg1;
|
||||
php_stream *stream;
|
||||
|
||||
|
||||
if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
@@ -1391,7 +1390,7 @@ PHPAPI PHP_FUNCTION(fgets)
|
||||
if (php_stream_get_line(stream, buf, len, &line_len) == NULL)
|
||||
goto exit_failed;
|
||||
}
|
||||
|
||||
|
||||
if (PG(magic_quotes_runtime)) {
|
||||
Z_STRVAL_P(return_value) = php_addslashes(buf, line_len, &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
@@ -1651,9 +1650,9 @@ PHP_FUNCTION(stream_set_write_buffer)
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
PHP_STREAM_TO_ZVAL(stream, arg1);
|
||||
|
||||
|
||||
convert_to_long_ex(arg2);
|
||||
buff = Z_LVAL_PP(arg2);
|
||||
|
||||
@@ -1803,7 +1802,7 @@ PHP_FUNCTION(readfile)
|
||||
int size=0;
|
||||
int use_include_path=0;
|
||||
php_stream *stream;
|
||||
|
||||
|
||||
/* check args */
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 1:
|
||||
@@ -1919,7 +1918,7 @@ PHP_FUNCTION(rename)
|
||||
RETURN_TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
php_error_docref2(NULL TSRMLS_CC, old_name, new_name, E_WARNING, "%s", strerror(errno));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1997,7 +1996,7 @@ PHP_NAMED_FUNCTION(php_if_fstat)
|
||||
*stat_size, *stat_atime, *stat_mtime, *stat_ctime, *stat_blksize, *stat_blocks;
|
||||
php_stream *stream;
|
||||
php_stream_statbuf stat_ssb;
|
||||
|
||||
|
||||
char *stat_sb_names[13]={"dev", "ino", "mode", "nlink", "uid", "gid", "rdev",
|
||||
"size", "atime", "mtime", "ctime", "blksize", "blocks"};
|
||||
|
||||
@@ -2020,16 +2019,16 @@ PHP_NAMED_FUNCTION(php_if_fstat)
|
||||
MAKE_LONG_ZVAL_INCREF(stat_uid, stat_ssb.sb.st_uid);
|
||||
MAKE_LONG_ZVAL_INCREF(stat_gid, stat_ssb.sb.st_gid);
|
||||
#ifdef HAVE_ST_RDEV
|
||||
MAKE_LONG_ZVAL_INCREF(stat_rdev, stat_ssb.sb.st_rdev);
|
||||
MAKE_LONG_ZVAL_INCREF(stat_rdev, stat_ssb.sb.st_rdev);
|
||||
#else
|
||||
MAKE_LONG_ZVAL_INCREF(stat_rdev, -1);
|
||||
MAKE_LONG_ZVAL_INCREF(stat_rdev, -1);
|
||||
#endif
|
||||
MAKE_LONG_ZVAL_INCREF(stat_size, stat_ssb.sb.st_size);
|
||||
MAKE_LONG_ZVAL_INCREF(stat_atime, stat_ssb.sb.st_atime);
|
||||
MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_ssb.sb.st_mtime);
|
||||
MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_ssb.sb.st_ctime);
|
||||
#ifdef HAVE_ST_BLKSIZE
|
||||
MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_ssb.sb.st_blksize);
|
||||
MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_ssb.sb.st_blksize);
|
||||
#else
|
||||
MAKE_LONG_ZVAL_INCREF(stat_blksize,-1);
|
||||
#endif
|
||||
@@ -2106,14 +2105,14 @@ PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC)
|
||||
php_stream *srcstream = NULL, *deststream = NULL;
|
||||
int ret = FAILURE;
|
||||
|
||||
srcstream = php_stream_open_wrapper(src, "rb",
|
||||
srcstream = php_stream_open_wrapper(src, "rb",
|
||||
STREAM_DISABLE_OPEN_BASEDIR | REPORT_ERRORS,
|
||||
NULL);
|
||||
|
||||
if (!srcstream)
|
||||
|
||||
if (!srcstream)
|
||||
return ret;
|
||||
|
||||
deststream = php_stream_open_wrapper(dest, "wb",
|
||||
deststream = php_stream_open_wrapper(dest, "wb",
|
||||
ENFORCE_SAFE_MODE | REPORT_ERRORS,
|
||||
NULL);
|
||||
|
||||
@@ -2157,7 +2156,7 @@ PHPAPI PHP_FUNCTION(fread)
|
||||
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
|
||||
|
||||
if (PG(magic_quotes_runtime)) {
|
||||
Z_STRVAL_P(return_value) = php_addslashes(Z_STRVAL_P(return_value),
|
||||
Z_STRVAL_P(return_value) = php_addslashes(Z_STRVAL_P(return_value),
|
||||
Z_STRLEN_P(return_value), &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
|
||||
}
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
@@ -2246,7 +2245,7 @@ PHP_FUNCTION(fgetcsv)
|
||||
/* first section exactly as php_fgetss */
|
||||
|
||||
zval **fd, **bytes, **p_delim, **p_enclosure;
|
||||
size_t len, buf_len;
|
||||
int len, buf_len;
|
||||
char *buf, *p, *s, *e, *re, *buf2=NULL;
|
||||
php_stream *stream;
|
||||
|
||||
@@ -2332,11 +2331,6 @@ PHP_FUNCTION(fgetcsv)
|
||||
} \
|
||||
}
|
||||
|
||||
if (!(e - s)) {
|
||||
CSV_ADD_ENTRY(s, e, s);
|
||||
goto done;
|
||||
}
|
||||
|
||||
csv_start:
|
||||
if (!enclosure || !(p = _php_fgetcsv_find_enclosure(s, (e - s), enclosure, 0))) {
|
||||
no_enclosure:
|
||||
@@ -2410,6 +2404,10 @@ enclosure:
|
||||
goto enclosure;
|
||||
}
|
||||
} else {
|
||||
while (e < re && e > s && *(e - 1) == enclosure) {
|
||||
e--;
|
||||
}
|
||||
|
||||
buf2 = erealloc(buf2, buf2_len + (e - s) + 1);
|
||||
memcpy(buf2 + buf2_len, s, (e - s));
|
||||
buf2_len += e - s;
|
||||
@@ -2582,13 +2580,13 @@ PHP_FUNCTION(fnmatch)
|
||||
int filename_len;
|
||||
long flags=0;
|
||||
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l",
|
||||
&pattern, &pattern_len,
|
||||
&filename, &filename_len,
|
||||
&flags)
|
||||
== FAILURE)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l",
|
||||
&pattern, &pattern_len,
|
||||
&filename, &filename_len,
|
||||
&flags)
|
||||
== FAILURE)
|
||||
return;
|
||||
|
||||
|
||||
RETURN_BOOL( ! fnmatch( pattern, filename, flags ));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -118,7 +118,6 @@ typedef struct {
|
||||
long default_socket_timeout;
|
||||
char *user_agent;
|
||||
char *user_stream_current_filename; /* for simple recursion protection */
|
||||
HashTable *stream_wrappers; /* per-request copy of url_stream_wrappers_hash */
|
||||
} php_file_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
Loaded 100 of 216 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user