What I Fixed Tonight
Date: 23/1/2007
Well lets see, I fixed the list control selecting a whole range of items in one click. I fixed the combo box not painting it's content. I fixed modal dialogs gettings hidden behind the owning window. I made the text on buttons darker. I fixed the saving of account settings, which brings me to the lovely topic of printf formatting.

Ah printf formatting. It's nice and universal between platforms and every coder knows the basics by wrote. But it seems that the humble printf is to blame for a number of bugs in my software, mostly to do with the processing of 64bit integers. In the case of a 64bit integer passed to printf, 8 bytes are put onto the stack instead of the usual 4, so you have to instruct the printf command to expect that when crafting the format string. And this is where the trouble starts. Each platform has it's own lingo for that:
  • Windows: "%I64i"
  • Linux: "%Ld"
  • Mac: "%lli"
These all format a 64bit integer into a decimal string. So I've abstracted that out and now I use a define for that, and conveniently C will concatenate adjact strings together so you can do this sort of thing:
int64 Value = 1234;
char s[256];
sprintf(s, "Value = " LGI_PrintfInt64 "\n", Value);
Where LGI_PrintfInt64 is the format string for 64bit ints for your platform.

The other case where it bit me is where I pass a single 64bit int to printf and use "%i" as the format. On Intel machines this works for values <4gb because of the byte ordering. On my PPC mac mini of course it doesn't work at all because the bytes are the other way around. Nevertheless you shouldn't do that, either cast it to an int or use the proper int64 formatting string.

So I've uploaded a file and downloaded a file, created an account. i.Ftp is pretty usable right now. The only thing really outstanding is deleting local files, a few asserts in the FTP protocol code and working out how to package it into a .dmg release.

But I feel good. The hard part is over... it's really down hill from here.
Email (optional): (Will be HTML encoded to evade harvesting)
Remember username and/or email in a cookie.
Notify me of new posts in this thread via email.