summaryrefslogtreecommitdiff
path: root/comm.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2015-05-09 11:19:33 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2015-05-09 11:19:33 -0700
commitaf90a105ec97c6d856d2e8a80e8822c3e192d1e9 (patch)
tree88e8a1428621f6dd10eb7c37370723d2e6a1b7e8 /comm.c
parent9ffefd5b3d38e9ed2b5ed59bc50e8a7da761fb77 (diff)
Replace remaining sprintf calls with snprintf
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'comm.c')
-rw-r--r--comm.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/comm.c b/comm.c
index b7aa0d8..fb949e3 100644
--- a/comm.c
+++ b/comm.c
@@ -90,8 +90,7 @@ ClientTimedOut(XtPointer data, XtIntervalId *id)
XtDisownSelection(w, global_client.atom,
XtLastTimestampProcessed(XtDisplay(w)));
- sprintf(msg, res_labels[4],
- "the Editres Protocol.");
+ snprintf(msg, sizeof(msg), res_labels[4], "the Editres Protocol.");
SetMessage(global_screen_data.info_label, msg);
}
@@ -226,13 +225,12 @@ SetCommand(Widget w, ResCommand command, char *msg)
XSync(dpy, FALSE);
XSetErrorHandler(global_old_error_handler);
if (global_error_code == NO_WINDOW) {
- char error_buf[BUFSIZ];
+ char error_buf[BUFSIZ] =
+ "The communication window with the"
+ " application is no longer available\n"
+ "Please select a new widget tree.";
global_error_code = NO_ERROR; /* Reset Error code. */
- sprintf(error_buf, "The communication window with%s%s.",
- " application is no longer available\n",
- "Please select a new widget tree");
-
global_client.window = None;
SetCommand(w, LocalSendWidgetTree, error_buf);
return;
@@ -280,7 +278,7 @@ TellUserAboutMessage(Widget label, ResCommand command)
break;
}
- sprintf(msg, res_labels[8], str);
+ snprintf(msg, sizeof(msg), res_labels[8], str);
SetMessage(label, msg);
}
@@ -420,7 +418,7 @@ GetClientValue(Widget w, XtPointer data, Atom *selection, Atom *type,
FreeEvent(event);
}
else {
- sprintf(msg, "Unable to unpack protocol request.");
+ snprintf(msg, sizeof(msg), "Unable to unpack protocol request.");
error_str = XtNewString(msg);
}
break;
@@ -438,7 +436,7 @@ GetClientValue(Widget w, XtPointer data, Atom *selection, Atom *type,
SetCommand(w, LocalSendWidgetTree, NULL);
break;
default:
- sprintf(msg, res_labels[11], (int) error_code);
+ snprintf(msg, sizeof(msg), res_labels[11], (int) error_code);
SetMessage(global_screen_data.info_label, msg);
break;
}
@@ -450,7 +448,7 @@ GetClientValue(Widget w, XtPointer data, Atom *selection, Atom *type,
return;
top = global_tree_info->top_node;
- sprintf(msg, res_labels[12], top->name, top->class);
+ snprintf(msg, sizeof(msg), res_labels[12], top->name, top->class);
SetMessage(global_screen_data.info_label, msg);
return;
}
@@ -893,8 +891,8 @@ DispatchEvent(Event *event)
default:
{
char msg[BUFSIZ];
- sprintf(msg, "Internal error: Unknown command %d.",
- global_client.command);
+ snprintf(msg, sizeof(msg), "Internal error: Unknown command %d.",
+ global_client.command);
error = XtNewString(msg);
}
break;