summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-06-26 00:39:00 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-06-26 00:39:00 +0000
commit25c10ed028da5c547b11f1f461916897272b0e6d (patch)
tree350a5858f8970b6e28b2dc395625d74d8bd597b2 /indra/llwindow
parent6dd125d375b38455997a0c4b8747659f4c2351aa (diff)
QAR-628 merge string-cleanup-5 -r 90476:90508 -> release
dataserver-is-deprecated
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/lldxhardware.cpp4
-rw-r--r--indra/llwindow/lldxhardware.h4
-rw-r--r--indra/llwindow/llkeyboard.cpp26
-rw-r--r--indra/llwindow/llkeyboard.h12
-rw-r--r--indra/llwindow/llmousehandler.h4
-rw-r--r--indra/llwindow/llwindow.cpp14
-rw-r--r--indra/llwindow/llwindow.h26
-rw-r--r--indra/llwindow/llwindowheadless.cpp2
-rw-r--r--indra/llwindow/llwindowheadless.h10
-rw-r--r--indra/llwindow/llwindowmacosx.cpp100
-rw-r--r--indra/llwindow/llwindowmacosx.h15
-rw-r--r--indra/llwindow/llwindowmesaheadless.cpp2
-rw-r--r--indra/llwindow/llwindowmesaheadless.h10
-rw-r--r--indra/llwindow/llwindowsdl.cpp145
-rw-r--r--indra/llwindow/llwindowsdl.h17
-rw-r--r--indra/llwindow/llwindowwin32.cpp118
-rw-r--r--indra/llwindow/llwindowwin32.h13
17 files changed, 142 insertions, 380 deletions
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index e3cbf6d9d2..053da0279c 100644
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -150,7 +150,7 @@ S32 LLVersion::getField(const S32 field_num)
}
}
-LLString LLDXDriverFile::dump()
+std::string LLDXDriverFile::dump()
{
if (gWriteDebug)
{
@@ -237,7 +237,7 @@ void LLDXHardware::cleanup()
}
/*
-LLString LLDXHardware::dumpDevices()
+std::string LLDXHardware::dumpDevices()
{
if (gWriteDebug)
{
diff --git a/indra/llwindow/lldxhardware.h b/indra/llwindow/lldxhardware.h
index e174b322b0..4f3254a8d7 100644
--- a/indra/llwindow/lldxhardware.h
+++ b/indra/llwindow/lldxhardware.h
@@ -53,7 +53,7 @@ protected:
class LLDXDriverFile
{
public:
- LLString dump();
+ std::string dump();
public:
std::string mFilepath;
@@ -103,7 +103,7 @@ public:
// ANY of them to match and return.
// LLDXDevice *findDevice(const std::string &vendor, const std::string &devices);
- // LLString dumpDevices();
+ // std::string dumpDevices();
public:
typedef std::map<std::string, LLDXDevice *> device_map_t;
// device_map_t mDevices;
diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp
index 9ed3c9b12d..5e6a412b06 100644
--- a/indra/llwindow/llkeyboard.cpp
+++ b/indra/llwindow/llkeyboard.cpp
@@ -43,8 +43,8 @@
LLKeyboard *gKeyboard = NULL;
//static
-std::map<KEY,LLString> LLKeyboard::sKeysToNames;
-std::map<LLString,KEY> LLKeyboard::sNamesToKeys;
+std::map<KEY,std::string> LLKeyboard::sKeysToNames;
+std::map<std::string,KEY> LLKeyboard::sNamesToKeys;
//
// Class Implementation
@@ -144,11 +144,11 @@ LLKeyboard::~LLKeyboard()
// nothing
}
-void LLKeyboard::addKeyName(KEY key, const LLString& name)
+void LLKeyboard::addKeyName(KEY key, const std::string& name)
{
sKeysToNames[key] = name;
- LLString nameuc = name;
- LLString::toUpper(nameuc);
+ std::string nameuc = name;
+ LLStringUtil::toUpper(nameuc);
sNamesToKeys[nameuc] = key;
}
@@ -294,9 +294,9 @@ S32 LLKeyboard::getKeyElapsedFrameCount(KEY key)
}
// static
-BOOL LLKeyboard::keyFromString(const LLString& str, KEY *key)
+BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key)
{
- LLString instring(str);
+ std::string instring(str);
size_t length = instring.size();
if (length < 1)
@@ -318,7 +318,7 @@ BOOL LLKeyboard::keyFromString(const LLString& str, KEY *key)
}
}
- LLString::toUpper(instring);
+ LLStringUtil::toUpper(instring);
KEY res = get_if_there(sNamesToKeys, instring, (KEY)0);
if (res != 0)
{
@@ -331,15 +331,15 @@ BOOL LLKeyboard::keyFromString(const LLString& str, KEY *key)
// static
-LLString LLKeyboard::stringFromKey(KEY key)
+std::string LLKeyboard::stringFromKey(KEY key)
{
- LLString res = get_if_there(sKeysToNames, key, LLString::null);
+ std::string res = get_if_there(sKeysToNames, key, std::string());
if (res.empty())
{
char buffer[2]; /* Flawfinder: ignore */
buffer[0] = key;
buffer[1] = '\0';
- res = LLString(buffer);
+ res = std::string(buffer);
}
return res;
}
@@ -347,9 +347,9 @@ LLString LLKeyboard::stringFromKey(KEY key)
//static
-BOOL LLKeyboard::maskFromString(const LLString& str, MASK *mask)
+BOOL LLKeyboard::maskFromString(const std::string& str, MASK *mask)
{
- LLString instring(str);
+ std::string instring(str);
if (instring == "NONE")
{
*mask = MASK_NONE;
diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h
index 55af6fed6f..05303c85c2 100644
--- a/indra/llwindow/llkeyboard.h
+++ b/indra/llwindow/llkeyboard.h
@@ -107,9 +107,9 @@ public:
EKeyboardInsertMode getInsertMode() { return mInsertMode; }
void toggleInsertMode();
- static BOOL maskFromString(const LLString& str, MASK *mask); // False on failure
- static BOOL keyFromString(const LLString& str, KEY *key); // False on failure
- static LLString stringFromKey(KEY key);
+ static BOOL maskFromString(const std::string& str, MASK *mask); // False on failure
+ static BOOL keyFromString(const std::string& str, KEY *key); // False on failure
+ static std::string stringFromKey(KEY key);
e_numpad_distinct getNumpadDistinct() { return mNumpadDistinct; }
void setNumpadDistinct(e_numpad_distinct val) { mNumpadDistinct = val; }
@@ -119,7 +119,7 @@ public:
S32 getKeyElapsedFrameCount( KEY key ); // Returns time in frames since key was pressed.
protected:
- void addKeyName(KEY key, const LLString& name);
+ void addKeyName(KEY key, const std::string& name);
protected:
std::map<U16, KEY> mTranslateKeyMap; // Map of translations from OS keys to Linden KEYs
@@ -139,8 +139,8 @@ protected:
EKeyboardInsertMode mInsertMode;
- static std::map<KEY,LLString> sKeysToNames;
- static std::map<LLString,KEY> sNamesToKeys;
+ static std::map<KEY,std::string> sKeysToNames;
+ static std::map<std::string,KEY> sNamesToKeys;
};
extern LLKeyboard *gKeyboard;
diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h
index e3ef37e4e7..6fbdbe3c3e 100644
--- a/indra/llwindow/llmousehandler.h
+++ b/indra/llwindow/llmousehandler.h
@@ -51,8 +51,8 @@ public:
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0;
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0;
virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0;
- virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) = 0;
- virtual const LLString& getName() const = 0;
+ virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0;
+ virtual const std::string& getName() const = 0;
virtual void onMouseCaptureLost() = 0;
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index d954bdf86b..5f46b36c68 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -58,13 +58,13 @@ BOOL gDebugClicks = FALSE;
BOOL gDebugWindowProc = FALSE;
const S32 gURLProtocolWhitelistCount = 3;
-const char* gURLProtocolWhitelist[] = { "file", "http", "https" };
+const std::string gURLProtocolWhitelist[] = { "file:", "http:", "https:" };
// CP: added a handler list - this is what's used to open the protocol and is based on registry entry
// only meaningful difference currently is that file: protocols are opened using http:
// since no protocol handler exists in registry for file:
// Important - these lists should match - protocol to handler
-const char* gURLProtocolWhitelistHandler[] = { "http", "http", "https" };
+const std::string gURLProtocolWhitelistHandler[] = { "http", "http", "https" };
BOOL LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, BOOL repeated)
{
@@ -203,7 +203,7 @@ BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window)
return FALSE;
}
-S32 OSMessageBox(const char* text, const char* caption, U32 type)
+S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type)
{
// Properly hide the splash screen when displaying the message box
BOOL was_visible = FALSE;
@@ -389,7 +389,7 @@ void LLSplashScreen::show()
}
//static
-void LLSplashScreen::update(const char* str)
+void LLSplashScreen::update(const std::string& str)
{
LLSplashScreen::show();
if (gSplashScreenp)
@@ -417,8 +417,8 @@ void LLSplashScreen::hide()
static std::set<LLWindow*> sWindowList;
LLWindow* LLWindowManager::createWindow(
- const char *title,
- const char *name,
+ const std::string& title,
+ const std::string& name,
LLCoordScreen upper_left,
LLCoordScreen size,
U32 flags,
@@ -434,7 +434,7 @@ LLWindow* LLWindowManager::createWindow(
}
LLWindow* LLWindowManager::createWindow(
- const char *title, const char *name, S32 x, S32 y, S32 width, S32 height, U32 flags,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags,
BOOL fullscreen,
BOOL clearBg,
BOOL disable_vsync,
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index 9fc91d3643..84ea9755fd 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -32,8 +32,6 @@
#ifndef LL_LLWINDOW_H
#define LL_LLWINDOW_H
-#include <sys/stat.h>
-
#include "llrect.h"
#include "llcoord.h"
#include "llstring.h"
@@ -197,10 +195,6 @@ public:
virtual void bringToFront() = 0;
virtual void focusClient() { }; // this may not have meaning or be required on other platforms, therefore, it's not abstract
- virtual S32 stat( const char* file_name, struct stat* stat_info ) = 0;
- virtual BOOL sendEmail(const char* address,const char* subject,const char* body_text, const char* attachment=NULL, const char* attachment_displayed_name=NULL ) = 0;
-
-
// handy coordinate space conversion routines
// NB: screen to window and vice verse won't work on width/height coordinate pairs,
// as the conversion must take into account left AND right border widths, etc.
@@ -233,6 +227,7 @@ public:
virtual void setLanguageTextInput( const LLCoordGL & pos ) {};
virtual void updateLanguageTextInputArea() {}
virtual void interruptLanguageTextInput() {}
+ virtual void spawnWebBrowser(const std::string& escaped_url) {};
static std::string getFontListSans();
@@ -293,13 +288,13 @@ public:
static LLSplashScreen * create();
static void show();
static void hide();
- static void update(const char* string);
+ static void update(const std::string& string);
static bool isVisible();
protected:
// These are overridden by the platform implementation
virtual void showImpl() = 0;
- virtual void updateImpl(const char* string) = 0;
+ virtual void updateImpl(const std::string& string) = 0;
virtual void hideImpl() = 0;
static BOOL sVisible;
@@ -307,7 +302,7 @@ protected:
};
// Platform-neutral for accessing the platform specific message box
-S32 OSMessageBox(const char* text, const char* caption, U32 type);
+S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type);
const U32 OSMB_OK = 0;
const U32 OSMB_OKCANCEL = 1;
const U32 OSMB_YESNO = 2;
@@ -325,8 +320,8 @@ class LLWindowManager
{
public:
static LLWindow* createWindow(
- const char *title,
- const char *name,
+ const std::string& title,
+ const std::string& name,
LLCoordScreen upper_left = LLCoordScreen(10, 10),
LLCoordScreen size = LLCoordScreen(320, 240),
U32 flags = 0,
@@ -336,7 +331,7 @@ public:
BOOL use_gl = TRUE,
BOOL ignore_pixel_depth = FALSE);
static LLWindow *createWindow(
- const char* title, const char* name, S32 x, S32 y, S32 width, S32 height,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags = 0,
BOOL fullscreen = FALSE,
BOOL clearBg = FALSE,
@@ -355,11 +350,8 @@ extern BOOL gDebugWindowProc;
// Protocols, like "http" and "https" we support in URLs
extern const S32 gURLProtocolWhitelistCount;
-extern const char* gURLProtocolWhitelist[];
-extern const char* gURLProtocolWhitelistHandler[];
-
-// Loads a URL with the user's default browser
-void spawn_web_browser(const char* escaped_url);
+extern const std::string gURLProtocolWhitelist[];
+extern const std::string gURLProtocolWhitelistHandler[];
void simpleEscapeString ( std::string& stringIn );
diff --git a/indra/llwindow/llwindowheadless.cpp b/indra/llwindow/llwindowheadless.cpp
index 77bee891b7..87cf3e0b86 100644
--- a/indra/llwindow/llwindowheadless.cpp
+++ b/indra/llwindow/llwindowheadless.cpp
@@ -37,7 +37,7 @@
//
// LLWindowHeadless
//
-LLWindowHeadless::LLWindowHeadless(const char *title, const char *name, S32 x, S32 y, S32 width, S32 height,
+LLWindowHeadless::LLWindowHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags, BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
: LLWindow(fullscreen, flags)
diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h
index 1970a03931..ef1be057c0 100644
--- a/indra/llwindow/llwindowheadless.h
+++ b/indra/llwindow/llwindowheadless.h
@@ -77,12 +77,6 @@ public:
/*virtual*/ void delayInputProcessing() {};
/*virtual*/ void swapBuffers();
- /*virtual*/ LLString getTempFileName() {return LLString(""); };
- /*virtual*/ void deleteFile( const char* file_name ) {};
- /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info ) {return 0; };
- /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL) { return FALSE; };
-
-
// handy coordinate space conversion routines
/*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) { return FALSE; };
/*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) { return FALSE; };
@@ -99,7 +93,7 @@ public:
/*virtual*/ void *getPlatformWindow() { return 0; };
/*virtual*/ void bringToFront() {};
- LLWindowHeadless(const char *title, const char *name, S32 x, S32 y, S32 width, S32 height,
+ LLWindowHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags, BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
virtual ~LLWindowHeadless();
@@ -114,7 +108,7 @@ public:
virtual ~LLSplashScreenHeadless() {};
/*virtual*/ void showImpl() {};
- /*virtual*/ void updateImpl(const char* mesg) {};
+ /*virtual*/ void updateImpl(const std::string& mesg) {};
/*virtual*/ void hideImpl() {};
};
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 22b594d745..65f0a2b7e2 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -64,35 +64,11 @@ BOOL LLWindowMacOSX::sUseMultGL = FALSE;
// Cross-platform bits:
-void show_window_creation_error(const char* title)
-{
- llwarns << title << llendl;
- /*
- OSMessageBox(
- "Second Life is unable to run because it can't set up your display.\n"
- "We need to be able to make a 32-bit color window at 1024x768, with\n"
- "an 8 bit alpha channel.\n"
- "\n"
- "First, be sure your monitor is set to True Color (32-bit) in\n"
- "Start -> Control Panels -> Display -> Settings.\n"
- "\n"
- "Otherwise, this may be due to video card driver issues.\n"
- "Please make sure you have the latest video card drivers installed.\n"
- "ATI drivers are available at http://www.ati.com/\n"
- "nVidia drivers are available at http://www.nvidia.com/\n"
- "\n"
- "If you continue to receive this message, contact customer service.",
- title,
- OSMB_OK);
- */
-}
-
BOOL check_for_card(const char* RENDERER, const char* bad_card)
{
if (!strnicmp(RENDERER, bad_card, strlen(bad_card)))
{
- char buffer[1024];/* Flawfinder: ignore */
- snprintf(buffer, sizeof(buffer),
+ std::string buffer = llformat(
"Your video card appears to be a %s, which Second Life does not support.\n"
"\n"
"Second Life requires a video card with 32 Mb of memory or more, as well as\n"
@@ -106,7 +82,7 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card)
"You can try to run Second Life, but it will probably crash or run\n"
"very slowly. Try anyway?",
bad_card);
- S32 button = OSMessageBox(buffer, "Unsupported video card", OSMB_YESNO);
+ S32 button = OSMessageBox(buffer.c_str(), "Unsupported video card", OSMB_YESNO);
if (OSBTN_YES == button)
{
return FALSE;
@@ -120,8 +96,6 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card)
return FALSE;
}
-
-
// Switch to determine whether we capture all displays, or just the main one.
// We may want to base this on the setting of _DEBUG...
@@ -238,7 +212,7 @@ static LLWindowMacOSX *gWindowImplementation = NULL;
-LLWindowMacOSX::LLWindowMacOSX(const char *title, const char *name, S32 x, S32 y, S32 width,
+LLWindowMacOSX::LLWindowMacOSX(const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
@@ -285,8 +259,8 @@ LLWindowMacOSX::LLWindowMacOSX(const char *title, const char *name, S32 x, S32 y
mOriginalAspectRatio = (double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay);
// Stash the window title
- strcpy((char*)mWindowTitle + 1, title); /* Flawfinder: ignore */
- mWindowTitle[0] = strlen(title); /* Flawfinder: ignore */
+ strcpy((char*)mWindowTitle + 1, title.c_str()); /* Flawfinder: ignore */
+ mWindowTitle[0] = title.length();
mEventHandlerUPP = NewEventHandlerUPP(staticEventHandler);
mGlobalHandlerRef = NULL;
@@ -463,8 +437,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
mFullscreenBits = -1;
mFullscreenRefresh = -1;
- char error[256]; /* Flawfinder: ignore */
- snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
+ std::string error= llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
OSMessageBox(error, "Error", OSMB_OK);
}
}
@@ -822,9 +795,6 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
}
}
- //make sure multisample starts off disabled
- glDisable(GL_MULTISAMPLE_ARB);
-
// Don't need to get the current gamma, since there's a call that restores it to the system defaults.
return TRUE;
}
@@ -1606,11 +1576,6 @@ void LLWindowMacOSX::afterDialog()
}
-S32 LLWindowMacOSX::stat(const char* file_name, struct stat* stat_info)
-{
- return ::stat( file_name, stat_info );
-}
-
void LLWindowMacOSX::flashIcon(F32 seconds)
{
// Don't do this if we're already started, since this would try to install the NMRec twice.
@@ -1740,15 +1705,6 @@ BOOL LLWindowMacOSX::copyTextToClipboard(const LLWString &s)
}
-BOOL LLWindowMacOSX::sendEmail(const char* address, const char* subject, const char* body_text,
- const char* attachment, const char* attachment_displayed_name )
-{
- // MBW -- XXX -- Um... yeah. I'll get to this later.
-
- return false;
-}
-
-
// protected
BOOL LLWindowMacOSX::resetDisplayResolution()
{
@@ -1945,7 +1901,7 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordScreen *to)
-void LLWindowMacOSX::setupFailure(const char* text, const char* caption, U32 type)
+void LLWindowMacOSX::setupFailure(const std::string& text, const std::string& caption, U32 type)
{
destroyContext();
@@ -3016,20 +2972,13 @@ void LLSplashScreenMacOSX::showImpl()
#endif
}
-void LLSplashScreenMacOSX::updateImpl(const char* mesg)
+void LLSplashScreenMacOSX::updateImpl(const std::string& mesg)
{
if(mWindow != NULL)
{
CFStringRef string = NULL;
- if(mesg != NULL)
- {
- string = CFStringCreateWithCString(NULL, mesg, kCFStringEncodingUTF8);
- }
- else
- {
- string = CFStringCreateWithCString(NULL, "", kCFStringEncodingUTF8);
- }
+ string = CFStringCreateWithCString(NULL, mesg.c_str(), kCFStringEncodingUTF8);
if(string != NULL)
{
@@ -3064,7 +3013,7 @@ void LLSplashScreenMacOSX::hideImpl()
-S32 OSMessageBoxMacOSX(const char* text, const char* caption, U32 type)
+S32 OSMessageBoxMacOSX(const std::string& text, const std::string& caption, U32 type)
{
S32 result = OSBTN_CANCEL;
SInt16 retval_mac = 1;
@@ -3075,23 +3024,8 @@ S32 OSMessageBoxMacOSX(const char* text, const char* caption, U32 type)
AlertType alertType = kAlertCautionAlert;
OSStatus err;
- if(text != NULL)
- {
- explanationString = CFStringCreateWithCString(NULL, text, kCFStringEncodingUTF8);
- }
- else
- {
- explanationString = CFStringCreateWithCString(NULL, "", kCFStringEncodingUTF8);
- }
-
- if(caption != NULL)
- {
- errorString = CFStringCreateWithCString(NULL, caption, kCFStringEncodingUTF8);
- }
- else
- {
- errorString = CFStringCreateWithCString(NULL, "", kCFStringEncodingUTF8);
- }
+ explanationString = CFStringCreateWithCString(NULL, text.c_str(), kCFStringEncodingUTF8);
+ errorString = CFStringCreateWithCString(NULL, caption.c_str(), kCFStringEncodingUTF8);
params.version = kStdCFStringAlertVersionOne;
params.movable = false;
@@ -3175,15 +3109,13 @@ S32 OSMessageBoxMacOSX(const char* text, const char* caption, U32 type)
// Open a URL with the user's default web browser.
// Must begin with protocol identifier.
-void spawn_web_browser(const char* escaped_url)
+void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url)
{
bool found = false;
S32 i;
for (i = 0; i < gURLProtocolWhitelistCount; i++)
{
- S32 len = strlen(gURLProtocolWhitelist[i]); /* Flawfinder: ignore */
- if (!strncmp(escaped_url, gURLProtocolWhitelist[i], len)
- && escaped_url[len] == ':')
+ if (escaped_url.find(gURLProtocolWhitelist[i]) != std::string::npos)
{
found = true;
break;
@@ -3192,7 +3124,7 @@ void spawn_web_browser(const char* escaped_url)
if (!found)
{
- llwarns << "spawn_web_browser() called for url with protocol not on whitelist: " << escaped_url << llendl;
+ llwarns << "spawn_web_browser called for url with protocol not on whitelist: " << escaped_url << llendl;
return;
}
@@ -3201,7 +3133,7 @@ void spawn_web_browser(const char* escaped_url)
llinfos << "Opening URL " << escaped_url << llendl;
- CFStringRef stringRef = CFStringCreateWithCString(NULL, escaped_url, kCFStringEncodingUTF8);
+ CFStringRef stringRef = CFStringCreateWithCString(NULL, escaped_url.c_str(), kCFStringEncodingUTF8);
if (stringRef)
{
// This will succeed if the string is a full URL, including the http://
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index 171ec9864a..10955b1288 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -86,12 +86,6 @@ public:
/*virtual*/ void delayInputProcessing() {};
/*virtual*/ void swapBuffers();
- /*virtual*/ LLString getTempFileName();
- /*virtual*/ void deleteFile( const char* file_name );
- /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info );
- /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL);
-
-
// handy coordinate space conversion routines
/*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to);
/*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to);
@@ -115,12 +109,13 @@ public:
/*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b);
/*virtual*/ void interruptLanguageTextInput();
+ /*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
static std::string getFontListSans();
protected:
LLWindowMacOSX(
- const char *title, const char *name, int x, int y, int width, int height, U32 flags,
+ const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples);
@@ -154,7 +149,7 @@ protected:
// create or re-create the GL context/window. Called from the constructor and switchContext().
BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync);
void destroyContext();
- void setupFailure(const char* text, const char* caption, U32 type);
+ void setupFailure(const std::string& text, const std::string& caption, U32 type);
static pascal OSStatus staticEventHandler (EventHandlerCallRef myHandler, EventRef event, void* userData);
OSStatus eventHandler (EventHandlerCallRef myHandler, EventRef event);
void adjustCursorDecouple(bool warpingMouse = false);
@@ -216,14 +211,14 @@ public:
virtual ~LLSplashScreenMacOSX();
/*virtual*/ void showImpl();
- /*virtual*/ void updateImpl(const char* mesg);
+ /*virtual*/ void updateImpl(const std::string& mesg);
/*virtual*/ void hideImpl();
private:
WindowRef mWindow;
};
-S32 OSMessageBoxMacOSX(const char* text, const char* caption, U32 type);
+S32 OSMessageBoxMacOSX(const std::string& text, const std::string& caption, U32 type);
void load_url_external(const char* url);
diff --git a/indra/llwindow/llwindowmesaheadless.cpp b/indra/llwindow/llwindowmesaheadless.cpp
index b24d3b91f8..a6fbf720de 100644
--- a/indra/llwindow/llwindowmesaheadless.cpp
+++ b/indra/llwindow/llwindowmesaheadless.cpp
@@ -43,7 +43,7 @@ U16 *gMesaBuffer = NULL;
//
// LLWindowMesaHeadless
//
-LLWindowMesaHeadless::LLWindowMesaHeadless(const char *title, const char *name, S32 x, S32 y, S32 width, S32 height,
+LLWindowMesaHeadless::LLWindowMesaHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags, BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
: LLWindow(fullscreen, flags)
diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h
index 4ecc971abb..d81dd31631 100644
--- a/indra/llwindow/llwindowmesaheadless.h
+++ b/indra/llwindow/llwindowmesaheadless.h
@@ -81,12 +81,6 @@ public:
/*virtual*/ void delayInputProcessing() {};
/*virtual*/ void swapBuffers();
- /*virtual*/ LLString getTempFileName() {return LLString(""); };
- /*virtual*/ void deleteFile( const char* file_name ) {};
- /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info ) {return 0; };
- /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL) { return FALSE; };
-
-
// handy coordinate space conversion routines
/*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) { return FALSE; };
/*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) { return FALSE; };
@@ -103,7 +97,7 @@ public:
/*virtual*/ void *getPlatformWindow() { return 0; };
/*virtual*/ void bringToFront() {};
- LLWindowMesaHeadless(const char *title, const char *name, S32 x, S32 y, S32 width, S32 height,
+ LLWindowMesaHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags, BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
~LLWindowMesaHeadless();
@@ -120,7 +114,7 @@ public:
virtual ~LLSplashScreenMesaHeadless() {};
/*virtual*/ void showImpl() {};
- /*virtual*/ void updateImpl(const char* mesg) {};
+ /*virtual*/ void updateImpl(const std::string& mesg) {};
/*virtual*/ void hideImpl() {};
};
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 50925dcebf..23030b559d 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -181,43 +181,7 @@ Display* get_SDL_Display(void)
#endif // LL_X11
-BOOL check_for_card(const char* RENDERER, const char* bad_card)
-{
- if (!strncasecmp(RENDERER, bad_card, strlen(bad_card)))
- {
- char buffer[1024]; /* Flawfinder: ignore */
- snprintf(buffer, sizeof(buffer),
- "Your video card appears to be a %s, which Second Life does not support.\n"
- "\n"
- "Second Life requires a video card with 32 Mb of memory or more, as well as\n"
- "multitexture support. We explicitly support nVidia GeForce 2 or better, \n"
- "and ATI Radeon 8500 or better.\n"
- "\n"
- "If you own a supported card and continue to receive this message, try \n"
- "updating to the latest video card drivers. Otherwise look in the\n"
- "secondlife.com support section or e-mail technical support\n"
- "\n"
- "You can try to run Second Life, but it will probably crash or run\n"
- "very slowly. Try anyway?",
- bad_card);
- S32 button = OSMessageBox(buffer, "Unsupported video card", OSMB_YESNO);
- if (OSBTN_YES == button)
- {
- return FALSE;
- }
- else
- {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-
-
-LLWindowSDL::LLWindowSDL(const char *title, S32 x, S32 y, S32 width,
+LLWindowSDL::LLWindowSDL(const std::string& title, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
@@ -258,18 +222,11 @@ LLWindowSDL::LLWindowSDL(const char *title, S32 x, S32 y, S32 width,
// Get the original aspect ratio of the main device.
mOriginalAspectRatio = 1024.0 / 768.0; // !!! *FIX: ? //(double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay);
- if (!title)
- title = "SDL Window"; // *FIX: (???)
-
- // Stash the window title
- mWindowTitle = new char[strlen(title) + 1]; /* Flawfinder: ignore */
- if(mWindowTitle == NULL)
- {
- llwarns << "Memory allocation failure" << llendl;
- return;
- }
+ if (title.empty())
+ mWindowTitle = "SDL Window"; // *FIX: (???)
+ else
+ mWindowTitle = title;
- strcpy(mWindowTitle, title); /* Flawfinder: ignore */
// Create the GL context and set it up for windowed or fullscreen, as appropriate.
if(createContext(x, y, width, height, 32, fullscreen, disable_vsync))
{
@@ -483,7 +440,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
}
SDL_EnableUNICODE(1);
- SDL_WM_SetCaption(mWindowTitle, mWindowTitle);
+ SDL_WM_SetCaption(mWindowTitle.c_str(), mWindowTitle.c_str());
// Set the application icon.
SDL_Surface *bmpsurface;
@@ -633,8 +590,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
mFullscreenBits = -1;
mFullscreenRefresh = -1;
- char error[256]; /* Flawfinder: ignore */
- snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
+ std::string error = llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
OSMessageBox(error, "Error", OSMB_OK);
}
}
@@ -824,8 +780,6 @@ LLWindowSDL::~LLWindowSDL()
delete []mSupportedResolutions;
}
- delete[] mWindowTitle;
-
gWindowImplementation = NULL;
}
@@ -1206,11 +1160,6 @@ void LLWindowSDL::afterDialog()
}
-S32 LLWindowSDL::stat(const char* file_name, struct stat* stat_info)
-{
- return ::stat( file_name, stat_info );
-}
-
#if LL_X11
// set/reset the XWMHints flag for 'urgency' that usually makes the icon flash
void LLWindowSDL::x11_set_urgent(BOOL urgent)
@@ -1775,15 +1724,6 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s)
}
#endif // LL_X11
-BOOL LLWindowSDL::sendEmail(const char* address, const char* subject, const char* body_text,
- const char* attachment, const char* attachment_displayed_name )
-{
- // MBW -- XXX -- Um... yeah. I'll get to this later.
-
- return FALSE;
-}
-
-
LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions)
{
if (!mSupportedResolutions)
@@ -1888,7 +1828,7 @@ BOOL LLWindowSDL::convertCoords(LLCoordGL from, LLCoordScreen *to)
-void LLWindowSDL::setupFailure(const char* text, const char* caption, U32 type)
+void LLWindowSDL::setupFailure(const std::string& text, const std::string& caption, U32 type)
{
destroyContext();
@@ -2518,7 +2458,7 @@ void LLSplashScreenSDL::showImpl()
{
}
-void LLSplashScreenSDL::updateImpl(const char* mesg)
+void LLSplashScreenSDL::updateImpl(const std::string& mesg)
{
}
@@ -2539,7 +2479,7 @@ static void response_callback (GtkDialog *dialog,
gtk_main_quit();
}
-S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type)
+S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type)
{
S32 rtn = OSBTN_CANCEL;
@@ -2576,9 +2516,7 @@ S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type)
buttons = GTK_BUTTONS_YES_NO;
break;
}
- win = gtk_message_dialog_new(NULL,
- flags, messagetype, buttons,
- text);
+ win = gtk_message_dialog_new(NULL,flags, messagetype, buttons, text.c_str());
# if LL_X11
// Make GTK tell the window manager to associate this
@@ -2600,8 +2538,8 @@ S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type)
gtk_window_set_type_hint(GTK_WINDOW(win),
GDK_WINDOW_TYPE_HINT_DIALOG);
- if (caption)
- gtk_window_set_title(GTK_WINDOW(win), caption);
+ if (!caption.empty())
+ gtk_window_set_title(GTK_WINDOW(win), caption.c_str());
gint response = GTK_RESPONSE_NONE;
g_signal_connect (win,
@@ -2725,7 +2663,7 @@ BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
return rtn;
}
#else
-S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type)
+S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type)
{
llinfos << "MSGBOX: " << caption << ": " << text << llendl;
return 0;
@@ -2737,30 +2675,13 @@ BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
}
#endif // LL_GTK
-// Open a URL with the user's default web browser.
-// Must begin with protocol identifier.
-void spawn_web_browser(const char* escaped_url)
-{
- llinfos << "spawn_web_browser: " << escaped_url << llendl;
-
#if LL_LINUX || LL_SOLARIS
-# if LL_X11
- if (gWindowImplementation && gWindowImplementation->mSDL_Display)
- {
- maybe_lock_display();
- // Just in case - before forking.
- XSync(gWindowImplementation->mSDL_Display, False);
- maybe_unlock_display();
- }
-# endif // LL_X11
-
- std::string cmd;
- cmd = gDirUtilp->getAppRODataDir();
- cmd += gDirUtilp->getDirDelimiter();
- cmd += "launch_url.sh";
- char* const argv[] = {(char*)cmd.c_str(), (char*)escaped_url, NULL};
-
- fflush(NULL); // flush all buffers before the child inherits them
+// extracted from spawnWebBrowser for clarity and to eliminate
+// compiler confusion regarding close(int fd) vs. LLWindow::close()
+void exec_cmd(const std::string& cmd, const std::string& arg)
+{
+ char* const argv[] = {(char*)cmd.c_str(), (char*)arg.c_str(), NULL};
+ fflush(NULL);
pid_t pid = fork();
if (pid == 0)
{ // child
@@ -2784,6 +2705,32 @@ void spawn_web_browser(const char* escaped_url)
llwarns << "fork failure." << llendl;
}
}
+}
+#endif
+
+// Open a URL with the user's default web browser.
+// Must begin with protocol identifier.
+void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url)
+{
+ llinfos << "spawn_web_browser: " << escaped_url << llendl;
+
+#if LL_LINUX || LL_SOLARIS
+# if LL_X11
+ if (mSDL_Display)
+ {
+ maybe_lock_display();
+ // Just in case - before forking.
+ XSync(mSDL_Display, False);
+ maybe_unlock_display();
+ }
+# endif // LL_X11
+
+ std::string cmd, arg;
+ cmd = gDirUtilp->getAppRODataDir().c_str();
+ cmd += gDirUtilp->getDirDelimiter().c_str();
+ cmd += "launch_url.sh";
+ arg = escaped_url;
+ exec_cmd(cmd, arg);
#endif // LL_LINUX || LL_SOLARIS
llinfos << "spawn_web_browser returning." << llendl;
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index f878ded891..6ac2a789ac 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -92,11 +92,6 @@ public:
/*virtual*/ void gatherInput();
/*virtual*/ void swapBuffers();
- /*virtual*/ LLString getTempFileName();
- /*virtual*/ void deleteFile( const char* file_name );
- /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info );
- /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL);
-
/*virtual*/ void delayInputProcessing() { };
// handy coordinate space conversion routines
@@ -120,6 +115,8 @@ public:
/*virtual*/ void *getPlatformWindow();
/*virtual*/ void bringToFront();
+ /*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
+
static std::string getFontListSans();
// Not great that these are public, but they have to be accessible
@@ -134,7 +131,7 @@ public:
protected:
LLWindowSDL(
- const char *title, int x, int y, int width, int height, U32 flags,
+ const std::string& title, int x, int y, int width, int height, U32 flags,
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth, U32 fsaa_samples);
~LLWindowSDL();
@@ -164,7 +161,7 @@ protected:
// create or re-create the GL context/window. Called from the constructor and switchContext().
BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync);
void destroyContext();
- void setupFailure(const char* text, const char* caption, U32 type);
+ void setupFailure(const std::string& text, const std::string& caption, U32 type);
void adjustCursorDecouple(bool warpingMouse = false);
void fixWindowSize(void);
U32 SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain);
@@ -176,7 +173,7 @@ protected:
U32 mGrabbyKeyFlags;
int mReallyCapturedCount;
SDL_Surface * mWindow;
- char * mWindowTitle;
+ std::string mWindowTitle;
double mOriginalAspectRatio;
BOOL mCursorDecoupled;
S32 mCursorLastEventDeltaX;
@@ -220,11 +217,11 @@ public:
virtual ~LLSplashScreenSDL();
/*virtual*/ void showImpl();
- /*virtual*/ void updateImpl(const char* mesg);
+ /*virtual*/ void updateImpl(const std::string& mesg);
/*virtual*/ void hideImpl();
};
-S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type);
+S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type);
void load_url_external(const char* url);
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index e715080916..ccff4f3161 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -80,7 +80,7 @@ LLW32MsgCallback gAsyncMsgCallback = NULL;
// LLWindowWin32
//
-void show_window_creation_error(const char* title)
+void show_window_creation_error(const std::string& title)
{
LL_WARNS("Window") << title << LL_ENDL;
}
@@ -357,7 +357,7 @@ LLWinImm::~LLWinImm()
}
-LLWindowWin32::LLWindowWin32(const char *title, const char *name, S32 x, S32 y, S32 width,
+LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
@@ -384,7 +384,7 @@ LLWindowWin32::LLWindowWin32(const char *title, const char *name, S32 x, S32 y,
RECT window_rect;
// Set the window title
- if (!title)
+ if (title.empty())
{
mWindowTitle = new WCHAR[50];
wsprintf(mWindowTitle, L"OpenGL Window");
@@ -392,12 +392,12 @@ LLWindowWin32::LLWindowWin32(const char *title, const char *name, S32 x, S32 y,
else
{
mWindowTitle = new WCHAR[256]; // Assume title length < 255 chars.
- mbstowcs(mWindowTitle, title, 255);
+ mbstowcs(mWindowTitle, title.c_str(), 255);
mWindowTitle[255] = 0;
}
// Set the window class name
- if (!name)
+ if (name.empty())
{
mWindowClassName = new WCHAR[50];
wsprintf(mWindowClassName, L"OpenGL Window");
@@ -405,7 +405,7 @@ LLWindowWin32::LLWindowWin32(const char *title, const char *name, S32 x, S32 y,
else
{
mWindowClassName = new WCHAR[256]; // Assume title length < 255 chars.
- mbstowcs(mWindowClassName, name, 255);
+ mbstowcs(mWindowClassName, name.c_str(), 255);
mWindowClassName[255] = 0;
}
@@ -569,8 +569,7 @@ LLWindowWin32::LLWindowWin32(const char *title, const char *name, S32 x, S32 y,
mFullscreenBits = -1;
mFullscreenRefresh = -1;
- char error[256]; /* Flawfinder: ignore */
- snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); /* Flawfinder: ignore */
+ std::string error = llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
OSMessageBox(error, "Error", OSMB_OK);
}
}
@@ -2375,7 +2374,7 @@ BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst)
if (utf16str)
{
dst = utf16str_to_wstring(utf16str);
- LLWString::removeCRLF(dst);
+ LLWStringUtil::removeCRLF(dst);
GlobalUnlock(h_data);
success = TRUE;
}
@@ -2398,7 +2397,7 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr)
// Provide a copy of the data in Unicode format.
LLWString sanitized_string(wstr);
- LLWString::addCRLF(sanitized_string);
+ LLWStringUtil::addCRLF(sanitized_string);
llutf16string out_utf16 = wstring_to_utf16str(sanitized_string);
const size_t size_utf16 = (out_utf16.length() + 1) * sizeof(WCHAR);
@@ -2485,86 +2484,6 @@ BOOL LLWindowWin32::getClientRectInScreenSpace( RECT* rectp )
return success;
}
-
-BOOL LLWindowWin32::sendEmail(const char* address, const char* subject, const char* body_text,
- const char* attachment, const char* attachment_displayed_name )
-{
- // Based on "A SendMail() DLL" by Greg Turner, Windows Developer Magazine, Nov. 1997.
- // See article for use of GetProcAddress
- // No restrictions on use.
-
- enum SendResult
- {
- LL_EMAIL_SUCCESS,
- LL_EMAIL_MAPI_NOT_INSTALLED, // No MAPI Server (eg Microsoft Exchange) installed
- LL_EMAIL_MAPILOAD_FAILED, // Load of MAPI32.DLL failed
- LL_EMAIL_SEND_FAILED // The message send itself failed
- };
-
- SendResult result = LL_EMAIL_SUCCESS;
-
- U32 mapi_installed = GetProfileInt(L"Mail", L"MAPI", 0);
- if( !mapi_installed)
- {
- result = LL_EMAIL_MAPI_NOT_INSTALLED;
- }
- else
- {
- HINSTANCE hMAPIInst = LoadLibrary(L"MAPI32.DLL"); /* Flawfinder: ignore */
- if(!hMAPIInst)
- {
- result = LL_EMAIL_MAPILOAD_FAILED;
- }
- else
- {
- LPMAPISENDMAIL pMAPISendMail = (LPMAPISENDMAIL) GetProcAddress(hMAPIInst, "MAPISendMail");
-
- // Send the message
- MapiRecipDesc recipients[1];
- recipients[0].ulReserved = 0;
- recipients[0].ulRecipClass = MAPI_TO;
- recipients[0].lpszName = (char*)address;
- recipients[0].lpszAddress = (char*)address;
- recipients[0].ulEIDSize = 0;
- recipients[0].lpEntryID = 0;
-
- MapiFileDesc files[1];
- files[0].ulReserved = 0;
- files[0].flFlags = 0; // non-OLE file
- files[0].nPosition = -1; // Leave file location in email unspecified.
- files[0].lpszPathName = (char*)attachment; // Must be fully qualified name, including drive letter.
- files[0].lpszFileName = (char*)attachment_displayed_name; // If NULL, uses attachment as displayed name.
- files[0].lpFileType = NULL; // Recipient will have to figure out what kind of file this is.
-
- MapiMessage msg;
- memset(&msg, 0, sizeof(msg));
- msg.lpszSubject = (char*)subject; // may be NULL
- msg.lpszNoteText = (char*)body_text;
- msg.nRecipCount = address ? 1 : 0;
- msg.lpRecips = address ? recipients : NULL;
- msg.nFileCount = attachment ? 1 : 0;
- msg.lpFiles = attachment ? files : NULL;
-
- U32 success = pMAPISendMail(0, (U32) mWindowHandle, &msg, MAPI_DIALOG|MAPI_LOGON_UI|MAPI_NEW_SESSION, 0);
- if(success != SUCCESS_SUCCESS)
- {
- result = LL_EMAIL_SEND_FAILED;
- }
-
- FreeLibrary(hMAPIInst);
- }
- }
-
- return result == LL_EMAIL_SUCCESS;
-}
-
-
-S32 LLWindowWin32::stat(const char* file_name, struct stat* stat_info)
-{
- llassert( sizeof(struct stat) == sizeof(struct _stat) ); // They are defined identically in sys/stat.h, but I'm paranoid.
- return LLFile::stat( file_name, (struct _stat*) stat_info );
-}
-
void LLWindowWin32::flashIcon(F32 seconds)
{
FLASHWINFO flash_info;
@@ -2802,12 +2721,12 @@ void LLSplashScreenWin32::showImpl()
}
-void LLSplashScreenWin32::updateImpl(const char *mesg)
+void LLSplashScreenWin32::updateImpl(const std::string& mesg)
{
if (!mWindow) return;
WCHAR w_mesg[1024];
- mbstowcs(w_mesg, mesg, 1024);
+ mbstowcs(w_mesg, mesg.c_str(), 1024);
SendDlgItemMessage(mWindow,
666, // HACK: text id
@@ -2839,7 +2758,7 @@ LRESULT CALLBACK LLSplashScreenWin32::windowProc(HWND h_wnd, UINT u_msg,
// Helper Funcs
//
-S32 OSMessageBoxWin32(const char* text, const char* caption, U32 type)
+S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 type)
{
UINT uType;
@@ -2860,7 +2779,7 @@ S32 OSMessageBoxWin32(const char* text, const char* caption, U32 type)
}
// HACK! Doesn't properly handle wide strings!
- int retval_win = MessageBoxA(NULL, text, caption, uType);
+ int retval_win = MessageBoxA(NULL, text.c_str(), caption.c_str(), uType);
S32 retval;
switch(retval_win)
@@ -2886,15 +2805,13 @@ S32 OSMessageBoxWin32(const char* text, const char* caption, U32 type)
}
-void spawn_web_browser(const char* escaped_url )
+void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url )
{
bool found = false;
S32 i;
for (i = 0; i < gURLProtocolWhitelistCount; i++)
{
- S32 len = strlen(gURLProtocolWhitelist[i]); /* Flawfinder: ignore */
- if (!strncmp(escaped_url, gURLProtocolWhitelist[i], len)
- && escaped_url[len] == ':')
+ if (escaped_url.find(gURLProtocolWhitelist[i]) == 0)
{
found = true;
break;
@@ -2930,10 +2847,9 @@ void spawn_web_browser(const char* escaped_url )
// Figure out the user's default web browser
// HKEY_CLASSES_ROOT\http\shell\open\command
/*
- char reg_path_str[256]; // Flawfinder: ignore
- snprintf(reg_path_str, sizeof(reg_path_str), "%s\\shell\\open\\command", gURLProtocolWhitelistHandler[i]); // Flawfinder: ignore
+ std::string reg_path_str = gURLProtocolWhitelistHandler[i] + "\\shell\\open\\command";
WCHAR reg_path_wstr[256];
- mbstowcs(reg_path_wstr, reg_path_str, sizeof(reg_path_wstr)/sizeof(reg_path_wstr[0]));
+ mbstowcs(reg_path_wstr, reg_path_str.c_str(), sizeof(reg_path_wstr)/sizeof(reg_path_wstr[0]));
HKEY key;
WCHAR browser_open_wstr[1024];
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index 039774f138..ec9da55826 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -86,12 +86,6 @@ public:
/*virtual*/ void delayInputProcessing();
/*virtual*/ void swapBuffers();
- /*virtual*/ LLString getTempFileName();
- /*virtual*/ void deleteFile( const char* file_name );
- /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info );
- /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL);
-
-
// handy coordinate space conversion routines
/*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to);
/*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to);
@@ -115,12 +109,13 @@ public:
/*virtual*/ void setLanguageTextInput( const LLCoordGL & pos );
/*virtual*/ void updateLanguageTextInputArea();
/*virtual*/ void interruptLanguageTextInput();
+ /*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
static std::string getFontListSans();
protected:
LLWindowWin32(
- const char *title, const char *name, int x, int y, int width, int height, U32 flags,
+ const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth, U32 fsaa_samples);
~LLWindowWin32();
@@ -220,7 +215,7 @@ public:
virtual ~LLSplashScreenWin32();
/*virtual*/ void showImpl();
- /*virtual*/ void updateImpl(const char* mesg);
+ /*virtual*/ void updateImpl(const std::string& mesg);
/*virtual*/ void hideImpl();
#if LL_WINDOWS
@@ -239,6 +234,6 @@ extern LPWSTR gIconResource;
static void handleMessage( const MSG& msg );
-S32 OSMessageBoxWin32(const char* text, const char* caption, U32 type);
+S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 type);
#endif //LL_LLWINDOWWIN32_H