mike Sat Oct 28 09:07:50 2006 UTC
Modified files:
/php-src/ext/sysvmsg sysvmsg.c
/php-src/ext/sysvmsg/tests 001.phpt
Log:
- convert unicode messages to strings
- mark functions unicode safe
- fix test
http://cvs.php.net/viewvc.cgi/php-src/ext/sysvmsg/sysvmsg.c?r1=1.26&r2=1.27&diff_format=u
Index: php-src/ext/sysvmsg/sysvmsg.c
diff -u php-src/ext/sysvmsg/sysvmsg.c:1.26 php-src/ext/sysvmsg/sysvmsg.c:1.27
--- php-src/ext/sysvmsg/sysvmsg.c:1.26 Sun Oct 8 13:34:24 2006
+++ php-src/ext/sysvmsg/sysvmsg.c Sat Oct 28 09:07:50 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sysvmsg.c,v 1.26 2006/10/08 13:34:24 bjori Exp $ */
+/* $Id: sysvmsg.c,v 1.27 2006/10/28 09:07:50 mike Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -144,12 +144,12 @@
{
php_info_print_table_start();
php_info_print_table_row(2, "sysvmsg support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.26 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.27 $");
php_info_print_table_end();
}
/* }}} */
-/* {{{ proto bool msg_set_queue(resource queue, array data)
+/* {{{ proto bool msg_set_queue(resource queue, array data) U
Set information for a message queue */
PHP_FUNCTION(msg_set_queue)
{
@@ -192,7 +192,7 @@
}
/* }}} */
-/* {{{ proto array msg_stat_queue(resource queue)
+/* {{{ proto array msg_stat_queue(resource queue) U
Returns information about a message queue */
PHP_FUNCTION(msg_stat_queue)
{
@@ -225,7 +225,7 @@
}
/* }}} */
-/* {{{ proto resource msg_get_queue(int key [, int perms])
+/* {{{ proto resource msg_get_queue(int key [, int perms]) U
Attach to a message queue */
PHP_FUNCTION(msg_get_queue)
{
@@ -254,7 +254,7 @@
}
/* }}} */
-/* {{{ proto bool msg_remove_queue(resource queue)
+/* {{{ proto bool msg_remove_queue(resource queue) U
Destroy the queue */
PHP_FUNCTION(msg_remove_queue)
{
@@ -275,7 +275,7 @@
}
/* }}} */
-/* {{{ proto mixed msg_receive(resource queue, int desiredmsgtype, int
&msgtype, int maxsize, mixed message [, bool unserialize=true [, int flags=0 [,
int errorcode]]])
+/* {{{ proto mixed msg_receive(resource queue, int desiredmsgtype, int
&msgtype, int maxsize, mixed message [, bool unserialize=true [, int flags=0 [,
int errorcode]]]) U
Send a message of type msgtype (must be > 0) to a message queue */
PHP_FUNCTION(msg_receive)
{
@@ -358,7 +358,7 @@
}
/* }}} */
-/* {{{ proto bool msg_send(resource queue, int msgtype, mixed message [, bool
serialize=true [, bool blocking=true [, int errorcode]]])
+/* {{{ proto bool msg_send(resource queue, int msgtype, mixed message [, bool
serialize=true [, bool blocking=true [, int errorcode]]]) U
Send a message of type msgtype (must be > 0) to a message queue */
PHP_FUNCTION(msg_send)
{
@@ -394,8 +394,14 @@
message_len = msg_var.len;
smart_str_free(&msg_var);
} else {
- char *p;
+ char *p = NULL;
switch (Z_TYPE_P(message)) {
+ case IS_UNICODE:
+ if (SUCCESS !=
zend_unicode_to_string(UG(runtime_encoding_conv), &p, &message_len,
Z_USTRVAL_P(message), Z_USTRLEN_P(message) TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+ break;
+
case IS_STRING:
p = Z_STRVAL_P(message);
message_len = Z_STRLEN_P(message);
http://cvs.php.net/viewvc.cgi/php-src/ext/sysvmsg/tests/001.phpt?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/sysvmsg/tests/001.phpt
diff -u php-src/ext/sysvmsg/tests/001.phpt:1.4
php-src/ext/sysvmsg/tests/001.phpt:1.5
--- php-src/ext/sysvmsg/tests/001.phpt:1.4 Wed May 19 08:45:23 2004
+++ php-src/ext/sysvmsg/tests/001.phpt Sat Oct 28 09:07:50 2006
@@ -5,7 +5,7 @@
if (!extension_loaded("sysvmsg")) print "skip"; ?>
--FILE--
<?php
-$key = ftok("./ext/sysvmsg/tests/001.phpt", "p");
+$key = ftok(__FILE__, "p");
$q = msg_get_queue($key);
msg_send($q, 1, "hello") or print "FAIL\n";
$type = null;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php