diff options
author | Dmitry Stogov <dmitry@php.net> | 2005-08-23 09:33:46 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2005-08-23 09:33:46 +0000 |
commit | f4b8f4e95871bbce1b9a3eb8cef04ee9f437bfd6 (patch) | |
tree | 615bb522213e08f4571605a5d8d2ee498a8d4ad6 /ext/sqlite | |
parent | 24743055a3b744272457465646dbdee174ae5f81 (diff) | |
download | php-git-f4b8f4e95871bbce1b9a3eb8cef04ee9f437bfd6.tar.gz |
Unicode support cleanup
Diffstat (limited to 'ext/sqlite')
-rw-r--r-- | ext/sqlite/sqlite.c | 44 |
1 files changed, 5 insertions, 39 deletions
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c index bbd0ccfe8b..a51a3d87f8 100644 --- a/ext/sqlite/sqlite.c +++ b/ext/sqlite/sqlite.c @@ -1917,11 +1917,7 @@ static void php_sqlite_fetch_column(struct php_sqlite_result *res, zval *which, char *decoded = emalloc(l); l = php_sqlite_decode_binary(rowdata[j]+1, decoded); decoded[l] = '\0'; - if (UG(unicode)) { - RETVAL_BINARYL(decoded, l, 0); - } else { - RETVAL_STRINGL(decoded, l, 0); - } + RETVAL_BINARYL(decoded, l, 0); if (!res->buffered) { efree((char*)rowdata[j]); rowdata[j] = NULL; @@ -2444,13 +2440,7 @@ PHP_FUNCTION(sqlite_libversion) if (ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } - if (UG(unicode)) { - char *temp = (char*)sqlite_libversion(); - UChar *u_temp = zend_ascii_to_unicode(temp, strlen(temp)+1 ZEND_FILE_LINE_CC); - RETURN_UNICODE(u_temp, 0); - } else { - RETURN_STRING((char*)sqlite_libversion(), 1); - } + RETURN_ASCII_STRING((char*)sqlite_libversion(), 1); } /* }}} */ @@ -2461,13 +2451,7 @@ PHP_FUNCTION(sqlite_libencoding) if (ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } - if (UG(unicode)) { - char *temp = (char*)sqlite_libencoding(); - UChar *u_temp = zend_ascii_to_unicode(temp, strlen(temp)+1 ZEND_FILE_LINE_CC); - RETURN_UNICODE(u_temp, 0); - } else { - RETURN_STRING((char*)sqlite_libencoding(), 1); - } + RETURN_ASCII_STRING((char*)sqlite_libencoding(), 1); } /* }}} */ @@ -2664,16 +2648,7 @@ PHP_FUNCTION(sqlite_field_name) RETURN_FALSE; } - if (UG(unicode)) { - UErrorCode status = U_ZERO_ERROR; - UChar *u_str; - int32_t u_len; - - zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, res->col_names[field], strlen(res->col_names[field]), &status); - RETURN_UNICODEL(u_str, u_len, 0); - } else { - RETURN_STRING(res->col_names[field], 1); - } + RETURN_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), res->col_names[field], 1); } /* }}} */ @@ -2914,16 +2889,7 @@ PHP_FUNCTION(sqlite_error_string) msg = sqlite_error_string(code); if (msg) { - if (UG(unicode)) { - UErrorCode status = U_ZERO_ERROR; - UChar *u_str; - int32_t u_len; - - zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, msg, strlen(msg), &status); - RETURN_UNICODEL(u_str, u_len, 0); - } else { - RETURN_STRING((char*)msg, 1); - } + RETURN_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), (char*)msg, 1); } else { RETURN_NULL(); } |