From 6cbc0d855e0e1a73820b0fc2e7a078044872d00b Mon Sep 17 00:00:00 2001 From: John Safranek Date: Thu, 24 Sep 2020 09:06:10 -0700 Subject: [PATCH 1/2] Change file including guard from pragma-once to ifndef-define. --- wolfssh/agent.h | 6 +++++- wolfssh/certs_test.h | 6 +++--- wolfssh/error.h | 4 +++- wolfssh/internal.h | 5 ++++- wolfssh/keygen.h | 9 ++++----- wolfssh/log.h | 5 ++++- wolfssh/misc.h | 8 +++----- wolfssh/port.h | 5 ++++- wolfssh/settings.h | 5 ++++- wolfssh/ssh.h | 6 +++++- wolfssh/test.h | 2 +- wolfssh/version.h | 6 +++++- wolfssh/version.h.in | 6 +++++- wolfssh/visibility.h | 5 ++++- wolfssh/wolfscp.h | 8 ++++---- wolfssh/wolfsftp.h | 8 +++++++- 16 files changed, 65 insertions(+), 29 deletions(-) diff --git a/wolfssh/agent.h b/wolfssh/agent.h index a6758eb..fc22cf3 100644 --- a/wolfssh/agent.h +++ b/wolfssh/agent.h @@ -23,7 +23,8 @@ */ -#pragma once +#ifndef _WOLFSSH_AGENT_H_ +#define _WOLFSSH_AGENT_H_ #include #include @@ -188,3 +189,6 @@ WOLFSSH_API int wolfSSH_AGENT_SignRequest(WOLFSSH*, const byte*, word32, #ifdef __cplusplus } #endif + +#endif /* _WOLFSSH_AGENT_H_ */ + diff --git a/wolfssh/certs_test.h b/wolfssh/certs_test.h index 40228ee..c313b76 100644 --- a/wolfssh/certs_test.h +++ b/wolfssh/certs_test.h @@ -18,8 +18,8 @@ * along with wolfSSH. If not, see . */ -#ifndef WOLFSSL_CERTS_TEST_H -#define WOLFSSL_CERTS_TEST_H +#ifndef _WOLFSSH_CERTS_TEST_H_ +#define _WOLFSSH_CERTS_TEST_H_ #if defined(NO_FILESYSTEM) @@ -222,5 +222,5 @@ static const int sizeof_ecc_key_der_521 = sizeof(ecc_key_der_521); #endif /* NO_FILESYSTEM */ -#endif /* WOLFSSL_CERTS_TEST_H */ +#endif /* _WOLFSSL_CERTS_TEST_H_ */ diff --git a/wolfssh/error.h b/wolfssh/error.h index 181d0d7..dd19229 100644 --- a/wolfssh/error.h +++ b/wolfssh/error.h @@ -24,7 +24,8 @@ */ -#pragma once +#ifndef _WOLFSSH_ERROR_H_ +#define _WOLFSSH_ERROR_H_ #include @@ -137,4 +138,5 @@ enum WS_IOerrors { #ifdef __cplusplus } #endif +#endif /* _WOLFSSH_ERROR_H_ */ diff --git a/wolfssh/internal.h b/wolfssh/internal.h index 7ee3f2d..ca92680 100644 --- a/wolfssh/internal.h +++ b/wolfssh/internal.h @@ -25,7 +25,8 @@ */ -#pragma once +#ifndef _WOLFSSH_INTERNAL_H_ +#define _WOLFSSH_INTERNAL_H_ #include #include @@ -900,3 +901,5 @@ enum TerminalModes { } #endif +#endif /* _WOLFSSH_INTERNAL_H_ */ + diff --git a/wolfssh/keygen.h b/wolfssh/keygen.h index 599e557..5e8c53d 100644 --- a/wolfssh/keygen.h +++ b/wolfssh/keygen.h @@ -25,10 +25,8 @@ */ -#pragma once - -#ifndef WOLFSSH_KEYGEN_H -#define WOLFSSH_KEYGEN_H +#ifndef _WOLFSSH_KEYGEN_H_ +#define _WOLFSSH_KEYGEN_H_ #include #include @@ -49,4 +47,5 @@ WOLFSSH_API int wolfSSH_MakeRsaKey(byte*, word32, word32, word32); } #endif -#endif +#endif /* _WOLFSSH_KEYGEN_H_ */ + diff --git a/wolfssh/log.h b/wolfssh/log.h index 54889cd..d8dfaaf 100644 --- a/wolfssh/log.h +++ b/wolfssh/log.h @@ -26,7 +26,8 @@ */ -#pragma once +#ifndef _WOLFSSH_LOG_H_ +#define _WOLFSSH_LOG_H_ #include @@ -80,3 +81,5 @@ WOLFSSH_API void wolfSSH_Log(enum wolfSSH_LogLevel, } #endif +#endif /* _WOLFSSH_LOG_H_ */ + diff --git a/wolfssh/misc.h b/wolfssh/misc.h index 99ee528..f81b0a8 100644 --- a/wolfssh/misc.h +++ b/wolfssh/misc.h @@ -18,10 +18,9 @@ * along with wolfSSH. If not, see . */ -#pragma once -#ifndef WOLFSSH_MISC_H -#define WOLFSSH_MISC_H +#ifndef _WOLFSSH_MISC_H_ +#define _WOLFSSH_MISC_H_ #ifdef __cplusplus @@ -55,6 +54,5 @@ WOLFSSH_LOCAL void CreateMpint(byte*, word32*, byte*); } /* extern "C" */ #endif - -#endif /* WOLFSSH_MISC_H */ +#endif /* _WOLFSSH_MISC_H_ */ diff --git a/wolfssh/port.h b/wolfssh/port.h index 3395a98..a713c99 100644 --- a/wolfssh/port.h +++ b/wolfssh/port.h @@ -27,7 +27,8 @@ */ -#pragma once +#ifndef _WOLFSSH_PORT_H_ +#define _WOLFSSH_PORT_H_ #include #include @@ -1111,3 +1112,5 @@ extern "C" { } #endif +#endif /* _WOLFSSH_PORT_H_ */ + diff --git a/wolfssh/settings.h b/wolfssh/settings.h index 3ec8840..4a07f9b 100644 --- a/wolfssh/settings.h +++ b/wolfssh/settings.h @@ -26,7 +26,8 @@ */ -#pragma once +#ifndef _WOLFSSH_SETTINGS_H_ +#define _WOLFSSH_SETTINGS_H_ #include @@ -75,3 +76,5 @@ extern "C" { } #endif +#endif /* _WOLFSSH_SETTINGS_H_ */ + diff --git a/wolfssh/ssh.h b/wolfssh/ssh.h index 9ac4023..2caf0a1 100644 --- a/wolfssh/ssh.h +++ b/wolfssh/ssh.h @@ -24,7 +24,9 @@ */ -#pragma once +#ifndef _WOLFSSH_SSH_H_ +#define _WOLFSSH_SSH_H_ + #ifdef WOLFSSL_USER_SETTINGS #include @@ -297,3 +299,5 @@ WOLFSSH_API void wolfSSH_ShowSizes(void); } #endif +#endif /* _WOLFSSH_SSH_H_ */ + diff --git a/wolfssh/test.h b/wolfssh/test.h index 64f88e0..80b92e4 100644 --- a/wolfssh/test.h +++ b/wolfssh/test.h @@ -18,7 +18,6 @@ * along with wolfSSH. If not, see . */ -#pragma once #ifndef _WOLFSSH_TEST_H_ #define _WOLFSSH_TEST_H_ @@ -887,3 +886,4 @@ static INLINE void ThreadDetach(THREAD_TYPE thread) #endif /* WOLFSSH_TEST_THREADING */ #endif /* _WOLFSSH_TEST_H_ */ + diff --git a/wolfssh/version.h b/wolfssh/version.h index 9287cdf..eba2efc 100644 --- a/wolfssh/version.h +++ b/wolfssh/version.h @@ -27,7 +27,9 @@ */ -#pragma once +#ifndef _WOLFSSH_VERSION_H_ +#define _WOLFSSH_VERSION_H_ + #ifdef __cplusplus extern "C" { @@ -40,3 +42,5 @@ extern "C" { } #endif +#endif /* _WOLFSSH_VERSION_H_ */ + diff --git a/wolfssh/version.h.in b/wolfssh/version.h.in index 34cf6d8..37738c5 100644 --- a/wolfssh/version.h.in +++ b/wolfssh/version.h.in @@ -27,7 +27,9 @@ */ -#pragma once +#ifndef _WOLFSSH_VERSION_H_ +#define _WOLFSSH_VERSION_H_ + #ifdef __cplusplus extern "C" { @@ -40,3 +42,5 @@ extern "C" { } #endif +#endif /* _WOLFSSH_VERSION_H_ */ + diff --git a/wolfssh/visibility.h b/wolfssh/visibility.h index 86aced2..6f44828 100644 --- a/wolfssh/visibility.h +++ b/wolfssh/visibility.h @@ -26,7 +26,8 @@ */ -#pragma once +#ifndef _WOLFSSH_VISIBILITY_H_ +#define _WOLFSSH_VISIBILITY_H_ #ifdef __cplusplus @@ -77,3 +78,5 @@ extern "C" { } #endif +#endif /* _WOLFSSH_VISIBILITY_H_ */ + diff --git a/wolfssh/wolfscp.h b/wolfssh/wolfscp.h index 22e1f03..270584a 100644 --- a/wolfssh/wolfscp.h +++ b/wolfssh/wolfscp.h @@ -18,10 +18,10 @@ * along with wolfSSH. If not, see . */ -#pragma once -#ifndef WOLFSSH_WOLFSCP_H -#define WOLFSSH_WOLFSCP_H +#ifndef _WOLFSSH_WOLFSCP_H_ +#define _WOLFSSH_WOLFSCP_H_ + #include #include @@ -139,5 +139,5 @@ WOLFSSH_API int wolfSSH_SCP_from(WOLFSSH*, const char*, const char*); #endif /* WOLFSSH_SCP */ -#endif /* WOLFSSH_WOLFSCP_H */ +#endif /* _WOLFSSH_WOLFSCP_H_ */ diff --git a/wolfssh/wolfsftp.h b/wolfssh/wolfsftp.h index 5eaea2e..7b95daa 100644 --- a/wolfssh/wolfsftp.h +++ b/wolfssh/wolfsftp.h @@ -18,7 +18,10 @@ * along with wolfSSH. If not, see . */ -#pragma once + +#ifndef _WOLFSSH_WOLFSFTP_H_ +#define _WOLFSSH_WOLFSFTP_H_ + #ifdef WOLFSSL_USER_SETTINGS #include @@ -241,3 +244,6 @@ WOLFSSH_LOCAL void wolfSSH_SFTP_ShowSizes(void); #ifdef __cplusplus } #endif + +#endif /* _WOLFSSH_WOLFSFTP_H_ */ + From 1be4042711dcb83bd29f89c7f276340846b82a65 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Thu, 24 Sep 2020 16:50:35 -0700 Subject: [PATCH 2/2] Change examples' header file including guard from pragma-once to ifndef-define. --- examples/client/client.h | 8 +++----- examples/echoserver/echoserver.h | 8 +++----- examples/portfwd/wolfssh_portfwd.h | 27 +++++++++++++++++++++++---- examples/scpclient/scpclient.h | 8 +++----- examples/server/server.h | 8 +++----- examples/sftpclient/sftpclient.h | 7 ++++--- 6 files changed, 39 insertions(+), 27 deletions(-) diff --git a/examples/client/client.h b/examples/client/client.h index 87599bf..29faac1 100644 --- a/examples/client/client.h +++ b/examples/client/client.h @@ -19,13 +19,11 @@ */ -#pragma once - -#ifndef _WOLFSSH_CLIENT_H_ -#define _WOLFSSH_CLIENT_H_ +#ifndef _WOLFSSH_EXAMPLES_CLIENT_H_ +#define _WOLFSSH_EXAMPLES_CLIENT_H_ THREAD_RETURN WOLFSSH_THREAD client_test(void* args); -#endif /* _WOLFSSH_CLIENT_H_ */ +#endif /* _WOLFSSH_EXAMPLES_CLIENT_H_ */ diff --git a/examples/echoserver/echoserver.h b/examples/echoserver/echoserver.h index a973ee7..99e4080 100644 --- a/examples/echoserver/echoserver.h +++ b/examples/echoserver/echoserver.h @@ -19,13 +19,11 @@ */ -#pragma once - -#ifndef _WOLFSSH_ECHOSERVER_H_ -#define _WOLFSSH_ECHOSERVER_H_ +#ifndef _WOLFSSH_EXAMPLES_ECHOSERVER_H_ +#define _WOLFSSH_EXAMPLES_ECHOSERVER_H_ THREAD_RETURN WOLFSSH_THREAD echoserver_test(void* args); -#endif /* _WOLFSSH_ECHOSERVER_H_ */ +#endif /* _WOLFSSH_EXAMPLES_ECHOSERVER_H_ */ diff --git a/examples/portfwd/wolfssh_portfwd.h b/examples/portfwd/wolfssh_portfwd.h index d7eb5d0..35377b3 100644 --- a/examples/portfwd/wolfssh_portfwd.h +++ b/examples/portfwd/wolfssh_portfwd.h @@ -1,8 +1,27 @@ -#pragma once +/* wolfssh_portfwd.h + * + * Copyright (C) 2014-2020 wolfSSL Inc. + * + * This file is part of wolfSSH. + * + * wolfSSH is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with wolfSSH. If not, see . + */ -#ifndef _WOLFSSH_CLIENT_H_ -#define _WOLFSSH_CLIENT_H_ + +#ifndef _WOLFSSH_EXAMPLES_PORTFWD_H_ +#define _WOLFSSH_EXAMPLES_PORTFWD_H_ THREAD_RETURN WOLFSSH_THREAD portfwd_worker(void* args); -#endif /* _WOLFSSH_CLIENT_H_ */ +#endif /* _WOLFSSH_EXAMPLES_PORTFWD_H_ */ diff --git a/examples/scpclient/scpclient.h b/examples/scpclient/scpclient.h index 9ced604..a4a3f4e 100644 --- a/examples/scpclient/scpclient.h +++ b/examples/scpclient/scpclient.h @@ -19,11 +19,9 @@ */ -#pragma once - -#ifndef _WOLFSSH_SCPCLIENT_H_ -#define _WOLFSSH_SCPCLIENT_H_ +#ifndef _WOLFSSH_EXAMPLES_SCPCLIENT_H_ +#define _WOLFSSH_EXAMPLES_SCPCLIENT_H_ THREAD_RETURN WOLFSSH_THREAD scp_client(void*); -#endif /* _WOLFSSH_SCPCLIENT_H_ */ +#endif /* _WOLFSSH_EXAMPLES_SCPCLIENT_H_ */ diff --git a/examples/server/server.h b/examples/server/server.h index 172b962..f7732c9 100644 --- a/examples/server/server.h +++ b/examples/server/server.h @@ -19,13 +19,11 @@ */ -#pragma once - -#ifndef _WOLFSSH_SERVER_H_ -#define _WOLFSSH_SERVER_H_ +#ifndef _WOLFSSH_EXAMPLES_SERVER_H_ +#define _WOLFSSH_EXAMPLES_SERVER_H_ THREAD_RETURN WOLFSSH_THREAD server_test(void* args); -#endif /* _WOLFSSH_SERVER_H_ */ +#endif /* _WOLFSSH_EXAMPLES_SERVER_H_ */ diff --git a/examples/sftpclient/sftpclient.h b/examples/sftpclient/sftpclient.h index b3a7d85..95ac291 100644 --- a/examples/sftpclient/sftpclient.h +++ b/examples/sftpclient/sftpclient.h @@ -19,9 +19,10 @@ */ -#pragma once - - +#ifndef _WOLFSSH_EXAMPLES_SFTPCLIENT_H_ +#define _WOLFSSH_EXAMPLES_SFTPCLIENT_H_ THREAD_RETURN WOLFSSH_THREAD sftpclient_test(void* args); +#endif /* _WOLFSSH_EXAMPLES_SFTPCLIENT_H_ */ +