From 8ef136bcbd2b022edd46dc4c262743096663d743 Mon Sep 17 00:00:00 2001 From: jixiaoxu Date: Thu, 11 Nov 2021 20:38:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dword=E3=80=81ppt=E3=80=81exce?= =?UTF-8?q?l=E6=96=87=E4=BB=B6=E5=86=85=E5=AE=B9=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E4=B9=B1=E7=A0=81=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/parser/binary-parser.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libsearch/parser/binary-parser.cpp b/libsearch/parser/binary-parser.cpp index fedf507..43f8854 100644 --- a/libsearch/parser/binary-parser.cpp +++ b/libsearch/parser/binary-parser.cpp @@ -4954,9 +4954,11 @@ bool KBinaryParser::read8DocText(FILE *pFile, const ppsInfoType *pPPS, if(pPPS->tWordDocument.ulSize < MIN_SIZE_FOR_BBD_USE) ulFileOffset = ulDepotOffset(pPPS->tWordDocument.ulSB, SMALL_BLOCK_SIZE) + ulTextOffset; while(uOff < ulTotLength) { - ULONG iAllocSize = MAX_BUFF_SIZE; - if((ulTotLength - uOff) < MAX_BUFF_SIZE) - iAllocSize = ulTotLength - uOff; +// ULONG iAllocSize = MAX_BUFF_SIZE; +// if((ulTotLength - uOff) < MAX_BUFF_SIZE) +// iAllocSize = ulTotLength - uOff; + + ULONG iAllocSize = (ulTotLength - uOff) < MAX_BUFF_SIZE ? (ulTotLength - uOff) : MAX_BUFF_SIZE; ptaucBytes = (UCHAR*)xmalloc(iAllocSize); if(!ptaucBytes) @@ -4969,7 +4971,7 @@ bool KBinaryParser::read8DocText(FILE *pFile, const ppsInfoType *pPPS, if(bUsesUnicode) { ushort* usAucData = (ushort*)ptaucBytes; - content.append(QString::fromUtf16(usAucData).replace("\n", "").replace("\r", " ")); + content.append(QString::fromUtf16(usAucData, iAllocSize/2).replace("\n", "").replace("\r", " "));//char num/2=short num usAucData = (ushort*)xfree((void*)usAucData); ptaucBytes = NULL; if(content.length() >= 682666) //20480000/3 @@ -5071,8 +5073,7 @@ int KBinaryParser:: readSSTRecord(readDataParam &rdParam, ppsInfoType PPS_info, qWarning() << "Unsupport excel type:" << m_strFileName; } else { ushort* usData = (ushort*)chData; - - content.append(QString::fromUtf16(usData).replace("\n", "").replace("\r", " ")); + content.append(QString::fromUtf16(usData, ustotalLen/2).replace("\n", "").replace("\r", " ")).append(" ");//每个单元格数据之间使用空格,//char num/2=short num usData = (ushort*)xfree((void*)usData); chData = NULL; if(content.length() >= 682666) //20480000/3 @@ -5137,7 +5138,7 @@ ULONG KBinaryParser::readPPtRecord(FILE* pFile, ppsInfoType* PPS_info, ULONG* au return -1; ushort* usData = (ushort*)chData; - content.append(QString::fromUtf16(usData).replace("\n", "").replace("\r", " ")); + content.append(QString::fromUtf16(usData, llen/2).replace("\n", "").replace("\r", " "));//char num/2=short num usData = (ushort*)xfree((void*)usData); chData = NULL;