[pedevel] Re: Pe and FTP

  • From: Rainer Riedl <mlist@xxxxxxxxx>
  • To: pedevel@xxxxxxxxxxxxx
  • Date: Wed, 24 Mar 2004 19:23:20 +0100

Hi,

> I am pretty sure that several bugs remain, so if you have access to a

yep, here's the first one:

In 
        void CFtpDialog::ListDirectory()

the first is thrown away:
                                                        CFtpListItem *i;
                                                        char s[256];

                                                        if (!s_gets(s, 256, 
dsf))
                                                                THROW(("Could 
not get listing."));
                                                        
                                                        bool showAll = 
IsOn("dotf");

                                                        while (s_gets(s, 256, 
dsf))
                                                        {
                                                                i = new 
CFtpListItem(s);
                                                                if (showAll || 
*(const char *)*i != '.')
                                                                {
                                                                        
fList->AddItem(i);
                                                                        
i->SetHeight(18);
                                                                }
                                                                else
                                                                        delete 
i;
                                                        }

As I first workaround the following should do the job (are there ftp servers 
that put someting other than an entry in the first line?!)

                                                        CFtpListItem *i;
                                                        char s[256];
                                                        bool showAll = 
IsOn("dotf");
                                                        int  entryCount = 0;
                                                        
                                                        while (s_gets(s, 256, 
dsf))
                                                        {
                                                                entryCount++;
                                                                i = new 
CFtpListItem(s);
                                                                if (showAll || 
*(const char *)*i != '.')
                                                                {
                                                                        
fList->AddItem(i);
                                                                        
i->SetHeight(18);
                                                                }
                                                                else
                                                                        delete 
i;
                                                        }
                                                        if (entryCount == 0)
                                                                THROW(("Could 
not get listing."));

I'm trying to do a more universial solution now


Other related posts: