summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-06-21 11:33:27 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-06-21 12:24:31 +0100
commite8de073d6336a2a8e170ecb5e1598c8ff4819cef (patch)
tree4224736cff13586488106eb1799f2fed2f0c28aa /hwpfilter
parent313c5e1e676655bcb6849e9ae8eaf78a18652e5d (diff)
use size_t here
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/htags.cxx7
-rw-r--r--hwpfilter/source/htags.h4
-rw-r--r--hwpfilter/source/hwpreader.cxx6
3 files changed, 9 insertions, 8 deletions
diff --git a/hwpfilter/source/htags.cxx b/hwpfilter/source/htags.cxx
index 30244a83f9b8..94cc05058d7c 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 bb244c07dd59..21c610db4e9d 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 47e8a50d5cbe..8fe47730a9e9 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];