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

2003-06-14 Thread Jani Taskinen
sniper  Sat Jun 14 09:31:52 2003 EDT

  Modified files:  
/php4/ext/ncurses   ncurses_functions.c 
  Log:
  Fix compile failure.
  
Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.40 
php4/ext/ncurses/ncurses_functions.c:1.41
--- php4/ext/ncurses/ncurses_functions.c:1.40   Tue Jun 10 16:03:33 2003
+++ php4/ext/ncurses/ncurses_functions.cSat Jun 14 09:31:51 2003
@@ -2239,7 +2239,7 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, handle) == FAILURE) 
{
return;
}
-   zend_list_delete(Z_RESVAL_PP(handle));
+   zend_list_delete(Z_RESVAL_P(handle));
 
RETURN_TRUE;
 }



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



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

2003-06-06 Thread Georg Richter
georg   Fri Jun  6 15:02:31 2003 EDT

  Modified files:  
/php4/ext/ncurses   ncurses_functions.c 
  Log:
  fixed bug #24060
  
  
Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.38 
php4/ext/ncurses/ncurses_functions.c:1.39
--- php4/ext/ncurses/ncurses_functions.c:1.38   Mon Mar 17 08:04:08 2003
+++ php4/ext/ncurses/ncurses_functions.cFri Jun  6 15:02:30 2003
@@ -2235,15 +2235,13 @@
 PHP_FUNCTION(ncurses_del_panel)
 {
zval *handle;
-   PANEL **panel;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, handle) == FAILURE) 
{
return;
}
+   zend_list_delete(Z_RESVAL_PP(handle));
 
-   FETCH_PANEL(panel, handle);
-
-   RETURN_LONG(del_panel(*panel));
+   RETURN_TRUE;
 }
 /* }}} */
 



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



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

2003-03-17 Thread Hartmut Holzgraefe
hholzgraMon Mar 17 08:04:08 2003 EDT

  Modified files:  
/php4/ext/ncurses   ncurses_functions.c 
  Log:
  proto fixes
  
Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.37 
php4/ext/ncurses/ncurses_functions.c:1.38
--- php4/ext/ncurses/ncurses_functions.c:1.37   Tue Dec 31 11:07:04 2002
+++ php4/ext/ncurses/ncurses_functions.cMon Mar 17 08:04:08 2003
@@ -2113,7 +2113,7 @@
 }
 /* }}} */
 
-/* {{{ proto int wattroff(resource window, int attrs)
+/* {{{ proto int ncurses_wattroff(resource window, int attrs)
Turns off attributes for a window */
 PHP_FUNCTION(ncurses_wattroff)
 {
@@ -2131,7 +2131,7 @@
 }
 /* }}} */
 
-/* {{{ proto int wattron(resource window, int attrs)
+/* {{{ proto int ncurses_wattron(resource window, int attrs)
Turns on attributes for a window */
 PHP_FUNCTION(ncurses_wattron)
 {
@@ -2149,7 +2149,7 @@
 }
 /* }}} */
 
-/* {{{ proto int wattrset(resource window, int attrs)
+/* {{{ proto int ncurses_wattrset(resource window, int attrs)
Set the attributes for a window */
 PHP_FUNCTION(ncurses_wattrset)
 {
@@ -2167,7 +2167,7 @@
 }
 /* }}} */
 
-/* {{{ proto int wstandend(resource window)
+/* {{{ proto int ncurses_wstandend(resource window)
End standout mode for a window */
 PHP_FUNCTION(ncurses_wstandend)
 {
@@ -2184,7 +2184,7 @@
 }
 /* }}} */
 
-/* {{{ proto int wstandout(resource window)
+/* {{{ proto int ncurses_wstandout(resource window)
Enter standout mode for a window */
 PHP_FUNCTION(ncurses_wstandout)
 {



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



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

2002-12-24 Thread Ilia Alshanetsky
iliaa   Tue Dec 24 12:30:48 2002 EDT

  Modified files:  
/php4/ext/ncurses   ncurses_functions.c 
  Log:
  Changed strncpy() to strlcpy().
  
  
Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.33 
php4/ext/ncurses/ncurses_functions.c:1.34
--- php4/ext/ncurses/ncurses_functions.c:1.33   Tue Dec 24 12:20:33 2002
+++ php4/ext/ncurses/ncurses_functions.cTue Dec 24 12:30:48 2002
@@ -1768,7 +1768,7 @@

IS_NCURSES_INITIALIZED();
 
-   strncpy(temp, termname(), sizeof(temp) - 1);
+   strlcpy(temp, termname(), sizeof(temp) - 1);
temp[sizeof(temp) - 1] = '\0';
 
RETURN_STRINGL (temp, strlen(temp), 1);
@@ -1783,7 +1783,7 @@
 
IS_NCURSES_INITIALIZED();
 
-   strncpy(temp, longname(), sizeof(temp) - 1);
+   strlcpy(temp, longname(), sizeof(temp) - 1);
temp[sizeof(temp) - 1] = '\0';
 
RETURN_STRINGL (temp, strlen(temp), 1);



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




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

2002-12-24 Thread Ilia Alshanetsky
iliaa   Tue Dec 24 12:33:34 2002 EDT

  Modified files:  
/php4/ext/ncurses   ncurses_functions.c 
  Log:
  The -1 is no longer needed, since it is done automatically by strlcpy().
  
  
Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.34 
php4/ext/ncurses/ncurses_functions.c:1.35
--- php4/ext/ncurses/ncurses_functions.c:1.34   Tue Dec 24 12:30:48 2002
+++ php4/ext/ncurses/ncurses_functions.cTue Dec 24 12:33:33 2002
@@ -1768,7 +1768,7 @@

IS_NCURSES_INITIALIZED();
 
-   strlcpy(temp, termname(), sizeof(temp) - 1);
+   strlcpy(temp, termname(), sizeof(temp));
temp[sizeof(temp) - 1] = '\0';
 
RETURN_STRINGL (temp, strlen(temp), 1);
@@ -1783,7 +1783,7 @@
 
IS_NCURSES_INITIALIZED();
 
-   strlcpy(temp, longname(), sizeof(temp) - 1);
+   strlcpy(temp, longname(), sizeof(temp));
temp[sizeof(temp) - 1] = '\0';
 
RETURN_STRINGL (temp, strlen(temp), 1);



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




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

2002-12-24 Thread Andi Gutmans
http://www.courtesan.com/todd/papers/strlcpy.html

It should be strlcpy(temp, blah, sizeof(temp));

That's one of the advantages of strlcpy(). It's much easier to use.

Andi

At 05:30 PM 12/24/2002 +, Ilia Alshanetsky wrote:

iliaa   Tue Dec 24 12:30:48 2002 EDT

  Modified files:
/php4/ext/ncurses   ncurses_functions.c
  Log:
  Changed strncpy() to strlcpy().


Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.33 
php4/ext/ncurses/ncurses_functions.c:1.34
--- php4/ext/ncurses/ncurses_functions.c:1.33   Tue Dec 24 12:20:33 2002
+++ php4/ext/ncurses/ncurses_functions.cTue Dec 24 12:30:48 2002
@@ -1768,7 +1768,7 @@

IS_NCURSES_INITIALIZED();

-   strncpy(temp, termname(), sizeof(temp) - 1);
+   strlcpy(temp, termname(), sizeof(temp) - 1);
temp[sizeof(temp) - 1] = '\0';

RETURN_STRINGL (temp, strlen(temp), 1);
@@ -1783,7 +1783,7 @@

IS_NCURSES_INITIALIZED();

-   strncpy(temp, longname(), sizeof(temp) - 1);
+   strlcpy(temp, longname(), sizeof(temp) - 1);
temp[sizeof(temp) - 1] = '\0';

RETURN_STRINGL (temp, strlen(temp), 1);



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


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




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

2002-12-23 Thread Derick Rethans
On Mon, 23 Dec 2002, Moriyoshi Koizumi wrote:

 Derick Rethans [EMAIL PROTECTED] wrote:
 
  On Sun, 22 Dec 2002, Moriyoshi Koizumi wrote:
  
   moriyoshi Sun Dec 22 14:51:49 2002 EDT
   
 Modified files:  
   /php4/ext/ncurses ncurses_functions.c 
 Log:
 Removed %s from format strings
  
  And this is exactly why no patches should be done so far in the release 
  process, the chance is simply to great for mistakes. 
 
 You might take me wrong. The error had been there before I committed my 
 docref patch.

Sorry, didn't see that.

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




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

2002-12-22 Thread Ilia Alshanetsky
iliaa   Sun Dec 22 15:16:37 2002 EDT

  Modified files:  
/php4/ext/ncurses   ncurses_functions.c 
  Log:
  Fixed various memory leaks.
  
  # Should this be MFHed?
  
  
Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.31 
php4/ext/ncurses/ncurses_functions.c:1.32
--- php4/ext/ncurses/ncurses_functions.c:1.31   Sun Dec 22 14:51:49 2002
+++ php4/ext/ncurses/ncurses_functions.cSun Dec 22 15:16:37 2002
@@ -235,12 +235,14 @@
 PHP_FUNCTION(ncurses_newpad)
 {
long rows,cols;
-   WINDOW **pwin = (WINDOW **)emalloc(sizeof(WINDOW *));
+   WINDOW **pwin;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
ll,rows,cols)==FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
+   
+   pwin = (WINDOW **)emalloc(sizeof(WINDOW *));
*pwin = newpad(rows,cols);
 
if(!*pwin) {
@@ -298,13 +300,14 @@
 PHP_FUNCTION(ncurses_newwin)
 {
long rows,cols,y,x;
-   WINDOW **pwin = (WINDOW **)emalloc(sizeof(WINDOW *));
+   WINDOW **pwin; 
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
,rows,cols,y,x)==FAILURE) {
return;
}
 
IS_NCURSES_INITIALIZED();
+   pwin = (WINDOW **)emalloc(sizeof(WINDOW *));
*pwin=newwin(rows,cols,y,x);
 
if(!*pwin) {
@@ -2249,13 +2252,14 @@
 {
zval **handle;
WINDOW **win;
-   PANEL **panel = (PANEL **)emalloc(sizeof(PANEL *));
+   PANEL **panel;
 
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, handle) == FAILURE)
WRONG_PARAM_COUNT;
 
FETCH_WINRES(win, handle);
 
+   panel = (PANEL **)emalloc(sizeof(PANEL *));
*panel = new_panel(*win);
 
if (*panel == NULL) {
@@ -2455,13 +2459,15 @@
 {
zval *phandle = NULL;
PANEL **panel;
-   WINDOW **win = (WINDOW **)emalloc(sizeof(WINDOW *));
+   WINDOW **win;
 
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, 
phandle)) {
return;
}
 
FETCH_PANEL(panel, phandle);
+
+   win = (WINDOW **)emalloc(sizeof(WINDOW *));
*win = panel_window(*panel);
 
if (*win == NULL) {



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




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

2002-09-29 Thread Wez Furlong

wez Sun Sep 29 18:55:09 2002 EDT

  Modified files:  
/php4/ext/ncurses   ncurses_functions.c 
  Log:
  Prevent possible problems with two resource ids referencing the same
  panel.
  
  
Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.23 
php4/ext/ncurses/ncurses_functions.c:1.24
--- php4/ext/ncurses/ncurses_functions.c:1.23   Sat Sep 28 18:50:23 2002
+++ php4/ext/ncurses/ncurses_functions.cSun Sep 29 18:55:09 2002
 -2061,7 +2061,8 
efree(panel);
RETURN_FALSE;
} else {
-   ZEND_REGISTER_RESOURCE(return_value, panel, le_ncurses_panels);
+   long id = ZEND_REGISTER_RESOURCE(return_value, panel, 
+le_ncurses_panels);
+   set_panel_userptr(*panel, (void*)id);
}
 
 }
 -2196,7 +2197,7 
 {
zval *phandle = NULL;
PANEL **panel;
-   PANEL **above = (PANEL **)emalloc(sizeof(PANEL *));
+   PANEL *above;
 
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r!, 
phandle)) {
return;
 -2204,16 +2205,18 
 
if (phandle) {
FETCH_PANEL(panel, phandle);
-   *above = panel_above(*panel);
+   above = panel_above(*panel);
} else {
-   *above = panel_above((PANEL *)0);
+   above = panel_above((PANEL *)0);
}
 
-   if (*above == NULL) {
-   efree(above);
+   if (above) {
+   long id = (long)panel_userptr(above);
+   zend_list_addref(id);
+   RETURN_RESOURCE(id);
+   } else {
RETURN_FALSE;
}
-   ZEND_REGISTER_RESOURCE(return_value, above, le_ncurses_panels);
 }
 /* }}} */
 
 -2223,7 +2226,7 
 {
zval *phandle = NULL;
PANEL **panel;
-   PANEL **below = (PANEL **)emalloc(sizeof(PANEL *));
+   PANEL *below;
 
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r!, 
phandle)) {
return;
 -2231,16 +2234,17 
 
if (phandle) {
FETCH_PANEL(panel, phandle);
-   *below = panel_below(*panel);
+   below = panel_below(*panel);
} else {
-   *below = panel_below((PANEL *)0);
+   below = panel_below((PANEL *)0);
}
-
-   if (*below == NULL) {
-   efree(below);
+   if (below) {
+   long id = (long)panel_userptr(below);
+   zend_list_addref(id);
+   RETURN_RESOURCE(id);
+   } else {
RETURN_FALSE;
}
-   ZEND_REGISTER_RESOURCE(return_value, below, le_ncurses_panels);
 }
 /* }}} */
 



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




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

2002-09-28 Thread Wez Furlong

wez Sat Sep 28 13:03:02 2002 EDT

  Modified files:  
/php4/ext/ncurses   ncurses_functions.c 
  Log:
  Fix crash bug and return value.
  
  
Index: php4/ext/ncurses/ncurses_functions.c
diff -u php4/ext/ncurses/ncurses_functions.c:1.21 
php4/ext/ncurses/ncurses_functions.c:1.22
--- php4/ext/ncurses/ncurses_functions.c:1.21   Fri Sep 27 18:33:14 2002
+++ php4/ext/ncurses/ncurses_functions.cSat Sep 28 13:03:02 2002
 -1642,7 +1642,7 
 }
 /* }}} */
 
-/* {{{ proto int ncurses_mousemask(int newmask, int oldmask)
+/* {{{ proto int ncurses_mousemask(int newmask, int oldmask)
Returns and sets mouse options */
 PHP_FUNCTION(ncurses_mousemask)
 {
 -1669,13 +1669,13 
Reads mouse event from queue */
 PHP_FUNCTION(ncurses_getmouse)
 {
-  zval **arg;
+   zval **arg;
MEVENT mevent;
ulong retval;
 
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg) == FAILURE){
WRONG_PARAM_COUNT;
-  }
+   }
 
pval_destructor(*arg);
array_init(*arg);
 -1688,7 +1688,7 
add_assoc_long(*arg, z, mevent.z);
add_assoc_long(*arg, mmask, mevent.bstate);
 
-   RETURN_BOOL(retval);
+   RETURN_BOOL(retval == 0);
 }
 /* }}} */
 
 -1775,9 +1775,9 
int nx, ny, retval;
WINDOW **win;
 
-   if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, y, x, toscreen) == 
FAILURE){
+   if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, handle, y, x, 
+toscreen) == FAILURE){
WRONG_PARAM_COUNT;
-  }
+   }
 
FETCH_WINRES(win, handle);
 
 -1788,10 +1788,10 
ny = Z_LVAL_PP(y);
nx = Z_LVAL_PP(x);
 
- retval = wmouse_trafo (*win, ny, nx, Z_LVAL_PP(toscreen));
+   retval = wmouse_trafo (*win, ny, nx, Z_LVAL_PP(toscreen));
 
- Z_LVAL_PP(y) = ny;
- Z_LVAL_PP(x) = nx;
+   Z_LVAL_PP(y) = ny;
+   Z_LVAL_PP(x) = nx;
 
RETURN_BOOL(retval);
 }



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