diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-09-22 11:17:34 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-09-22 11:17:34 +0200 |
commit | b2046432794cd8a1cb7a9737329186e1fec2dcc7 (patch) | |
tree | 18c65fb09078daf52fbd95c4cd3500a700167b67 /vncviewer | |
parent | ba0180e5d3dde0c4610e514520c2610bf0ef382f (diff) | |
download | tigervnc-b2046432794cd8a1cb7a9737329186e1fec2dcc7.tar.gz tigervnc-b2046432794cd8a1cb7a9737329186e1fec2dcc7.zip |
Split up the info string
Avoids having to translate the entire thing if just part of
it changes.
Diffstat (limited to 'vncviewer')
-rw-r--r-- | vncviewer/CConn.cxx | 78 |
1 files changed, 56 insertions, 22 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index 305eddce..858840c7 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -160,31 +160,65 @@ const char *CConn::connectionInfo() { static char infoText[1024] = ""; + char scratch[100]; char pfStr[100]; - char spfStr[100]; + + // Crude way of avoiding constant overflow checks + assert((sizeof(scratch) + 1) * 10 < sizeof(infoText)); + + infoText[0] = '\0'; + + snprintf(scratch, sizeof(scratch), + _("Desktop name: %.80s"), cp.name()); + strcat(infoText, scratch); + strcat(infoText, "\n"); + + snprintf(scratch, sizeof(scratch), + _("Host: %.80s port: %d"), serverHost, serverPort); + strcat(infoText, scratch); + strcat(infoText, "\n"); + + snprintf(scratch, sizeof(scratch), + _("Size: %d x %d"), cp.width, cp.height); + strcat(infoText, scratch); + strcat(infoText, "\n"); cp.pf().print(pfStr, 100); - serverPF.print(spfStr, 100); - - int secType = csecurity->getType(); - - snprintf(infoText, sizeof(infoText), - _("Desktop name: %.80s\n" - "Host: %.80s port: %d\n" - "Size: %d x %d\n" - "Pixel format: %s\n" - "(server default %s)\n" - "Requested encoding: %s\n" - "Last used encoding: %s\n" - "Line speed estimate: %d kbit/s\n" - "Protocol version: %d.%d\n" - "Security method: %s\n"), - cp.name(), serverHost, serverPort, cp.width, cp.height, - pfStr, spfStr, encodingName(currentEncoding), - encodingName(lastServerEncoding), - sock->inStream().kbitsPerSecond(), - cp.majorVersion, cp.minorVersion, - secTypeName(secType)); + snprintf(scratch, sizeof(scratch), + _("Pixel format: %s"), pfStr); + strcat(infoText, scratch); + strcat(infoText, "\n"); + + serverPF.print(pfStr, 100); + snprintf(scratch, sizeof(scratch), + _("(server default %s)"), pfStr); + strcat(infoText, scratch); + strcat(infoText, "\n"); + + snprintf(scratch, sizeof(scratch), + _("Requested encoding: %s"), encodingName(currentEncoding)); + strcat(infoText, scratch); + strcat(infoText, "\n"); + + snprintf(scratch, sizeof(scratch), + _("Last used encoding: %s"), encodingName(lastServerEncoding)); + strcat(infoText, scratch); + strcat(infoText, "\n"); + + snprintf(scratch, sizeof(scratch), + _("Line speed estimate: %d kbit/s"), sock->inStream().kbitsPerSecond()); + strcat(infoText, scratch); + strcat(infoText, "\n"); + + snprintf(scratch, sizeof(scratch), + _("Protocol version: %d.%d"), cp.majorVersion, cp.minorVersion); + strcat(infoText, scratch); + strcat(infoText, "\n"); + + snprintf(scratch, sizeof(scratch), + _("Security method: %s"), secTypeName(csecurity->getType())); + strcat(infoText, scratch); + strcat(infoText, "\n"); return infoText; } |