openbsd-ports/x11/wxWidgets/patches/patch-samples_console_console_cpp

88 lines
3.0 KiB
Plaintext
Raw Normal View History

$OpenBSD: patch-samples_console_console_cpp,v 1.1.1.1 2004/07/16 21:01:35 todd Exp $
--- samples/console/console.cpp.orig Tue Jun 3 23:57:50 2003
+++ samples/console/console.cpp Thu Jun 26 11:05:09 2003
@@ -2560,38 +2560,43 @@ static void
fp_test (void)
{
int i, j, k, l;
- wxChar buf[7];
- wxChar *prefix = buf;
+ wxChar prefix[7];
wxChar tp[20];
wxPuts(_T("\nFormatted output test"));
wxPrintf(_T("prefix 6d 6o 6x 6X 6u\n"));
- wxStrcpy(prefix, _T("%"));
+
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
for (k = 0; k < 2; k++) {
for (l = 0; l < 2; l++) {
- wxStrcpy(prefix, _T("%"));
- if (i == 0) wxStrcat(prefix, _T("-"));
- if (j == 0) wxStrcat(prefix, _T("+"));
- if (k == 0) wxStrcat(prefix, _T("#"));
- if (l == 0) wxStrcat(prefix, _T("0"));
+ strlcpy(prefix, _T("%"), sizeof(prefix));
+ if (i == 0) strlcat(prefix, _T("-"), sizeof(prefix));
+ if (j == 0) strlcat(prefix, _T("+"), sizeof(prefix));
+ if (k == 0) strlcat(prefix, _T("#"), sizeof(prefix));
+ if (l == 0) strlcat(prefix, _T("0"), sizeof(prefix));
wxPrintf(_T("%5s |"), prefix);
- wxStrcpy(tp, prefix);
- wxStrcat(tp, _T("6d |"));
+
+ strlcpy(tp, prefix, sizeof(tp));
+ strlcat(tp, _T("6d |"), sizeof(tp));
wxPrintf(tp, DEC);
- wxStrcpy(tp, prefix);
- wxStrcat(tp, _T("6o |"));
+
+ strlcpy(tp, prefix, sizeof(tp));
+ strlcat(tp, _T("6o |"), sizeof(tp));
wxPrintf(tp, INT);
- wxStrcpy(tp, prefix);
- wxStrcat(tp, _T("6x |"));
+
+ strlcpy(tp, prefix, sizeof(tp));
+ strlcat(tp, _T("6x |"), sizeof(tp));
wxPrintf(tp, INT);
- wxStrcpy(tp, prefix);
- wxStrcat(tp, _T("6X |"));
+
+ strlcpy(tp, prefix, sizeof(tp));
+ strlcat(tp, _T("6X |"), sizeof(tp));
wxPrintf(tp, INT);
- wxStrcpy(tp, prefix);
- wxStrcat(tp, _T("6u |"));
+
+ strlcpy(tp, prefix, sizeof(tp));
+ strlcat(tp, _T("6u |"), sizeof(tp));
wxPrintf(tp, UNS);
+
wxPrintf(_T("\n"));
}
}
@@ -5804,14 +5809,14 @@ static void TestPChar()
for (int i = 0; i < 1000000; ++i)
{
- wxStrcpy (a, _T("Hello"));
- wxStrcpy (b, _T(" world"));
- wxStrcpy (c, _T("! How'ya doin'?"));
- wxStrcat (a, b);
- wxStrcat (a, c);
- wxStrcpy (c, _T("Hello world! What's up?"));
+ strlcpy (a, _T("Hello"), sizeof(a));
+ strlcpy (b, _T(" world"), sizeof(b));
+ strlcpy (c, _T("! How'ya doin'?"), sizeof(c));
+ strlcat (a, b, sizeof(a));
+ strlcat (a, c, sizeof(a));
+ strlcpy (c, _T("Hello world! What's up?"), sizeof(c));
if (wxStrcmp (c, a) == 0)
- wxStrcpy (c, _T("Doh!"));
+ strlcpy (c, _T("Doh!"), sizeof(c));
}
wxPrintf(_T("TestPChar elapsed time: %ld\n"), sw.Time());