Changed: Use std::string instead of const char* for openURL and openDoc

--HG--
branch : develop
This commit is contained in:
kervala 2016-12-02 15:58:59 +01:00
parent 58ec64e380
commit 591dc1dffd
2 changed files with 6 additions and 6 deletions

View file

@ -690,10 +690,10 @@ inline int nlisprint(int c)
#endif #endif
// Open an url in a browser // Open an url in a browser
bool openURL (const char *url); bool openURL (const std::string &url);
// Open a document // Open a document
bool openDoc (const char *document); bool openDoc (const std::string &document);
// AntiBug method that return an epsilon if x==0, else x // AntiBug method that return an epsilon if x==0, else x
inline float favoid0(float x) inline float favoid0(float x)

View file

@ -1434,7 +1434,7 @@ LONG GetRegKey(HKEY key, LPCWSTR subkey, LPWSTR retdata)
} }
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
static bool openDocWithExtension (const char *document, const char *ext) static bool openDocWithExtension (const std::string &document, const std::string &ext)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
// First try ShellExecute() // First try ShellExecute()
@ -1552,18 +1552,18 @@ static bool openDocWithExtension (const char *document, const char *ext)
return false; return false;
} }
bool openURL (const char *url) bool openURL(const std::string &url)
{ {
return openDocWithExtension(url, "htm"); return openDocWithExtension(url, "htm");
} }
bool openDoc (const char *document) bool openDoc(const std::string &document)
{ {
// get extension from document fullpath // get extension from document fullpath
string ext = CFile::getExtension(document); string ext = CFile::getExtension(document);
// try to open document // try to open document
return openDocWithExtension(document, ext.c_str()); return openDocWithExtension(document, ext);
} }
} // NLMISC } // NLMISC