summaryrefslogtreecommitdiff
path: root/textscreen/examples
diff options
context:
space:
mode:
Diffstat (limited to 'textscreen/examples')
-rw-r--r--textscreen/examples/calculator.c6
-rw-r--r--textscreen/examples/guitest.c14
2 files changed, 10 insertions, 10 deletions
diff --git a/textscreen/examples/calculator.c b/textscreen/examples/calculator.c
index 7c77e838..3db60ef7 100644
--- a/textscreen/examples/calculator.c
+++ b/textscreen/examples/calculator.c
@@ -49,7 +49,7 @@ void UpdateInputBox(void)
{
char buf[20];
- sprintf(buf, " %i", input_value);
+ TXT_snprintf(buf, sizeof(buf), " %i", input_value);
TXT_SetLabel(input_box, buf);
}
@@ -76,7 +76,7 @@ void AddNumberButton(txt_table_t *table, int value)
val_copy = malloc(sizeof(int));
*val_copy = value;
- sprintf(buf, " %i ", value);
+ TXT_snprintf(buf, sizeof(buf), " %i ", value);
TXT_AddWidget(table, TXT_NewButton2(buf, InsertNumber, val_copy));
}
@@ -98,7 +98,7 @@ void AddOperatorButton(txt_table_t *table, char *label, operator_t op)
op_copy = malloc(sizeof(operator_t));
*op_copy = op;
- sprintf(buf, " %s ", label);
+ TXT_snprintf(buf, sizeof(buf), " %s ", label);
TXT_AddWidget(table, TXT_NewButton2(buf, Operator, op_copy));
}
diff --git a/textscreen/examples/guitest.c b/textscreen/examples/guitest.c
index 08faae98..3904ffa9 100644
--- a/textscreen/examples/guitest.c
+++ b/textscreen/examples/guitest.c
@@ -76,13 +76,13 @@ void UpdateLabel(TXT_UNCAST_ARG(widget), void *user_data)
{
char buf[40];
- strcpy(buf, " Current value: ");
+ TXT_StringCopy(buf, " Current value: ", sizeof(buf));
if (cheesy)
{
- strcat(buf, "Cheesy ");
+ TXT_StringConcat(buf, "Cheesy ", sizeof(buf));
}
- strcat(buf, radio_values[radiobutton_value]);
- strcat(buf, "\n");
+ TXT_StringConcat(buf, radio_values[radiobutton_value], sizeof(buf));
+ TXT_StringConcat(buf, "\n", sizeof(buf));
TXT_SetLabel(value_label, buf);
}
@@ -119,11 +119,11 @@ void SetupWindow(void)
for (i=0; i<5; ++i)
{
- sprintf(buf, "Option %i in a table:", i + 1);
+ TXT_snprintf(buf, sizeof(buf), "Option %i in a table:", i + 1);
TXT_AddWidget(table, TXT_NewLabel(buf));
- sprintf(buf, " Button %i-1 ", i + 1);
+ TXT_snprintf(buf, sizeof(buf), " Button %i-1 ", i + 1);
TXT_AddWidget(table, TXT_NewButton(buf));
- sprintf(buf, " Button %i-2 ", i + 1);
+ TXT_snprintf(buf, sizeof(buf), " Button %i-2 ", i + 1);
TXT_AddWidget(table, TXT_NewButton(buf));
}