diff options
author | Dan Kalowsky <kalowsky@php.net> | 2002-09-09 20:49:00 +0000 |
---|---|---|
committer | Dan Kalowsky <kalowsky@php.net> | 2002-09-09 20:49:00 +0000 |
commit | 44685a9ae58e3c0fd3984883688493cb9b565f72 (patch) | |
tree | 1f794d9d5d7605a172f7cea62b80a64fa878e9f3 | |
parent | 8569a9ab7a7dee756143112c4da5407590015ee5 (diff) | |
download | php-git-44685a9ae58e3c0fd3984883688493cb9b565f72.tar.gz |
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
-rw-r--r-- | ext/imap/php_imap.c | 58 |
1 files changed, 41 insertions, 17 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index be9accb99f..a802ce1892 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -376,13 +376,28 @@ void mail_free_messagelist(MESSAGELIST **msglist, MESSAGELIST **tail) */ 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 @@ PHP_FUNCTION(imap_get_quota) 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 @@ PHP_FUNCTION(imap_get_quota) 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 @@ PHP_FUNCTION(imap_utf7_decode) /* author: Andrew Skalski <askalski@chek.com> */ 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 @@ PHP_FUNCTION(imap_utf7_decode) 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 @@ PHP_FUNCTION(imap_utf7_encode) /* author: Andrew Skalski <askalski@chek.com> */ 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 @@ PHP_FUNCTION(imap_utf7_encode) } 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 @@ PHP_FUNCTION(imap_utf7_encode) /* 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: |