1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

- cleanup broken double definition of php_win_err and rename it while being there

This commit is contained in:
Pierre Joye
2010-11-25 23:06:12 +00:00
parent 8f85ff3dd6
commit 4574844c52
10 changed files with 19 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Wed Nov 24 08:41:46 2010 */
/* Generated by re2c 0.13.5 on Thu Nov 25 23:17:48 2010 */
#line 1 "Zend/zend_language_scanner.l"
/*
+----------------------------------------------------------------------+

View File

@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Wed Nov 24 08:41:46 2010 */
/* Generated by re2c 0.13.5 on Thu Nov 25 23:17:48 2010 */
#line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE {

View File

@@ -224,7 +224,7 @@ PHP_FUNCTION(com_create_instance)
if (FAILED(res)) {
char *werr, *msg;
werr = php_win_err(res);
werr = php_win32_error_to_msg(res);
spprintf(&msg, 0, "Failed to create COM object `%s': %s", module_name, werr);
LocalFree(werr);
@@ -383,7 +383,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
case DISP_E_PARAMNOTFOUND:
case DISP_E_TYPEMISMATCH:
desc = php_win_err(hr);
desc = php_win32_error_to_msg(hr);
spprintf(&msg, 0, "Parameter %d: %s", arg_err, desc);
LocalFree(desc);
break;
@@ -399,7 +399,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
/* else fall through */
default:
desc = php_win_err(hr);
desc = php_win32_error_to_msg(hr);
spprintf(&msg, 0, "Error [0x%08x] %s", hr, desc);
LocalFree(desc);
break;
@@ -481,7 +481,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
if (FAILED(hr)) {
char *winerr = NULL;
char *msg = NULL;
winerr = php_win_err(hr);
winerr = php_win32_error_to_msg(hr);
spprintf(&msg, 0, "Unable to lookup `%s': %s", name, winerr);
LocalFree(winerr);
php_com_throw_exception(hr, msg TSRMLS_CC);
@@ -640,7 +640,7 @@ int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
hr = php_com_get_id_of_name(obj, name, namelen, &dispid TSRMLS_CC);
if (FAILED(hr)) {
winerr = php_win_err(hr);
winerr = php_win32_error_to_msg(hr);
spprintf(&msg, 0, "Unable to lookup `%s': %s", name, winerr);
LocalFree(winerr);
php_com_throw_exception(hr, msg TSRMLS_CC);

View File

@@ -199,7 +199,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
hr = dotnet_init(&where TSRMLS_CC);
if (FAILED(hr)) {
char buf[1024];
char *err = php_win_err(hr);
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to init .Net runtime [%s] %s", where, err);
if (err)
LocalFree(err);
@@ -278,7 +278,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
if (ret == FAILURE) {
char buf[1024];
char *err = php_win_err(hr);
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to instantiate .Net object [%s] [0x%08x] %s", where, hr, err);
if (err && err[0]) {
LocalFree(err);

View File

@@ -33,7 +33,7 @@ void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC)
{
int free_msg = 0;
if (message == NULL) {
message = php_win_err(code);
message = php_win32_error_to_msg(code);
free_msg = 1;
}
zend_throw_exception(php_com_exception_class_entry, message, (long)code TSRMLS_CC);

View File

@@ -54,7 +54,7 @@ PHPAPI OLECHAR *php_com_string_to_olestring(char *string, uint string_len, int c
}
if (!ok) {
char *msg = php_win_err(GetLastError());
char *msg = php_win32_error_to_msg(GetLastError());
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Could not convert string to unicode: `%s'", msg);
@@ -87,7 +87,7 @@ PHPAPI char *php_com_olestring_to_string(OLECHAR *olestring, uint *string_len, i
}
if (!ok) {
char *msg = php_win_err(err);
char *msg = php_win32_error_to_msg(err);
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Could not convert string from unicode: `%s'", msg);

View File

@@ -446,7 +446,7 @@ PHP_FUNCTION(com_variant_create_instance)
if (FAILED(res)) {
char *werr, *msg;
werr = php_win_err(res);
werr = php_win32_error_to_msg(res);
spprintf(&msg, 0, "Variant type conversion failed: %s", werr);
LocalFree(werr);
@@ -1022,7 +1022,7 @@ PHP_FUNCTION(variant_set_type)
} else {
char *werr, *msg;
werr = php_win_err(res);
werr = php_win32_error_to_msg(res);
spprintf(&msg, 0, "Variant type conversion failed: %s", werr);
LocalFree(werr);
@@ -1056,7 +1056,7 @@ PHP_FUNCTION(variant_cast)
} else {
char *werr, *msg;
werr = php_win_err(res);
werr = php_win32_error_to_msg(res);
spprintf(&msg, 0, "Variant type conversion failed: %s", werr);
LocalFree(werr);

View File

@@ -29,9 +29,6 @@
#include <dispex.h>
#include "win32/winutil.h"
/* brain-death in winutil.h defines the macro to hide the useful function... */
#undef php_win_err
typedef struct _php_com_dotnet_object {
zend_object zo;

View File

@@ -22,7 +22,7 @@
#include "php.h"
#include <wincrypt.h>
PHPAPI char *php_win_err(int error)
PHPAPI char *php_win32_error_to_msg(int error)
{
char *buf = NULL;
@@ -75,3 +75,4 @@ PHPAPI int php_win32_get_random_bytes(unsigned char *buf, size_t size) { /* {{{
return FAILURE;
}
/* }}} */

View File

@@ -16,8 +16,8 @@
+----------------------------------------------------------------------+
*/
PHPAPI char *php_win_err(int error);
PHPAPI char *php_win32_error_to_msg(int error);
#define php_win_err() php_win_err(GetLastError())
#define php_win_err() php_win32_error_to_msg(GetLastError())
int php_win32_check_trailing_space(const char * path, const int path_len);
PHPAPI php_win32_get_random_bytes(unsigned char *buf, size_t size);