Skip to content

Commit

Permalink
Another attempt to fix notepad windows - removed static buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Jan 20, 2018
1 parent 86586c8 commit ed1aa5d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2602,7 +2602,7 @@ return (first[0] << 8) + first[1];
// i18n (Internationalization) stuff

// translate message (eg. "File cannot be opened") into locale-specific language
const char * TranslateGeneric (const char * sText, const char * sSection)
CString TranslateGeneric (const char * sText, const char * sSection)
{
static bool bInTranslateGeneric = false; // stop stack overflow if we are re-called

Expand Down Expand Up @@ -2656,7 +2656,7 @@ const char * TranslateGeneric (const char * sText, const char * sSection)
/* valid flags in a format specification */
#define FORMATFLAGS "-+ #0"

const char * TFormat (const char * sFormat, ...)
CString TFormat (const char * sFormat, ...)
{

static bool bInTFormat = false; // stop stack overflow if we are re-called
Expand Down
2 changes: 1 addition & 1 deletion dialogs/cmdhist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ CString str;

// edit current input window
CreateTextWindow ((LPCTSTR) str, // command
TFormat ("Notepad: %s", (LPCTSTR) m_pDoc->m_mush_name), // title
(LPCTSTR) TFormat ("Notepad: %s", (LPCTSTR) m_pDoc->m_mush_name), // title
m_pDoc, // document
m_pDoc->m_iUniqueDocumentNumber, // document number
m_pDoc->m_input_font_name,
Expand Down
4 changes: 2 additions & 2 deletions doc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5127,7 +5127,7 @@ CString strMessage;

if (!strMessage.IsEmpty ())
CreateTextWindow ((LPCTSTR) strMessage,
TFormat ("Recall: %s",
(LPCTSTR) TFormat ("Recall: %s",
(LPCTSTR) m_RecallFindInfo.m_strFindStringList.GetHead ()),
this,
m_iUniqueDocumentNumber,
Expand Down Expand Up @@ -5795,7 +5795,7 @@ CTextDocument * pTextDoc = NULL;
} // end of having an existing notepad document
else
CreateTextWindow ("", // contents
TFormat ("Notepad: %s", (LPCTSTR) m_mush_name), // title
(LPCTSTR) TFormat ("Notepad: %s", (LPCTSTR) m_mush_name), // title
this, // document
m_iUniqueDocumentNumber, // document number
m_input_font_name,
Expand Down
4 changes: 2 additions & 2 deletions mushview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5442,7 +5442,7 @@ CString strSelection;

// edit current input window
CreateTextWindow ((LPCTSTR) strSelection, // contents
TFormat ("Notepad: %s", (LPCTSTR) pDoc->m_mush_name), // title
(LPCTSTR) TFormat ("Notepad: %s", (LPCTSTR) pDoc->m_mush_name), // title
pDoc, // document
pDoc->m_iUniqueDocumentNumber, // document number
pDoc->m_input_font_name,
Expand Down Expand Up @@ -5495,7 +5495,7 @@ CString strMessage;
pDoc->m_strRecallLinePreamble); // default preamble

CreateTextWindow ((LPCTSTR) strMessage,
TFormat ("Recall: %s",
(LPCTSTR) TFormat ("Recall: %s",
(LPCTSTR) strSelection),
pDoc,
pDoc->m_iUniqueDocumentNumber,
Expand Down
2 changes: 1 addition & 1 deletion sendvw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2322,7 +2322,7 @@ CString strCurrent;

// edit current input window
CreateTextWindow ((LPCTSTR) strCurrent, // selection
TFormat ("Notepad: %s", (LPCTSTR) pDoc->m_mush_name), // title
(LPCTSTR) TFormat ("Notepad: %s", (LPCTSTR) pDoc->m_mush_name), // title
pDoc, // document
pDoc->m_iUniqueDocumentNumber, // document number
pDoc->m_input_font_name,
Expand Down
8 changes: 4 additions & 4 deletions stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -814,10 +814,10 @@ extern "C" const unsigned char _pcre_utf8_table4[];
int UMessageBox (const char * sText, UINT nType = MB_OK, const char * = "MUSHclient");
// translate lpszText and then call UMessageBox
int TMessageBox (const char * sText, UINT nType = MB_OK);
// translate text - result is statically allocated - do not attempt to modify or store it
const char * TranslateGeneric (const char * sText, const char * sSection);
// translate formatted text - result is statically allocated - do not attempt to modify or store it
const char * TFormat (const char * sFormat, ...);
// translate text
CString TranslateGeneric (const char * sText, const char * sSection);
// translate formatted text
CString TFormat (const char * sFormat, ...);
// translate a static string
#define Translate(string) TranslateGeneric (string, "messages")
// translate a date/time string
Expand Down

0 comments on commit ed1aa5d

Please sign in to comment.