ICU-3192 add string termination for :include
X-SVN-Rev: 14639
This commit is contained in:
parent
dfe8a192e2
commit
eef53a9191
@ -301,6 +301,7 @@ ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* error){
|
||||
}
|
||||
buf->currentPos = pTarget;
|
||||
buf->bufLimit=pTarget+outputWritten;
|
||||
*buf->bufLimit=0; /*NUL terminate*/
|
||||
if(cbuf!=carr){
|
||||
uprv_free(cbuf);
|
||||
}
|
||||
@ -483,12 +484,11 @@ ucbuf_open(const char* fileName,const char** cp,UBool showWarning, UBool buffere
|
||||
}
|
||||
buf->remaining=fileSize-buf->signatureLength;
|
||||
if(buf->isBuffered){
|
||||
buf->buffer=(UChar*) uprv_malloc(U_SIZEOF_UCHAR* MAX_U_BUF);
|
||||
buf->bufCapacity=MAX_U_BUF;
|
||||
}else{
|
||||
buf->buffer=(UChar*) uprv_malloc(U_SIZEOF_UCHAR * (buf->remaining+buf->signatureLength));
|
||||
buf->bufCapacity=buf->remaining+buf->signatureLength;
|
||||
buf->bufCapacity=buf->remaining+buf->signatureLength+1/*for terminating nul*/;
|
||||
}
|
||||
buf->buffer=(UChar*) uprv_malloc(U_SIZEOF_UCHAR * buf->bufCapacity );
|
||||
if (buf->buffer == NULL) {
|
||||
*error = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user