From cf7f7d5d96c178d35ceb96fe74ea3eb13dd009de Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 27 Jun 2009 21:35:27 +0000 Subject: [PATCH] correct an example which had no chance of working git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- interface/wx/protocol/ftp.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/interface/wx/protocol/ftp.h b/interface/wx/protocol/ftp.h index 12bbca605f..364e5e434d 100644 --- a/interface/wx/protocol/ftp.h +++ b/interface/wx/protocol/ftp.h @@ -47,14 +47,20 @@ enum TransferMode } ftp.ChDir("/pub/2.8.9"); - wxInputStream *i = ftp.GetInputStream("wxWidgets-2.8.9.tar.bz2"); + const char *filename = "wxWidgets-2.8.9.tar.bz2"; + int size = ftp.GetFileSize(filename); + if ( size == -1 ) + { + wxLogError("Couldn't get the file size for \"%s\"", filename); + } + + wxInputStream *i = ftp.GetInputStream(filename); if ( !in ) { wxLogError("Couldn't get the file"); } else { - size_t size = in->GetSize(); char *data = new char[size]; if ( !in->Read(data, size) ) { -- 2.45.2