X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3f4a0c5be34be837210768501c13dbcff81e533c..a4f964122df05b83a7753ea50fb0831b9781822d:/src/msw/pnghand.cpp?ds=sidebyside diff --git a/src/msw/pnghand.cpp b/src/msw/pnghand.cpp index 01309d2b84..c855358dd7 100644 --- a/src/msw/pnghand.cpp +++ b/src/msw/pnghand.cpp @@ -38,7 +38,7 @@ #include extern "C" { -#include "png.h" +#include "../png/png.h" } extern "C" void png_read_init PNGARG((png_structp png_ptr)); @@ -93,7 +93,7 @@ wxPNGReader::wxPNGReader(void) imageOK = FALSE; } -wxPNGReader::wxPNGReader ( char* ImageFileName ) +wxPNGReader::wxPNGReader ( wxChar* ImageFileName ) { imageOK = FALSE; filetype = 0; @@ -130,7 +130,8 @@ wxPNGReader::Create(int width, int height, int depth, int colortype) } RawImage = 0; Palette = 0; - if (lpbi = DibCreate(Depth, Width, Height)) { + lpbi = DibCreate(Depth, Width, Height); + if (lpbi) { RawImage = (ImagePointerType)DibPtr(lpbi); EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4; imageOK = TRUE; @@ -291,7 +292,7 @@ bool wxPNGReader::InstantiateBitmap(wxBitmap *bitmap) if ( Palette ) { - HPALETTE oldPal = ::SelectPalette(dc, (HPALETTE) Palette->GetHPALETTE(), FALSE); + ::SelectPalette(dc, (HPALETTE) Palette->GetHPALETTE(), FALSE); ::RealizePalette(dc); } @@ -382,12 +383,12 @@ wxMask *wxPNGReader::CreateMask(void) return mask; } -bool wxPNGReader::ReadFile(char * ImageFileName) +bool wxPNGReader::ReadFile(wxChar * ImageFileName) { int number_passes; if (ImageFileName) - strcpy(filename, ImageFileName); + wxStrcpy(filename, ImageFileName); FILE *fp; png_struct *png_ptr; @@ -395,7 +396,7 @@ bool wxPNGReader::ReadFile(char * ImageFileName) wxPNGReaderIter iter(this); /* open the file */ - fp = fopen(filename, "rb"); + fp = fopen(wxConvFile.cWX2MB(filename), "rb"); if (!fp) return FALSE; @@ -524,10 +525,10 @@ bool wxPNGReader::ReadFile(char * ImageFileName) /* write a png file */ -bool wxPNGReader::SaveFile(char * ImageFileName) +bool wxPNGReader::SaveFile(wxChar * ImageFileName) { if (ImageFileName) - strcpy(filename, ImageFileName); + wxStrcpy(filename, ImageFileName); wxPNGReaderIter iter(this); FILE *fp; @@ -535,7 +536,7 @@ bool wxPNGReader::SaveFile(char * ImageFileName) png_info *info_ptr; /* open the file */ - fp = fopen(filename, "wb"); + fp = fopen(wxConvFile.cWX2MB(filename), "wb"); if (!fp) return FALSE; @@ -692,14 +693,14 @@ static void DecToHex(int dec, char *buf) } -bool wxPNGReader::SaveXPM(char *filename, char *name) +bool wxPNGReader::SaveXPM(wxChar *filename, wxChar *name) { - char nameStr[256]; + wxChar nameStr[256]; if ( name ) - strcpy(nameStr, name); + wxStrcpy(nameStr, name); else { - strcpy(nameStr, filename); + wxStrcpy(nameStr, filename); wxStripExtension(nameStr); } @@ -712,7 +713,7 @@ bool wxPNGReader::SaveXPM(char *filename, char *name) if ( !GetPalette() ) return FALSE; - ofstream str(filename); + ofstream str(wxConvFile.cWX2MB(filename)); if ( str.bad() ) return FALSE; @@ -769,7 +770,7 @@ bool wxPNGFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla int desiredWidth, int desiredHeight) { wxPNGReader reader; - if (reader.ReadFile((char*) (const char*) name)) + if (reader.ReadFile(WXSTRINGCAST name)) { return reader.InstantiateBitmap(bitmap); }