Tsukada
ttsuk****@users*****
2002年 5月 23日 (木) 05:13:45 JST
ttsukada 02/05/23 05:13:45 Modified: ext/mbstring mbfunction.c Log: MBFL update Revision Changes Path 1.4 +96 -96 php4/ext/mbstring/mbfunction.c Index: mbfunction.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mbstring/mbfunction.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- mbfunction.c 22 May 2002 19:55:52 -0000 1.3 +++ mbfunction.c 22 May 2002 20:13:45 -0000 1.4 @@ -79,18 +79,18 @@ *return_size = 0; } if (string_val == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return result; } if (string_len <= 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return result; } /* copy the string for work */ tmpstr = (char *)estrndup(string_val, string_len); if (tmpstr == NULL) { - MBG(last_errno) = PHP_MB_ERR_NO_MEMORY; + MBSTRG(last_errno) = PHP_MB_ERR_NO_MEMORY; return result; } @@ -102,12 +102,12 @@ p1 = p2 + 1; n++; } - size = n + MBG(language_r)->auto_detect_count; + size = n + MBSTRG(language_r)->auto_detect_count; /* make list */ list = (php_mb_enc **)pecalloc(size + 1, sizeof(php_mb_enc *), persistent); if (list == NULL) { - MBG(last_errno) = PHP_MB_ERR_NO_MEMORY; + MBSTRG(last_errno) = PHP_MB_ERR_NO_MEMORY; efree(tmpstr); return result; } @@ -138,8 +138,8 @@ if (!bauto) { bauto = 1; i = 0; - while (i < MBG(language_r)->auto_detect_count) { - list[n] = php_mb_enc_get(MBG(language_r)->auto_detect_list[i]); + while (i < MBSTRG(language_r)->auto_detect_count) { + list[n] = php_mb_enc_get(MBSTRG(language_r)->auto_detect_list[i]); i++; n++; } @@ -201,15 +201,15 @@ result = NULL; if (from == NULL || to == NULL) { - MBG(last_errno) = PHP_MB_ERR_UNSUPPORTED_ENCODING; + MBSTRG(last_errno) = PHP_MB_ERR_UNSUPPORTED_ENCODING; return result; } if (string_val == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return result; } if (string_len < 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return result; } @@ -224,10 +224,10 @@ filter1 = php_mb_conv_filt_create(from, to, php_mb_str_output, NULL, tmpstr); filter2 = NULL; if (filter1 == NULL) { - filter2 = php_mb_conv_filt_create(MBG(wchar_encoding), to, php_mb_str_output, NULL, tmpstr); + filter2 = php_mb_conv_filt_create(MBSTRG(wchar_encoding), to, php_mb_str_output, NULL, tmpstr); if (filter2 != NULL) { PHP_MB_FILT_TSRMLS_SET(filter2); - filter1 = php_mb_conv_filt_create(from, MBG(wchar_encoding), (int (*)(int, void*))filter2->filter_function, NULL, filter2); + filter1 = php_mb_conv_filt_create(from, MBSTRG(wchar_encoding), (int (*)(int, void*))filter2->filter_function, NULL, filter2); } } if (filter1 == NULL) { @@ -235,7 +235,7 @@ php_mb_conv_filt_free(filter2); } php_mb_str_free(tmpstr); - MBG(last_errno) = PHP_MB_ERR_UNSUPPORTED_CONVERT; + MBSTRG(last_errno) = PHP_MB_ERR_UNSUPPORTED_CONVERT; return result; } PHP_MB_FILT_TSRMLS_SET(filter1); @@ -298,7 +298,7 @@ return NULL; } } else { - to_encoding = MBG(internal_encoding_r); + to_encoding = MBSTRG(internal_encoding_r); } /* pre-conversion encoding */ @@ -354,11 +354,11 @@ mbfl_convert_filter *filter; if (string_val == NULL || from == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return NULL; } if (string_len < 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return NULL; } @@ -370,7 +370,7 @@ php_mb_buf_adjust_realloc(result, string_len); PHP_MB_BUF_TSRMLS_SET(result); - filter = php_mb_conv_filt_create(from, MBG(wchar_encoding), php_mb_buf_output, NULL, result); + filter = php_mb_conv_filt_create(from, MBSTRG(wchar_encoding), php_mb_buf_output, NULL, result); if (filter == NULL) { php_mb_buf_free(result); return NULL; @@ -407,7 +407,7 @@ result = NULL; if (buffer == NULL || to == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return result; } @@ -419,7 +419,7 @@ php_mb_str_adjust_realloc(tmpstr, buffer->length); PHP_MB_STR_TSRMLS_SET(tmpstr); - filter = php_mb_conv_filt_create(MBG(wchar_encoding), to, php_mb_str_output, NULL, tmpstr); + filter = php_mb_conv_filt_create(MBSTRG(wchar_encoding), to, php_mb_str_output, NULL, tmpstr); if (filter == NULL) { php_mb_str_free(tmpstr); return result; @@ -460,18 +460,18 @@ php_mb_bufconv *convd; if (from == NULL || to == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return NULL; } if (initsz < 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return NULL; } /* allocate */ convd = (php_mb_bufconv*)emalloc(sizeof(php_mb_bufconv)); if (convd == NULL) { - MBG(last_errno) = PHP_MB_ERR_NO_MEMORY; + MBSTRG(last_errno) = PHP_MB_ERR_NO_MEMORY; return NULL; } convd->string = php_mb_str_create(); @@ -482,12 +482,12 @@ /* create convert filter */ convd->filter1 = php_mb_conv_filt_create(from, to, php_mb_str_output, NULL, convd->string); - convd->filter2 = php_mb_conv_filt_create(MBG(wchar_encoding), to, php_mb_str_output, NULL, convd->string); + convd->filter2 = php_mb_conv_filt_create(MBSTRG(wchar_encoding), to, php_mb_str_output, NULL, convd->string); if (convd->filter1 != NULL) { convd->input_filter = convd->filter1; convd->output_filter = convd->filter1; } else if (convd->filter2 != NULL) { - convd->filter1 = php_mb_conv_filt_create(from, MBG(wchar_encoding), (int (*)(int, void*))convd->filter2->filter_function, NULL, convd->filter2); + convd->filter1 = php_mb_conv_filt_create(from, MBSTRG(wchar_encoding), (int (*)(int, void*))convd->filter2->filter_function, NULL, convd->filter2); convd->input_filter = convd->filter1; convd->output_filter = convd->filter2; } @@ -496,10 +496,10 @@ php_mb_conv_filt_free(convd->filter2); php_mb_str_free(convd->string); efree(convd); - MBG(last_errno) = PHP_MB_ERR_UNSUPPORTED_CONVERT; + MBSTRG(last_errno) = PHP_MB_ERR_UNSUPPORTED_CONVERT; return NULL; } - MBG(last_errno) = PHP_MB_SUCCESS; + MBSTRG(last_errno) = PHP_MB_SUCCESS; convd->from = from; convd->to = to; @@ -528,16 +528,16 @@ php_mb_bufconv_reset(php_mb_bufconv *convd, php_mb_enc *to, php_mb_enc *from TSRMLS_DC) { if (convd == NULL || from == NULL || to == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return FAILURE; } php_mb_bufconv_flush(convd); if (php_mb_conv_filt_reset(convd->filter1, from, to) < 0) { - if (php_mb_conv_filt_reset(convd->filter1, from, MBG(wchar_encoding)) < 0) { + if (php_mb_conv_filt_reset(convd->filter1, from, MBSTRG(wchar_encoding)) < 0) { return FAILURE; } - if (php_mb_conv_filt_reset(convd->filter2, MBG(wchar_encoding), to) < 0) { + if (php_mb_conv_filt_reset(convd->filter2, MBSTRG(wchar_encoding), to) < 0) { return FAILURE; } convd->input_filter = convd->filter1; @@ -572,7 +572,7 @@ int (*filter_function)(int c, mbfl_convert_filter *filter); if (convd == NULL || value == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return FAILURE; } @@ -634,18 +634,18 @@ php_mb_enc *result; if (string_val == NULL || list == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return NULL; } if (string_len < 0 || listsize < 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return NULL; } /* initialize */ flist = (mbfl_identify_filter **)emalloc(listsize*sizeof(mbfl_identify_filter*)); if (flist == NULL) { - MBG(last_errno) = PHP_MB_ERR_NO_MEMORY; + MBSTRG(last_errno) = PHP_MB_ERR_NO_MEMORY; return NULL; } i = 0; @@ -715,24 +715,24 @@ mbfl_identify_filter *filter; if (list == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return NULL; } if (listsize <= 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return NULL; } /* allocate */ identd = (php_mb_detector*)emalloc(sizeof(php_mb_detector)); if (identd == NULL) { - MBG(last_errno) = PHP_MB_ERR_NO_MEMORY; + MBSTRG(last_errno) = PHP_MB_ERR_NO_MEMORY; return NULL; } identd->filter_list = (mbfl_identify_filter **)emalloc(listsize*sizeof(mbfl_identify_filter *)); if (identd->filter_list == NULL) { efree(identd); - MBG(last_errno) = PHP_MB_ERR_NO_MEMORY; + MBSTRG(last_errno) = PHP_MB_ERR_NO_MEMORY; return NULL; } @@ -800,7 +800,7 @@ res = 0; if (identd == NULL || value == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return res; } @@ -902,7 +902,7 @@ len = -1; if (string_val == NULL || encoding == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return len; } @@ -929,7 +929,7 @@ mbfl_convert_filter *filter; /* wchar filter */ - filter = php_mb_conv_filt_create(encoding, MBG(wchar_encoding), filter_count_output, NULL, &len); + filter = php_mb_conv_filt_create(encoding, MBSTRG(wchar_encoding), filter_count_output, NULL, &len); if (filter == NULL) { return len; } @@ -1027,15 +1027,15 @@ result = -1; if (haystack == NULL || needle == NULL || encoding == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return result; } if (haystack_len < 0 || needle_len < 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return result; } if (offset < 0) { - MBG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; + MBSTRG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; return result; } @@ -1046,12 +1046,12 @@ } if (cd.needle->length <= 0 || cd.needle->value == NULL) { php_mb_buf_free(cd.needle); - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return result; } /* initialize filter and collector data */ - filter = php_mb_conv_filt_create(encoding, MBG(wchar_encoding), collector_strpos, NULL, &cd); + filter = php_mb_conv_filt_create(encoding, MBSTRG(wchar_encoding), collector_strpos, NULL, &cd); if (filter == NULL) { php_mb_buf_free(cd.needle); return result; @@ -1153,7 +1153,7 @@ struct collector_replace_data pc; if (search == NULL || replace == NULL || subject == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return NULL; } @@ -1184,13 +1184,13 @@ pc.decoder = php_mb_conv_filt_create( libglobal, - MBG(wchar_encoding), + MBSTRG(wchar_encoding), subject->encoding, php_mb_str_output, NULL, result); encoder = php_mb_conv_filt_create( libglobal, subject->encoding, - MBG(wchar_encoding), + MBSTRG(wchar_encoding), collector_replace, NULL, &pc); if (pc.decoder == NULL || encoder == NULL) { php_mb_buf_free(pc.search); @@ -1269,15 +1269,15 @@ result = NULL; if (string_val == NULL || encoding == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return result; } if (string_len < 0 || count < 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return result; } if (start < 0) { - MBG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; + MBSTRG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; return result; } @@ -1328,7 +1328,7 @@ } if (start_index < 0 || start_index >= string_len || start_index > end_index) { - MBG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; + MBSTRG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; return result; } if (end_index > string_len) { @@ -1357,9 +1357,9 @@ php_mb_str_adjust_realloc(tmpstr, count*2); PHP_MB_STR_TSRMLS_SET(tmpstr); /* output code filter */ - cd.decoder = php_mb_conv_filt_create(MBG(wchar_encoding), encoding, php_mb_str_output, NULL, tmpstr); + cd.decoder = php_mb_conv_filt_create(MBSTRG(wchar_encoding), encoding, php_mb_str_output, NULL, tmpstr); /* wchar filter */ - encoder = php_mb_conv_filt_create(encoding, MBG(wchar_encoding), collector_substr, NULL, &cd); + encoder = php_mb_conv_filt_create(encoding, MBSTRG(wchar_encoding), collector_substr, NULL, &cd); if (cd.decoder == NULL || encoder == NULL) { php_mb_conv_filt_free(encoder); php_mb_conv_filt_free(cd.decoder); @@ -1388,7 +1388,7 @@ php_mb_conv_filt_free(encoder); php_mb_conv_filt_free(cd.decoder); if (start >= cd.output) { - MBG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; + MBSTRG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; } else { php_mb_str_nullpad(tmpstr); result = tmpstr->value; @@ -1420,15 +1420,15 @@ result = NULL; if (string_val == NULL || encoding == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return result; } if (string_len < 0 || size < 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return result; } if (start < 0 || start >= string_len) { - MBG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; + MBSTRG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; return result; } @@ -1483,7 +1483,7 @@ } if (start_index < 0 || start_index >= string_len || start_index > end_index) { - MBG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; + MBSTRG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; return result; } if (end_index > string_len) { @@ -1511,9 +1511,9 @@ php_mb_str_adjust_realloc(tmpstr, size + 4); PHP_MB_STR_TSRMLS_SET(tmpstr); /* wchar filter */ - encoder = php_mb_conv_filt_create(encoding, MBG(wchar_encoding), mbfl_filter_output_null, NULL, NULL); + encoder = php_mb_conv_filt_create(encoding, MBSTRG(wchar_encoding), mbfl_filter_output_null, NULL, NULL); /* output code filter */ - decoder = php_mb_conv_filt_create(MBG(wchar_encoding), encoding, php_mb_str_output, NULL, tmpstr); + decoder = php_mb_conv_filt_create(MBSTRG(wchar_encoding), encoding, php_mb_str_output, NULL, tmpstr); if (encoder == NULL || decoder == NULL) { php_mb_conv_filt_free(decoder); php_mb_conv_filt_free(encoder); @@ -1609,16 +1609,16 @@ len = -1; if (string_val == NULL || encoding == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return len; } if (string_len < 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return len; } /* wchar filter */ - filter = php_mb_conv_filt_create(encoding, MBG(wchar_encoding), filter_count_width, NULL, &len); + filter = php_mb_conv_filt_create(encoding, MBSTRG(wchar_encoding), filter_count_width, NULL, &len); if (filter == NULL) { return len; } @@ -1712,15 +1712,15 @@ result = NULL; if (string_val == NULL || encoding == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return result; } if (string_len < 0 || marker_len < 0 || width < 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return result; } if (start < 0) { - MBG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; + MBSTRG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; return result; } @@ -1733,9 +1733,9 @@ PHP_MB_STR_TSRMLS_SET(tmpstr); /* output code filter */ - cd.decoder = php_mb_conv_filt_create(MBG(wchar_encoding), encoding, php_mb_str_output, NULL, tmpstr); + cd.decoder = php_mb_conv_filt_create(MBSTRG(wchar_encoding), encoding, php_mb_str_output, NULL, tmpstr); /* wchar filter */ - encoder = php_mb_conv_filt_create(encoding, MBG(wchar_encoding), collector_trim_width, NULL, &cd); + encoder = php_mb_conv_filt_create(encoding, MBSTRG(wchar_encoding), collector_trim_width, NULL, &cd); if (cd.decoder == NULL || encoder == NULL) { php_mb_conv_filt_free(encoder); php_mb_conv_filt_free(cd.decoder); @@ -1801,7 +1801,7 @@ php_mb_conv_filt_free(cd.decoder); php_mb_conv_filt_free(encoder); if (start >= cd.outchar) { - MBG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; + MBSTRG(last_errno) = PHP_MB_ERR_INDEX_OUT_OF_BOUNDS; } else { php_mb_str_nullpad(tmpstr); result = tmpstr->value; @@ -1925,20 +1925,20 @@ php_mb_mime_header_encoder *pe; if (input == NULL || charset == NULL || transfer == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return NULL; } /* check MIME charset name */ if (charset->mime_name == NULL || transfer->mime_name == NULL) { - MBG(last_errno) = PHP_MB_ERR_UNSUPPORTED_ENCODING; + MBSTRG(last_errno) = PHP_MB_ERR_UNSUPPORTED_ENCODING; return NULL; } /* allocate */ pe = (php_mb_mime_header_encoder*)emalloc(sizeof(php_mb_mime_header_encoder)); if (pe == NULL) { - MBG(last_errno) = PHP_MB_ERR_NO_MEMORY; + MBSTRG(last_errno) = PHP_MB_ERR_NO_MEMORY; return NULL; } @@ -1957,10 +1957,10 @@ pe->encod_filter = php_mb_conv_filt_create(charset, transfer, php_mb_str_output, NULL, pe->result); /* Output code filter */ - pe->conv2_filter = php_mb_conv_filt_create(MBG(wchar_encoding), charset, mbfl_filter_output_pipe, NULL, pe->encod_filter); + pe->conv2_filter = php_mb_conv_filt_create(MBSTRG(wchar_encoding), charset, mbfl_filter_output_pipe, NULL, pe->encod_filter); /* Input code filter */ - pe->conv1_filter = php_mb_conv_filt_create(input, MBG(wchar_encoding), mime_header_encoder_collector, NULL, pe); + pe->conv1_filter = php_mb_conv_filt_create(input, MBSTRG(wchar_encoding), mime_header_encoder_collector, NULL, pe); /* encoded block filter */ encoding = php_mb_enc_get(php_mb_encid_pass); @@ -2077,11 +2077,11 @@ php_mb_mime_header_encoder *pe; if (string_val == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return NULL; } if (string_len < 0 || indent < 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return NULL; } @@ -2189,7 +2189,7 @@ pd->status = 5; pd->encoding_transfer = encoding; /* charset convert filter */ - php_mb_conv_filt_reset(pd->conv1_filter, pd->encoding_charset, MBG(wchar_encoding) ); + php_mb_conv_filt_reset(pd->conv1_filter, pd->encoding_charset, MBSTRG(wchar_encoding) ); /* decode filter */ php_mb_conv_filt_reset(pd->deco_filter, pd->encoding_transfer, php_mb_enc_get(php_mb_encid_8bit) ); if (pd->encoding_transfer->id == php_mb_encid_qprint) { @@ -2225,7 +2225,7 @@ /* flush and reset filter */ php_mb_conv_filt_flush(pd->deco_filter); php_mb_conv_filt_flush(pd->conv1_filter); - php_mb_conv_filt_reset(pd->conv1_filter, php_mb_enc_get(php_mb_encid_ascii), MBG(wchar_encoding) ); + php_mb_conv_filt_reset(pd->conv1_filter, php_mb_enc_get(php_mb_encid_ascii), MBSTRG(wchar_encoding) ); pd->status = 7; } else { PHP_MB_CONV_FILT_PUTC(0x3f, pd->deco_filter); @@ -2291,14 +2291,14 @@ php_mb_mime_header_decoder *decoder; if (output_enc == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return NULL; } /* allocate */ decoder = (php_mb_mime_header_decoder*)emalloc(sizeof(php_mb_mime_header_decoder)); if (decoder == NULL) { - MBG(last_errno) = PHP_MB_ERR_NO_MEMORY; + MBSTRG(last_errno) = PHP_MB_ERR_NO_MEMORY; return NULL; } @@ -2316,12 +2316,12 @@ /* charset convert filter */ decoder->conv2_filter = php_mb_conv_filt_create( - MBG(wchar_encoding), + MBSTRG(wchar_encoding), decoder->encoding_output, php_mb_str_output, NULL, decoder->result); decoder->conv1_filter = php_mb_conv_filt_create( decoder->encoding_charset, - MBG(wchar_encoding), + MBSTRG(wchar_encoding), mbfl_filter_output_pipe, NULL, decoder->conv2_filter); /* decode filter */ encoding = php_mb_enc_get(php_mb_encid_pass); @@ -2414,7 +2414,7 @@ php_mb_mime_header_decoder *decoder; if (string_val == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return NULL; } @@ -2668,11 +2668,11 @@ result = NULL; if (string_val == NULL || encoding == NULL || convmap == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return result; } if (string_len < 0 || mapsize <= 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return result; } @@ -2693,19 +2693,19 @@ /* output code filter */ cd.decoder = php_mb_conv_filt_create( - MBG(wchar_encoding), + MBSTRG(wchar_encoding), encoding, php_mb_str_output, NULL, tmpstr); /* wchar filter */ if (type == 0) { encoder = php_mb_conv_filt_create( encoding, - MBG(wchar_encoding), + MBSTRG(wchar_encoding), collector_encode_htmlnumericentity, NULL, &cd); } else { encoder = php_mb_conv_filt_create( encoding, - MBG(wchar_encoding), + MBSTRG(wchar_encoding), collector_decode_htmlnumericentity, NULL, &cd); } if (cd.decoder == NULL || encoder == NULL) { @@ -3036,11 +3036,11 @@ result = NULL; if (string_val == NULL || encoding == NULL) { - MBG(last_errno) = PHP_MB_ERR_NULL_POINTER; + MBSTRG(last_errno) = PHP_MB_ERR_NULL_POINTER; return result; } if (string_len < 0) { - MBG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; + MBSTRG(last_errno) = PHP_MB_ERR_ILLEGAL_ARGUMENT; return result; } @@ -3054,12 +3054,12 @@ /* initialize */ cd.decoder = php_mb_conv_filt_create( - MBG(wchar_encoding), + MBSTRG(wchar_encoding), encoding, php_mb_str_output, NULL, tmpstr); encoder = php_mb_conv_filt_create( encoding, - MBG(wchar_encoding), + MBSTRG(wchar_encoding), collector_hantozen, NULL, &cd); if (cd.decoder == NULL || encoder == NULL) { php_mb_str_free(tmpstr); @@ -3112,7 +3112,7 @@ zend_multibyte_oddlen multibyte_oddlen; /* notify script encoding to Zend Engine */ - zend_multibyte_set_script_encoding(MBG(script_encoding), strlen(MBG(script_encoding)) TSRMLS_CC); + zend_multibyte_set_script_encoding(MBSTRG(script_encoding), strlen(MBSTRG(script_encoding)) TSRMLS_CC); encoding_detector = php_mbstring_encoding_detector; encoding_converter = NULL; @@ -3120,7 +3120,7 @@ #if defined(MBSTR_ENC_TRANS) /* notify internal encoding to Zend Engine */ - zend_multibyte_set_internal_encoding((char*)MBG(internal_encoding_r)->name, strlen(MBG(internal_encoding_r)->name) TSRMLS_CC); + zend_multibyte_set_internal_encoding((char*)MBSTRG(internal_encoding_r)->name, strlen(MBSTRG(internal_encoding_r)->name) TSRMLS_CC); encoding_converter = php_mbstring_encoding_converter; #endif /* defined(MBSTR_ENC_TRANS) */ @@ -3149,7 +3149,7 @@ } if (elist == NULL) { - php_mb_parse_encoding_list(MBG(detect_order), strlen(MBG(detect_order)), &elist, &size, 0 TSRMLS_CC); + php_mb_parse_encoding_list(MBSTRG(detect_order), strlen(MBSTRG(detect_order)), &elist, &size, 0 TSRMLS_CC); } encoding = php_mb_detect_encoding(arg_string, arg_length, elist, size TSRMLS_CC);