kalowsky                Mon Sep  9 16:49:01 2002 EDT

  Modified files:              (Branch: PHP_4_2_0)
    /php4/ext/imap      php_imap.c 
  Log:
  Re-applying compiler fix for IRIX, bug #15630
  # Jani make sure you update your sources before you commit them.  You 
  # blew this entire bugfix out of 4.2.3
  
  
Index: php4/ext/imap/php_imap.c
diff -u php4/ext/imap/php_imap.c:1.112.2.4 php4/ext/imap/php_imap.c:1.112.2.5
--- php4/ext/imap/php_imap.c:1.112.2.4  Sun Aug 25 21:58:31 2002
+++ php4/ext/imap/php_imap.c    Mon Sep  9 16:49:00 2002
@@ -25,7 +25,7 @@
    | PHP 4.0 updates:  Zeev Suraski <[EMAIL PROTECTED]>                       |
    +----------------------------------------------------------------------+
  */
-/* $Id: php_imap.c,v 1.112.2.4 2002/08/26 01:58:31 sniper Exp $ */
+/* $Id: php_imap.c,v 1.112.2.5 2002/09/09 20:49:00 kalowsky Exp $ */
 
 #define IMAP41
 
@@ -376,13 +376,28 @@
  */
 void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist)
 {
+       zval *t_map;
        TSRMLS_FETCH();
 
        /* this should only be run through once */
        for (; qlist; qlist = qlist->next)
        {
-               IMAPG(quota_usage) = qlist->usage;
-               IMAPG(quota_limit) = qlist->limit;
+               MAKE_STD_ZVAL(t_map);
+               if (array_init(t_map) == FAILURE) {
+                       php_error(E_WARNING, "Unable to allocate t_map memory");
+                       FREE_ZVAL(t_map);
+                       FREE_ZVAL(IMAPG(quota_return));
+                       return;
+               }
+               if (strncmp(qlist->name, "STORAGE", 7) == 0)
+               {
+                       add_assoc_long_ex(IMAPG(quota_return), "usage", 
+sizeof("usage"), qlist->usage);
+                       add_assoc_long_ex(IMPAG(quota_return), "limit", 
+sizeof("limit"), qlist->limit);
+               }
+
+               add_assoc_long_ex(t_map, "usage", sizeof("usage"), qlist->usage);
+               add_assoc_long_ex(t_map, "limit", sizeof("limit"), qlist->usage);
+               ass_assoc_zval_ex(IMAPG(quota_return), qlist->name, 
+strlen(qlist->name)+1, t_map);
        }
 }
 /* }}} */
@@ -1044,6 +1059,13 @@
 
        convert_to_string_ex(qroot);
 
+       MAKE_STD_ZVAL(IMAPG(quota_return));
+       if (array_init(IMAPG(quota_return)) == FAILURE) {
+               php_error(E_WARNING, "Unable to allocate array memory");
+               FREE_ZVAL(IMAPG(quota_return));
+               RETURN_FALSE;
+       }
+
        /* set the callback for the GET_QUOTA function */
        mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
        if(!imap_getquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot))) {
@@ -1051,13 +1073,9 @@
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               php_error(E_WARNING, "Unable to allocate array memory");
-               RETURN_FALSE;
-       }
-               
-       add_assoc_long(return_value, "usage", IMAPG(quota_usage));
-       add_assoc_long(return_value, "limit", IMAPG(quota_limit));
+       *return_value = *IMAPG(quota_return);
+       FREE_ZVAL(IMAPG(quota_return));
+
 }
 /* }}} */
 
@@ -2200,7 +2218,7 @@
        /* author: Andrew Skalski <[EMAIL PROTECTED]> */
        zval **arg;
        const unsigned char *in, *inp, *endp;
-       unsigned char *out, *outp;
+       unsigned char *out, *outp, c;
        int inlen, outlen;
        enum {
                ST_NORMAL,      /* printable text */
@@ -2302,13 +2320,15 @@
                                break;
                        case ST_DECODE1:
                                outp[1] = UNB64(*inp);
-                               *outp++ |= outp[1] >> 4;
+                               c = outp[1] >> 4;
+                               *outp++ |= c;
                                *outp <<= 4;
                                state = ST_DECODE2;
                                break;
                        case ST_DECODE2:
                                outp[1] = UNB64(*inp);
-                               *outp++ |= outp[1] >> 2;
+                               c = outp[1] >> 2;
+                               *outp++ |= c;
                                *outp <<= 6;
                                state = ST_DECODE3;
                                break;
@@ -2341,7 +2361,7 @@
        /* author: Andrew Skalski <[EMAIL PROTECTED]> */
        zval **arg;
        const unsigned char *in, *inp, *endp;
-       unsigned char *out, *outp;
+       unsigned char *out, *outp, c;
        int inlen, outlen;
        enum {
                ST_NORMAL,      /* printable text */
@@ -2412,7 +2432,8 @@
                } else if (inp == endp || !SPECIAL(*inp)) {
                        /* flush overflow and terminate region */
                        if (state != ST_ENCODE0) {
-                               *outp++ = B64(*outp);
+                               c = B64(*outp);
+                               *outp++ = c;
                        }
                        *outp++ = '-';
                        state = ST_NORMAL;
@@ -2420,17 +2441,20 @@
                        /* encode input character */
                        switch (state) {
                                case ST_ENCODE0:
-                                       *outp++ = B64(*inp >> 2);
+                                       c = B64(*outp | *inp >> 4);
+                                       *outp = c;
                                        *outp = *inp++ << 4;
                                        state = ST_ENCODE1;
                                        break;
                                case ST_ENCODE1:
-                                       *outp++ = B64(*outp | *inp >> 4);
+                                       c = B64(*outp | *inp >> 4);
+                                       *outp++ = c;
                                        *outp = *inp++ << 2;
                                        state = ST_ENCODE2;
                                        break;
                                case ST_ENCODE2:
-                                       *outp++ = B64(*outp | *inp >> 6);
+                                       c = B64(*outp | *inp >> 6);
+                                       *outp++ = c;
                                        *outp++ = B64(*inp++);
                                        state = ST_ENCODE0;
                                case ST_NORMAL:



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

Reply via email to