Revision: 436
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=436&view=rev
Author: pstieber
Date: 2008-04-06 21:49:52 -0700 (Sun, 06 Apr 2008)
Log Message:
-----------
1. Checked the size of the returned string to fix a bug.
2. Made cosmetic changes.
Modified Paths:
--------------
trunk/jazz/src/FileSelector.cpp
Modified: trunk/jazz/src/FileSelector.cpp
===================================================================
--- trunk/jazz/src/FileSelector.cpp 2008-04-07 04:33:58 UTC (rev 435)
+++ trunk/jazz/src/FileSelector.cpp 2008-04-07 04:49:52 UTC (rev 436)
@@ -31,17 +31,17 @@
wxString add_default_ext(const wxString fn, const wxString ext)
{
- // is any extension already there?
+ // Is any extension already there?
{
const wxString x = wxFileNameFromPath(fn);
- if (x.find( '.', TRUE) != 0)
+ if (x.find('.', TRUE) != 0)
{
- //if there is a dot, assume its an extension and return
+ // if there is a dot, assume its an extension and return.
return fn;
}
}
- // otherwise append the supplied extension and return
+ // Otherwise append the supplied extension and return
wxString RevisedFileName = fn;
RevisedFileName += ext;
return RevisedFileName;
@@ -64,7 +64,6 @@
bool changed,
const wxString ext)
{
- wxString s;
wxString file;
wxString path;
@@ -76,10 +75,10 @@
path = wxPathOnly(deffile);
int flags = save ? wxFD_SAVE : wxFD_OPEN;
- s = wxFileSelector(title, path, file, 0, ext, flags);
+ wxString s = wxFileSelector(title, path, file, 0, ext, flags);
// add extension if missing
- if (s && ext)
+ if (!s.empty() && ext)
{
s = add_default_ext(s, ext);
}
@@ -104,7 +103,8 @@
wxString buf;
buf<<deffile;
buf <<" has changed. Load anyway?";
- if (wxMessageBox(buf, "Load ?", wxYES_NO) == wxNO) {
+ if (wxMessageBox(buf, "Load ?", wxYES_NO) == wxNO)
+ {
s = wxEmptyString;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|