Re: [PHP-CVS] cvs: php4 /ext/mssql php_mssql.c

2002-12-03 Thread Jani Taskinen

Don't forget the MFH.. :)

--Jani



On Tue, 3 Dec 2002, Frank M. Kromann wrote:

fmkTue Dec  3 00:56:39 2002 EDT

  Modified files:  
/php4/ext/mssqlphp_mssql.c 
  Log:
  Allocating enough memory to hold values.
  Fix crash when certan stored procedures was called. This caused the free_result 
function to free memory not yet allocated.
  
  
Index: php4/ext/mssql/php_mssql.c
diff -u php4/ext/mssql/php_mssql.c:1.86 php4/ext/mssql/php_mssql.c:1.87
--- php4/ext/mssql/php_mssql.c:1.86Mon Oct 28 15:16:24 2002
+++ php4/ext/mssql/php_mssql.c Tue Dec  3 00:56:39 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_mssql.c,v 1.86 2002/10/28 20:16:24 sterling Exp $ */
+/* $Id: php_mssql.c,v 1.87 2002/12/03 05:56:39 fmk Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -376,7 +376,7 @@
   case 0: /* defaults */
   host=user=passwd=NULL;
   hashed_details_length=5+3;
-  hashed_details = (char *) emalloc(hashed_details_length);
+  hashed_details = (char *) emalloc(hashed_details_length+1);
   strcpy(hashed_details,mssql___);
   break;
   case 1: {
@@ -389,7 +389,7 @@
   host = Z_STRVAL_PP(yyhost);
   user=passwd=NULL;
   hashed_details_length = Z_STRLEN_PP(yyhost)+5+3;
-  hashed_details = (char *) 
emalloc(hashed_details_length);
+  hashed_details = (char *) 
emalloc(hashed_details_length+1);
   
sprintf(hashed_details,mssql_%s__,Z_STRVAL_PP(yyhost));
   }
   break;
@@ -405,7 +405,7 @@
   user = Z_STRVAL_PP(yyuser);
   passwd=NULL;
   hashed_details_length = 
Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+5+3;
-  hashed_details = (char *) 
emalloc(hashed_details_length);
+  hashed_details = (char *) 
emalloc(hashed_details_length+1);
   
sprintf(hashed_details,mssql_%s_%s_,Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser));
   }
   break;
@@ -422,7 +422,7 @@
   user = Z_STRVAL_PP(yyuser);
   passwd = Z_STRVAL_PP(yypasswd);
   hashed_details_length = 
Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+5+3;
-  hashed_details = (char *) 
emalloc(hashed_details_length);
+  hashed_details = (char *) 
emalloc(hashed_details_length+1);
   
sprintf(hashed_details,mssql_%s_%s_%s,Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser),Z_STRVAL_PP(yypasswd));
 /* SAFE */
   }
   break;
@@ -796,7 +796,7 @@
   unsigned char *res_buf;
   int res_length = dbdatlen(mssql_ptr-link, offset);
 
-  res_buf = (unsigned char *) emalloc(res_length);
+  res_buf = (unsigned char *) emalloc(res_length+1);
   bin = ((DBBINARY *)dbdata(mssql_ptr-link, offset));
   memcpy(res_buf,bin,res_length);
   res_buf[res_length] = '\0';
@@ -817,13 +817,13 @@
   if (column_type == SQLDATETIM4) res_length += 
14;
   if (column_type == SQLDATETIME) res_length += 
10;
   
-  res_buf = (unsigned char *) 
emalloc(res_length);
+  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);
   } else {
   dbdatecrack(mssql_ptr-link, dateinfo, 
(DBDATETIME *) dbdata(mssql_ptr-link,offset));
   
   res_length = 19;
-  res_buf = (unsigned char *) 
emalloc(res_length);
+  res_buf = (unsigned char *) 
emalloc(res_length+1);
   sprintf(res_buf, %d-%02d-%02d %02d:%02d:%02d 
, dateinfo.year, dateinfo.month, dateinfo.day, dateinfo.hour, dateinfo.minute, 
dateinfo.second);
   }
   
@@ -852,7 +852,7 @@
   unsigned char *res_buf;
   int res_length = dbdatlen(mssql_ptr-link, offset);
 
-  res_buf = (unsigned char *) emalloc(res_length);
+  res_buf = (unsigned char *) 

[PHP-CVS] cvs: php4(PHP_4_3) /ext/ldap config.m4

2002-12-03 Thread Jani Taskinen
sniper  Tue Dec  3 04:36:31 2002 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/ldap  config.m4 
  Log:
  MFH: Fixed build with iPlanet LDAP SDK 5.x
  
  
Index: php4/ext/ldap/config.m4
diff -u php4/ext/ldap/config.m4:1.26 php4/ext/ldap/config.m4:1.26.2.1
--- php4/ext/ldap/config.m4:1.26Fri Sep 27 06:38:08 2002
+++ php4/ext/ldap/config.m4 Tue Dec  3 04:36:31 2002
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.26 2002/09/27 10:38:08 derick Exp $
+dnl $Id: config.m4,v 1.26.2.1 2002/12/03 09:36:31 sniper Exp $
 dnl
 
 AC_DEFUN(PHP_LDAP_CHECKS, [
@@ -55,6 +55,16 @@
   elif test -f $LDAP_LIBDIR/libldap.so.3; then
 PHP_ADD_LIBRARY_WITH_PATH(ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
 
+  elif test -f $LDAP_LIBDIR/libssldap50.so -o -f $LDAP_LIBDIR/libssldap50.sl; then
+if test -n $LDAP_PTHREAD; then 
+  PHP_ADD_LIBRARY($LDAP_PTHREAD)
+fi
+PHP_ADD_LIBRARY_WITH_PATH(nspr4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+PHP_ADD_LIBRARY_WITH_PATH(plc4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+PHP_ADD_LIBRARY_WITH_PATH(plds4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+PHP_ADD_LIBRARY_WITH_PATH(ssldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+AC_DEFINE(HAVE_NSLDAP,1,[ ])
+
   elif test -f $LDAP_LIBDIR/libldapssl41.so -o -f $LDAP_LIBDIR/libldapssl41.sl; then
 if test -n $LDAP_PTHREAD; then 
   PHP_ADD_LIBRARY($LDAP_PTHREAD)
@@ -86,7 +96,10 @@
   elif test -f $LDAP_LIBDIR/libclntsh.so; then
 PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
 AC_DEFINE(HAVE_ORALDAP,1,[ ])
-  fi  
+
+  else
+AC_MSG_ERROR(Cannot find ldap libraries in $LDAP_LIBDIR.)
+  fi
 
   PHP_ADD_INCLUDE($LDAP_INCDIR)
   PHP_SUBST(LDAP_SHARED_LIBADD)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/ircg config.m4 ircg.c php_ircg.h php_ircg_alloc.h php_ircg_cache.c php_ircg_cache.h php_ircg_conversion.c php_ircg_conversion.h php_ircg_error.c php_ircg_error.h php_ircg_private.h php_ircg_tokenizer.c php_ircg_tokenizer.h

2002-12-03 Thread Sascha Schumann
sas Tue Dec  3 05:13:36 2002 EDT

  Added files: 
/php4/ext/ircg  php_ircg_cache.c php_ircg_cache.h 
php_ircg_conversion.c php_ircg_conversion.h 
php_ircg_error.c php_ircg_error.h php_ircg_private.h 
php_ircg_tokenizer.c php_ircg_tokenizer.h 

  Modified files:  
/php4/ext/ircg  config.m4 ircg.c php_ircg.h php_ircg_alloc.h 
  Log:
  Move subsystems into their own source file.
  
  
Index: php4/ext/ircg/config.m4
diff -u php4/ext/ircg/config.m4:1.16 php4/ext/ircg/config.m4:1.17
--- php4/ext/ircg/config.m4:1.16Sat Nov 30 22:47:49 2002
+++ php4/ext/ircg/config.m4 Tue Dec  3 05:13:36 2002
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.16 2002/12/01 03:47:49 sas Exp $
+dnl $Id: config.m4,v 1.17 2002/12/03 10:13:36 sas Exp $
 dnl
 
 PHP_ARG_WITH(ircg, for IRCG support,
@@ -26,7 +26,9 @@
   PHP_EVAL_INCLINE(`$IRCG_CONFIG --cppflags`)
   PHP_ADD_LIBRARY_WITH_PATH(ircg, $PHP_IRCG/lib)
   PHP_ADD_INCLUDE($PHP_IRCG/include)
-  PHP_NEW_EXTENSION(ircg, ircg.c ircg_scanner.c, $ext_shared)
+  PHP_NEW_EXTENSION(ircg,[ ircg.c ircg_scanner.c php_ircg_cache.c \
+  php_ircg_conversion.c php_ircg_error.c php_ircg_tokenizer.c], 
+  $ext_shared)
   if test $PHP_SAPI = thttpd; then
 PHP_ADD_SOURCES(PHP_EXT_DIR(ircg),ircg_thttpd.c,[],sapi)
 PHP_ADD_SOURCES(PHP_EXT_DIR(ircg),ircg_common.c,[],cli)
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.149 php4/ext/ircg/ircg.c:1.150
--- php4/ext/ircg/ircg.c:1.149  Sun Dec  1 01:30:01 2002
+++ php4/ext/ircg/ircg.cTue Dec  3 05:13:36 2002
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: ircg.c,v 1.149 2002/12/01 06:30:01 sas Exp $ */
+/* $Id: ircg.c,v 1.150 2002/12/03 10:13:36 sas Exp $ */
 
 /* {{{ includes */
 
@@ -54,54 +54,23 @@
 #include arpa/inet.h
 #endif
 
-#include if_irc.h
-#include irc_write_buffer.h
-
 /* }}} */
 
 /* {{{ Definitions */
 
-#if IRCG_API_VERSION  20021127
-#define USE_IRCONN_MANAGEMENT
-static HashTable h_irconn; /* Integer IDs to php_irconn_t * */
-static int irconn_id;
-
-#define USE_FD2IRCONN
-static HashTable h_fd2irconn; /* fd's to Integer IDs */
-
-
-/* provide dummy definitions */
-#include php_ircg_hash.h
-#include php_ircg_lock.h
-
-#else
-#include ircg_resource.h
-#include ircg_hash.h
-#include ircg_lock.h
-#endif
-
+#include php_ircg_conversion.h
+#include php_ircg_cache.h
 #include php_ircg_alloc.h
+#include php_ircg_error.h
+#include php_ircg_tokenizer.h
 
 #include ext/standard/php_smart_str.h
+#include php_ircg_private.h
 
-static struct {
-   ircg_hash_table h_fmt_msgs;
-
-   IRCG_LOCK(fmt_msgs_lock);
-
-   /* these just serve statistical/entertainment purposes */
-   unsigned long irc_connects, irc_set_currents, irc_quit_handlers, 
-   exec_fmt_msgs, exec_token_compiler;
-
-   unsigned long cache_hits, cache_misses;
-
-
-   time_t next_gc;
+struct php_ircg_global  *php_ircg;
 
-   struct errormsg *error_msgs;
-
-   IRCG_LOCK(error_msgs_lock);
-} *php_ircg;
+/* initialized in the IRCG control process, so that we can avoid locking */
+struct cache_entry *php_ircg_cache_entries;
 
 /* }}} */
 
@@ -199,21 +168,7 @@
 #endif
 
 typedef struct {
-   unsigned char code;
-   union {
-   unsigned char v;
-   void *ptr;
-   smart_str *s;
-   } para;
-} token_t;
-
-typedef struct {
-   token_t *t;
-   int ntoken;
-} format_msg_t;
-
-typedef struct {
-   format_msg_t fmt_msgs[NO_FMTS];
+   format_msg_t *fmt_msgs[NO_FMTS];
 } php_fmt_msgs_t;
 
 typedef struct {
@@ -245,33 +200,9 @@
char *realname; /* dito */
 } php_irconn_t;
 
-enum {
-   C_CHANNEL = 1,
-   C_FROM,
-   C_TO,
-   C_MESSAGE,
-   C_STRING,
-   C_PERCENT,
-   C_TERMINATE_1   /* auth by username */
-};
-
-enum {
-   P_RAW = 0,
-   P_JS  = 1,
-   P_NICKNAME= 2,
-   P_NICKNAME_JS = 3,
-   P_MIRC= 4,
-   P_MIRC_JS = 5,
-   P_NOAUTO_LINKS = 8, /* Don't automatically convert links */
-   P_CONV_BR  = 16,/* Convert a special character to br */
-   P_COND_STOP= 32,/* If argument != username, stop */
-}; 
-
 static php_fmt_msgs_t fmt_msgs_default_compiled;
 
-static void format_msg(const format_msg_t *fmt_msg, smart_str *channel, 
-   smart_str *to, smart_str *from, smart_str *msg, smart_str *result, 
-   const char *username, int username_len, int *status);
+#define format_msg php_ircg_format_msg
 
 static void msg_send(php_irconn_t *conn, smart_str *msg);
 
@@ -280,9 +211,9 @@
 /* {{{ Default format messages */
 
 static char *fmt_msgs_default[] = {
-   %f@%c: %mbr /,
-   %f: %mbr /,
-   To %t: %mbr /,
+   [%c] %f: %mbr /,
+   privat from %f: %mbr /,
+   %f privat to %t: %mbr /,

[PHP-CVS] cvs: php4 /ext/ldap config.m4

2002-12-03 Thread Jani Taskinen
sniper  Tue Dec  3 06:34:12 2002 EDT

  Modified files:  
/php4/ext/ldap  config.m4 
  Log:
  - Need these libraries for static build
  
  
Index: php4/ext/ldap/config.m4
diff -u php4/ext/ldap/config.m4:1.27 php4/ext/ldap/config.m4:1.28
--- php4/ext/ldap/config.m4:1.27Tue Dec  3 04:35:42 2002
+++ php4/ext/ldap/config.m4 Tue Dec  3 06:34:12 2002
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.27 2002/12/03 09:35:42 sniper Exp $
+dnl $Id: config.m4,v 1.28 2002/12/03 11:34:12 sniper Exp $
 dnl
 
 AC_DEFUN(PHP_LDAP_CHECKS, [
@@ -63,6 +63,9 @@
 PHP_ADD_LIBRARY_WITH_PATH(plc4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
 PHP_ADD_LIBRARY_WITH_PATH(plds4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
 PHP_ADD_LIBRARY_WITH_PATH(ssldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+PHP_ADD_LIBRARY_WITH_PATH(ldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+PHP_ADD_LIBRARY_WITH_PATH(prldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+PHP_ADD_LIBRARY_WITH_PATH(ssl3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
 AC_DEFINE(HAVE_NSLDAP,1,[ ])
 
   elif test -f $LDAP_LIBDIR/libldapssl41.so -o -f $LDAP_LIBDIR/libldapssl41.sl; then



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4(PHP_4_3) /ext/ldap config.m4

2002-12-03 Thread Jani Taskinen
sniper  Tue Dec  3 06:34:33 2002 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/ldap  config.m4 
  Log:
  MFH: Need these libraries for static build
  
  
Index: php4/ext/ldap/config.m4
diff -u php4/ext/ldap/config.m4:1.26.2.1 php4/ext/ldap/config.m4:1.26.2.2
--- php4/ext/ldap/config.m4:1.26.2.1Tue Dec  3 04:36:31 2002
+++ php4/ext/ldap/config.m4 Tue Dec  3 06:34:33 2002
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.26.2.1 2002/12/03 09:36:31 sniper Exp $
+dnl $Id: config.m4,v 1.26.2.2 2002/12/03 11:34:33 sniper Exp $
 dnl
 
 AC_DEFUN(PHP_LDAP_CHECKS, [
@@ -63,6 +63,9 @@
 PHP_ADD_LIBRARY_WITH_PATH(plc4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
 PHP_ADD_LIBRARY_WITH_PATH(plds4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
 PHP_ADD_LIBRARY_WITH_PATH(ssldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+PHP_ADD_LIBRARY_WITH_PATH(ldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+PHP_ADD_LIBRARY_WITH_PATH(prldap50, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
+PHP_ADD_LIBRARY_WITH_PATH(ssl3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
 AC_DEFINE(HAVE_NSLDAP,1,[ ])
 
   elif test -f $LDAP_LIBDIR/libldapssl41.so -o -f $LDAP_LIBDIR/libldapssl41.sl; then



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/ircg ircg.c php_ircg_private.h

2002-12-03 Thread Sascha Schumann
sas Tue Dec  3 09:14:34 2002 EDT

  Modified files:  
/php4/ext/ircg  ircg.c php_ircg_private.h 
  Log:
  further work on stabilizing concurrent IRCG accesses
  
  
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.150 php4/ext/ircg/ircg.c:1.151
--- php4/ext/ircg/ircg.c:1.150  Tue Dec  3 05:13:36 2002
+++ php4/ext/ircg/ircg.cTue Dec  3 09:14:33 2002
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: ircg.c,v 1.150 2002/12/03 10:13:36 sas Exp $ */
+/* $Id: ircg.c,v 1.151 2002/12/03 14:14:33 sas Exp $ */
 
 /* {{{ includes */
 
@@ -67,6 +67,15 @@
 #include ext/standard/php_smart_str.h
 #include php_ircg_private.h
 
+#ifdef USE_IRCONN_MANAGEMENT
+static HashTable h_irconn; /* Integer IDs to php_irconn_t * */
+static int irconn_id;
+#endif
+
+#ifdef USE_FD2IRCONN
+static HashTable h_fd2irconn; /* fd's to Integer IDs */
+#endif
+
 struct php_ircg_global  *php_ircg;
 
 /* initialized in the IRCG control process, so that we can avoid locking */
@@ -181,7 +190,10 @@
struct sockaddr_in sin; /* address of stream conn */
 #endif
php_fmt_msgs_t *fmt_msgs;
+#if IRCG_API_VERSION  20021127
irc_write_buf wb;
+#endif
+   irc_write_buf *wbp;
ircg_hash_table ctcp_msgs;

 #ifdef IRCG_PENDING_URL
@@ -352,7 +364,7 @@
shutdown(conn-fd, 2);
 #endif
if (conn-file_fd == -1  conn-fd = 0)
-   irc_write_buf_del(conn-wb);
+   irc_write_buf_del(conn-wbp);
}
if (conn-file_fd != -1) {
smart_str m = {0};
@@ -381,6 +393,7 @@
}
 #endif

+   memset(conn, 0xbb, sizeof *conn);
IRCG_SHARED_FREE(conn);
 }
 /* }}} */
@@ -453,7 +466,7 @@
goto done;
default:
 #if IRCG_API_VERSION - 0 = 20010601
-   if ((n = irc_write_buf_append_ex(conn-wb, msg, 0))) {
+   if ((n = irc_write_buf_append_ex(conn-wbp, msg, 0))) {
const char *reason;

 #if IRCG_API_VERSION - 0 = 20020308   
@@ -481,10 +494,10 @@
}
return;
 #elif IRCG_API_VERSION - 0 = 20010302
-   irc_write_buf_append_ex(conn-wb, msg, 0); /* no copy */
+   irc_write_buf_append_ex(conn-wbp, msg, 0); /* no copy */
return;
 #else
-   irc_write_buf_append(conn-wb, msg);
+   irc_write_buf_append(conn-wbp, msg);
goto done;
 #endif
break;
@@ -499,7 +512,7 @@
 {
msg_accum_send(conn, msg);
if (conn-fd = 0  conn-file_fd == -1)
-   irc_write_buf_flush(conn-wb);
+   irc_write_buf_flush(conn-wbp);
 }
 
 static void msg_replay_buffer(php_irconn_t *conn)
@@ -882,8 +895,8 @@
smart_str tmp = {0};
 
smart_str_setl(tmp,   , 2);
-   irc_write_buf_append_ex(conn-wb, tmp, 1);
-   irc_write_buf_flush(conn-wb);
+   irc_write_buf_append_ex(conn-wbp, tmp, 1);
+   irc_write_buf_flush(conn-wbp);
} else if (conn-file_fd  0 
 (php_ircg_now() - conn-login)  WINDOW_TIMEOUT) {
char buf[1024];
@@ -1037,6 +1050,13 @@
 }
 /* }}} */
 
+static void wbuf_destruct(irc_write_buf *p)
+{
+   php_ircg-irc_wbuf_destructs++;
+   memset(p, 0xaa, sizeof(*p));
+   IRCG_SHARED_FREE(p);
+}
+
 /* {{{ proto bool ircg_set_current(int connection)
Sets current connection for output */
 PHP_FUNCTION(ircg_set_current)
@@ -1059,11 +1079,9 @@
ircg_hash_index_del(h_fd2irconn, conn-fd);
 #endif
if (conn-file_fd == -1)
-   irc_write_buf_del(conn-wb);
+   irc_write_buf_del(conn-wbp);
conn-fd = -1;
}
-
-   php_ircg-irc_set_currents++;

if (php_ircg_register_with_sapi(conn-fd TSRMLS_CC) 
 #ifdef USE_FD2IRCONN
@@ -1081,7 +1099,15 @@
sizeof(int), NULL);
 #endif
if (conn-file_fd == -1  conn-fd = 0) {
-   irc_write_buf_add(conn-wb, conn-fd);
+#if IRCG_API_VERSION  20021127
+   conn-wbp = conn-wb;
+   irc_write_buf_add(conn-wbp, conn-fd);
+#else
+   conn-wbp = IRCG_SHARED_ALLOC(sizeof(irc_write_buf));
+   irc_write_buf_add_ex(conn-wbp, conn-fd, wbuf_destruct);
+#endif
+   
+   php_ircg-irc_set_currents++;
IRCGG(flush_data) = conn;
}
RETVAL_TRUE;
@@ -2056,7 +2082,7 @@
 #endif
 
msg_replay_buffer(conn);
-   irc_write_buf_flush(conn-wb);
+   irc_write_buf_flush(conn-wbp);
}
 
return SUCCESS;
@@ -2183,10 +2209,12 @@
php_info_print_table_row(2, Tokenizer invocations, buf);

[PHP-CVS] cvs: php4 /sapi/milter milter.php

2002-12-03 Thread Harald Radi
phanto  Tue Dec  3 09:43:43 2002 EDT

  Modified files:  
/php4/sapi/milter   milter.php 
  Log:
  fix typos and make example more useful
  
  
Index: php4/sapi/milter/milter.php
diff -u php4/sapi/milter/milter.php:1.1 php4/sapi/milter/milter.php:1.2
--- php4/sapi/milter/milter.php:1.1 Sun Dec  1 15:29:14 2002
+++ php4/sapi/milter/milter.php Tue Dec  3 09:43:43 2002
@@ -21,8 +21,18 @@
  *
  * see 
http://www.sendmail.com/partner/resources/development/milter_api/smfi_register.html#flags
  */
+
+function milter_log($msg)
+{
+   $GLOBALS['log'] = fopen(/tmp/milter.log, a);
+   fwrite($GLOBALS['log'], date([H:i:s d.m.Y]) . \t{$msg}\n);
+   fclose($GLOBALS['log']);
+}
+
 function milter_init() {
-  smfi_setflags(SMFIF_ADDHDRS);
+   milter_log(-- startup --);
+   milter_log(milter_init());
+   smfi_setflags(SMFIF_ADDHDRS);
 }
 
 /**
@@ -30,6 +40,7 @@
  */
 function milter_connect($connect)
 {
+   milter_log(milter_connect('$connect'));
 }
 
 /**
@@ -38,6 +49,7 @@
  */
 function milter_helo($helo)
 {
+   milter_log(milter_helo('$helo'));
 }
 
 /**
@@ -46,6 +58,10 @@
  */
 function milter_envfrom($args)
 {
+   milter_log(milter_envfrom(args[]));
+   foreach ($args as $ix = $arg) {
+   milter_log(\targs[$ix] = $arg);
+   }
 }
 
 /**
@@ -54,6 +70,10 @@
  */
 function milter_envrcpt($args)
 {
+   milter_log(milter_envrcpt(args[]));
+   foreach ($args as $ix = $arg) {
+   milter_log(\targs[$ix] = $arg);
+   }
 }
 
 /**
@@ -62,6 +82,7 @@
  */
 function milter_header($header, $value)
 {
+   milter_log(milter_header('$header', '$value'));
 }
 
 /**
@@ -69,13 +90,15 @@
  */
 function milter_eoh()
 {
+   milter_log(milter_eoh());
 }
 
 /**
  * is called zero or more times between milter_eoh and milter_eom.
  */
-function mlfi_body($bodypart)
+function milter_body($bodypart)
 {
+   milter_log(milter_body('$bodypart'));
 }
 
 /**
@@ -85,6 +108,7 @@
  */
 function milter_eom()
 {
+   milter_log(milter_eom());
   /* add PHP header to the message */
   smfi_addheader(X-PHP, phpversion());   
 }
@@ -93,14 +117,16 @@
  * may be called at any time during message processing
  * (i.e. between some message-oriented routine and milter_eom).
  */
-function mlfi_abort()
+function milter_abort()
 {
+   milter_log(milter_abort());
 }
 
 /**
  * is always called once at the end of each connection.
  */
-function mlfi_close()
+function milter_close()
 {
+   milter_log(milter_close());
 }
 ?



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/standard array.c

2002-12-03 Thread Moriyoshi Koizumi
moriyoshi   Tue Dec  3 10:02:07 2002 EDT

  Modified files:  
/php4/ext/standard  array.c 
  Log:
  Fixed leaks in array_walk()
  
  
Index: php4/ext/standard/array.c
diff -u php4/ext/standard/array.c:1.205 php4/ext/standard/array.c:1.206
--- php4/ext/standard/array.c:1.205 Tue Nov 26 17:12:40 2002
+++ php4/ext/standard/array.c   Tue Dec  3 10:02:06 2002
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.205 2002/11/26 22:12:40 moriyoshi Exp $ */
+/* $Id: array.c,v 1.206 2002/12/03 15:02:06 moriyoshi Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -994,7 +994,7 @@
 
zend_hash_move_forward_ex(target_hash, pos);
}
-   efree(key);
+   zval_ptr_dtor(key);

return 0;
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4(PHP_4_3) /ext/standard array.c

2002-12-03 Thread Moriyoshi Koizumi
moriyoshi   Tue Dec  3 10:02:57 2002 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/standard  array.c 
  Log:
  MFH: fixed leaks in array_walk()
  
  
Index: php4/ext/standard/array.c
diff -u php4/ext/standard/array.c:1.199.2.4 php4/ext/standard/array.c:1.199.2.5
--- php4/ext/standard/array.c:1.199.2.4 Tue Nov 26 17:14:11 2002
+++ php4/ext/standard/array.c   Tue Dec  3 10:02:55 2002
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.199.2.4 2002/11/26 22:14:11 moriyoshi Exp $ */
+/* $Id: array.c,v 1.199.2.5 2002/12/03 15:02:55 moriyoshi Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -994,7 +994,7 @@
 
zend_hash_move_forward_ex(target_hash, pos);
}
-   efree(key);
+   zval_ptr_dtor(key);

return 0;
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/gd/libgd gd_gd2.c gd_png.c

2002-12-03 Thread Ilia Alshanetsky
iliaa   Tue Dec  3 10:43:18 2002 EDT

  Modified files:  
/php4/ext/gd/libgd  gd_gd2.c gd_png.c 
  Log:
  Fixed a crash that occurs during the last step of png/jpeg - gd2 - png/jpeg
  conversion. The same crash still occures with png/jpeg - gd - png/jpeg, because
  apparently gd format cannot handle truecolor images.
  Turned off debug messages inside gd_gd2.c.
  
  
Index: php4/ext/gd/libgd/gd_gd2.c
diff -u php4/ext/gd/libgd/gd_gd2.c:1.8 php4/ext/gd/libgd/gd_gd2.c:1.9
--- php4/ext/gd/libgd/gd_gd2.c:1.8  Sun Dec  1 06:43:54 2002
+++ php4/ext/gd/libgd/gd_gd2.c  Tue Dec  3 10:43:17 2002
@@ -25,8 +25,8 @@
 
 /* Use this for commenting out debug-print statements. */
 /* Just use the first '#define' to allow all the prints... */
-#define GD2_DBG(s) (s) 
-//#define GD2_DBG(s)
+/* #define GD2_DBG(s) (s) */
+#define GD2_DBG(s)
 
 typedef struct
   {
@@ -184,7 +184,7 @@
   goto fail1;
 }
 
-  im = gdImageCreate (*sx, *sy);
+  im = gdImageCreateTrueColor(*sx, *sy);
   if (im == NULL)
 {
   GD2_DBG(php_gd_error(Could not create gdImage\n));
@@ -393,7 +393,7 @@
  int r = chunkBuf[chunkPos++]  16;
  int g = chunkBuf[chunkPos++]  8;
  int b = chunkBuf[chunkPos++];
- im-pixels[y][x] = a + r + g + b;
+ im-tpixels[y][x] = a + r + g + b;
}
  else
{
@@ -818,10 +818,10 @@
{
  for (x = xlo; x  xhi; x++)
{
- int p = im-pixels[y][x];
  GD2_DBG(php_gd_error(%d...,x));
  if (im-trueColor)
{
+ int p = im-tpixels[y][x];
  chunkData[chunkLen++] = gdTrueColorGetAlpha (p);
  chunkData[chunkLen++] = gdTrueColorGetRed (p);
  chunkData[chunkLen++] = gdTrueColorGetGreen (p);
@@ -829,7 +829,7 @@
}
  else
{
- chunkData[chunkLen++] = p;
+ chunkData[chunkLen++] = im-pixels[y][x];
}
};
}
Index: php4/ext/gd/libgd/gd_png.c
diff -u php4/ext/gd/libgd/gd_png.c:1.8 php4/ext/gd/libgd/gd_png.c:1.9
--- php4/ext/gd/libgd/gd_png.c:1.8  Sun Dec  1 06:43:54 2002
+++ php4/ext/gd/libgd/gd_png.c  Tue Dec  3 10:43:17 2002
@@ -667,20 +667,10 @@
   /* Our little 7-bit alpha channel trick costs us a bit here. */
   png_bytep *row_pointers;
   row_pointers = gdMalloc (sizeof (png_bytep) * height);
-  if (row_pointers == NULL)
-   {
- php_gd_error(gd-png error: unable to allocate row_pointers\n);
-   }
   for (j = 0; j  height; ++j)
{
  int bo = 0;
- if ((row_pointers[j] = (png_bytep) gdMalloc (width * channels)) == NULL)
-   {
- php_gd_error(gd-png error: unable to allocate rows\n);
- for (i = 0; i  j; ++i)
-   gdFree (row_pointers[i]);
- return;
-   }
+ row_pointers[j] = (png_bytep) gdMalloc (width * channels);
  for (i = 0; i  width; ++i)
{
  unsigned char a;
@@ -714,20 +704,10 @@
{
  png_bytep *row_pointers;
  row_pointers = gdMalloc (sizeof (png_bytep) * height);
- if (row_pointers == NULL)
-   {
- php_gd_error(gd-png error: unable to allocate row_pointers\n);
-   }
  for (j = 0; j  height; ++j)
{
- if ((row_pointers[j] = (png_bytep) gdMalloc (width)) == NULL)
-   {
- php_gd_error(gd-png error: unable to allocate rows\n);
- for (i = 0; i  j; ++i)
-   gdFree (row_pointers[i]);
- return;
-   }
- for (i = 0; i  width; ++i)
+ row_pointers[j] = (png_bytep) gdMalloc (width);
+ for (i = 0; i  width; ++i) 
row_pointers[j][i] = mapping[im-pixels[j][i]];
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/milter TODO

2002-12-03 Thread Harald Radi
phanto  Tue Dec  3 11:26:57 2002 EDT

  Modified files:  
/php4/sapi/milter   TODO 
  Log:
  damn milter api:
  Furthermore, since there is not a one-to-one correspondence between
   threads and connections (N connections mapped onto M threads,
   M = N), connection-specific data must be accessed through the handles
   provided by the Milter library.
  
  which in other words means php_request_startup() and the corresponding
  php_request_shutdown() will never be called for the same thread
  
  
Index: php4/sapi/milter/TODO
diff -u php4/sapi/milter/TODO:1.4 php4/sapi/milter/TODO:1.5
--- php4/sapi/milter/TODO:1.4   Sun Dec  1 14:50:07 2002
+++ php4/sapi/milter/TODO   Tue Dec  3 11:26:57 2002
@@ -1,3 +1,4 @@
+extensions aren't loaded
 stdout to syslog
 testing
 documentation



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4(PHP_4_3) /ext/mssql php_mssql.c

2002-12-03 Thread Frank M. Kromann
Thanks Edin,

I was just waiting for a test report from the user who found the bug.

- Frank


 edink Tue Dec  3 11:09:15 2002 EDT
 
   Modified files:  (Branch: PHP_4_3)
 /php4/ext/mssql   php_mssql.c 
   Log:
   MFH: Allocating enough memory to hold values.
Fix crash when certan stored procedures was called. This caused
the free_result function to free memory not yet allocated.
   
   
 Index: php4/ext/mssql/php_mssql.c
 diff -u php4/ext/mssql/php_mssql.c:1.86
php4/ext/mssql/php_mssql.c:1.86.2.1
 --- php4/ext/mssql/php_mssql.c:1.86   Mon Oct 28 15:16:24 2002
 +++ php4/ext/mssql/php_mssql.cTue Dec  3 11:09:14 2002
 @@ -16,7 +16,7 @@

+--+
   */
  
 -/* $Id: php_mssql.c,v 1.86 2002/10/28 20:16:24 sterling Exp $ */
 +/* $Id: php_mssql.c,v 1.86.2.1 2002/12/03 16:09:14 edink Exp $ */
  
  #ifdef COMPILE_DL_MSSQL
  #define HAVE_MSSQL 1
 @@ -376,7 +376,7 @@
   case 0: /* defaults */
   host=user=passwd=NULL;
   hashed_details_length=5+3;
 - hashed_details = (char *) emalloc(hashed_details_length);
 + hashed_details = (char *) emalloc(hashed_details_length+1);
   strcpy(hashed_details,mssql___);
   break;
   case 1: {
 @@ -389,7 +389,7 @@
   host = Z_STRVAL_PP(yyhost);
   user=passwd=NULL;
   hashed_details_length = Z_STRLEN_PP(yyhost)+5+3;
 - hashed_details = (char *) 
emalloc(hashed_details_length);
 + hashed_details = (char *) 
emalloc(hashed_details_length+1);
   
sprintf(hashed_details,mssql_%s__,Z_STRVAL_PP(yyhost));
   }
   break;
 @@ -405,7 +405,7 @@
   user = Z_STRVAL_PP(yyuser);
   passwd=NULL;
   hashed_details_length =
Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+5+3;
 - hashed_details = (char *) 
emalloc(hashed_details_length);
 + hashed_details = (char *) 
emalloc(hashed_details_length+1);
 

sprintf(hashed_details,mssql_%s_%s_,Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser));
   }
   break;
 @@ -422,7 +422,7 @@
   user = Z_STRVAL_PP(yyuser);
   passwd = Z_STRVAL_PP(yypasswd);
   hashed_details_length =
Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+5+3;
 - hashed_details = (char *) 
emalloc(hashed_details_length);
 + hashed_details = (char *) 
emalloc(hashed_details_length+1);
 

sprintf(hashed_details,mssql_%s_%s_%s,Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser),Z_STRVAL_PP(yypasswd));
/* SAFE */
   }
   break;
 @@ -796,7 +796,7 @@
   unsigned char *res_buf;
   int res_length = dbdatlen(mssql_ptr-link, offset);
  
 - res_buf = (unsigned char *) emalloc(res_length);
 + res_buf = (unsigned char *) emalloc(res_length+1);
   bin = ((DBBINARY *)dbdata(mssql_ptr-link, offset));
   memcpy(res_buf,bin,res_length);
   res_buf[res_length] = '\0';
 @@ -817,13 +817,13 @@
   if (column_type == SQLDATETIM4) res_length += 
14;
   if (column_type == SQLDATETIME) res_length += 
10;
   
 - res_buf = (unsigned char *) 
emalloc(res_length);
 + 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);
   } else {
   dbdatecrack(mssql_ptr-link, dateinfo, 
(DBDATETIME *)
dbdata(mssql_ptr-link,offset));
   
   res_length = 19;
 - res_buf = (unsigned char *) 
emalloc(res_length);
 + res_buf = (unsigned char *) 
emalloc(res_length+1);
   sprintf(res_buf, %d-%02d-%02d %02d:%02d:%02d 
, dateinfo.year,
dateinfo.month, dateinfo.day, dateinfo.hour, dateinfo.minute,
dateinfo.second);
   }
   
 @@ -852,7 +852,7 @@
   unsigned char *res_buf;
   int res_length = dbdatlen(mssql_ptr-link, offset);
  
 - res_buf = (unsigned 

[PHP-CVS] cvs: php4 /ext/mssql php_mssql.c

2002-12-03 Thread Frank M. Kromann
fmk Tue Dec  3 13:04:35 2002 EDT

  Modified files:  
/php4/ext/mssql php_mssql.c 
  Log:
  Bug #17593
  Make sure any pending data is released from the server when freeing the result
  
  
Index: php4/ext/mssql/php_mssql.c
diff -u php4/ext/mssql/php_mssql.c:1.87 php4/ext/mssql/php_mssql.c:1.88
--- php4/ext/mssql/php_mssql.c:1.87 Tue Dec  3 00:56:39 2002
+++ php4/ext/mssql/php_mssql.c  Tue Dec  3 13:04:35 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_mssql.c,v 1.87 2002/12/03 05:56:39 fmk Exp $ */
+/* $Id: php_mssql.c,v 1.88 2002/12/03 18:04:35 fmk Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -1112,6 +1112,8 @@
}
 
ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, MS 
SQL-result, le_result);
+   if (dbdataready(result-mssql_ptr-link))
+   dbresults(result-mssql_ptr-link);
zend_list_delete(Z_LVAL_PP(mssql_result_index));
RETURN_TRUE;
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/mssql php_mssql.c php_mssql.h

2002-12-03 Thread Frank M. Kromann
fmk Tue Dec  3 13:57:05 2002 EDT

  Modified files:  
/php4/ext/mssql php_mssql.c php_mssql.h 
  Log:
  Bug #19370
  Allow stored procedures to return multiple results.
  
  
Index: php4/ext/mssql/php_mssql.c
diff -u php4/ext/mssql/php_mssql.c:1.88 php4/ext/mssql/php_mssql.c:1.89
--- php4/ext/mssql/php_mssql.c:1.88 Tue Dec  3 13:04:35 2002
+++ php4/ext/mssql/php_mssql.c  Tue Dec  3 13:57:04 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_mssql.c,v 1.88 2002/12/03 18:04:35 fmk Exp $ */
+/* $Id: php_mssql.c,v 1.89 2002/12/03 18:57:04 fmk Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -838,7 +838,7 @@
}
 }
 
-static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int 
offset,zval *result, int column_type  TSRMLS_DC)
+static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int 
+offset,zval *result, int column_type TSRMLS_DC)
 {
if (dbdatlen(mssql_ptr-link,offset) == 0) {
ZVAL_NULL(result);
@@ -890,6 +890,65 @@
}
 }
 
+static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *statement 
+TSRMLS_DC) 
+{
+   int i, num_rets, type;
+   char *parameter;
+   mssql_bind *bind;
+
+   /* Now to fetch RETVAL and OUTPUT values*/
+   num_rets = dbnumrets(mssql_ptr-link);
+   
+   if (num_rets!=0) {
+   for (i = 1; i = num_rets; i++) {
+   parameter = (char*)dbretname(mssql_ptr-link, i);
+   type = dbrettype(mssql_ptr-link, i);
+   
+   if (statement-binds!=NULL ) {  /*  Maybe a non-parameter 
+sp*/
+   if (zend_hash_find(statement-binds, parameter, 
+strlen(parameter), (void**)bind)==SUCCESS) {
+   switch (type) {
+   case SQLBIT:
+   case SQLINT1:
+   case SQLINT2:
+   case SQLINT4:
+   
+convert_to_long_ex(bind-zval);
+   Z_LVAL_P(bind-zval) = *((int 
+*)(dbretdata(mssql_ptr-link,i)));
+   break;
+   
+   case SQLFLT8:
+   case SQLFLTN:
+   
+convert_to_double_ex(bind-zval);
+   Z_DVAL_P(bind-zval) = 
+*((double *)(dbretdata(mssql_ptr-link,i)));
+   break;
+
+   case SQLCHAR:
+   case SQLVARCHAR:
+   case SQLTEXT:
+   
+convert_to_string_ex(bind-zval);
+   Z_STRLEN_P(bind-zval) = 
+dbretlen(mssql_ptr-link,i);
+   Z_STRVAL_P(bind-zval) = 
+estrndup(dbretdata(mssql_ptr-link,i),Z_STRLEN_P(bind-zval));
+   break;
+   }
+   }
+   else {
+   php_error(E_WARNING, %s(): an output 
+parameter variable was not provided, get_active_function_name(TSRMLS_C));
+   }
+   }
+   }
+   }
+   if (statement-binds!=NULL ) {  /*  Maybe a non-parameter sp*/
+   if (zend_hash_find(statement-binds, RETVAL, 6, 
+(void**)bind)==SUCCESS) {
+   if (dbhasretstat(mssql_ptr-link)) {
+   convert_to_long_ex(bind-zval);
+   Z_LVAL_P(bind-zval)=dbretstatus(mssql_ptr-link);
+   }
+   else {
+   php_error(E_WARNING, %s(): stored procedure has no 
+return value. Nothing was returned into RETVAL, get_active_function_name(TSRMLS_C));
+   }
+   }
+   }
+}
+
 static int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int 
retvalue TSRMLS_DC) 
 {
int i, j = 0;
@@ -1059,6 +1118,7 @@
}
 
result = (mssql_result *) emalloc(sizeof(mssql_result));
+   result-statement = NULL;
result-num_fields = num_fields;
result-blocks_initialized = 1;

@@ -1673,7 +1733,13 @@
 
mssql_ptr = result-mssql_ptr;
retvalue = dbresults(mssql_ptr-link);
-   if 

[PHP-CVS] cvs: php4 /ext/mssql php_mssql.c

2002-12-03 Thread Frank M. Kromann
fmk Tue Dec  3 14:19:15 2002 EDT

  Modified files:  
/php4/ext/mssql php_mssql.c 
  Log:
  Changed php_error() to php_error_docref()
  
  
Index: php4/ext/mssql/php_mssql.c
diff -u php4/ext/mssql/php_mssql.c:1.89 php4/ext/mssql/php_mssql.c:1.90
--- php4/ext/mssql/php_mssql.c:1.89 Tue Dec  3 13:57:04 2002
+++ php4/ext/mssql/php_mssql.c  Tue Dec  3 14:19:15 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_mssql.c,v 1.89 2002/12/03 18:57:04 fmk Exp $ */
+/* $Id: php_mssql.c,v 1.90 2002/12/03 19:19:15 fmk Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -146,7 +146,7 @@
TSRMLS_FETCH();
 
if (severity = MS_SQL_G(min_error_severity)) {
-   php_error(E_WARNING,%s(): %s (severity %d), 
get_active_function_name(TSRMLS_C), dberrstr, severity);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s (severity %d), 
+dberrstr, severity);
}
return INT_CANCEL;  
 }
@@ -157,7 +157,7 @@
TSRMLS_FETCH();
 
if (severity = MS_SQL_G(min_message_severity)) {
-   php_error(E_WARNING,%s(): message: %s (severity %d), 
get_active_function_name(TSRMLS_C), msgtext, severity);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, message: %s (severity 
+%d), msgtext, severity);
}
if (MS_SQL_G(server_message)) {
STR_FREE(MS_SQL_G(server_message));
@@ -432,13 +432,13 @@
}
 
if (hashed_details == NULL) {
-   php_error(E_WARNING, %s(): Out of memory, 
get_active_function_name(TSRMLS_C));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Out of memory);
RETURN_FALSE;
}
 
/* set a DBLOGIN record */  
if ((mssql.login = dblogin()) == NULL) {
-   php_error(E_WARNING,%s(): Unable to allocate login record, 
get_active_function_name(TSRMLS_C));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to allocate login 
+record);
RETURN_FALSE;
}

@@ -473,20 +473,20 @@
list_entry new_le;
 
if (MS_SQL_G(max_links) != -1  MS_SQL_G(num_links) = 
MS_SQL_G(max_links)) {
-   php_error(E_WARNING,%s(): Too many open links (%d), 
get_active_function_name(TSRMLS_C), MS_SQL_G(num_links));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Too many 
+open links (%d), MS_SQL_G(num_links));
efree(hashed_details);
dbfreelogin(mssql.login);
RETURN_FALSE;
}
if (MS_SQL_G(max_persistent) != -1  MS_SQL_G(num_persistent) 
= MS_SQL_G(max_persistent)) {
-   php_error(E_WARNING,%s(): Too many open persistent 
links (%d), get_active_function_name(TSRMLS_C), MS_SQL_G(num_persistent));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Too many 
+open persistent links (%d), MS_SQL_G(num_persistent));
efree(hashed_details);
dbfreelogin(mssql.login);
RETURN_FALSE;
}
/* create the link */
if ((mssql.link = dbopen(mssql.login, host)) == FAIL) {
-   php_error(E_WARNING,%s(): Unable to connect to 
server:  %s, get_active_function_name(TSRMLS_C), host);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to 
+connect to server:  %s, host);
efree(hashed_details);
dbfreelogin(mssql.login);
RETURN_FALSE;
@@ -532,7 +532,7 @@
 #if BROKEN_MSSQL_PCONNECTS
log_error(PHP/MS SQL:  Hashed persistent link is not 
a MS SQL link!,php_rqst-server);
 #endif
-   php_error(E_WARNING, %s(): Hashed persistent link is 
not a MS SQL link!, get_active_function_name(TSRMLS_C));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Hashed 
+persistent link is not a MS SQL link!);
RETURN_FALSE;
}

@@ -546,7 +546,7 @@
 #if BROKEN_MSSQL_PCONNECTS
log_error(PHP/MS SQL:  Unable to 
reconnect!,php_rqst-server);
 #endif
-   php_error(E_WARNING, %s(): Link to server 
lost, unable to reconnect, get_active_function_name(TSRMLS_C));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+Link to server lost, unable to reconnect);
zend_hash_del(EG(persistent_list), 
hashed_details, hashed_details_length+1);
 

[PHP-CVS] cvs: php4(PHP_4_3) /ext/mssql php_mssql.c

2002-12-03 Thread Frank M. Kromann
fmk Tue Dec  3 14:19:46 2002 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/mssql php_mssql.c 
  Log:
  MFH
  # Changed php_error() to php_error_docref()
  
  
Index: php4/ext/mssql/php_mssql.c
diff -u php4/ext/mssql/php_mssql.c:1.86.2.3 php4/ext/mssql/php_mssql.c:1.86.2.4
--- php4/ext/mssql/php_mssql.c:1.86.2.3 Tue Dec  3 13:59:38 2002
+++ php4/ext/mssql/php_mssql.c  Tue Dec  3 14:19:45 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_mssql.c,v 1.86.2.3 2002/12/03 18:59:38 fmk Exp $ */
+/* $Id: php_mssql.c,v 1.86.2.4 2002/12/03 19:19:45 fmk Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -146,7 +146,7 @@
TSRMLS_FETCH();
 
if (severity = MS_SQL_G(min_error_severity)) {
-   php_error(E_WARNING,%s(): %s (severity %d), 
get_active_function_name(TSRMLS_C), dberrstr, severity);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s (severity %d), 
+dberrstr, severity);
}
return INT_CANCEL;  
 }
@@ -157,7 +157,7 @@
TSRMLS_FETCH();
 
if (severity = MS_SQL_G(min_message_severity)) {
-   php_error(E_WARNING,%s(): message: %s (severity %d), 
get_active_function_name(TSRMLS_C), msgtext, severity);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, message: %s (severity 
+%d), msgtext, severity);
}
if (MS_SQL_G(server_message)) {
STR_FREE(MS_SQL_G(server_message));
@@ -432,13 +432,13 @@
}
 
if (hashed_details == NULL) {
-   php_error(E_WARNING, %s(): Out of memory, 
get_active_function_name(TSRMLS_C));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Out of memory);
RETURN_FALSE;
}
 
/* set a DBLOGIN record */  
if ((mssql.login = dblogin()) == NULL) {
-   php_error(E_WARNING,%s(): Unable to allocate login record, 
get_active_function_name(TSRMLS_C));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to allocate login 
+record);
RETURN_FALSE;
}

@@ -473,20 +473,20 @@
list_entry new_le;
 
if (MS_SQL_G(max_links) != -1  MS_SQL_G(num_links) = 
MS_SQL_G(max_links)) {
-   php_error(E_WARNING,%s(): Too many open links (%d), 
get_active_function_name(TSRMLS_C), MS_SQL_G(num_links));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Too many 
+open links (%d), MS_SQL_G(num_links));
efree(hashed_details);
dbfreelogin(mssql.login);
RETURN_FALSE;
}
if (MS_SQL_G(max_persistent) != -1  MS_SQL_G(num_persistent) 
= MS_SQL_G(max_persistent)) {
-   php_error(E_WARNING,%s(): Too many open persistent 
links (%d), get_active_function_name(TSRMLS_C), MS_SQL_G(num_persistent));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Too many 
+open persistent links (%d), MS_SQL_G(num_persistent));
efree(hashed_details);
dbfreelogin(mssql.login);
RETURN_FALSE;
}
/* create the link */
if ((mssql.link = dbopen(mssql.login, host)) == FAIL) {
-   php_error(E_WARNING,%s(): Unable to connect to 
server:  %s, get_active_function_name(TSRMLS_C), host);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to 
+connect to server:  %s, host);
efree(hashed_details);
dbfreelogin(mssql.login);
RETURN_FALSE;
@@ -532,7 +532,7 @@
 #if BROKEN_MSSQL_PCONNECTS
log_error(PHP/MS SQL:  Hashed persistent link is not 
a MS SQL link!,php_rqst-server);
 #endif
-   php_error(E_WARNING, %s(): Hashed persistent link is 
not a MS SQL link!, get_active_function_name(TSRMLS_C));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Hashed 
+persistent link is not a MS SQL link!);
RETURN_FALSE;
}

@@ -546,7 +546,7 @@
 #if BROKEN_MSSQL_PCONNECTS
log_error(PHP/MS SQL:  Unable to 
reconnect!,php_rqst-server);
 #endif
-   php_error(E_WARNING, %s(): Link to server 
lost, unable to reconnect, get_active_function_name(TSRMLS_C));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+Link to server lost, unable to reconnect);
zend_hash_del(EG(persistent_list), 
hashed_details, 

[PHP-CVS] cvs: php4 /ext/pdf pdf.c

2002-12-03 Thread Ilia Alshanetsky
iliaa   Tue Dec  3 14:25:16 2002 EDT

  Modified files:  
/php4/ext/pdf   pdf.c 
  Log:
  Fixed a bug that caused a crash in pdf_open_memory_image(), when a truecolor
  image was loaded, it now checks if the image is truecolor and performs the
  appropriate calculations (fixed bug #20785).
  Changed E_WARNING back to E_ERROR.
  
  
Index: php4/ext/pdf/pdf.c
diff -u php4/ext/pdf/pdf.c:1.113 php4/ext/pdf/pdf.c:1.114
--- php4/ext/pdf/pdf.c:1.113Mon Dec  2 01:35:28 2002
+++ php4/ext/pdf/pdf.c  Tue Dec  3 14:25:16 2002
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: pdf.c,v 1.113 2002/12/02 06:35:28 iliaa Exp $ */
+/* $Id: pdf.c,v 1.114 2002/12/03 19:25:16 iliaa Exp $ */
 
 /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE.
Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */
@@ -276,7 +276,7 @@
case PDF_SystemError:
case PDF_UnknownError:
default:
-   php_error(E_WARNING,PDFlib error: %s, shortmsg);
+   php_error(E_ERROR,PDFlib error: %s, shortmsg);
}
 }
 /* }}} */
@@ -331,7 +331,7 @@
 #else
php_info_print_table_row(2, PDFlib GmbH Version, tmp );
 #endif
-   php_info_print_table_row(2, Revision, $Revision: 1.113 $ );
+   php_info_print_table_row(2, Revision, $Revision: 1.114 $ );
php_info_print_table_end();
 
 }
@@ -1963,17 +1963,30 @@
ZEND_FETCH_RESOURCE(im, gdImagePtr, arg2, -1, Image, le_gd);
 
count = 3 * im-sx * im-sy;
-   if(NULL == (buffer = (unsigned char *) emalloc(count))) {
-   RETURN_FALSE;
-   }
+   buffer = (unsigned char *) emalloc(count);
 
ptr = buffer;
for(i=0; iim-sy; i++) {
for(j=0; jim-sx; j++) {
-   color = im-pixels[i][j];
-   *ptr++ = im-red[color];
-   *ptr++ = im-green[color];
-   *ptr++ = im-blue[color];
+#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[im-sy][im-sx];
+   *ptr++ = im-red[color];
+   *ptr++ = im-green[color];
+   *ptr++ = im-blue[color];
+   }
+#if HAVE_LIBGD20
+   }
+#endif 
}
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4(PHP_4_3) /ext/pdf pdf.c

2002-12-03 Thread Ilia Alshanetsky
iliaa   Tue Dec  3 14:25:49 2002 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/pdf   pdf.c 
  Log:
  MFH
  
  
Index: php4/ext/pdf/pdf.c
diff -u php4/ext/pdf/pdf.c:1.112.2.1 php4/ext/pdf/pdf.c:1.112.2.2
--- php4/ext/pdf/pdf.c:1.112.2.1Mon Dec  2 01:35:50 2002
+++ php4/ext/pdf/pdf.c  Tue Dec  3 14:25:48 2002
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: pdf.c,v 1.112.2.1 2002/12/02 06:35:50 iliaa Exp $ */
+/* $Id: pdf.c,v 1.112.2.2 2002/12/03 19:25:48 iliaa Exp $ */
 
 /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE.
Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */
@@ -276,7 +276,7 @@
case PDF_SystemError:
case PDF_UnknownError:
default:
-   php_error(E_WARNING,PDFlib error: %s, shortmsg);
+   php_error(E_ERROR,PDFlib error: %s, shortmsg);
}
 }
 /* }}} */
@@ -331,7 +331,7 @@
 #else
php_info_print_table_row(2, PDFlib GmbH Version, tmp );
 #endif
-   php_info_print_table_row(2, Revision, $Revision: 1.112.2.1 $ );
+   php_info_print_table_row(2, Revision, $Revision: 1.112.2.2 $ );
php_info_print_table_end();
 
 }
@@ -1963,17 +1963,30 @@
ZEND_FETCH_RESOURCE(im, gdImagePtr, arg2, -1, Image, le_gd);
 
count = 3 * im-sx * im-sy;
-   if(NULL == (buffer = (unsigned char *) emalloc(count))) {
-   RETURN_FALSE;
-   }
+   buffer = (unsigned char *) emalloc(count);
 
ptr = buffer;
for(i=0; iim-sy; i++) {
for(j=0; jim-sx; j++) {
-   color = im-pixels[i][j];
-   *ptr++ = im-red[color];
-   *ptr++ = im-green[color];
-   *ptr++ = im-blue[color];
+#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[im-sy][im-sx];
+   *ptr++ = im-red[color];
+   *ptr++ = im-green[color];
+   *ptr++ = im-blue[color];
+   }
+#if HAVE_LIBGD20
+   }
+#endif 
}
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /ext/gd/libgd gd_gd2.c gd_png.c

2002-12-03 Thread Ilia A.
On December 3, 2002 02:13 pm, Marcus Börger wrote:
 Ah great now it waorks!
 Should we add a test for ImageGd() then, verify it isn't a true color
 image? And what about MFH?

Adding a test for truecolor inside imageGd code seems like the best choice, 
that code was not designed with truecolor images in mind and is mostly a 
leftover from 1.X code, the maintained gd format is gd2. So, I am +1 on the 
idea (I'll implement it shortly). I s'pose we need to MFH this as well, I was 
mostly waiting for additional feedback before proceeding.

Ilia

P.S. I will also try to write a small test suit to test various format 
conversions, so if you have any suggestions, test cases and so on, please let 
me know.


 marcus

 At 16:43 03.12.2002, Ilia Alshanetsky wrote:
 iliaa   Tue Dec  3 10:43:18 2002 EDT
 
Modified files:
  /php4/ext/gd/libgd  gd_gd2.c gd_png.c
Log:
Fixed a crash that occurs during the last step of png/jpeg - gd2 -
  png/jpeg
conversion. The same crash still occures with png/jpeg - gd -
  png/jpeg, because
apparently gd format cannot handle truecolor images.
Turned off debug messages inside gd_gd2.c.
 
 
 Index: php4/ext/gd/libgd/gd_gd2.c
 diff -u php4/ext/gd/libgd/gd_gd2.c:1.8 php4/ext/gd/libgd/gd_gd2.c:1.9
 --- php4/ext/gd/libgd/gd_gd2.c:1.8  Sun Dec  1 06:43:54 2002
 +++ php4/ext/gd/libgd/gd_gd2.c  Tue Dec  3 10:43:17 2002
 @@ -25,8 +25,8 @@
 
   /* Use this for commenting out debug-print statements. */
   /* Just use the first '#define' to allow all the prints... */
 -#define GD2_DBG(s) (s)
 -//#define GD2_DBG(s)
 +/* #define GD2_DBG(s) (s) */
 +#define GD2_DBG(s)
 
   typedef struct
 {
 @@ -184,7 +184,7 @@
 goto fail1;
   }
 
 -  im = gdImageCreate (*sx, *sy);
 +  im = gdImageCreateTrueColor(*sx, *sy);
 if (im == NULL)
   {
 GD2_DBG(php_gd_error(Could not create gdImage\n));
 @@ -393,7 +393,7 @@
int r = chunkBuf[chunkPos++]  16;
int g = chunkBuf[chunkPos++]  8;
int b = chunkBuf[chunkPos++];
 - im-pixels[y][x] = a + r + g + b;
 + im-tpixels[y][x] = a + r + g + b;
  }
else
  {
 @@ -818,10 +818,10 @@
  {
for (x = xlo; x  xhi; x++)
  {
 - int p = im-pixels[y][x];
GD2_DBG(php_gd_error(%d...,x));
if (im-trueColor)
  {
 + int p = im-tpixels[y][x];
chunkData[chunkLen++] = gdTrueColorGetAlpha
  (p); chunkData[chunkLen++] = gdTrueColorGetRed (p); chunkData[chunkLen++]
  = gdTrueColorGetGreen (p); @@ -829,7 +829,7 @@
  }
else
  {
 - chunkData[chunkLen++] = p;
 + chunkData[chunkLen++] = im-pixels[y][x];
  }
  };
  }
 Index: php4/ext/gd/libgd/gd_png.c
 diff -u php4/ext/gd/libgd/gd_png.c:1.8 php4/ext/gd/libgd/gd_png.c:1.9
 --- php4/ext/gd/libgd/gd_png.c:1.8  Sun Dec  1 06:43:54 2002
 +++ php4/ext/gd/libgd/gd_png.c  Tue Dec  3 10:43:17 2002
 @@ -667,20 +667,10 @@
 /* Our little 7-bit alpha channel trick costs us a bit here. */
 png_bytep *row_pointers;
 row_pointers = gdMalloc (sizeof (png_bytep) * height);
 -  if (row_pointers == NULL)
 -   {
 - php_gd_error(gd-png error: unable to allocate row_pointers\n);
 -   }
 for (j = 0; j  height; ++j)
  {
int bo = 0;
 - if ((row_pointers[j] = (png_bytep) gdMalloc (width * channels))
 == NULL)
 -   {
 - php_gd_error(gd-png error: unable to allocate rows\n);
 - for (i = 0; i  j; ++i)
 -   gdFree (row_pointers[i]);
 - return;
 -   }
 + row_pointers[j] = (png_bytep) gdMalloc (width * channels);
for (i = 0; i  width; ++i)
  {
unsigned char a;
 @@ -714,20 +704,10 @@
  {
png_bytep *row_pointers;
row_pointers = gdMalloc (sizeof (png_bytep) * height);
 - if (row_pointers == NULL)
 -   {
 - php_gd_error(gd-png error: unable to allocate
  row_pointers\n); -   }
for (j = 0; j  height; ++j)
  {
 - if ((row_pointers[j] = (png_bytep) gdMalloc (width)) ==
  NULL) -   {
 - php_gd_error(gd-png error: unable to allocate rows\n);
 - for (i = 0; i  j; ++i)
 -   gdFree (row_pointers[i]);
 - return;
 -   }
 - for (i = 0; i  width; ++i)
 + row_pointers[j] = (png_bytep) gdMalloc (width);
 + for (i = 0; i  width; ++i)
  

[PHP-CVS] cvs: php4 /ext/fbsql php_fbsql.c

2002-12-03 Thread Frank M. Kromann
fmk Tue Dec  3 14:39:25 2002 EDT

  Modified files:  
/php4/ext/fbsql php_fbsql.c 
  Log:
  Changed php_error() to php_error_docref()
  
  
Index: php4/ext/fbsql/php_fbsql.c
diff -u php4/ext/fbsql/php_fbsql.c:1.86 php4/ext/fbsql/php_fbsql.c:1.87
--- php4/ext/fbsql/php_fbsql.c:1.86 Thu Oct 24 09:14:34 2002
+++ php4/ext/fbsql/php_fbsql.c  Tue Dec  3 14:39:25 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_fbsql.c,v 1.86 2002/10/24 13:14:34 sas Exp $ */
+/* $Id: php_fbsql.c,v 1.87 2002/12/03 19:39:25 fmk Exp $ */
 
 /* TODO:
  *
@@ -261,7 +261,7 @@
 #define CHECK_LINK(link) { \
if (link==-1) { \
if (FB_SQL_G(generateWarnings)) \
-   php_error(E_WARNING, %s(): A link to the server could not be 
established, get_active_function_name(TSRMLS_C)); \
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, A link to the 
+server could not be established); \
RETURN_FALSE; \
} \
 }
@@ -525,14 +525,14 @@
if ((FB_SQL_G(maxLinks) != -1  FB_SQL_G(linkCount) == 
FB_SQL_G(maxLinks)))
{
if (FB_SQL_G(generateWarnings))
-   php_error(E_WARNING, %s(): FrontBase link 
limit %d exceeded , get_active_function_name(TSRMLS_C), FB_SQL_G(maxLinks));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+FrontBase link limit %d exceeded, FB_SQL_G(maxLinks));
RETURN_FALSE;
}
 
if ((FB_SQL_G(maxPersistent) != -1  
FB_SQL_G(persistentCount) == FB_SQL_G(maxPersistent)))
{
if (FB_SQL_G(generateWarnings))
-   php_error(E_WARNING, %s(): FrontBase 
persistent link limit %d exceeded , get_active_function_name(TSRMLS_C), 
FB_SQL_G(maxPersistent));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+FrontBase persistent link limit %d exceeded, FB_SQL_G(maxPersistent));
RETURN_FALSE;
}
 
@@ -574,7 +574,7 @@
if ((FB_SQL_G(maxLinks) != -1  FB_SQL_G(linkCount) == 
FB_SQL_G(maxLinks)))
{
if (FB_SQL_G(generateWarnings))
-   php_error(E_WARNING, %s(): FrontBase link limit %d 
exceeded , get_active_function_name(TSRMLS_C), FB_SQL_G(maxLinks));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, FrontBase 
+link limit %d exceeded, FB_SQL_G(maxLinks));
RETURN_FALSE;
}
 
@@ -735,7 +735,7 @@
if (c == NULL)
{
if (FB_SQL_G(generateWarnings))
-   php_error(E_WARNING, %s(): %s, 
get_active_function_name(TSRMLS_C), fbcdcClassErrorMessage());
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+fbcdcClassErrorMessage());
return 0;
}
md = fbcdcCreateSession(c, PHP, link-userName, link-userPassword, 
link-userName);
@@ -746,9 +746,9 @@
if (FB_SQL_G(generateWarnings))
{
if (emg)
-   php_error(E_WARNING, %s(): %s, 
get_active_function_name(TSRMLS_C), emg);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+emg);
else
-   php_error(E_WARNING, %s(): No message, 
get_active_function_name(TSRMLS_C));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+No message);
}
link-errorText = strdup(emg);
link-errorNo  = fbcemdErrorCodeAtIndex(emd, 0);;
@@ -1063,7 +1063,8 @@
convert_to_string_ex(lob_handle);
 
if (Z_STRLEN_PP(lob_handle) != 27 || Z_STRVAL_PP(lob_handle)[0] != '@') {
-   if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, %s(): The handle 
is invalid, get_active_function_name(TSRMLS_C));
+   if (FB_SQL_G(generateWarnings)) 
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The handle is 
+invalid);
RETURN_FALSE;
}
 
@@ -1126,7 +1127,8 @@
convert_to_string_ex(lob_handle);
 
if (Z_STRLEN_PP(lob_handle) != 27 || Z_STRVAL_PP(lob_handle)[0] != '@') {
-   if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, %s(): The handle 
is invalid, get_active_function_name(TSRMLS_C));
+   if (FB_SQL_G(generateWarnings)) 
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The handle is 
+invalid);
RETURN_FALSE;

[PHP-CVS] cvs: php4(PHP_4_3) /ext/fbsql php_fbsql.c

2002-12-03 Thread Frank M. Kromann
fmk Tue Dec  3 14:39:55 2002 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/fbsql php_fbsql.c 
  Log:
  MFH
  # Changed php_error() to php_error_docref()
  
  
Index: php4/ext/fbsql/php_fbsql.c
diff -u php4/ext/fbsql/php_fbsql.c:1.86 php4/ext/fbsql/php_fbsql.c:1.86.2.1
--- php4/ext/fbsql/php_fbsql.c:1.86 Thu Oct 24 09:14:34 2002
+++ php4/ext/fbsql/php_fbsql.c  Tue Dec  3 14:39:54 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_fbsql.c,v 1.86 2002/10/24 13:14:34 sas Exp $ */
+/* $Id: php_fbsql.c,v 1.86.2.1 2002/12/03 19:39:54 fmk Exp $ */
 
 /* TODO:
  *
@@ -261,7 +261,7 @@
 #define CHECK_LINK(link) { \
if (link==-1) { \
if (FB_SQL_G(generateWarnings)) \
-   php_error(E_WARNING, %s(): A link to the server could not be 
established, get_active_function_name(TSRMLS_C)); \
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, A link to the 
+server could not be established); \
RETURN_FALSE; \
} \
 }
@@ -525,14 +525,14 @@
if ((FB_SQL_G(maxLinks) != -1  FB_SQL_G(linkCount) == 
FB_SQL_G(maxLinks)))
{
if (FB_SQL_G(generateWarnings))
-   php_error(E_WARNING, %s(): FrontBase link 
limit %d exceeded , get_active_function_name(TSRMLS_C), FB_SQL_G(maxLinks));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+FrontBase link limit %d exceeded, FB_SQL_G(maxLinks));
RETURN_FALSE;
}
 
if ((FB_SQL_G(maxPersistent) != -1  
FB_SQL_G(persistentCount) == FB_SQL_G(maxPersistent)))
{
if (FB_SQL_G(generateWarnings))
-   php_error(E_WARNING, %s(): FrontBase 
persistent link limit %d exceeded , get_active_function_name(TSRMLS_C), 
FB_SQL_G(maxPersistent));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+FrontBase persistent link limit %d exceeded, FB_SQL_G(maxPersistent));
RETURN_FALSE;
}
 
@@ -574,7 +574,7 @@
if ((FB_SQL_G(maxLinks) != -1  FB_SQL_G(linkCount) == 
FB_SQL_G(maxLinks)))
{
if (FB_SQL_G(generateWarnings))
-   php_error(E_WARNING, %s(): FrontBase link limit %d 
exceeded , get_active_function_name(TSRMLS_C), FB_SQL_G(maxLinks));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, FrontBase 
+link limit %d exceeded, FB_SQL_G(maxLinks));
RETURN_FALSE;
}
 
@@ -735,7 +735,7 @@
if (c == NULL)
{
if (FB_SQL_G(generateWarnings))
-   php_error(E_WARNING, %s(): %s, 
get_active_function_name(TSRMLS_C), fbcdcClassErrorMessage());
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+fbcdcClassErrorMessage());
return 0;
}
md = fbcdcCreateSession(c, PHP, link-userName, link-userPassword, 
link-userName);
@@ -746,9 +746,9 @@
if (FB_SQL_G(generateWarnings))
{
if (emg)
-   php_error(E_WARNING, %s(): %s, 
get_active_function_name(TSRMLS_C), emg);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+emg);
else
-   php_error(E_WARNING, %s(): No message, 
get_active_function_name(TSRMLS_C));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+No message);
}
link-errorText = strdup(emg);
link-errorNo  = fbcemdErrorCodeAtIndex(emd, 0);;
@@ -1063,7 +1063,8 @@
convert_to_string_ex(lob_handle);
 
if (Z_STRLEN_PP(lob_handle) != 27 || Z_STRVAL_PP(lob_handle)[0] != '@') {
-   if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, %s(): The handle 
is invalid, get_active_function_name(TSRMLS_C));
+   if (FB_SQL_G(generateWarnings)) 
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The handle is 
+invalid);
RETURN_FALSE;
}
 
@@ -1126,7 +1127,8 @@
convert_to_string_ex(lob_handle);
 
if (Z_STRLEN_PP(lob_handle) != 27 || Z_STRVAL_PP(lob_handle)[0] != '@') {
-   if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, %s(): The handle 
is invalid, get_active_function_name(TSRMLS_C));
+   if (FB_SQL_G(generateWarnings)) 
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The handle is 
+invalid);
  

[PHP-CVS] cvs: php4 /ext/ircg ircg.c php_ircg_private.h

2002-12-03 Thread Sascha Schumann
sas Tue Dec  3 16:50:13 2002 EDT

  Modified files:  
/php4/ext/ircg  ircg.c php_ircg_private.h 
  Log:
  Ensure that a terminating Apache child does not destroy our globally
  shared locks and data structures.
  
  
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.151 php4/ext/ircg/ircg.c:1.152
--- php4/ext/ircg/ircg.c:1.151  Tue Dec  3 09:14:33 2002
+++ php4/ext/ircg/ircg.cTue Dec  3 16:50:12 2002
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: ircg.c,v 1.151 2002/12/03 14:14:33 sas Exp $ */
+/* $Id: ircg.c,v 1.152 2002/12/03 21:50:12 sas Exp $ */
 
 /* {{{ includes */
 
@@ -2132,6 +2132,8 @@
}
 }
 
+static pid_t initialized_from;
+
 /* {{{ PHP_MINIT_FUNCTION
  */
 PHP_MINIT_FUNCTION(ircg)
@@ -2152,6 +2154,8 @@
}
 #endif

+   initialized_from = getpid();
+   
 #if IRCG_API_VERSION = 20021127
ircg_setup_global(/tmp/ircg.lock, 0, setup);
 #else
@@ -2174,7 +2178,6 @@
  */
 PHP_MSHUTDOWN_FUNCTION(ircg)
 {
-   ircg_hash_destroy(php_ircg-h_fmt_msgs);
 #ifdef USE_IRCONN_MANAGEMENT
ircg_hash_destroy(h_irconn);
 #endif
@@ -2182,10 +2185,14 @@
ircg_hash_destroy(h_fd2irconn);
 #endif
 
-   IRCG_LOCK_DESTROY(php_ircg-fmt_msgs_lock);
-   IRCG_LOCK_DESTROY(php_ircg-error_msgs_lock);
+   if (getpid() == initialized_from) {
+   ircg_hash_destroy(php_ircg-h_fmt_msgs);
 
-   ircg_shutdown_global();
+   IRCG_LOCK_DESTROY(php_ircg-fmt_msgs_lock);
+   IRCG_LOCK_DESTROY(php_ircg-error_msgs_lock);
+
+   ircg_shutdown_global();
+   }

return SUCCESS;
 }
Index: php4/ext/ircg/php_ircg_private.h
diff -u php4/ext/ircg/php_ircg_private.h:1.2 php4/ext/ircg/php_ircg_private.h:1.3
--- php4/ext/ircg/php_ircg_private.h:1.2Tue Dec  3 09:14:33 2002
+++ php4/ext/ircg/php_ircg_private.hTue Dec  3 16:50:12 2002
@@ -20,6 +20,8 @@
 #include ircg_lock.h
 #endif
 
+#include php_ircg_error.h
+
 struct php_ircg_global {
ircg_hash_table h_fmt_msgs;
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/ircg ircg.c

2002-12-03 Thread Sascha Schumann
sas Tue Dec  3 19:19:52 2002 EDT

  Modified files:  
/php4/ext/ircg  ircg.c 
  Log:
  restore inline allocation of write buffer
  
  
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.152 php4/ext/ircg/ircg.c:1.153
--- php4/ext/ircg/ircg.c:1.152  Tue Dec  3 16:50:12 2002
+++ php4/ext/ircg/ircg.cTue Dec  3 19:19:51 2002
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: ircg.c,v 1.152 2002/12/03 21:50:12 sas Exp $ */
+/* $Id: ircg.c,v 1.153 2002/12/04 00:19:51 sas Exp $ */
 
 /* {{{ includes */
 
@@ -190,10 +190,7 @@
struct sockaddr_in sin; /* address of stream conn */
 #endif
php_fmt_msgs_t *fmt_msgs;
-#if IRCG_API_VERSION  20021127
irc_write_buf wb;
-#endif
-   irc_write_buf *wbp;
ircg_hash_table ctcp_msgs;

 #ifdef IRCG_PENDING_URL
@@ -363,8 +360,8 @@
if (is_my_conn(conn))
shutdown(conn-fd, 2);
 #endif
-   if (conn-file_fd == -1  conn-fd = 0)
-   irc_write_buf_del(conn-wbp);
+   if (conn-file_fd == -1)
+   irc_write_buf_del(conn-wb);
}
if (conn-file_fd != -1) {
smart_str m = {0};
@@ -466,7 +463,7 @@
goto done;
default:
 #if IRCG_API_VERSION - 0 = 20010601
-   if ((n = irc_write_buf_append_ex(conn-wbp, msg, 0))) {
+   if ((n = irc_write_buf_append_ex(conn-wb, msg, 0))) {
const char *reason;

 #if IRCG_API_VERSION - 0 = 20020308   
@@ -494,10 +491,10 @@
}
return;
 #elif IRCG_API_VERSION - 0 = 20010302
-   irc_write_buf_append_ex(conn-wbp, msg, 0); /* no copy */
+   irc_write_buf_append_ex(conn-wb, msg, 0); /* no copy */
return;
 #else
-   irc_write_buf_append(conn-wbp, msg);
+   irc_write_buf_append(conn-wb, msg);
goto done;
 #endif
break;
@@ -512,7 +509,7 @@
 {
msg_accum_send(conn, msg);
if (conn-fd = 0  conn-file_fd == -1)
-   irc_write_buf_flush(conn-wbp);
+   irc_write_buf_flush(conn-wb);
 }
 
 static void msg_replay_buffer(php_irconn_t *conn)
@@ -895,8 +892,8 @@
smart_str tmp = {0};
 
smart_str_setl(tmp,   , 2);
-   irc_write_buf_append_ex(conn-wbp, tmp, 1);
-   irc_write_buf_flush(conn-wbp);
+   irc_write_buf_append_ex(conn-wb, tmp, 1);
+   irc_write_buf_flush(conn-wb);
} else if (conn-file_fd  0 
 (php_ircg_now() - conn-login)  WINDOW_TIMEOUT) {
char buf[1024];
@@ -1079,7 +1076,7 @@
ircg_hash_index_del(h_fd2irconn, conn-fd);
 #endif
if (conn-file_fd == -1)
-   irc_write_buf_del(conn-wbp);
+   irc_write_buf_del(conn-wb);
conn-fd = -1;
}

@@ -1099,18 +1096,14 @@
sizeof(int), NULL);
 #endif
if (conn-file_fd == -1  conn-fd = 0) {
-#if IRCG_API_VERSION  20021127
-   conn-wbp = conn-wb;
-   irc_write_buf_add(conn-wbp, conn-fd);
-#else
-   conn-wbp = IRCG_SHARED_ALLOC(sizeof(irc_write_buf));
-   irc_write_buf_add_ex(conn-wbp, conn-fd, wbuf_destruct);
-#endif
-   
-   php_ircg-irc_set_currents++;
-   IRCGG(flush_data) = conn;
+   if (irc_write_buf_add(conn-wb, conn-fd) == 0) {
+   php_ircg-irc_set_currents++;
+   IRCGG(flush_data) = conn;
+   RETVAL_TRUE;
+   } else {
+   RETVAL_FALSE;
+   }
}
-   RETVAL_TRUE;
}
put_irconn(conn);
 }
@@ -2082,7 +2075,7 @@
 #endif
 
msg_replay_buffer(conn);
-   irc_write_buf_flush(conn-wbp);
+   irc_write_buf_flush(conn-wb);
}
 
return SUCCESS;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/gd gd.c

2002-12-03 Thread Pierre-Alain Joye
pajoye  Tue Dec  3 21:37:21 2002 EDT

  Modified files:  
/php4/ext/gdgd.c 
  Log:
  Fix imagegd crashes when used with truecolor image (from jpeg,png, or 
imagecreatetruecolor)
  may we add parameters to imagegd to let user specify the palette size and dither 
(set to 256 and true) ?
  
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.229 php4/ext/gd/gd.c:1.230
--- php4/ext/gd/gd.c:1.229  Thu Nov 28 17:48:20 2002
+++ php4/ext/gd/gd.cTue Dec  3 21:37:21 2002
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.229 2002/11/28 22:48:20 helly Exp $ */
+/* $Id: gd.c,v 1.230 2002/12/04 02:37:21 pajoye Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
@@ -1588,6 +1588,12 @@
if(gdImageRed(im, i) == 0) break;
}
(*func_p)(im, i, fp);
+   break;
+   case PHP_GDIMG_TYPE_GD:
+   if(im-trueColor){
+   gdImageTrueColorToPalette(im,1,255);
+   }
+   (*func_p)(im, fp);
break;
default:
(*func_p)(im, fp);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/gd gd.c

2002-12-03 Thread Pierre-Alain Joye
pajoye  Tue Dec  3 21:48:23 2002 EDT

  Modified files:  
/php4/ext/gdgd.c 
  Log:
  Fix imagegd stdoutput
  Typo 256 colors
  
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.230 php4/ext/gd/gd.c:1.231
--- php4/ext/gd/gd.c:1.230  Tue Dec  3 21:37:21 2002
+++ php4/ext/gd/gd.cTue Dec  3 21:48:23 2002
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.230 2002/12/04 02:37:21 pajoye Exp $ */
+/* $Id: gd.c,v 1.231 2002/12/04 02:48:23 pajoye Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
@@ -1591,7 +1591,7 @@
break;
case PHP_GDIMG_TYPE_GD:
if(im-trueColor){
-   gdImageTrueColorToPalette(im,1,255);
+   gdImageTrueColorToPalette(im,1,256);
}
(*func_p)(im, fp);
break;
@@ -1626,6 +1626,12 @@
}
(*func_p)(im, q, tmp);
break;
+case PHP_GDIMG_TYPE_GD:
+if(im-trueColor){
+   gdImageTrueColorToPalette(im,1,256);
+   }
+(*func_p)(im, tmp);
+break;
default:
(*func_p)(im, tmp);
break;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /ext/gd gd.c

2002-12-03 Thread Derick Rethans
On Wed, 4 Dec 2002, Pierre-Alain Joye wrote:

 pajoyeTue Dec  3 21:48:23 2002 EDT
 
   Modified files:  
 /php4/ext/gd  gd.c 
   Log:
   Fix imagegd stdoutput
   Typo 256 colors
   
   
   }
   (*func_p)(im, q, tmp);
   break;
 +case PHP_GDIMG_TYPE_GD:
 +if(im-trueColor){
 + gdImageTrueColorToPalette(im,1,256);
 + }
 +(*func_p)(im, tmp);
 +break;
   default:
   (*func_p)(im, tmp);
   break;

Can you please watch your whitespace here?

Derick

-- 

-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php