[Libreoffice-commits] .: hwpfilter/source
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Jun 21 09:23:58 PDT 2011
hwpfilter/source/htags.cxx | 7 ++++---
hwpfilter/source/htags.h | 4 ++--
hwpfilter/source/hwpreader.cxx | 6 +++---
3 files changed, 9 insertions(+), 8 deletions(-)
New commits:
commit 26077d1d2efbf9f03f741f33f5fca4c99676492f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 21 11:33:27 2011 +0100
use size_t here
diff --git a/hwpfilter/source/htags.cxx b/hwpfilter/source/htags.cxx
index 30244a8..94cc050 100644
--- a/hwpfilter/source/htags.cxx
+++ b/hwpfilter/source/htags.cxx
@@ -59,9 +59,10 @@ bool HyperText::Read(HWPFile & hwpf)
}
-EmPicture::EmPicture(int tsize):size(tsize - 32)
+EmPicture::EmPicture(size_t tsize)
+ : size(tsize >= 32 ? tsize - 32 : 0)
{
- if (size <= 0)
+ if (size == 0)
data = 0;
else
data = new uchar[size];
@@ -82,7 +83,7 @@ EmPicture::~EmPicture(void)
bool EmPicture::Read(HWPFile & hwpf)
{
- if (size <= 0)
+ if (size == 0)
return false;
hwpf.Read1b(name, 16);
hwpf.Read1b(type, 16);
diff --git a/hwpfilter/source/htags.h b/hwpfilter/source/htags.h
index 589d3be..830d38f 100644
--- a/hwpfilter/source/htags.h
+++ b/hwpfilter/source/htags.h
@@ -39,12 +39,12 @@ class HWPFile;
*/
struct EmPicture
{
- int size;
+ size_t size;
char name[16];
char type[16];
uchar *data;
- EmPicture(int size);
+ EmPicture(size_t size);
~EmPicture(void);
bool Read(HWPFile& hwpf);
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index 177a6df..416ae51 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -538,12 +538,12 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo )
if( (fd = open( filename , O_CREAT | O_WRONLY , 0666)) >= 0 )
#endif
{
- write( fd, emp->data, emp->size );
+ size_t nWritten = write(fd, emp->data, emp->size);
+ OSL_VERIFY(nWritten == emp->size);
close(fd);
}
#ifdef _WIN32
- int j;
- for( j = 0 ; j < (int)strlen( dirname ) ; j++)
+ for(int j = 0 ; j < (int)strlen( dirname ) ; j++)
{
if( dirname[j] == '\\' ) buf[j] = '/';
else buf[j] = dirname[j];
More information about the Libreoffice-commits
mailing list