com php-src: fixed 32 bit unsigned to int64 casts: ext/com_do tnet/com_extension.c ext/com_dotnet/com_misc.c

From: Date: Tue, 26 Nov 2013 16:35:25 +0000
Subject: com php-src: fixed 32 bit unsigned to int64 casts: ext/com_do tnet/com_extension.c ext/com_dotnet/com_misc.c
Groups: php.cvs 
Request: Send a blank email to [email protected] to get a copy of this message
Commit:    d508a094ae750718c6ac28fe4adf8f7ddfecef58
Author:    Anatol Belski <[email protected]>         Tue, 26 Nov 2013 17:35:25 +0100
Parents:   f88a3e7fb94cb32a6916b1cca55c381713231e96
Branches:  str_size_and_int64

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=d508a094ae750718c6ac28fe4adf8f7ddfecef58

Log:
fixed 32 bit unsigned to int64 casts

Changed paths:
  M  ext/com_dotnet/com_extension.c
  M  ext/com_dotnet/com_misc.c


Diff:
diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c
index 1257974..90453b4 100644
--- a/ext/com_dotnet/com_extension.c
+++ b/ext/com_dotnet/com_extension.c
@@ -29,6 +29,8 @@
 #include "php_com_dotnet_internal.h"
 #include "Zend/zend_exceptions.h"
 
+#include <intsafe.h>
+
 ZEND_DECLARE_MODULE_GLOBALS(com_dotnet)
 static PHP_GINIT_FUNCTION(com_dotnet);
 
@@ -382,6 +384,12 @@ PHP_MINIT_FUNCTION(com_dotnet)
 	REGISTER_INI_ENTRIES();
 
 #define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
+
+#define COM_ERR_CONST(x) { \
+	php_int_t __tmp; \
+	ULongToUIntPtr(x, &__tmp); \
+	REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
+}
 	
 	COM_CONST(CLSCTX_INPROC_SERVER);
 	COM_CONST(CLSCTX_INPROC_HANDLER);
@@ -441,10 +449,10 @@ PHP_MINIT_FUNCTION(com_dotnet)
 #ifdef NORM_IGNOREKASHIDA
 	COM_CONST(NORM_IGNOREKASHIDA);
 #endif
-	COM_CONST(DISP_E_DIVBYZERO);
-	COM_CONST(DISP_E_OVERFLOW);
-	COM_CONST(DISP_E_BADINDEX);
-	COM_CONST(MK_E_UNAVAILABLE);
+	COM_ERR_CONST(DISP_E_DIVBYZERO);
+	COM_ERR_CONST(DISP_E_OVERFLOW);
+	COM_ERR_CONST(DISP_E_BADINDEX);
+	COM_ERR_CONST(MK_E_UNAVAILABLE);
 
 	return SUCCESS;
 }
diff --git a/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c
index f1972a4..45778df 100644
--- a/ext/com_dotnet/com_misc.c
+++ b/ext/com_dotnet/com_misc.c
@@ -29,14 +29,18 @@
 #include "php_com_dotnet_internal.h"
 #include "Zend/zend_exceptions.h"
 
+#include <intsafe.h>
+
 void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC)
 {
 	int free_msg = 0;
+	php_uint_t cd;
 	if (message == NULL) {
 		message = php_win32_error_to_msg(code);
 		free_msg = 1;
 	}
-	zend_throw_exception(php_com_exception_class_entry, message, (php_int_t)code TSRMLS_CC);
+	ULongToUIntPtr(code, &cd);
+	zend_throw_exception(php_com_exception_class_entry, message, (php_int_t)cd TSRMLS_CC);
 	if (free_msg) {
 		LocalFree(message);
 	}



Thread (1 message)

  • Anatol Belski
« previous php.cvs (#74054) next »