Source cleaning: whitespaces, tabs, -1/wxDefaultCoord/wxNOT_FOUND, TRUE/true, FALSE/false, !!/!IsEmpty().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-09-16 18:13:32 +00:00
parent 7b44c67058
commit 7beb59f36c
29 changed files with 888 additions and 888 deletions

View File

@@ -60,7 +60,7 @@ public:
// returns the first icon in the bundle // returns the first icon in the bundle
const wxIcon& GetIcon( const wxSize& size ) const; const wxIcon& GetIcon( const wxSize& size ) const;
// equivalent to GetIcon( wxSize( size, size ) ) // equivalent to GetIcon( wxSize( size, size ) )
const wxIcon& GetIcon( wxCoord size = -1 ) const const wxIcon& GetIcon( wxCoord size = wxDefaultCoord ) const
{ return GetIcon( wxSize( size, size ) ); } { return GetIcon( wxSize( size, size ) ); }
private: private:
// delete all icons // delete all icons

View File

@@ -63,8 +63,8 @@ public:
}; };
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
protected: protected:
@@ -97,8 +97,8 @@ public:
}; };
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index ); virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
virtual int GetImageCount( wxInputStream& stream ); virtual int GetImageCount( wxInputStream& stream );
@@ -152,8 +152,8 @@ public:
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=TRUE) ){return FALSE ;}; virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=true) ){return false ;};
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
virtual int GetImageCount( wxInputStream& stream ); virtual int GetImageCount( wxInputStream& stream );
#endif // wxUSE_STREAMS #endif // wxUSE_STREAMS

View File

@@ -52,8 +52,8 @@ public:
{ } { }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
virtual int GetImageCount( wxInputStream& stream ); virtual int GetImageCount( wxInputStream& stream );
@@ -138,7 +138,7 @@ class WXDLLEXPORT wxImage: public wxObject
public: public:
wxImage(); wxImage();
wxImage( int width, int height, bool clear = true ); wxImage( int width, int height, bool clear = true );
wxImage( int width, int height, unsigned char* data, bool static_data = FALSE ); wxImage( int width, int height, unsigned char* data, bool static_data = false );
wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 ); wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 );
wxImage( const wxString& name, const wxString& mimetype, int index = -1 ); wxImage( const wxString& name, const wxString& mimetype, int index = -1 );
@@ -151,7 +151,7 @@ public:
wxImage( const wxImage* image ); wxImage( const wxImage* image );
bool Create( int width, int height, bool clear = true ); bool Create( int width, int height, bool clear = true );
bool Create( int width, int height, unsigned char* data, bool static_data = FALSE ); bool Create( int width, int height, unsigned char* data, bool static_data = false );
void Destroy(); void Destroy();
// creates an identical copy of the image (the = operator // creates an identical copy of the image (the = operator
@@ -176,10 +176,10 @@ public:
// Rotates the image about the given point, 'angle' radians. // Rotates the image about the given point, 'angle' radians.
// Returns the rotated image, leaving this image intact. // Returns the rotated image, leaving this image intact.
wxImage Rotate(double angle, const wxPoint & centre_of_rotation, wxImage Rotate(double angle, const wxPoint & centre_of_rotation,
bool interpolating = TRUE, wxPoint * offset_after_rotation = (wxPoint*) NULL) const; bool interpolating = true, wxPoint * offset_after_rotation = (wxPoint*) NULL) const;
wxImage Rotate90( bool clockwise = TRUE ) const; wxImage Rotate90( bool clockwise = true ) const;
wxImage Mirror( bool horizontally = TRUE ) const; wxImage Mirror( bool horizontally = true ) const;
// replace one colour with another // replace one colour with another
void Replace( unsigned char r1, unsigned char g1, unsigned char b1, void Replace( unsigned char r1, unsigned char g1, unsigned char b1,
@@ -251,7 +251,7 @@ public:
unsigned char GetMaskRed() const; unsigned char GetMaskRed() const;
unsigned char GetMaskGreen() const; unsigned char GetMaskGreen() const;
unsigned char GetMaskBlue() const; unsigned char GetMaskBlue() const;
void SetMask( bool mask = TRUE ); void SetMask( bool mask = true );
bool HasMask() const; bool HasMask() const;
#if wxUSE_PALETTE #if wxUSE_PALETTE

View File

@@ -35,8 +35,8 @@ public:
} }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif #endif

View File

@@ -34,8 +34,8 @@ public:
} }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1); virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1);
virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=TRUE); virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true);
virtual bool DoCanRead(wxInputStream& stream); virtual bool DoCanRead(wxInputStream& stream);
#endif #endif

View File

@@ -43,8 +43,8 @@ public:
} }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif #endif

View File

@@ -34,8 +34,8 @@ public:
} }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif // wxUSE_STREAMS #endif // wxUSE_STREAMS

View File

@@ -33,8 +33,8 @@ public:
} }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif #endif

View File

@@ -33,8 +33,8 @@ public:
} }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif #endif

View File

@@ -28,8 +28,8 @@ public:
wxTIFFHandler(); wxTIFFHandler();
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
virtual int GetImageCount( wxInputStream& stream ); virtual int GetImageCount( wxInputStream& stream );
#endif #endif

View File

@@ -33,8 +33,8 @@ public:
} }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif #endif

View File

@@ -32,7 +32,7 @@
// macros // macros
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// gettext() style macros (notice that xgettext should be invoked with // gettext() style macros (notice that xgettext should be invoked with
// --keyword="_" --keyword="wxGetTranslation:1,2" options // --keyword="_" --keyword="wxGetTranslation:1,2" options
// to extract the strings from the sources) // to extract the strings from the sources)
#ifndef WXINTL_NO_GETTEXT_MACRO #ifndef WXINTL_NO_GETTEXT_MACRO

View File

@@ -77,7 +77,7 @@ public:
wxChar *WXUNUSED(data), wxChar *WXUNUSED(data),
int WXUNUSED(size), int WXUNUSED(size),
wxIPCFormat WXUNUSED(format) ) wxIPCFormat WXUNUSED(format) )
{ return FALSE; }; { return false; };
virtual wxChar *OnRequest ( const wxString& WXUNUSED(topic), virtual wxChar *OnRequest ( const wxString& WXUNUSED(topic),
const wxString& WXUNUSED(item), const wxString& WXUNUSED(item),
@@ -90,15 +90,15 @@ public:
wxChar *WXUNUSED(data), wxChar *WXUNUSED(data),
int WXUNUSED(size), int WXUNUSED(size),
wxIPCFormat WXUNUSED(format) ) wxIPCFormat WXUNUSED(format) )
{ return FALSE; }; { return false; };
virtual bool OnStartAdvise ( const wxString& WXUNUSED(topic), virtual bool OnStartAdvise ( const wxString& WXUNUSED(topic),
const wxString& WXUNUSED(item) ) const wxString& WXUNUSED(item) )
{ return FALSE; }; { return false; };
virtual bool OnStopAdvise ( const wxString& WXUNUSED(topic), virtual bool OnStopAdvise ( const wxString& WXUNUSED(topic),
const wxString& WXUNUSED(item) ) const wxString& WXUNUSED(item) )
{ return FALSE; }; { return false; };
// Callbacks to CLIENT - override at will // Callbacks to CLIENT - override at will
virtual bool OnAdvise ( const wxString& WXUNUSED(topic), virtual bool OnAdvise ( const wxString& WXUNUSED(topic),
@@ -106,10 +106,10 @@ public:
wxChar *WXUNUSED(data), wxChar *WXUNUSED(data),
int WXUNUSED(size), int WXUNUSED(size),
wxIPCFormat WXUNUSED(format) ) wxIPCFormat WXUNUSED(format) )
{ return FALSE; }; { return false; };
// Callbacks to BOTH - override at will // Callbacks to BOTH - override at will
// Default behaviour is to delete connection and return TRUE // Default behaviour is to delete connection and return true
virtual bool OnDisconnect(void) = 0; virtual bool OnDisconnect(void) = 0;
// return a buffer at least this size, reallocating buffer if needed // return a buffer at least this size, reallocating buffer if needed
@@ -137,7 +137,7 @@ public:
inline wxServerBase(void) {} inline wxServerBase(void) {}
inline ~wxServerBase(void) {}; inline ~wxServerBase(void) {};
// Returns FALSE on error (e.g. port number is already in use) // Returns false on error (e.g. port number is already in use)
virtual bool Create(const wxString& serverName) = 0; virtual bool Create(const wxString& serverName) = 0;
// Callbacks to SERVER - override at will // Callbacks to SERVER - override at will

View File

@@ -27,14 +27,14 @@
#define _ISQL_H #define _ISQL_H
#if defined(WIN32) #if defined(WIN32)
#define SQL_API __stdcall #define SQL_API __stdcall
#ifndef FAR #ifndef FAR
#define FAR #define FAR
#endif #endif
#elif defined(__OS2__) #elif defined(__OS2__)
#define SQL_API _Optlink #define SQL_API _Optlink
#ifndef FAR #ifndef FAR
#define FAR #define FAR
@@ -46,7 +46,7 @@
#define FAR #define FAR
#define EXPORT #define EXPORT
#define CALLBACK #define CALLBACK
#define SQL_API EXPORT CALLBACK #define SQL_API EXPORT CALLBACK
#ifndef __EMX__ #ifndef __EMX__
typedef void *HWND; typedef void *HWND;
@@ -67,126 +67,126 @@ typedef void FAR *HDBC;
typedef void FAR *HSTMT; typedef void FAR *HSTMT;
typedef signed short RETCODE; typedef signed short RETCODE;
#define SQLRETURN RETCODE #define SQLRETURN RETCODE
#define ODBCVER 0x0250 #define ODBCVER 0x0250
#define SQL_MAX_MESSAGE_LENGTH 512 #define SQL_MAX_MESSAGE_LENGTH 512
#define SQL_MAX_DSN_LENGTH 32 #define SQL_MAX_DSN_LENGTH 32
/* /*
* Function return codes * Function return codes
*/ */
#define SQL_INVALID_HANDLE (-2) #define SQL_INVALID_HANDLE (-2)
#define SQL_ERROR (-1) #define SQL_ERROR (-1)
#define SQL_SUCCESS 0 #define SQL_SUCCESS 0
#define SQL_SUCCESS_WITH_INFO 1 #define SQL_SUCCESS_WITH_INFO 1
#define SQL_NO_DATA_FOUND 100 #define SQL_NO_DATA_FOUND 100
/* /*
* Standard SQL datatypes, using ANSI type numbering * Standard SQL datatypes, using ANSI type numbering
*/ */
#define SQL_CHAR 1 #define SQL_CHAR 1
#define SQL_NUMERIC 2 #define SQL_NUMERIC 2
#define SQL_DECIMAL 3 #define SQL_DECIMAL 3
#define SQL_INTEGER 4 #define SQL_INTEGER 4
#define SQL_SMALLINT 5 #define SQL_SMALLINT 5
#define SQL_FLOAT 6 #define SQL_FLOAT 6
#define SQL_REAL 7 #define SQL_REAL 7
#define SQL_DOUBLE 8 #define SQL_DOUBLE 8
#define SQL_VARCHAR 12 #define SQL_VARCHAR 12
#define SQL_TYPE_MIN SQL_CHAR #define SQL_TYPE_MIN SQL_CHAR
#define SQL_TYPE_NULL 0 #define SQL_TYPE_NULL 0
#define SQL_TYPE_MAX SQL_VARCHAR #define SQL_TYPE_MAX SQL_VARCHAR
/* /*
* C datatype to SQL datatype mapping * C datatype to SQL datatype mapping
*/ */
#define SQL_C_CHAR SQL_CHAR #define SQL_C_CHAR SQL_CHAR
#define SQL_C_LONG SQL_INTEGER #define SQL_C_LONG SQL_INTEGER
#define SQL_C_SHORT SQL_SMALLINT #define SQL_C_SHORT SQL_SMALLINT
#define SQL_C_FLOAT SQL_REAL #define SQL_C_FLOAT SQL_REAL
#define SQL_C_DOUBLE SQL_DOUBLE #define SQL_C_DOUBLE SQL_DOUBLE
#define SQL_C_DEFAULT 99 #define SQL_C_DEFAULT 99
/* /*
* NULL status constants. * NULL status constants.
*/ */
#define SQL_NO_NULLS 0 #define SQL_NO_NULLS 0
#define SQL_NULLABLE 1 #define SQL_NULLABLE 1
#define SQL_NULLABLE_UNKNOWN 2 #define SQL_NULLABLE_UNKNOWN 2
/* /*
* Special length values * Special length values
*/ */
#define SQL_NULL_DATA (-1) #define SQL_NULL_DATA (-1)
#define SQL_DATA_AT_EXEC (-2) #define SQL_DATA_AT_EXEC (-2)
#define SQL_NTS (-3) #define SQL_NTS (-3)
/* /*
* SQLFreeStmt * SQLFreeStmt
*/ */
#define SQL_CLOSE 0 #define SQL_CLOSE 0
#define SQL_DROP 1 #define SQL_DROP 1
#define SQL_UNBIND 2 #define SQL_UNBIND 2
#define SQL_RESET_PARAMS 3 #define SQL_RESET_PARAMS 3
/* /*
* SQLTransact * SQLTransact
*/ */
#define SQL_COMMIT 0 #define SQL_COMMIT 0
#define SQL_ROLLBACK 1 #define SQL_ROLLBACK 1
/* /*
* SQLColAttributes * SQLColAttributes
*/ */
#define SQL_COLUMN_COUNT 0 #define SQL_COLUMN_COUNT 0
#define SQL_COLUMN_NAME 1 #define SQL_COLUMN_NAME 1
#define SQL_COLUMN_TYPE 2 #define SQL_COLUMN_TYPE 2
#define SQL_COLUMN_LENGTH 3 #define SQL_COLUMN_LENGTH 3
#define SQL_COLUMN_PRECISION 4 #define SQL_COLUMN_PRECISION 4
#define SQL_COLUMN_SCALE 5 #define SQL_COLUMN_SCALE 5
#define SQL_COLUMN_DISPLAY_SIZE 6 #define SQL_COLUMN_DISPLAY_SIZE 6
#define SQL_COLUMN_NULLABLE 7 #define SQL_COLUMN_NULLABLE 7
#define SQL_COLUMN_UNSIGNED 8 #define SQL_COLUMN_UNSIGNED 8
#define SQL_COLUMN_MONEY 9 #define SQL_COLUMN_MONEY 9
#define SQL_COLUMN_UPDATABLE 10 #define SQL_COLUMN_UPDATABLE 10
#define SQL_COLUMN_AUTO_INCREMENT 11 #define SQL_COLUMN_AUTO_INCREMENT 11
#define SQL_COLUMN_CASE_SENSITIVE 12 #define SQL_COLUMN_CASE_SENSITIVE 12
#define SQL_COLUMN_SEARCHABLE 13 #define SQL_COLUMN_SEARCHABLE 13
#define SQL_COLUMN_TYPE_NAME 14 #define SQL_COLUMN_TYPE_NAME 14
#define SQL_COLUMN_TABLE_NAME 15 #define SQL_COLUMN_TABLE_NAME 15
#define SQL_COLUMN_OWNER_NAME 16 #define SQL_COLUMN_OWNER_NAME 16
#define SQL_COLUMN_QUALIFIER_NAME 17 #define SQL_COLUMN_QUALIFIER_NAME 17
#define SQL_COLUMN_LABEL 18 #define SQL_COLUMN_LABEL 18
#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL #define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL
#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT #define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT
#define SQL_COLUMN_DRIVER_START 1000 #define SQL_COLUMN_DRIVER_START 1000
/* /*
* SQLColAttributes : SQL_COLUMN_UPDATABLE * SQLColAttributes : SQL_COLUMN_UPDATABLE
*/ */
#define SQL_ATTR_READONLY 0 #define SQL_ATTR_READONLY 0
#define SQL_ATTR_WRITE 1 #define SQL_ATTR_WRITE 1
#define SQL_ATTR_READWRITE_UNKNOWN 2 #define SQL_ATTR_READWRITE_UNKNOWN 2
/* /*
* SQLColAttributes : SQL_COLUMN_SEARCHABLE * SQLColAttributes : SQL_COLUMN_SEARCHABLE
*/ */
#define SQL_UNSEARCHABLE 0 #define SQL_UNSEARCHABLE 0
#define SQL_LIKE_ONLY 1 #define SQL_LIKE_ONLY 1
#define SQL_ALL_EXCEPT_LIKE 2 #define SQL_ALL_EXCEPT_LIKE 2
#define SQL_SEARCHABLE 3 #define SQL_SEARCHABLE 3
/* /*
* NULL Handles * NULL Handles
*/ */
#define SQL_NULL_HENV 0 #define SQL_NULL_HENV 0
#define SQL_NULL_HDBC 0 #define SQL_NULL_HDBC 0
#define SQL_NULL_HSTMT 0 #define SQL_NULL_HSTMT 0
/* /*

File diff suppressed because it is too large Load Diff

View File

@@ -76,7 +76,7 @@ bool wxBMPHandler::SaveFile(wxImage *image,
wxOutputStream& stream, wxOutputStream& stream,
bool verbose) bool verbose)
{ {
return SaveDib(image, stream, verbose, TRUE/*IsBmp*/, FALSE/*IsMask*/); return SaveDib(image, stream, verbose, true/*IsBmp*/, false/*IsMask*/);
} }
bool wxBMPHandler::SaveDib(wxImage *image, bool wxBMPHandler::SaveDib(wxImage *image,
@@ -86,13 +86,13 @@ bool wxBMPHandler::SaveDib(wxImage *image,
bool IsMask) bool IsMask)
{ {
wxCHECK_MSG( image, FALSE, _T("invalid pointer in wxBMPHandler::SaveFile") ); wxCHECK_MSG( image, false, _T("invalid pointer in wxBMPHandler::SaveFile") );
if ( !image->Ok() ) if ( !image->Ok() )
{ {
if ( verbose ) if ( verbose )
wxLogError(_("BMP: Couldn't save invalid image.")); wxLogError(_("BMP: Couldn't save invalid image."));
return FALSE; return false;
} }
// get the format of the BMP file to save, else use 24bpp // get the format of the BMP file to save, else use 24bpp
@@ -126,7 +126,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
{ {
if ( verbose ) if ( verbose )
wxLogError(_("BMP: wxImage doesn't have own wxPalette.")); wxLogError(_("BMP: wxImage doesn't have own wxPalette."));
return FALSE; return false;
} }
bpp = 8; bpp = 8;
palette_size = 256; palette_size = 256;
@@ -201,7 +201,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
{ {
if (verbose) if (verbose)
wxLogError(_("BMP: Couldn't write the file (Bitmap) header.")); wxLogError(_("BMP: Couldn't write the file (Bitmap) header."));
return FALSE; return false;
} }
} }
if ( !IsMask ) if ( !IsMask )
@@ -222,7 +222,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
{ {
if (verbose) if (verbose)
wxLogError(_("BMP: Couldn't write the file (BitmapInfo) header.")); wxLogError(_("BMP: Couldn't write the file (BitmapInfo) header."));
return FALSE; return false;
} }
} }
@@ -301,7 +301,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
delete palette; delete palette;
#endif // wxUSE_PALETTE #endif // wxUSE_PALETTE
delete q_image; delete q_image;
return FALSE; return false;
} }
} }
delete []rgbquad; delete []rgbquad;
@@ -433,7 +433,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
delete palette; delete palette;
#endif // wxUSE_PALETTE #endif // wxUSE_PALETTE
delete q_image; delete q_image;
return FALSE; return false;
} }
} }
delete[] buffer; delete[] buffer;
@@ -442,7 +442,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
#endif // wxUSE_PALETTE #endif // wxUSE_PALETTE
delete q_image; delete q_image;
return TRUE; return true;
} }
@@ -474,7 +474,7 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
{ {
if (verbose) if (verbose)
wxLogError(_("BMP: Couldn't allocate memory.")); wxLogError(_("BMP: Couldn't allocate memory."));
return FALSE; return false;
} }
} }
else else
@@ -492,7 +492,7 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
wxLogError( _("BMP: Couldn't allocate memory.") ); wxLogError( _("BMP: Couldn't allocate memory.") );
if ( cmap ) if ( cmap )
delete[] cmap; delete[] cmap;
return FALSE; return false;
} }
// Reading the palette, if it exists: // Reading the palette, if it exists:
@@ -831,7 +831,7 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
delete[] cmap; delete[] cmap;
image->SetMask(FALSE); image->SetMask(false);
const wxStreamError err = stream.GetLastError(); const wxStreamError err = stream.GetLastError();
return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF; return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF;
@@ -874,13 +874,13 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
{ {
if (verbose) if (verbose)
wxLogError( _("DIB Header: Image width > 32767 pixels for file.") ); wxLogError( _("DIB Header: Image width > 32767 pixels for file.") );
return FALSE; return false;
} }
if ( height > 32767 ) if ( height > 32767 )
{ {
if (verbose) if (verbose)
wxLogError( _("DIB Header: Image height > 32767 pixels for file.") ); wxLogError( _("DIB Header: Image height > 32767 pixels for file.") );
return FALSE; return false;
} }
stream.Read(&aWord, 2); stream.Read(&aWord, 2);
@@ -894,7 +894,7 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
{ {
if (verbose) if (verbose)
wxLogError( _("DIB Header: Unknown bitdepth in file.") ); wxLogError( _("DIB Header: Unknown bitdepth in file.") );
return FALSE; return false;
} }
stream.Read(dbuf, 4 * 4); stream.Read(dbuf, 4 * 4);
@@ -904,7 +904,7 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
{ {
if (verbose) if (verbose)
wxLogError( _("DIB Header: Unknown encoding in file.") ); wxLogError( _("DIB Header: Unknown encoding in file.") );
return FALSE; return false;
} }
stream.Read(dbuf, 4 * 2); stream.Read(dbuf, 4 * 2);
@@ -918,16 +918,16 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
{ {
if (verbose) if (verbose)
wxLogError( _("DIB Header: Encoding doesn't match bitdepth.") ); wxLogError( _("DIB Header: Encoding doesn't match bitdepth.") );
return FALSE; return false;
} }
//read DIB; this is the BMP image or the XOR part of an icon image //read DIB; this is the BMP image or the XOR part of an icon image
if ( !DoLoadDib(image, width, height, bpp, ncolors, comp, offset, stream, if ( !DoLoadDib(image, width, height, bpp, ncolors, comp, offset, stream,
verbose, IsBmp, TRUE) ) verbose, IsBmp, true) )
{ {
if (verbose) if (verbose)
wxLogError( _("Error in reading image DIB .") ); wxLogError( _("Error in reading image DIB .") );
return FALSE; return false;
} }
if ( !IsBmp ) if ( !IsBmp )
@@ -936,24 +936,24 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
//there is no palette, so we will create one //there is no palette, so we will create one
wxImage mask; wxImage mask;
if ( !DoLoadDib(&mask, width, height, 1, 2, BI_RGB, offset, stream, if ( !DoLoadDib(&mask, width, height, 1, 2, BI_RGB, offset, stream,
verbose, IsBmp, FALSE) ) verbose, IsBmp, false) )
{ {
if (verbose) if (verbose)
wxLogError( _("ICO: Error in reading mask DIB.") ); wxLogError( _("ICO: Error in reading mask DIB.") );
return FALSE; return false;
} }
image->SetMaskFromImage(mask, 255, 255, 255); image->SetMaskFromImage(mask, 255, 255, 255);
} }
return TRUE; return true;
} }
bool wxBMPHandler::LoadFile(wxImage *image, wxInputStream& stream, bool wxBMPHandler::LoadFile(wxImage *image, wxInputStream& stream,
bool verbose, int WXUNUSED(index)) bool verbose, int WXUNUSED(index))
{ {
// Read a single DIB fom the file: // Read a single DIB fom the file:
return LoadDib(image, stream, verbose, TRUE/*isBmp*/); return LoadDib(image, stream, verbose, true/*isBmp*/);
} }
bool wxBMPHandler::DoCanRead(wxInputStream& stream) bool wxBMPHandler::DoCanRead(wxInputStream& stream)
@@ -961,7 +961,7 @@ bool wxBMPHandler::DoCanRead(wxInputStream& stream)
unsigned char hdr[2]; unsigned char hdr[2];
if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
return FALSE; return false;
// do we have the BMP file signature? // do we have the BMP file signature?
return hdr[0] == 'B' && hdr[1] == 'M'; return hdr[0] == 'B' && hdr[1] == 'M';
@@ -1013,13 +1013,13 @@ bool wxICOHandler::SaveFile(wxImage *image,
{ {
if ( verbose ) if ( verbose )
wxLogError(_("ICO: Image too tall for an icon.")); wxLogError(_("ICO: Image too tall for an icon."));
return FALSE; return false;
} }
if ( image->GetWidth () > 255 ) if ( image->GetWidth () > 255 )
{ {
if ( verbose ) if ( verbose )
wxLogError(_("ICO: Image too wide for an icon.")); wxLogError(_("ICO: Image too wide for an icon."));
return FALSE; return false;
} }
int images = 1; // only generate one image int images = 1; // only generate one image
@@ -1045,7 +1045,7 @@ bool wxICOHandler::SaveFile(wxImage *image,
{ {
if ( verbose ) if ( verbose )
wxLogError(_("ICO: Error writing the image file!")); wxLogError(_("ICO: Error writing the image file!"));
return FALSE; return false;
} }
// for each iamage write a description ICONDIRENTRY: // for each iamage write a description ICONDIRENTRY:
@@ -1094,8 +1094,8 @@ bool wxICOHandler::SaveFile(wxImage *image,
// monochome bitmap: // monochome bitmap:
mask.SetOption(wxIMAGE_OPTION_BMP_FORMAT, wxBMP_1BPP_BW); mask.SetOption(wxIMAGE_OPTION_BMP_FORMAT, wxBMP_1BPP_BW);
bool IsBmp = FALSE; bool IsBmp = false;
bool IsMask = FALSE; bool IsMask = false;
//calculate size and offset of image and mask //calculate size and offset of image and mask
wxCountingOutputStream cStream; wxCountingOutputStream cStream;
@@ -1104,27 +1104,27 @@ bool wxICOHandler::SaveFile(wxImage *image,
{ {
if ( verbose ) if ( verbose )
wxLogError(_("ICO: Error writing the image file!")); wxLogError(_("ICO: Error writing the image file!"));
return FALSE; return false;
} }
IsMask = TRUE; IsMask = true;
bResult = SaveDib(&mask, cStream, verbose, IsBmp, IsMask); bResult = SaveDib(&mask, cStream, verbose, IsBmp, IsMask);
if ( !bResult ) if ( !bResult )
{ {
if ( verbose ) if ( verbose )
wxLogError(_("ICO: Error writing the image file!")); wxLogError(_("ICO: Error writing the image file!"));
return FALSE; return false;
} }
wxUint32 Size = cStream.GetSize(); wxUint32 Size = cStream.GetSize();
// wxCountingOutputStream::Ok() always returns TRUE for now and this // wxCountingOutputStream::Ok() always returns true for now and this
// "if" provokes VC++ warnings in optimized build // "if" provokes VC++ warnings in optimized build
#if 0 #if 0
if ( !cStream.Ok() ) if ( !cStream.Ok() )
{ {
if ( verbose ) if ( verbose )
wxLogError(_("ICO: Error writing the image file!")); wxLogError(_("ICO: Error writing the image file!"));
return FALSE; return false;
} }
#endif // 0 #endif // 0
@@ -1168,31 +1168,31 @@ bool wxICOHandler::SaveFile(wxImage *image,
{ {
if ( verbose ) if ( verbose )
wxLogError(_("ICO: Error writing the image file!")); wxLogError(_("ICO: Error writing the image file!"));
return FALSE; return false;
} }
// actually save it: // actually save it:
IsMask = FALSE; IsMask = false;
bResult = SaveDib(image, stream, verbose, IsBmp, IsMask); bResult = SaveDib(image, stream, verbose, IsBmp, IsMask);
if ( !bResult ) if ( !bResult )
{ {
if ( verbose ) if ( verbose )
wxLogError(_("ICO: Error writing the image file!")); wxLogError(_("ICO: Error writing the image file!"));
return FALSE; return false;
} }
IsMask = TRUE; IsMask = true;
bResult = SaveDib(&mask, stream, verbose, IsBmp, IsMask); bResult = SaveDib(&mask, stream, verbose, IsBmp, IsMask);
if ( !bResult ) if ( !bResult )
{ {
if ( verbose ) if ( verbose )
wxLogError(_("ICO: Error writing the image file!")); wxLogError(_("ICO: Error writing the image file!"));
return FALSE; return false;
} }
} // end of for loop } // end of for loop
return TRUE; return true;
} }
bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream, bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream,
@@ -1259,7 +1259,7 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream,
// seek to selected icon: // seek to selected icon:
pCurrentEntry = pIconDirEntry + iSel; pCurrentEntry = pIconDirEntry + iSel;
stream.SeekI(iPos + wxUINT32_SWAP_ON_BE(pCurrentEntry->dwImageOffset), wxFromStart); stream.SeekI(iPos + wxUINT32_SWAP_ON_BE(pCurrentEntry->dwImageOffset), wxFromStart);
bResult = LoadDib(image, stream, TRUE, IsBmp); bResult = LoadDib(image, stream, true, IsBmp);
bool bIsCursorType = (this->GetType() == wxBITMAP_TYPE_CUR) || (this->GetType() == wxBITMAP_TYPE_ANI); bool bIsCursorType = (this->GetType() == wxBITMAP_TYPE_CUR) || (this->GetType() == wxBITMAP_TYPE_ANI);
if ( bResult && bIsCursorType && nType == 2 ) if ( bResult && bIsCursorType && nType == 2 )
{ {
@@ -1288,7 +1288,7 @@ bool wxICOHandler::DoCanRead(wxInputStream& stream)
stream.SeekI(0); stream.SeekI(0);
unsigned char hdr[4]; unsigned char hdr[4];
if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
return FALSE; return false;
// hdr[2] is one for an icon and two for a cursor // hdr[2] is one for an icon and two for a cursor
return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\1' && hdr[3] == '\0'; return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\1' && hdr[3] == '\0';
@@ -1310,7 +1310,7 @@ bool wxCURHandler::DoCanRead(wxInputStream& stream)
stream.SeekI(0); stream.SeekI(0);
unsigned char hdr[4]; unsigned char hdr[4];
if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
return FALSE; return false;
// hdr[2] is one for an icon and two for a cursor // hdr[2] is one for an icon and two for a cursor
return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\2' && hdr[3] == '\0'; return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\2' && hdr[3] == '\0';
@@ -1343,7 +1343,7 @@ bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
stream.SeekI(0); stream.SeekI(0);
stream.Read(&FCC1, 4); stream.Read(&FCC1, 4);
if ( FCC1 != riff32 ) if ( FCC1 != riff32 )
return FALSE; return false;
// we have a riff file: // we have a riff file:
while (stream.IsOk()) while (stream.IsOk())
@@ -1375,35 +1375,35 @@ bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
// try to read next data chunk: // try to read next data chunk:
stream.Read(&FCC1, 4); stream.Read(&FCC1, 4);
} }
return FALSE; return false;
} }
bool wxANIHandler::DoCanRead(wxInputStream& stream) bool wxANIHandler::DoCanRead(wxInputStream& stream)
{ {
wxInt32 FCC1, FCC2; wxInt32 FCC1, FCC2;
wxUint32 datalen ; wxUint32 datalen ;
wxInt32 riff32; wxInt32 riff32;
memcpy( &riff32, "RIFF", 4 ); memcpy( &riff32, "RIFF", 4 );
wxInt32 list32; wxInt32 list32;
memcpy( &list32, "LIST", 4 ); memcpy( &list32, "LIST", 4 );
wxInt32 ico32; wxInt32 ico32;
memcpy( &ico32, "icon", 4 ); memcpy( &ico32, "icon", 4 );
wxInt32 anih32; wxInt32 anih32;
memcpy( &anih32, "anih", 4 ); memcpy( &anih32, "anih", 4 );
stream.SeekI(0); stream.SeekI(0);
if ( !stream.Read(&FCC1, 4) ) if ( !stream.Read(&FCC1, 4) )
return FALSE; return false;
if ( FCC1 != riff32 ) if ( FCC1 != riff32 )
return FALSE; return false;
// we have a riff file: // we have a riff file:
while ( stream.IsOk() ) while ( stream.IsOk() )
{ {
if ( FCC1 == anih32 ) if ( FCC1 == anih32 )
return TRUE; return true;
// we always have a data size: // we always have a data size:
stream.Read(&datalen, 4); stream.Read(&datalen, 4);
datalen = wxINT32_SWAP_ON_BE(datalen) ; datalen = wxINT32_SWAP_ON_BE(datalen) ;
@@ -1423,11 +1423,11 @@ bool wxANIHandler::DoCanRead(wxInputStream& stream)
if ( !stream.Read(&FCC1, 4) ) if ( !stream.Read(&FCC1, 4) )
{ {
// reading failed -- either EOF or IO error, bail out anyhow // reading failed -- either EOF or IO error, bail out anyhow
return FALSE; return false;
} }
} }
return FALSE; return false;
} }
int wxANIHandler::GetImageCount(wxInputStream& stream) int wxANIHandler::GetImageCount(wxInputStream& stream)
@@ -1443,7 +1443,7 @@ int wxANIHandler::GetImageCount(wxInputStream& stream)
memcpy( &ico32, "icon", 4 ); memcpy( &ico32, "icon", 4 );
wxInt32 anih32; wxInt32 anih32;
memcpy( &anih32, "anih", 4 ); memcpy( &anih32, "anih", 4 );
stream.SeekI(0); stream.SeekI(0);
stream.Read(&FCC1, 4); stream.Read(&FCC1, 4);
if ( FCC1 != riff32 ) if ( FCC1 != riff32 )

View File

@@ -231,7 +231,7 @@ wxImage wxImage::ShrinkBy( int xFactor , int yFactor ) const
{ {
if( xFactor == 1 && yFactor == 1 ) if( xFactor == 1 && yFactor == 1 )
return Copy() ; return Copy() ;
wxImage image; wxImage image;
wxCHECK_MSG( Ok(), image, wxT("invalid image") ); wxCHECK_MSG( Ok(), image, wxT("invalid image") );
@@ -242,7 +242,7 @@ wxImage wxImage::ShrinkBy( int xFactor , int yFactor ) const
long old_height = M_IMGDATA->m_height, long old_height = M_IMGDATA->m_height,
old_width = M_IMGDATA->m_width; old_width = M_IMGDATA->m_width;
wxCHECK_MSG( (old_height > 0) && (old_width > 0), image, wxCHECK_MSG( (old_height > 0) && (old_width > 0), image,
wxT("invalid old image size") ); wxT("invalid old image size") );
@@ -265,14 +265,14 @@ wxImage wxImage::ShrinkBy( int xFactor , int yFactor ) const
maskRed = M_IMGDATA->m_maskRed; maskRed = M_IMGDATA->m_maskRed;
maskGreen = M_IMGDATA->m_maskGreen; maskGreen = M_IMGDATA->m_maskGreen;
maskBlue =M_IMGDATA->m_maskBlue ; maskBlue =M_IMGDATA->m_maskBlue ;
image.SetMaskColour( M_IMGDATA->m_maskRed, image.SetMaskColour( M_IMGDATA->m_maskRed,
M_IMGDATA->m_maskGreen, M_IMGDATA->m_maskGreen,
M_IMGDATA->m_maskBlue ); M_IMGDATA->m_maskBlue );
} }
char unsigned *source_data = M_IMGDATA->m_data; char unsigned *source_data = M_IMGDATA->m_data;
char unsigned *target_data = data; char unsigned *target_data = data;
for (long y = 0; y < height; y++) for (long y = 0; y < height; y++)
{ {
for (long x = 0; x < width; x++) for (long x = 0; x < width; x++)
@@ -935,7 +935,7 @@ bool wxImage::SetMaskFromImage(const wxImage& mask,
return true; return true;
} }
bool wxImage::ConvertAlphaToMask(unsigned char threshold) bool wxImage::ConvertAlphaToMask(unsigned char threshold)
{ {
if (!HasAlpha()) if (!HasAlpha())

View File

@@ -35,7 +35,7 @@
static bool LINKAGEMODE MatchPixel(wxImage *img, int x, int y, int w, int h, const wxColour& c) static bool LINKAGEMODE MatchPixel(wxImage *img, int x, int y, int w, int h, const wxColour& c)
{ {
if ((x<0)||(x>=w)||(y<0)||(y>=h)) return FALSE; if ((x<0)||(x>=w)||(y<0)||(y>=h)) return false;
unsigned char r = img->GetRed(x,y); unsigned char r = img->GetRed(x,y);
unsigned char g = img->GetGreen(x,y); unsigned char g = img->GetGreen(x,y);
@@ -45,16 +45,16 @@ static bool LINKAGEMODE MatchPixel(wxImage *img, int x, int y, int w, int h, con
static bool LINKAGEMODE MatchBoundaryPixel(wxImage *img, int x, int y, int w, int h, const wxColour & fill, const wxColour& bound) static bool LINKAGEMODE MatchBoundaryPixel(wxImage *img, int x, int y, int w, int h, const wxColour & fill, const wxColour& bound)
{ {
if ((x<0)||(x>=w)||(y<0)||(y>=h)) return TRUE; if ((x<0)||(x>=w)||(y<0)||(y>=h)) return true;
unsigned char r = img->GetRed(x,y); unsigned char r = img->GetRed(x,y);
unsigned char g = img->GetGreen(x,y); unsigned char g = img->GetGreen(x,y);
unsigned char b = img->GetBlue(x,y); unsigned char b = img->GetBlue(x,y);
if ( fill.Red() == r && fill.Green() == g && fill.Blue() == b ) if ( fill.Red() == r && fill.Green() == g && fill.Blue() == b )
return TRUE; return true;
if ( bound.Red() == r && bound.Green() == g && bound.Blue() == b ) if ( bound.Red() == r && bound.Green() == g && bound.Blue() == b )
return TRUE; return true;
return FALSE; return false;
} }
@@ -277,14 +277,14 @@ bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
const wxColour& col, int style) const wxColour& col, int style)
{ {
if (dc->GetBrush().GetStyle() == wxTRANSPARENT) if (dc->GetBrush().GetStyle() == wxTRANSPARENT)
return TRUE; return true;
int height = 0; int height = 0;
int width = 0; int width = 0;
dc->GetSize(&width, &height); dc->GetSize(&width, &height);
//it would be nice to fail if we don't get a sensible size... //it would be nice to fail if we don't get a sensible size...
wxCHECK_MSG(width >= 1 && height >= 1, FALSE, wxCHECK_MSG(width >= 1 && height >= 1, false,
wxT("In FloodFill, dc.GetSize routine failed, method not supported by this DC")); wxT("In FloodFill, dc.GetSize routine failed, method not supported by this DC"));
//this is much faster than doing the individual pixels //this is much faster than doing the individual pixels
@@ -302,7 +302,7 @@ bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
dc->Blit(0, 0, width, height, &memdc, 0, 0); dc->Blit(0, 0, width, height, &memdc, 0, 0);
memdc.SelectObject(wxNullBitmap); memdc.SelectObject(wxNullBitmap);
return TRUE; return true;
} }
#endif // wxUSE_IMAGE #endif // wxUSE_IMAGE

View File

@@ -43,10 +43,10 @@ bool wxGIFHandler::LoadFile(wxImage *image, wxInputStream& stream,
{ {
wxGIFDecoder *decod; wxGIFDecoder *decod;
int error; int error;
bool ok = TRUE; bool ok = true;
// image->Destroy(); // image->Destroy();
decod = new wxGIFDecoder(&stream, TRUE); decod = new wxGIFDecoder(&stream, true);
error = decod->ReadGIF(); error = decod->ReadGIF();
if ((error != wxGIF_OK) && (error != wxGIF_TRUNCATED)) if ((error != wxGIF_OK) && (error != wxGIF_TRUNCATED))
@@ -67,7 +67,7 @@ bool wxGIFHandler::LoadFile(wxImage *image, wxInputStream& stream,
} }
} }
delete decod; delete decod;
return FALSE; return false;
} }
if ((error == wxGIF_TRUNCATED) && verbose) if ((error == wxGIF_TRUNCATED) && verbose)
@@ -83,7 +83,7 @@ bool wxGIFHandler::LoadFile(wxImage *image, wxInputStream& stream,
// accept an index of 0. (Instead GoFirstFrame() should be used) // accept an index of 0. (Instead GoFirstFrame() should be used)
// Also if the gif image has only one frame, calling GoFrame(0) // Also if the gif image has only one frame, calling GoFrame(0)
// fails because GoFrame() only works with gif animations. // fails because GoFrame() only works with gif animations.
// (It fails if IsAnimation() returns FALSE) // (It fails if IsAnimation() returns false)
// All valid reasons to NOT call GoFrame when index equals 0. // All valid reasons to NOT call GoFrame when index equals 0.
if (index != 0) if (index != 0)
{ {
@@ -111,7 +111,7 @@ bool wxGIFHandler::SaveFile( wxImage * WXUNUSED(image),
if (verbose) if (verbose)
wxLogDebug(wxT("GIF: the handler is read-only!!")); wxLogDebug(wxT("GIF: the handler is read-only!!"));
return FALSE; return false;
} }
bool wxGIFHandler::DoCanRead( wxInputStream& stream ) bool wxGIFHandler::DoCanRead( wxInputStream& stream )

View File

@@ -72,7 +72,7 @@ public:
unsigned int w; /* width */ unsigned int w; /* width */
unsigned int h; /* height */ unsigned int h; /* height */
int transparent; /* transparent color (-1 = none) */ int transparent; /* transparent color (-1 = none) */
int colors; /* number of colors */ int colors; /* number of colors */
unsigned char *p; /* bitmap */ unsigned char *p; /* bitmap */
unsigned char *pal; /* palette */ unsigned char *pal; /* palette */
@@ -83,8 +83,8 @@ public:
class WXDLLEXPORT wxIFFDecoder class WXDLLEXPORT wxIFFDecoder
{ {
private: private:
IFFImage *m_image; // image data IFFImage *m_image; // image data
wxInputStream *m_f; // input stream wxInputStream *m_f; // input stream
unsigned char *databuf; unsigned char *databuf;
unsigned char *picptr; unsigned char *picptr;
unsigned char *decomp_mem; unsigned char *decomp_mem;
@@ -146,7 +146,7 @@ bool wxIFFDecoder::ConvertToImage(wxImage *image) const
image->Create(GetWidth(), GetHeight()); image->Create(GetWidth(), GetHeight());
if (!image->Ok()) if (!image->Ok())
return FALSE; return false;
unsigned char *pal = GetPalette(); unsigned char *pal = GetPalette();
unsigned char *src = GetData(); unsigned char *src = GetData();
@@ -175,7 +175,7 @@ bool wxIFFDecoder::ConvertToImage(wxImage *image) const
image->SetMaskColour(255, 0, 255); image->SetMaskColour(255, 0, 255);
} }
else else
image->SetMask(FALSE); image->SetMask(false);
#if wxUSE_PALETTE #if wxUSE_PALETTE
if (pal && colors > 0) if (pal && colors > 0)
@@ -207,7 +207,7 @@ bool wxIFFDecoder::ConvertToImage(wxImage *image) const
dst[2] = src[2]; dst[2] = src[2];
} }
return TRUE; return true;
} }
@@ -230,14 +230,14 @@ int wxIFFDecoder::GetTransparentColour() const { return m_image->transparent; }
// //
// CanRead: // CanRead:
// Returns TRUE if the file looks like a valid IFF, FALSE otherwise. // Returns true if the file looks like a valid IFF, false otherwise.
// //
bool wxIFFDecoder::CanRead() bool wxIFFDecoder::CanRead()
{ {
unsigned char buf[12]; unsigned char buf[12];
if ( !m_f->Read(buf, WXSIZEOF(buf)) ) if ( !m_f->Read(buf, WXSIZEOF(buf)) )
return FALSE; return false;
m_f->SeekI(-(off_t)WXSIZEOF(buf), wxFromCurrent); m_f->SeekI(-(off_t)WXSIZEOF(buf), wxFromCurrent);
@@ -384,7 +384,7 @@ int wxIFFDecoder::ReadIFF()
// main decoding loop. searches IFF chunks and handles them. // main decoding loop. searches IFF chunks and handles them.
// terminates when BODY chunk was found or dataptr ran over end of file // terminates when BODY chunk was found or dataptr ran over end of file
// //
bool BMHDok = FALSE, CMAPok = FALSE, CAMGok = FALSE; bool BMHDok = false, CMAPok = false, CAMGok = false;
int bmhd_width = 0, bmhd_height = 0, bmhd_bitplanes = 0, bmhd_transcol = -1; int bmhd_width = 0, bmhd_height = 0, bmhd_bitplanes = 0, bmhd_transcol = -1;
byte bmhd_masking = 0, bmhd_compression = 0; byte bmhd_masking = 0, bmhd_compression = 0;
long camg_viewmode = 0; long camg_viewmode = 0;
@@ -400,7 +400,7 @@ int wxIFFDecoder::ReadIFF()
#else #else
if (chunkLen < 0) { // format error? if (chunkLen < 0) { // format error?
#endif #endif
break; break;
} }
bool truncated = (dataptr + 8 + chunkLen > dataend); bool truncated = (dataptr + 8 + chunkLen > dataend);
@@ -414,7 +414,7 @@ int wxIFFDecoder::ReadIFF()
bmhd_masking = *(dataptr + 8 + 9); bmhd_masking = *(dataptr + 8 + 9);
bmhd_compression = *(dataptr + 8 + 10); // get compression bmhd_compression = *(dataptr + 8 + 10); // get compression
bmhd_transcol = iff_getword(dataptr + 8 + 12); bmhd_transcol = iff_getword(dataptr + 8 + 12);
BMHDok = TRUE; // got BMHD BMHDok = true; // got BMHD
dataptr += 8 + chunkLen; // to next chunk dataptr += 8 + chunkLen; // to next chunk
} }
else if (strncmp((char *)dataptr, "CMAP", 4) == 0) { // CMAP ? else if (strncmp((char *)dataptr, "CMAP", 4) == 0) { // CMAP ?
@@ -445,14 +445,14 @@ int wxIFFDecoder::ReadIFF()
wxLogTrace(_T("iff"), _T("Read %d colors from IFF file."), wxLogTrace(_T("iff"), _T("Read %d colors from IFF file."),
colors); colors);
CMAPok = TRUE; // got CMAP CMAPok = true; // got CMAP
dataptr += 8 + chunkLen; // to next chunk dataptr += 8 + chunkLen; // to next chunk
} else if (strncmp((char *)dataptr, "CAMG", 4) == 0) { // CAMG ? } else if (strncmp((char *)dataptr, "CAMG", 4) == 0) { // CAMG ?
if (chunkLen < 4 || truncated) { if (chunkLen < 4 || truncated) {
break; break;
} }
camg_viewmode = iff_getlong(dataptr + 8); // get viewmodes camg_viewmode = iff_getlong(dataptr + 8); // get viewmodes
CAMGok = TRUE; // got CAMG CAMGok = true; // got CAMG
dataptr += 8 + chunkLen; // to next chunk dataptr += 8 + chunkLen; // to next chunk
} }
else if (strncmp((char *)dataptr, "BODY", 4) == 0) { // BODY ? else if (strncmp((char *)dataptr, "BODY", 4) == 0) { // BODY ?
@@ -763,7 +763,7 @@ bool wxIFFHandler::LoadFile(wxImage *image, wxInputStream& stream,
} }
} }
delete decod; delete decod;
return FALSE; return false;
} }
if ((error == wxIFF_TRUNCATED) && verbose) if ((error == wxIFF_TRUNCATED) && verbose)
@@ -784,7 +784,7 @@ bool wxIFFHandler::SaveFile(wxImage * WXUNUSED(image),
if (verbose) if (verbose)
wxLogDebug(wxT("IFF: the handler is read-only!!")); wxLogDebug(wxT("IFF: the handler is read-only!!"));
return FALSE; return false;
} }
bool wxIFFHandler::DoCanRead(wxInputStream& stream) bool wxIFFHandler::DoCanRead(wxInputStream& stream)

View File

@@ -28,7 +28,7 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/app.h" #include "wx/app.h"
// NB: Some compilers define boolean type in Windows headers // NB: Some compilers define boolean type in Windows headers
// (e.g. Watcom C++, but not Open Watcom). // (e.g. Watcom C++, but not Open Watcom).
// This causes a conflict with jmorecfg.h header from libjpeg, so we have // This causes a conflict with jmorecfg.h header from libjpeg, so we have
// to make sure libjpeg won't try to define boolean itself. This is done by // to make sure libjpeg won't try to define boolean itself. This is done by
@@ -226,7 +226,7 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
(cinfo.src->term_source)(&cinfo); (cinfo.src->term_source)(&cinfo);
jpeg_destroy_decompress(&cinfo); jpeg_destroy_decompress(&cinfo);
if (image->Ok()) image->Destroy(); if (image->Ok()) image->Destroy();
return FALSE; return false;
} }
jpeg_create_decompress( &cinfo ); jpeg_create_decompress( &cinfo );
@@ -239,9 +239,9 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
if (!image->Ok()) { if (!image->Ok()) {
jpeg_finish_decompress( &cinfo ); jpeg_finish_decompress( &cinfo );
jpeg_destroy_decompress( &cinfo ); jpeg_destroy_decompress( &cinfo );
return FALSE; return false;
} }
image->SetMask( FALSE ); image->SetMask( false );
ptr = image->GetData(); ptr = image->GetData();
stride = cinfo.output_width * 3; stride = cinfo.output_width * 3;
tempbuf = (*cinfo.mem->alloc_sarray) tempbuf = (*cinfo.mem->alloc_sarray)
@@ -254,7 +254,7 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
} }
jpeg_finish_decompress( &cinfo ); jpeg_finish_decompress( &cinfo );
jpeg_destroy_decompress( &cinfo ); jpeg_destroy_decompress( &cinfo );
return TRUE; return true;
} }
typedef struct { typedef struct {
@@ -338,7 +338,7 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
if (verbose) if (verbose)
wxLogError(_("JPEG: Couldn't save image.")); wxLogError(_("JPEG: Couldn't save image."));
jpeg_destroy_compress(&cinfo); jpeg_destroy_compress(&cinfo);
return FALSE; return false;
} }
jpeg_create_compress(&cinfo); jpeg_create_compress(&cinfo);
@@ -362,7 +362,7 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
// sets the resolution fields in the output file // sets the resolution fields in the output file
if (image->HasOption(wxIMAGE_OPTION_RESOLUTION)) if (image->HasOption(wxIMAGE_OPTION_RESOLUTION))
{ {
cinfo.X_density = cinfo.X_density =
cinfo.Y_density = image->GetOptionInt(wxIMAGE_OPTION_RESOLUTION); cinfo.Y_density = image->GetOptionInt(wxIMAGE_OPTION_RESOLUTION);
} }
@@ -385,7 +385,7 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
jpeg_finish_compress(&cinfo); jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo); jpeg_destroy_compress(&cinfo);
return TRUE; return true;
} }
#ifdef __VISUALC__ #ifdef __VISUALC__
@@ -397,7 +397,7 @@ bool wxJPEGHandler::DoCanRead( wxInputStream& stream )
unsigned char hdr[2]; unsigned char hdr[2];
if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
return FALSE; return false;
return hdr[0] == 0xFF && hdr[1] == 0xD8; return hdr[0] == 0xFF && hdr[1] == 0xD8;
} }

View File

@@ -108,7 +108,7 @@ void RLEdecode(unsigned char *p, unsigned int size, wxInputStream& s)
// If ((data & 0xC0) != 0xC0), then the value read is a data // If ((data & 0xC0) != 0xC0), then the value read is a data
// byte. Else, it is a counter (cont = val & 0x3F) and the // byte. Else, it is a counter (cont = val & 0x3F) and the
// next byte is the data byte. // next byte is the data byte.
//
if ((data & 0xC0) != 0xC0) if ((data & 0xC0) != 0xC0)
{ {
*(p++) = (unsigned char)data; *(p++) = (unsigned char)data;
@@ -416,7 +416,7 @@ int SavePCX(wxImage *image, wxOutputStream& stream)
memset(pal, 0, sizeof(pal)); memset(pal, 0, sizeof(pal));
unsigned long index; unsigned long index;
for (wxImageHistogram::iterator entry = histogram.begin(); for (wxImageHistogram::iterator entry = histogram.begin();
entry != histogram.end(); entry++ ) entry != histogram.end(); entry++ )
{ {
@@ -447,7 +447,7 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
if (verbose) if (verbose)
wxLogError(_("PCX: this is not a PCX file.")); wxLogError(_("PCX: this is not a PCX file."));
return FALSE; return false;
} }
image->Destroy(); image->Destroy();
@@ -465,10 +465,10 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
} }
} }
image->Destroy(); image->Destroy();
return FALSE; return false;
} }
return TRUE; return true;
} }
bool wxPCXHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose ) bool wxPCXHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
@@ -495,7 +495,7 @@ bool wxPCXHandler::DoCanRead( wxInputStream& stream )
{ {
unsigned char c = stream.GetC(); unsigned char c = stream.GetC();
if ( !stream ) if ( !stream )
return FALSE; return false;
// not very safe, but this is all we can get from PCX header :-( // not very safe, but this is all we can get from PCX header :-(
return c == 10; return c == 10;

View File

@@ -321,7 +321,7 @@ bool wxPNGHandler::DoCanRead( wxInputStream& stream )
unsigned char hdr[4]; unsigned char hdr[4];
if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
return FALSE; return false;
return memcmp(hdr, "\211PNG", WXSIZEOF(hdr)) == 0; return memcmp(hdr, "\211PNG", WXSIZEOF(hdr)) == 0;
} }
@@ -600,7 +600,7 @@ wxPNGHandler::LoadFile(wxImage *image,
free( lines[i] ); free( lines[i] );
free( lines ); free( lines );
return TRUE; return true;
error: error:
if (verbose) if (verbose)
@@ -626,7 +626,7 @@ error:
else else
png_destroy_read_struct( &png_ptr, (png_infopp) NULL, (png_infopp) NULL ); png_destroy_read_struct( &png_ptr, (png_infopp) NULL, (png_infopp) NULL );
} }
return FALSE; return false;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -645,7 +645,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
{ {
if (verbose) if (verbose)
wxLogError(_("Couldn't save PNG image.")); wxLogError(_("Couldn't save PNG image."));
return FALSE; return false;
} }
png_set_error_fn(png_ptr, (png_voidp)NULL, wx_png_error, wx_png_warning); png_set_error_fn(png_ptr, (png_voidp)NULL, wx_png_error, wx_png_warning);
@@ -656,7 +656,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
png_destroy_write_struct( &png_ptr, (png_infopp)NULL ); png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
if (verbose) if (verbose)
wxLogError(_("Couldn't save PNG image.")); wxLogError(_("Couldn't save PNG image."));
return FALSE; return false;
} }
if (setjmp(wxinfo.jmpbuf)) if (setjmp(wxinfo.jmpbuf))
@@ -664,7 +664,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
png_destroy_write_struct( &png_ptr, (png_infopp)NULL ); png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
if (verbose) if (verbose)
wxLogError(_("Couldn't save PNG image.")); wxLogError(_("Couldn't save PNG image."));
return FALSE; return false;
} }
// NB: please see the comment near wxPNGInfoStruct declaration for // NB: please see the comment near wxPNGInfoStruct declaration for
@@ -689,7 +689,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
if (!data) if (!data)
{ {
png_destroy_write_struct( &png_ptr, (png_infopp)NULL ); png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
return FALSE; return false;
} }
for (int y = 0; y < image->GetHeight(); y++) for (int y = 0; y < image->GetHeight(); y++)
@@ -724,7 +724,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
png_write_end( png_ptr, info_ptr ); png_write_end( png_ptr, info_ptr );
png_destroy_write_struct( &png_ptr, (png_infopp)&info_ptr ); png_destroy_write_struct( &png_ptr, (png_infopp)&info_ptr );
return TRUE; return true;
} }
#ifdef __VISUALC__ #ifdef __VISUALC__

View File

@@ -70,15 +70,15 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
{ {
case wxT('2'): case wxT('2'):
if (verbose) wxLogError(_("Loading Grey Ascii PNM image is not yet implemented.")); if (verbose) wxLogError(_("Loading Grey Ascii PNM image is not yet implemented."));
return FALSE; return false;
case wxT('5'): case wxT('5'):
if (verbose) wxLogError(_("Loading Grey Raw PNM image is not yet implemented.")); if (verbose) wxLogError(_("Loading Grey Raw PNM image is not yet implemented."));
return FALSE; return false;
case wxT('3'): case wxT('3'):
case wxT('6'): break; case wxT('6'): break;
default: default:
if (verbose) wxLogError(_("PNM: File format is not recognized.")); if (verbose) wxLogError(_("PNM: File format is not recognized."));
return FALSE; return false;
} }
text_stream.ReadLine(); // for the \n text_stream.ReadLine(); // for the \n
@@ -94,7 +94,7 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
{ {
if (verbose) if (verbose)
wxLogError( _("PNM: Couldn't allocate memory.") ); wxLogError( _("PNM: Couldn't allocate memory.") );
return FALSE; return false;
} }
if (c=='3') // Ascii RBG if (c=='3') // Ascii RBG
@@ -110,14 +110,14 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
if ( !buf_stream ) if ( !buf_stream )
{ {
if (verbose) wxLogError(_("PNM: File seems truncated.")); if (verbose) wxLogError(_("PNM: File seems truncated."));
return FALSE; return false;
} }
} }
} }
if (c=='6') // Raw RGB if (c=='6') // Raw RGB
buf_stream.Read( ptr, 3*width*height ); buf_stream.Read( ptr, 3*width*height );
image->SetMask( FALSE ); image->SetMask( false );
const wxStreamError err = buf_stream.GetLastError(); const wxStreamError err = buf_stream.GetLastError();
return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF; return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF;
@@ -146,11 +146,11 @@ bool wxPNMHandler::DoCanRead( wxInputStream& stream )
{ {
case '3': case '3':
case '6': case '6':
return TRUE; return true;
} }
} }
return FALSE; return false;
} }

View File

@@ -143,7 +143,7 @@ TIFFwxWarningHandler(const char* module, const char* fmt, va_list ap)
wxLogWarning(_("tiff module: %s"), module); wxLogWarning(_("tiff module: %s"), module);
wxLogWarning((wxChar *) fmt, ap); wxLogWarning((wxChar *) fmt, ap);
} }
static void static void
TIFFwxErrorHandler(const char* module, const char* fmt, va_list ap) TIFFwxErrorHandler(const char* module, const char* fmt, va_list ap)
{ {
@@ -202,7 +202,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
if (verbose) if (verbose)
wxLogError( _("TIFF: Error loading image.") ); wxLogError( _("TIFF: Error loading image.") );
return FALSE; return false;
} }
if (!TIFFSetDirectory( tif, (tdir_t)index )) if (!TIFFSetDirectory( tif, (tdir_t)index ))
@@ -212,7 +212,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
TIFFClose( tif ); TIFFClose( tif );
return FALSE; return false;
} }
uint32 w, h; uint32 w, h;
@@ -233,7 +233,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
TIFFClose( tif ); TIFFClose( tif );
return FALSE; return false;
} }
image->Create( (int)w, (int)h ); image->Create( (int)w, (int)h );
@@ -245,7 +245,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
_TIFFfree( raster ); _TIFFfree( raster );
TIFFClose( tif ); TIFFClose( tif );
return FALSE; return false;
} }
if (!TIFFReadRGBAImage( tif, w, h, raster, 0 )) if (!TIFFReadRGBAImage( tif, w, h, raster, 0 ))
@@ -257,10 +257,10 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
image->Destroy(); image->Destroy();
TIFFClose( tif ); TIFFClose( tif );
return FALSE; return false;
} }
bool hasmask = FALSE; bool hasmask = false;
unsigned char *ptr = image->GetData(); unsigned char *ptr = image->GetData();
ptr += w*3*(h-1); ptr += w*3*(h-1);
@@ -273,7 +273,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
unsigned char alpha = (unsigned char)TIFFGetA(raster[pos]); unsigned char alpha = (unsigned char)TIFFGetA(raster[pos]);
if (alpha < 127) if (alpha < 127)
{ {
hasmask = TRUE; hasmask = true;
ptr[0] = image->GetMaskRed(); ptr[0] = image->GetMaskRed();
ptr++; ptr++;
ptr[0] = image->GetMaskGreen(); ptr[0] = image->GetMaskGreen();
@@ -301,7 +301,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
image->SetMask( hasmask ); image->SetMask( hasmask );
return TRUE; return true;
} }
int wxTIFFHandler::GetImageCount( wxInputStream& stream ) int wxTIFFHandler::GetImageCount( wxInputStream& stream )
@@ -330,7 +330,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
if (verbose) if (verbose)
wxLogError( _("TIFF: Error saving image.") ); wxLogError( _("TIFF: Error saving image.") );
return FALSE; return false;
} }
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32)image->GetWidth()); TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32)image->GetWidth());
@@ -355,7 +355,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
TIFFClose( tif ); TIFFClose( tif );
return FALSE; return false;
} }
} }
else else
@@ -381,7 +381,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
if (buf) if (buf)
_TIFFfree(buf); _TIFFfree(buf);
return FALSE; return false;
} }
ptr += image->GetWidth()*3; ptr += image->GetWidth()*3;
} }
@@ -391,7 +391,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
if (buf) if (buf)
_TIFFfree(buf); _TIFFfree(buf);
return TRUE; return true;
} }
bool wxTIFFHandler::DoCanRead( wxInputStream& stream ) bool wxTIFFHandler::DoCanRead( wxInputStream& stream )
@@ -399,7 +399,7 @@ bool wxTIFFHandler::DoCanRead( wxInputStream& stream )
unsigned char hdr[2]; unsigned char hdr[2];
if ( !stream.Read(&hdr, WXSIZEOF(hdr)) ) if ( !stream.Read(&hdr, WXSIZEOF(hdr)) )
return FALSE; return false;
return (hdr[0] == 'I' && hdr[1] == 'I') || return (hdr[0] == 'I' && hdr[1] == 'I') ||
(hdr[0] == 'M' && hdr[1] == 'M'); (hdr[0] == 'M' && hdr[1] == 'M');

View File

@@ -102,9 +102,9 @@ bool wxXPMHandler::LoadFile(wxImage *image,
wxImage img = decoder.ReadFile(stream); wxImage img = decoder.ReadFile(stream);
if ( !img.Ok() ) if ( !img.Ok() )
return FALSE; return false;
*image = img; *image = img;
return TRUE; return true;
} }
@@ -140,7 +140,7 @@ bool wxXPMHandler::SaveFile(wxImage * image,
for ( k = MaxCixels; cols > k; k *= MaxCixels) for ( k = MaxCixels; cols > k; k *= MaxCixels)
chars_per_pixel++; chars_per_pixel++;
// 2. write the header: // 2. write the header:
wxString sName; wxString sName;
if ( image->HasOption(wxIMAGE_OPTION_FILENAME) ) if ( image->HasOption(wxIMAGE_OPTION_FILENAME) )
{ {
@@ -148,17 +148,17 @@ bool wxXPMHandler::SaveFile(wxImage * image,
NULL, &sName, NULL); NULL, &sName, NULL);
sName << wxT("_xpm"); sName << wxT("_xpm");
} }
if ( !sName.IsEmpty() ) if ( !sName.IsEmpty() )
sName = wxString(wxT("/* XPM */\nstatic char *")) + sName; sName = wxString(wxT("/* XPM */\nstatic char *")) + sName;
else else
sName = wxT("/* XPM */\nstatic char *xpm_data"); sName = wxT("/* XPM */\nstatic char *xpm_data");
stream.Write( (const char*) sName.ToAscii(), sName.Len() ); stream.Write( (const char*) sName.ToAscii(), sName.Len() );
char tmpbuf[200]; char tmpbuf[200];
// VS: 200b is safe upper bound for anything produced by sprintf below // VS: 200b is safe upper bound for anything produced by sprintf below
// (<101 bytes the string, neither %i can expand into more than 10 chars) // (<101 bytes the string, neither %i can expand into more than 10 chars)
sprintf(tmpbuf, sprintf(tmpbuf,
"[] = {\n" "[] = {\n"
"/* columns rows colors chars-per-pixel */\n" "/* columns rows colors chars-per-pixel */\n"
"\"%i %i %i %i\",\n", "\"%i %i %i %i\",\n",
@@ -240,7 +240,7 @@ bool wxXPMHandler::SaveFile(wxImage * image,
delete[] symbols; delete[] symbols;
delete[] symbols_data; delete[] symbols_data;
return TRUE; return true;
} }
bool wxXPMHandler::DoCanRead(wxInputStream& stream) bool wxXPMHandler::DoCanRead(wxInputStream& stream)

View File

@@ -312,7 +312,7 @@ bool wxEntryStart(int& argc, char **argv)
// clean up // clean up
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// cleanup done before destroying wxTheApp // cleanup done before destroying wxTheApp
static void DoCommonPreCleanup() static void DoCommonPreCleanup()
{ {
#if wxUSE_LOG #if wxUSE_LOG

View File

@@ -1078,7 +1078,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0,
FIXME: UNICODE SUPPORT: must use CHARSET specifier! FIXME: UNICODE SUPPORT: must use CHARSET specifier!
*/ */
wxString szName = szName0; wxString szName = szName0;
if(szName.Find(wxT('.')) != -1) // contains a dot if(szName.Find(wxT('.')) != wxNOT_FOUND) // contains a dot
szName = szName.Left(szName.Find(wxT('.'))); szName = szName.Left(szName.Find(wxT('.')));
wxString searchPath = GetFullSearchPath(szDirPrefix); wxString searchPath = GetFullSearchPath(szDirPrefix);
@@ -1108,7 +1108,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0,
wxString strFullName; wxString strFullName;
if ( !wxFindFileInPath(&strFullName, searchPath, strFile) ) { if ( !wxFindFileInPath(&strFullName, searchPath, strFile) ) {
wxLogVerbose(_("catalog file for domain '%s' not found."), szName.c_str()); wxLogVerbose(_("catalog file for domain '%s' not found."), szName.c_str());
return FALSE; return false;
} }
// open file // open file
@@ -1117,18 +1117,18 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0,
wxFile fileMsg(strFullName); wxFile fileMsg(strFullName);
if ( !fileMsg.IsOpened() ) if ( !fileMsg.IsOpened() )
return FALSE; return false;
// get the file size // get the file size
off_t nSize = fileMsg.Length(); off_t nSize = fileMsg.Length();
if ( nSize == wxInvalidOffset ) if ( nSize == wxInvalidOffset )
return FALSE; return false;
// read the whole file in memory // read the whole file in memory
m_pData = new size_t8[nSize]; m_pData = new size_t8[nSize];
if ( fileMsg.Read(m_pData, nSize) != nSize ) { if ( fileMsg.Read(m_pData, nSize) != nSize ) {
wxDELETEA(m_pData); wxDELETEA(m_pData);
return FALSE; return false;
} }
// examine header // examine header
@@ -1148,7 +1148,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0,
wxLogWarning(_("'%s' is not a valid message catalog."), strFullName.c_str()); wxLogWarning(_("'%s' is not a valid message catalog."), strFullName.c_str());
wxDELETEA(m_pData); wxDELETEA(m_pData);
return FALSE; return false;
} }
// initialize // initialize
@@ -1222,7 +1222,7 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
{ {
#if wxUSE_WCHAR_T #if wxUSE_WCHAR_T
wxCSConv *csConv = NULL; wxCSConv *csConv = NULL;
if ( !!m_charset ) if ( !m_charset.IsEmpty() )
csConv = new wxCSConv(m_charset); csConv = new wxCSConv(m_charset);
wxMBConv& inputConv = csConv ? *((wxMBConv*)csConv) : *wxConvCurrent; wxMBConv& inputConv = csConv ? *((wxMBConv*)csConv) : *wxConvCurrent;
@@ -1234,15 +1234,15 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
#elif wxUSE_FONTMAP #elif wxUSE_FONTMAP
wxASSERT_MSG( msgIdCharset == NULL, wxASSERT_MSG( msgIdCharset == NULL,
_T("non-ASCII msgid languages only supported if wxUSE_WCHAR_T=1") ); _T("non-ASCII msgid languages only supported if wxUSE_WCHAR_T=1") );
wxEncodingConverter converter; wxEncodingConverter converter;
if ( convertEncoding ) if ( convertEncoding )
{ {
wxFontEncoding targetEnc = wxFONTENCODING_SYSTEM; wxFontEncoding targetEnc = wxFONTENCODING_SYSTEM;
wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(m_charset, FALSE); wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(m_charset, false);
if ( enc == wxFONTENCODING_SYSTEM ) if ( enc == wxFONTENCODING_SYSTEM )
{ {
convertEncoding = FALSE; // unknown encoding convertEncoding = false; // unknown encoding
} }
else else
{ {
@@ -1252,10 +1252,10 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
wxFontEncodingArray a = wxEncodingConverter::GetPlatformEquivalents(enc); wxFontEncodingArray a = wxEncodingConverter::GetPlatformEquivalents(enc);
if (a[0] == enc) if (a[0] == enc)
// no conversion needed, locale uses native encoding // no conversion needed, locale uses native encoding
convertEncoding = FALSE; convertEncoding = false;
if (a.GetCount() == 0) if (a.GetCount() == 0)
// we don't know common equiv. under this platform // we don't know common equiv. under this platform
convertEncoding = FALSE; convertEncoding = false;
targetEnc = a[0]; targetEnc = a[0];
} }
} }
@@ -1338,10 +1338,10 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName,
if ( file.Load(szDirPrefix, szName, m_pluralFormsCalculator) ) if ( file.Load(szDirPrefix, szName, m_pluralFormsCalculator) )
{ {
file.FillHash(m_messages, msgIdCharset, bConvertEncoding); file.FillHash(m_messages, msgIdCharset, bConvertEncoding);
return TRUE; return true;
} }
return FALSE; return false;
} }
const wxChar *wxMsgCatalog::GetString(const wxChar *sz, size_t n) const const wxChar *wxMsgCatalog::GetString(const wxChar *sz, size_t n) const
@@ -1425,7 +1425,7 @@ bool wxLocale::Init(const wxChar *szName,
// the argument to setlocale() // the argument to setlocale()
szLocale = szShort; szLocale = szShort;
wxCHECK_MSG( szLocale, FALSE, _T("no locale to set in wxLocale::Init()") ); wxCHECK_MSG( szLocale, false, _T("no locale to set in wxLocale::Init()") );
} }
#ifdef __WXWINCE__ #ifdef __WXWINCE__
@@ -1471,7 +1471,7 @@ bool wxLocale::Init(const wxChar *szName,
// load the default catalog with wxWidgets standard messages // load the default catalog with wxWidgets standard messages
m_pMsgCat = NULL; m_pMsgCat = NULL;
bool bOk = TRUE; bool bOk = true;
if ( bLoadDefault ) if ( bLoadDefault )
bOk = AddCatalog(wxT("wxstd")); bOk = AddCatalog(wxT("wxstd"));
@@ -1485,24 +1485,24 @@ static wxWCharBuffer wxSetlocaleTryUTF(int c, const wxChar *lc)
wxMB2WXbuf l = wxSetlocale(c, lc); wxMB2WXbuf l = wxSetlocale(c, lc);
if ( !l && lc && lc[0] != 0 ) if ( !l && lc && lc[0] != 0 )
{ {
wxString buf(lc); wxString buf(lc);
wxString buf2; wxString buf2;
buf2 = buf + wxT(".UTF-8"); buf2 = buf + wxT(".UTF-8");
l = wxSetlocale(c, buf2.c_str()); l = wxSetlocale(c, buf2.c_str());
if ( !l ) if ( !l )
{ {
buf2 = buf + wxT(".utf-8"); buf2 = buf + wxT(".utf-8");
l = wxSetlocale(c, buf2.c_str()); l = wxSetlocale(c, buf2.c_str());
} }
if ( !l ) if ( !l )
{ {
buf2 = buf + wxT(".UTF8"); buf2 = buf + wxT(".UTF8");
l = wxSetlocale(c, buf2.c_str()); l = wxSetlocale(c, buf2.c_str());
} }
if ( !l ) if ( !l )
{ {
buf2 = buf + wxT(".utf8"); buf2 = buf + wxT(".utf8");
l = wxSetlocale(c, buf2.c_str()); l = wxSetlocale(c, buf2.c_str());
} }
} }
return l; return l;
@@ -1523,7 +1523,7 @@ bool wxLocale::Init(int language, int flags)
// We failed to detect system language, so we will use English: // We failed to detect system language, so we will use English:
if (lang == wxLANGUAGE_UNKNOWN) if (lang == wxLANGUAGE_UNKNOWN)
{ {
return FALSE; return false;
} }
const wxLanguageInfo *info = GetLanguageInfo(lang); const wxLanguageInfo *info = GetLanguageInfo(lang);
@@ -1532,7 +1532,7 @@ bool wxLocale::Init(int language, int flags)
if (info == NULL) if (info == NULL)
{ {
wxLogError(wxT("Unknown language %i."), lang); wxLogError(wxT("Unknown language %i."), lang);
return FALSE; return false;
} }
wxString name = info->Description; wxString name = info->Description;
@@ -1580,7 +1580,7 @@ bool wxLocale::Init(int language, int flags)
if ( !retloc ) if ( !retloc )
{ {
wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str()); wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str());
return FALSE; return false;
} }
#elif defined(__WIN32__) #elif defined(__WIN32__)
@@ -1637,7 +1637,7 @@ bool wxLocale::Init(int language, int flags)
{ {
wxLogLastError(wxT("SetThreadLocale")); wxLogLastError(wxT("SetThreadLocale"));
wxLogError(wxT("Cannot set locale to language %s."), name.c_str()); wxLogError(wxT("Cannot set locale to language %s."), name.c_str());
return FALSE; return false;
} }
else else
{ {
@@ -1679,12 +1679,12 @@ bool wxLocale::Init(int language, int flags)
if ( !retloc ) if ( !retloc )
{ {
wxLogError(wxT("Cannot set locale to language %s."), name.c_str()); wxLogError(wxT("Cannot set locale to language %s."), name.c_str());
return FALSE; return false;
} }
#elif defined(__WXMAC__) || defined(__WXPM__) #elif defined(__WXMAC__) || defined(__WXPM__)
wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString); wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString);
#else #else
return FALSE; return false;
#define WX_NO_LOCALE_SUPPORT #define WX_NO_LOCALE_SUPPORT
#endif #endif
@@ -2285,11 +2285,11 @@ wxFontEncoding wxLocale::GetSystemEncoding()
return wxFONTENCODING_CP950; return wxFONTENCODING_CP950;
} }
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
TextEncoding encoding = 0 ; TextEncoding encoding = 0 ;
#if TARGET_CARBON #if TARGET_CARBON
encoding = CFStringGetSystemEncoding() ; encoding = CFStringGetSystemEncoding() ;
#else #else
UpgradeScriptInfoToTextEncoding ( smSystemScript , kTextLanguageDontCare , kTextRegionDontCare , NULL , &encoding ) ; UpgradeScriptInfoToTextEncoding ( smSystemScript , kTextLanguageDontCare , kTextRegionDontCare , NULL , &encoding ) ;
#endif #endif
return wxMacGetFontEncFromSystemEnc( encoding ) ; return wxMacGetFontEncFromSystemEnc( encoding ) ;
#elif defined(__UNIX_LIKE__) && wxUSE_FONTMAP #elif defined(__UNIX_LIKE__) && wxUSE_FONTMAP
@@ -2297,7 +2297,7 @@ wxFontEncoding wxLocale::GetSystemEncoding()
if ( !encname.empty() ) if ( !encname.empty() )
{ {
wxFontEncoding enc = wxFontMapper::Get()-> wxFontEncoding enc = wxFontMapper::Get()->
CharsetToEncoding(encname, FALSE /* not interactive */); CharsetToEncoding(encname, false /* not interactive */);
// on some modern Linux systems (RedHat 8) the default system locale // on some modern Linux systems (RedHat 8) the default system locale
// is UTF8 -- but it isn't supported by wxGTK in ANSI build at all so // is UTF8 -- but it isn't supported by wxGTK in ANSI build at all so
@@ -2538,11 +2538,11 @@ wxString wxLocale::GetHeaderValue( const wxChar* szHeader,
wxChar const * pszFound = wxStrstr(pszTrans, szHeader); wxChar const * pszFound = wxStrstr(pszTrans, szHeader);
if ( pszFound == NULL ) if ( pszFound == NULL )
return wxEmptyString; return wxEmptyString;
pszFound += wxStrlen(szHeader) + 2 /* ': ' */; pszFound += wxStrlen(szHeader) + 2 /* ': ' */;
// Every header is separated by \n // Every header is separated by \n
wxChar const * pszEndLine = wxStrchr(pszFound, wxT('\n')); wxChar const * pszEndLine = wxStrchr(pszFound, wxT('\n'));
if ( pszEndLine == NULL ) pszEndLine = pszFound + wxStrlen(pszFound); if ( pszEndLine == NULL ) pszEndLine = pszFound + wxStrlen(pszFound);
@@ -2736,7 +2736,7 @@ class wxLocaleModule: public wxModule
DECLARE_DYNAMIC_CLASS(wxLocaleModule) DECLARE_DYNAMIC_CLASS(wxLocaleModule)
public: public:
wxLocaleModule() {} wxLocaleModule() {}
bool OnInit() { return TRUE; } bool OnInit() { return true; }
void OnExit() { wxLocale::DestroyLanguagesDB(); } void OnExit() { wxLocale::DestroyLanguagesDB(); }
}; };

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98 // Created: 04/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
@@ -31,23 +31,23 @@ IMPLEMENT_CLASS(wxClientBase, wxObject)
IMPLEMENT_CLASS(wxConnectionBase, wxObject) IMPLEMENT_CLASS(wxConnectionBase, wxObject)
wxConnectionBase::wxConnectionBase(wxChar *buffer, int size) wxConnectionBase::wxConnectionBase(wxChar *buffer, int size)
: m_connected(TRUE), : m_connected(true),
m_buffer(buffer), m_buffer(buffer),
m_buffersize(size), m_buffersize(size),
m_deletebufferwhendone(FALSE) m_deletebufferwhendone(false)
{ {
if ( buffer == (wxChar *)NULL ) if ( buffer == (wxChar *)NULL )
{ // behave like next constructor { // behave like next constructor
m_buffersize = 0; m_buffersize = 0;
m_deletebufferwhendone = TRUE; m_deletebufferwhendone = true;
} }
} }
wxConnectionBase::wxConnectionBase() wxConnectionBase::wxConnectionBase()
: m_connected(TRUE), : m_connected(true),
m_buffer(NULL), m_buffer(NULL),
m_buffersize(0), m_buffersize(0),
m_deletebufferwhendone(TRUE) m_deletebufferwhendone(true)
{ {
} }
@@ -55,7 +55,7 @@ wxConnectionBase::wxConnectionBase(wxConnectionBase& copy)
: m_connected(copy.m_connected), : m_connected(copy.m_connected),
m_buffer(copy.m_buffer), m_buffer(copy.m_buffer),
m_buffersize(copy.m_buffersize), m_buffersize(copy.m_buffersize),
m_deletebufferwhendone(FALSE) m_deletebufferwhendone(false)
{ {
// copy constructor would require ref-counted pointer to buffer // copy constructor would require ref-counted pointer to buffer