summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hwpfilter/source/hbox.h2
-rw-r--r--hwpfilter/source/hwpread.cxx11
2 files changed, 8 insertions, 5 deletions
diff --git a/hwpfilter/source/hbox.h b/hwpfilter/source/hbox.h
index 5ed353364c0f..a110d70d0f32 100644
--- a/hwpfilter/source/hbox.h
+++ b/hwpfilter/source/hbox.h
@@ -228,7 +228,7 @@ struct Cell // Cell
unsigned char diagonal; // { 0=none,\=1,/=2,X=3}
unsigned char protect;
- void Read( HWPFile &hwpf );
+ bool Read(HWPFile &hwpf);
};
/**
diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx
index 1a96eaa29046..92f484b1d10d 100644
--- a/hwpfilter/source/hwpread.cxx
+++ b/hwpfilter/source/hwpread.cxx
@@ -185,7 +185,7 @@ static void UpdateBBox(FBox * fbox)
fbox->boundey = fbox->pgy + fbox->ys - 1;
}
-void Cell::Read(HWPFile & hwpf)
+bool Cell::Read(HWPFile & hwpf)
{
hwpf.Read2b(&p, 1);
hwpf.Read2b(&color, 1);
@@ -203,7 +203,7 @@ void Cell::Read(HWPFile & hwpf)
hwpf.Read1b(linetype, 4);
hwpf.Read1b(&shade, 1);
hwpf.Read1b(&diagonal, 1);
- hwpf.Read1b(&protect, 1);
+ return hwpf.Read1b(&protect, 1) == 1;
}
bool TxtBox::Read(HWPFile & hwpf)
@@ -288,11 +288,14 @@ bool TxtBox::Read(HWPFile & hwpf)
if (!cell) {
return hwpf.SetState(HWP_InvalidFileFormat);
}
- for (ii = 0; ii < ncell; ii++)
+ bool bSuccess = true;
+ for (ii = 0; ii < ncell && bSuccess; ii++)
{
- cell[ii].Read(hwpf);
+ bSuccess = cell[ii].Read(hwpf);
cell[ii].key = sal::static_int_cast<unsigned char>(ii);
}
+ if (!bSuccess)
+ return false;
if (ncell == 1)
style.cell = &cell[0];
plists.resize(ncell);