From 84c2abee9457d79d9db8abf4dfb0b5d541269c52 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Sun, 13 May 2007 20:26:31 +0000 Subject: [PATCH] Cast errors to status_t before throwing, otherwise the catch operator won't catch them (as ints). Thanks to Ingo and Marcus for pointing out the problem and suggesting a solution. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21133 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/PictureDataWriter.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kits/interface/PictureDataWriter.cpp b/src/kits/interface/PictureDataWriter.cpp index ee5cf63315..18f7642ed3 100644 --- a/src/kits/interface/PictureDataWriter.cpp +++ b/src/kits/interface/PictureDataWriter.cpp @@ -15,6 +15,8 @@ #include +#define THROW_ERROR(error) throw (status_t)(error) + PictureDataWriter::PictureDataWriter() : fData(NULL) @@ -450,7 +452,7 @@ void PictureDataWriter::BeginOp(const int16 &op) { if (fData == NULL) - throw B_NO_INIT; + THROW_ERROR(B_NO_INIT); fStack.push(fData->Position()); fData->Write(&op, sizeof(op)); @@ -465,7 +467,7 @@ void PictureDataWriter::EndOp() { if (fData == NULL) - throw B_NO_INIT; + THROW_ERROR(B_NO_INIT); off_t curPos = fData->Position(); off_t stackPos = fStack.top(); @@ -489,7 +491,7 @@ PictureDataWriter::WriteData(const void *data, size_t size) { ssize_t result = fData->Write(data, size); if (result < 0) - throw (status_t)result; + THROW_ERROR(result); if (result != size) - throw B_IO_ERROR; + THROW_ERROR(B_IO_ERROR); }