Commit 039c85fb2aa20379cab4842a55db46aa0f75ce29
1 parent
95b628bd
Exists in
master
and in
2 other branches
Fixing LGTM warning.
Showing
1 changed file
with
14 additions
and
34 deletions
Show diff stats
src/core/telnet.c
... | ... | @@ -124,19 +124,6 @@ |
124 | 124 | #define E_OPT(n) (1 << (n)) |
125 | 125 | #endif // X3270_TN3270E |
126 | 126 | |
127 | -/* | |
128 | -#if defined(X3270_ANSI) | |
129 | -static char vintr; | |
130 | -static char vquit; | |
131 | -static char verase; | |
132 | -static char vkill; | |
133 | -static char veof; | |
134 | -static char vwerase; | |
135 | -static char vrprnt; | |
136 | -static char vlnext; | |
137 | -#endif | |
138 | -*/ | |
139 | - | |
140 | 127 | struct _ansictl ansictl = { 0 }; |
141 | 128 | |
142 | 129 | static int telnet_fsm(H3270 *session, unsigned char c); |
... | ... | @@ -2090,27 +2077,23 @@ static void check_linemode(H3270 *hSession, Boolean init) |
2090 | 2077 | } |
2091 | 2078 | } |
2092 | 2079 | |
2093 | - | |
2094 | 2080 | #if defined(X3270_TRACE) |
2095 | 2081 | |
2096 | -/* | |
2097 | - * nnn | |
2098 | - * Expands a number to a character string, for displaying unknown telnet | |
2099 | - * commands and options. | |
2100 | - */ | |
2082 | +/// | |
2083 | +/// @brief Expands a number to a character string, for displaying unknown telnet commands and options. | |
2084 | +/// | |
2101 | 2085 | static const char * |
2102 | 2086 | nnn(int c) |
2103 | 2087 | { |
2104 | 2088 | static char buf[64]; |
2105 | - | |
2106 | - (void) sprintf(buf, "%d", c); | |
2089 | + memset(buf,0,sizeof(buf)); | |
2090 | + (void) snprintf(buf, 63, "%d", c); | |
2107 | 2091 | return buf; |
2108 | 2092 | } |
2109 | 2093 | |
2110 | -/* | |
2111 | - * cmd | |
2112 | - * Expands a TELNET command into a character string. | |
2113 | - */ | |
2094 | +/// | |
2095 | +/// @brief Expands a TELNET command into a character string. | |
2096 | +/// | |
2114 | 2097 | static const char * cmd(int c) |
2115 | 2098 | { |
2116 | 2099 | if (TELCMD_OK(c)) |
... | ... | @@ -2119,20 +2102,17 @@ static const char * cmd(int c) |
2119 | 2102 | return nnn(c); |
2120 | 2103 | } |
2121 | 2104 | |
2122 | -/*** | |
2123 | - * | |
2124 | - * @brief Expands a TELNET option into a character string. | |
2125 | - */ | |
2105 | +/// | |
2106 | +/// @brief Expands a TELNET option into a character string. | |
2107 | +/// | |
2126 | 2108 | static const char * opt(unsigned char c) |
2127 | 2109 | { |
2128 | - if (TELOPT_OK(c)) | |
2129 | - return TELOPT(c); | |
2130 | - else if (c == TELOPT_TN3270E) | |
2110 | + if (c == TELOPT_TN3270E) | |
2131 | 2111 | return "TN3270E"; |
2132 | -#if defined(HAVE_LIBSSL) /*[*/ | |
2133 | 2112 | else if (c == TELOPT_STARTTLS) |
2134 | 2113 | return "START-TLS"; |
2135 | -#endif /*]*/ | |
2114 | + else if (TELOPT_OK(c)) | |
2115 | + return TELOPT(c); | |
2136 | 2116 | else |
2137 | 2117 | return nnn((int)c); |
2138 | 2118 | } | ... | ... |