Changes I made to get it to build
Code:
@@ -1,5 +1,6 @@
+#include <float.h>
#include "mcc_get.h"
int mcc_encoding_type = 0;
int mcc_encoding_node = mcc_encoding_count;
char const *env_LANG = NULL;
mcc_char_info_t mcc_common_char_info[ mcc_encoding_count ] = {{0}};
@@ -442,14 +443,16 @@ int mcc_getall( MCC_POS *src, MCC_CH8 *dst,
tok.src = mcc_iconv_tok_mem( tok.src, srcm->addr,
srcv->use * mcc_char_info.size );
if ( mcc_char_info.enc == mcc_encoding_ch8 ) {
if ( srcv->use > (dstv->cap - dstv->use) ) {
ret = mcc_vecsize( dstv,
- (dstv->use + srcv->use) * sizeof(mcc_ch8_t),
+ (dstv->use + srcv->use + 1) * sizeof(mcc_ch8_t),
sizeof(mcc_ch8_t) );
if ( ret != EXIT_SUCCESS ) return ret;
- }
+ } else {
+ ret = EXIT_SUCCESS;
+ }
tok.dst = mcc_iconv_tok_mem( tok.dst, dstm->addr, dstm->size );
(void)memcpy( tok.dst.addr, srcm->addr, tok.src.size );
dstv->use += srcv->use;
goto mcc_getall_done;
}
@@ -976,11 +979,11 @@ int mcc_getnum(
long len = 0;
ullong rev = 0, num = 0, dec, pos, bit, no_mul = 0;
sllong exp;
if ( !dst ) return EDESTADDRREQ;
(void)memset( dst, 0, sizeof(MCC_NUM) );
- if ( !src || !src->text.use ) return ENODATA;
+ if ( !src || !src->text.vec.use ) return ENODATA;
if ( !base ) {
if ( mcc_ch8ctype( C[0] ) == MCC_CHAR_TYPE_SPACE ) {
mcc_getnum_sign:
while ( (ret = mcc_getc(src, C, &len )) == EXIT_SUCCESS ) {
if ( len != 1 ) break;
The only dubious change is
Code:
(dstv->use + srcv->use + 1) * sizeof(mcc_ch8_t),
Which I merely added so that there's room for the '\0' character. The other changes were required to get it to actually build (apart from the ret = EXIT_SUCCESS; which is necessary to make sure it's initialised if the preceding condition is false)