Index: ie_imp_Text.cpp =================================================================== RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_Text.cpp,v retrieving revision 1.18 diff -u -r1.18 ie_imp_Text.cpp --- ie_imp_Text.cpp 2000/02/15 22:13:06 1.18 +++ ie_imp_Text.cpp 2000/03/27 20:55:39 @@ -95,6 +95,7 @@ { UT_GrowBuf gbBlock(1024); UT_Bool bEatLF = UT_FALSE; + UT_Bool bEmptyFile = UT_TRUE; unsigned char c; while (fread(&c, 1, sizeof(c), fp) > 0) @@ -119,6 +120,7 @@ // start a paragraph and emit any text that we // have accumulated. X_ReturnNoMemIfError(m_pDocument->appendStrux(PTX_Block, NULL)); + bEmptyFile = UT_FALSE; if (gbBlock.getLength() > 0) { X_ReturnNoMemIfError(m_pDocument->appendSpan(gbBlock.getPointer(0), gbBlock.getLength())); @@ -141,12 +143,14 @@ } } - if (gbBlock.getLength() > 0) + if (gbBlock.getLength() > 0 || bEmptyFile) { // if we have text left over (without final CR/LF), + // or if we read an empty file, // create a paragraph and emit the text now. X_ReturnNoMemIfError(m_pDocument->appendStrux(PTX_Block, NULL)); - X_ReturnNoMemIfError(m_pDocument->appendSpan(gbBlock.getPointer(0), gbBlock.getLength())); + if (gbBlock.getLength() > 0) + X_ReturnNoMemIfError(m_pDocument->appendSpan(gbBlock.getPointer(0), gbBlock.getLength())); } return UT_OK; Index: ie_imp_UTF8.cpp =================================================================== RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_UTF8.cpp,v retrieving revision 1.4 diff -u -r1.4 ie_imp_UTF8.cpp --- ie_imp_UTF8.cpp 2000/02/15 22:13:06 1.4 +++ ie_imp_UTF8.cpp 2000/03/27 20:55:49 @@ -151,6 +151,7 @@ { UT_GrowBuf gbBlock(1024); UT_Bool bEatLF = UT_FALSE; + UT_Bool bEmptyFile = UT_TRUE; UT_Bool bSmashUTF8 = UT_FALSE; unsigned char c; @@ -176,6 +177,7 @@ // start a paragraph and emit any text that we // have accumulated. X_ReturnNoMemIfError(m_pDocument->appendStrux(PTX_Block, NULL)); + bEmptyFile = UT_FALSE; if (gbBlock.getLength() > 0) { if (bSmashUTF8) @@ -202,15 +204,17 @@ } } - if (gbBlock.getLength() > 0) + if (gbBlock.getLength() > 0 || bEmptyFile) { // if we have text left over (without final CR/LF), + // or if we read an empty file, // create a paragraph and emit the text now. if (bSmashUTF8) _smashUTF8(&gbBlock); X_ReturnNoMemIfError(m_pDocument->appendStrux(PTX_Block, NULL)); - X_ReturnNoMemIfError(m_pDocument->appendSpan(gbBlock.getPointer(0), gbBlock.getLength())); + if (gbBlock.getLength() > 0) + X_ReturnNoMemIfError(m_pDocument->appendSpan(gbBlock.getPointer(0), gbBlock.getLength())); } return UT_OK;