dtdocbook: fix a crash caused by type casting.

This commit is contained in:
Liang Chang
2022-04-16 08:18:06 -06:00
parent c051e6d3bc
commit 2a988df4c3
3 changed files with 7 additions and 7 deletions

View File

@@ -45,7 +45,7 @@ FlexBuffer::FlexBuffer()
void
FlexBuffer::grow(size_t needed)
{
if(needed + 1 > (size_t) maxSize){
if(needed + 1 > maxSize){
char *born = new char[maxSize = needed * 3 / 2 + 10];
if(pos){
@@ -70,7 +70,7 @@ FlexBuffer::write(const char *d, size_t n)
void
FlexBuffer::writeStr(const char *str )
{
int n = strlen(str);
size_t n = strlen(str);
grow( pos + n );
memcpy ( HeadPtr + pos, str, n );
pos += n;

View File

@@ -33,8 +33,8 @@ class FlexBuffer {
friend ostream &operator<< ( ostream &s, FlexBuffer &);
private:
int pos;
int maxSize;
size_t pos;
size_t maxSize;
char *HeadPtr;
void grow(size_t);

View File

@@ -735,7 +735,7 @@ writeGraphics(BookCaseDB &db, const char *thisBook, DBCursor &gr_cursor,
const char *version;
const char *typeInfo;
const char *data;
int len;
size_t len;
const char *title;
while(gr_cursor.next(STRING_CODE, &aBook,
@@ -765,7 +765,7 @@ writeGraphics(BookCaseDB &db, const char *thisBook, DBCursor &gr_cursor,
STRING_CODE, name,
STRING_CODE, version,
STRING_CODE, typeInfo,
-COMPRESSED_STRING_CODE, comp_agent, data, (size_t)len,
-COMPRESSED_STRING_CODE, comp_agent, data, len,
STRING_CODE, title,
NULL);
}
@@ -774,7 +774,7 @@ writeGraphics(BookCaseDB &db, const char *thisBook, DBCursor &gr_cursor,
STRING_CODE, name,
STRING_CODE, version,
STRING_CODE, typeInfo,
-STRING_CODE, data, (size_t)len,
-STRING_CODE, data, len,
STRING_CODE, title,
NULL);
}