diff --git a/.sconsign.dblite b/.sconsign.dblite deleted file mode 100644 index 545bc48..0000000 Binary files a/.sconsign.dblite and /dev/null differ diff --git a/src/uchardet.cpp b/src/uchardet.cpp index 4edda4e..57378ea 100644 --- a/src/uchardet.cpp +++ b/src/uchardet.cpp @@ -81,11 +81,10 @@ void uchardet_delete(uchardet_t ud) delete reinterpret_cast(ud); } -void uchardet_handle_data(uchardet_t ud, const char * data, size_t len) +int uchardet_handle_data(uchardet_t ud, const char * data, size_t len) { nsresult ret = reinterpret_cast(ud)->HandleData(data, (PRUint32)len); - if (ret != NS_OK) - ; //TODO + return (ret != NS_OK); } void uchardet_data_end(uchardet_t ud) diff --git a/src/uchardet.h b/src/uchardet.h index 7d2a466..4e76636 100644 --- a/src/uchardet.h +++ b/src/uchardet.h @@ -77,35 +77,46 @@ extern "C" { typedef void * uchardet_t; +/** + * Create an encoding detector. + * @return a handle of a instance of uchardet + */ uchardet_t uchardet_new(); +/** + * Delete an encoding detector. + * @param ud [in] handle of a instance of uchardet + */ void uchardet_delete(uchardet_t ud); - /** * Feed data to an encoding detector. + * @param ud [in] handle of a instance of uchardet * @param data [in] data + * @param len [in] number of byte of data + * @return non-zero number on failure. */ -void uchardet_handle_data(uchardet_t ud, const char * data, size_t len); +int uchardet_handle_data(uchardet_t ud, const char * data, size_t len); /** * Notify an end of data to an encoding detctor. + * @param ud [in] handle of a instance of uchardet */ void uchardet_data_end(uchardet_t ud); /** * Reset an encoding detector. + * @param ud [in] handle of a instance of uchardet */ void uchardet_reset(uchardet_t ud); /** * Get the name of encoding that was detected. + * @param ud [in] handle of a instance of uchardet * @return name of charset */ const char * uchardet_get_charset(uchardet_t ud); - - #ifdef __cplusplus } #endif