X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/227989f3e96d846023d36a797931875c57fbae6d..6f26925422c2de7938509657eb981d6f752a6249:/src/common/file.cpp diff --git a/src/common/file.cpp b/src/common/file.cpp index 8aaa9ac05e..bd4a4f0a0c 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -312,7 +312,12 @@ bool wxFile::Write(const wxString& s, const wxMBConv& conv) if ( !buf ) return false; +#if wxUSE_UNICODE const size_t size = buf.length(); +#else + const size_t size = s.length(); +#endif + return Write(buf, size) == size; } @@ -410,8 +415,7 @@ wxFileOffset wxFile::Length() const wxFileOffset iRc = Tell(); if ( iRc != wxInvalidOffset ) { - // have to use const_cast :-( - wxFileOffset iLen = ((wxFile *)this)->SeekEnd(); + wxFileOffset iLen = const_cast(this)->SeekEnd(); if ( iLen != wxInvalidOffset ) { // restore old position if ( ((wxFile *)this)->Seek(iRc) == wxInvalidOffset ) {