[X2Go-Commits] [nx-libs] 20/29: Args.c: simplify nxagentGetDialogName()
git-admin at x2go.org
git-admin at x2go.org
Sun Jan 7 01:30:59 CET 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch 3.6.x
in repository nx-libs.
commit cac1af52d93222e3705ea20f999ba7178010963e
Author: Ulrich Sibiller <uli42 at gmx.de>
Date: Wed Jan 3 00:59:59 2018 +0100
Args.c: simplify nxagentGetDialogName()
---
nx-X11/programs/Xserver/hw/nxagent/Args.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index ee18f3b..14f696e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -2098,31 +2098,24 @@ void ddxUseMsg()
static int nxagentGetDialogName()
{
- snprintf(nxagentDialogName, NXAGENTDIALOGNAMELENGTH, "NX");
-
if (*nxagentSessionId != '\0')
{
int length = strlen(nxagentSessionId);
- strcpy(nxagentDialogName, "NX - ");
-
/* if the session id contains an MD5 hash in a well-known format cut it off */
if (length > (MD5_LENGTH * 2 + 1) &&
*(nxagentSessionId + (length - (MD5_LENGTH * 2 + 1))) == '-')
{
- strncat(nxagentDialogName, nxagentSessionId,
- MIN(NXAGENTDIALOGNAMELENGTH - strlen(nxagentDialogName), length - (MD5_LENGTH * 2 + 1)) - 1);
- }
- else
- {
- strncat(nxagentDialogName, nxagentSessionId, NXAGENTDIALOGNAMELENGTH - strlen(nxagentDialogName) - 1);
+ length -= (MD5_LENGTH * 2 + 1);
}
- nxagentDialogName[NXAGENTDIALOGNAMELENGTH - 1] = '\0';
+ snprintf(nxagentDialogName, NXAGENTDIALOGNAMELENGTH, "NX - %.*s", length, nxagentSessionId);
return 1;
}
+ snprintf(nxagentDialogName, NXAGENTDIALOGNAMELENGTH, "NX");
+
return 0;
}
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
More information about the x2go-commits
mailing list