X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/223d09f6b523aac674ef9b72a883dfa8d37c5d4e..696e1ea0b7cee1394693a0e507bbf49c9863952b:/src/common/imagpcx.cpp?ds=sidebyside diff --git a/src/common/imagpcx.cpp b/src/common/imagpcx.cpp index 5d72d09ef0..ee9c9a0c21 100644 --- a/src/common/imagpcx.cpp +++ b/src/common/imagpcx.cpp @@ -24,13 +24,13 @@ # include "wx/defs.h" #endif -#if wxUSE_STREAMS && wxUSE_PCX +#if wxUSE_STREAMS && wxUSE_PCX #include "wx/image.h" #include "wx/wfstream.h" #include "wx/module.h" #include "wx/log.h" - +#include "wx/intl.h" //----------------------------------------------------------------------------- // PCX decoding @@ -76,12 +76,12 @@ void RLEdecode(unsigned char *p, unsigned int size, wxInputStream& s) /* PCX header */ -#define HDR_VERSION 1 +#define HDR_VERSION 1 #define HDR_ENCODING 2 #define HDR_BITSPERPIXEL 3 #define HDR_XMIN 4 #define HDR_YMIN 6 -#define HDR_XMAX 8 +#define HDR_XMAX 8 #define HDR_YMAX 10 #define HDR_NPLANES 65 #define HDR_BYTESPERLINE 66 @@ -201,7 +201,7 @@ int ReadPCX(wxImage *image, wxInputStream& stream) { *(dst++) = p[i]; *(dst++) = p[i + bytesperline]; - *(dst++) = p[i + 2 * bytesperline]; + *(dst++) = p[i + 2 * bytesperline]; } break; } @@ -222,14 +222,14 @@ int ReadPCX(wxImage *image, wxInputStream& stream) IMPLEMENT_DYNAMIC_CLASS(wxPCXHandler,wxImageHandler) #endif -bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose ) +bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int WXUNUSED(index) ) { int error; if (!CanRead(stream)) { if (verbose) - wxLogError(wxT("wxPCXHandler: this is not a PCX file")); + wxLogError(_("PCX: this is not a PCX file.")); return FALSE; } @@ -242,10 +242,10 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose { switch (error) { - case E_FORMATO: wxLogError(wxT("wxPCXHandler: image format unsupported")); break; - case E_MEMORIA: wxLogError(wxT("wxPCXHandler: couldn't allocate memory")); break; - case E_VERSION: wxLogError(wxT("wxPCXHandler: version number too low")); break; - default: wxLogError(wxT("wxPCXHandler: unknown error !!!")); + case E_FORMATO: wxLogError(_("PCX: Image format unsupported.")); break; + case E_MEMORIA: wxLogError(_("PCX: Couldn't allocate memory.")); break; + case E_VERSION: wxLogError(_("PCX: Wrong version number.")); break; + default: wxLogError(_("PCX: Unknown error.")); } } image->Destroy(); @@ -257,21 +257,17 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose bool wxPCXHandler::SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool verbose ) { - if (verbose) - wxLogError(wxT("wxPCXHandler::SaveFile still not implemented")); + wxFAIL_MSG(wxT("wxPCXHandler::SaveFile still not implemented")); return FALSE; } -bool wxPCXHandler::CanRead( wxInputStream& stream ) +bool wxPCXHandler::DoCanRead( wxInputStream& stream ) { unsigned char c; - off_t pos; - pos = stream.TellI(); - stream.SeekI(0, wxFromStart); c = stream.GetC(); - stream.SeekI(pos, wxFromStart); + stream.SeekI(-1, wxFromCurrent); // not very safe, but this is all we can get from PCX header :-( return (c == 10);