diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/Converter.h | 4 | ||||
-rw-r--r-- | gtk/PlatGTK.cxx | 11 |
2 files changed, 7 insertions, 8 deletions
diff --git a/gtk/Converter.h b/gtk/Converter.h index fe9e23199..be530341f 100644 --- a/gtk/Converter.h +++ b/gtk/Converter.h @@ -51,8 +51,8 @@ public: // Try allowing approximate transliterations if (transliterations) { char fullDest[200]; - strcpy(fullDest, charSetDestination); - strcat(fullDest, "//TRANSLIT"); + g_strlcpy(fullDest, charSetDestination, sizeof(fullDest)); + g_strlcat(fullDest, "//TRANSLIT", sizeof(fullDest)); OpenHandle(fullDest, charSetSource); } if (!Succeeded()) { diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index da9171470..1479d50ee 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -23,8 +23,9 @@ #include "Scintilla.h" #include "ScintillaWidget.h" -#include "UniConversion.h" +#include "StringCopy.h" #include "XPM.h" +#include "UniConversion.h" #if defined(__clang__) // Clang 3.0 incorrectly displays sentinel warnings. Fixed by clang 3.1. @@ -231,7 +232,7 @@ static void SetLogFont(LOGFONT &lf, const char *faceName, int characterSet, floa lf.weight = weight; lf.italic = italic; lf.characterSet = characterSet; - strncpy(lf.faceName, faceName, sizeof(lf.faceName) - 1); + StringCopy(lf.faceName, faceName); } /** @@ -1830,8 +1831,7 @@ void ListBoxX::GetValue(int n, char *value, int len) { gtk_tree_model_get(model, &iter, TEXT_COLUMN, &text, -1); } if (text && len > 0) { - strncpy(value, text, len); - value[len - 1] = '\0'; + g_strlcpy(value, text, len); } else { value[0] = '\0'; } @@ -2142,8 +2142,7 @@ bool Platform::ShowAssertionPopUps(bool assertionPopUps_) { void Platform::Assert(const char *c, const char *file, int line) { char buffer[2000]; - sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line); - strcat(buffer, "\r\n"); + g_snprintf(buffer, sizeof(buffer), "Assertion [%s] failed at %s %d\r\n", c, file, line); Platform::DebugDisplay(buffer); abort(); } |