1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-16 04:39:03 +00:00

Fix comment style for LGTM alert suppression

This commit is contained in:
dmiller
2019-12-22 14:32:04 +00:00
parent 87a92c969f
commit bf9b61ad22

View File

@@ -169,7 +169,7 @@ int n_ctime(char *buffer, size_t bufsz, const time_t *timer) {
return ctime_s(buffer, bufsz, timer); return ctime_s(buffer, bufsz, timer);
} }
#else //WIN32 #else /* WIN32 */
#include <errno.h> #include <errno.h>
#ifdef HAVE_LOCALTIME_S #ifdef HAVE_LOCALTIME_S
@@ -210,8 +210,12 @@ int n_ctime(char *buffer, size_t bufsz, const time_t *timer) {
#else #else
/* No thread-safe alternatives. */ /* No thread-safe alternatives. */
// Using C99's one-line commments since LGTM.com does not recognize C-style
// block comments. This may cause problems, but only for very old systems
// without a C99-compatible compiler that do not have localtime_r or
// localtime_s
int n_localtime(const time_t *timer, struct tm *result) { int n_localtime(const time_t *timer, struct tm *result) {
struct tm *tmp = localtime(timer); /* lgtm [cpp/potentially-dangerous-function] */ struct tm *tmp = localtime(timer); // lgtm[cpp/potentially-dangerous-function]
if (tmp) if (tmp)
*result = *tmp; *result = *tmp;
else else
@@ -220,16 +224,16 @@ int n_localtime(const time_t *timer, struct tm *result) {
} }
int n_ctime(char *buffer, size_t bufsz, const time_t *timer) { int n_ctime(char *buffer, size_t bufsz, const time_t *timer) {
char *tmp = ctime(timer); /* lgtm [cpp/potentially-dangerous-function] */ char *tmp = ctime(timer); // lgtm[cpp/potentially-dangerous-function]
if (tmp) if (tmp)
Strncpy(buffer, tmp, bufsz); Strncpy(buffer, tmp, bufsz);
else else
return errno; return errno;
return 0; return 0;
} }
#endif //HAVE_LOCALTIME_R #endif /* HAVE_LOCALTIME_R */
#endif //HAVE_LOCALTIME_S #endif /* HAVE_LOCALTIME_S */
#endif //WIN32 #endif /* WIN32 */
#ifdef WIN32 #ifdef WIN32
int gettimeofday(struct timeval *tv, struct timeval *tz) int gettimeofday(struct timeval *tv, struct timeval *tz)