From 9aa3b3f868c23f2afeeba0bfdd05aaa7c55f4da6 Mon Sep 17 00:00:00 2001 From: Yonggoo Kang Date: Thu, 7 Mar 2024 11:22:16 +0900 Subject: [PATCH] Remove trailing whitespace Change-Id: Icbfa6f1b3101adf88b59277f32e2ea41d49336f8 --- include/webauthn-types.h | 2 +- include/webauthn.h | 58 +++++++++++++++++++++--------------------- srcs/client/client-request.h | 4 +-- srcs/common/connection.cpp | 8 +++--- srcs/common/message-buffer.h | 6 ++--- srcs/common/protocols.cpp | 2 +- srcs/common/protocols.h | 2 +- srcs/common/serialization.cpp | 4 +-- srcs/common/utils.h | 4 +-- srcs/server/request.h | 2 +- srcs/server/service.cpp | 4 +-- srcs/server/socket-manager.cpp | 2 +- tests/serialization-test.cpp | 6 ++--- tests/webauthn-client-test.cpp | 20 +++++++-------- 14 files changed, 62 insertions(+), 62 deletions(-) diff --git a/include/webauthn-types.h b/include/webauthn-types.h index 378ec1b..bf8e6c5 100644 --- a/include/webauthn-types.h +++ b/include/webauthn-types.h @@ -269,7 +269,7 @@ typedef struct __wauthn_pubkey_cred_descriptor { wauthn_pubkey_cred_type_e type; wauthn_buffer_s *id; unsigned int transports; /**< To represent multiple transports, - #wauthn_authenticator_transport_e can be ORed multiple times */ + #wauthn_authenticator_transport_e can be ORed multiple times */ } wauthn_pubkey_cred_descriptor_s; /** diff --git a/include/webauthn.h b/include/webauthn.h index e4eac41..e94b8c5 100644 --- a/include/webauthn.h +++ b/include/webauthn.h @@ -37,14 +37,14 @@ extern "C" { /** * @brief Set API version that the caller uses. - * + * * @since_tizen 9.0 - * + * * @remarks This API must be called before other APIs are called. - * + * * @param[in] api_version_number API version number to set. * Use #WATUH_API_VERSION_NUMBER as an input. - * + * * @return @c 0 on success, * otherwise a negative error value * @retval #WAUTHN_ERROR_NONE Successful @@ -54,20 +54,20 @@ WEBAUTHN_API int wauthn_set_api_version(int api_version_number); /** * @brief Get information on authenticator types that the client platform supports. - * - * @since_tizen 9.0 - * + * + * @since_tizen 9.0 + * * @remarks This version of API only support hybrid roaming authenticator. - * So the bit for #WAUTHN_TRANSPORT_HYBRID is set 1 and + * So the bit for #WAUTHN_TRANSPORT_HYBRID is set 1 and * bits for other authenticators set 0. * Each authenticators can be checked using bitwise operation. * Here is sample code for check supported authenticators, * if (supported & WAUTHN_TRANSPORT_HYBRID) - * then // hybrid transport is supported + * then // hybrid transport is supported * else // hybrid transport is not supported - * + * * @param[out] supported The pointer to an unsigned int for return supported authenticators - * + * * @return @c 0 on success, * otherwise a negative error value * @retval #WAUTHN_ERROR_NONE Successful @@ -78,16 +78,16 @@ WEBAUTHN_API int wauthn_supported_authenticators(unsigned int *supported); /** * @brief Make a new web authentication credential and store it to authenticator. - * + * * @since_tizen 9.0 - * + * * @remarks [TBD] something important to remember - * + * * @param[in] client_data UTF-8 encoded JSON serialization of the client data - * @param[in] options This argument is a #wauthn_pubkey_cred_creation_options_s object specifying the + * @param[in] options This argument is a #wauthn_pubkey_cred_creation_options_s object specifying the * desired attributes of the to-be-created public key credential * @param[in] callbacks The callback functions to be invoked - * + * * @return @c 0 on success, * otherwise a negative error value * @retval #WAUTHN_ERROR_NONE Successful @@ -95,9 +95,9 @@ WEBAUTHN_API int wauthn_supported_authenticators(unsigned int *supported); * @retval #WAUTHN_ERROR_NOT_ALLOWED Not allowed in the current context including busy state * @retval #WAUTHN_ERROR_INVALID_STATE Get in an invalid state * @retval #WAUTHN_ERROR_CANCELLED Cancelled by cancel request - * + * * @pre [TBD] Precondition - * + * * @see wauthn_get_assertion() * @see #wauthn_pubkey_cred_creation_options_s * @see #wauthn_mc_callbacks_s @@ -108,24 +108,24 @@ WEBAUTHN_API int wauthn_make_credential( const wauthn_client_data_s *client_data /** * @brief Get assertion from authenticator. - * + * * @since_tizen 9.0 - * + * * @remarks [TBD] Something important to remember - * + * * @param[in] client_data UTF-8 encoded JSON serialization of the client data - * @param[in] options This argument is a #wauthn_pubkey_cred_request_options_s object specifying the - * desired attributes of the public key credential to discover + * @param[in] options This argument is a #wauthn_pubkey_cred_request_options_s object specifying the + * desired attributes of the public key credential to discover * @param[in] callbacks The callback functions to be invoked - * + * * @return @c 0 on success, * @retval #WAUTHN_ERROR_NONE Successful * @retval #WAUTHN_ERROR_INVALID_PARAMETER Input parameter is invalid * @retval #WAUTHN_ERROR_NOT_ALLOWED Not allowed in the current context including busy state * @retval #WAUTHN_ERROR_CANCELLED Cancelled by cancel request - * + * * @pre [TBD] Precondition - * + * * @see wauthn_make_credential() * @see #wauthn_pubkey_cred_request_options_s * @see #wauthn_ga_callbacks_s @@ -136,13 +136,13 @@ WEBAUTHN_API int wauthn_get_assertion( const wauthn_client_data_s *client_data, /** * @brief Stops operation about previous wauthn_make_credential or wauthn_get_assertion call. - * + * * @since_tizen 9.0 - * + * * @return @c 0 on success, * @retval #WAUTHN_ERROR_NONE Successful * @retval #WAUTHN_ERROR_NOT_ALLOWED Not allowed in the current context - * + * * @see wauthn_make_credential() * @see wauthn_get_assertion() */ diff --git a/srcs/client/client-request.h b/srcs/client/client-request.h index b655a7e..97bcbd4 100644 --- a/srcs/client/client-request.h +++ b/srcs/client/client-request.h @@ -36,7 +36,7 @@ namespace WA { class ClientRequest { public: - explicit ClientRequest(WebAuthnCall action) : + explicit ClientRequest(WebAuthnCall action) : m_action(action), m_conn(std::make_unique()) { @@ -60,7 +60,7 @@ public: { return m_status != WAUTHN_ERROR_NONE; } - + ClientRequest &send() { if (m_sent) diff --git a/srcs/common/connection.cpp b/srcs/common/connection.cpp index ec771ee..5498ec3 100644 --- a/srcs/common/connection.cpp +++ b/srcs/common/connection.cpp @@ -165,11 +165,11 @@ Connection::~Connection() int Connection::createConnect(char const * const interface) { int ret = WAUTHN_ERROR_NONE; - + if (WAUTHN_ERROR_NONE != (ret = m_sock->Connect(interface))) { LogError("Error in SockRAII"); } - + return ret; } @@ -205,10 +205,10 @@ int Connection::recv(MessageBuffer &buffer) temp = readBytesInternal(buffer.PayloadPtr(), buffer.PayloadSize()); if (temp <= 0) return WAUTHN_ERROR_SOCKET; - + if (MessageBuffer::InputResult::Done != buffer.InputDone(sizeof(size_t) + temp)) return WAUTHN_ERROR_SOCKET; - + buffer.ModeStreaming(); return WAUTHN_ERROR_NONE; } diff --git a/srcs/common/message-buffer.h b/srcs/common/message-buffer.h index d02a713..469844d 100644 --- a/srcs/common/message-buffer.h +++ b/srcs/common/message-buffer.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License * - * + * * @file message-buffer.h * @version 1.0 * @brief Implementatin of MessageBuffer. @@ -266,7 +266,7 @@ public: assert(messageSize >= m_offset); assert(messageSize <= m_bufferSize); - + return messageSize - m_offset; } @@ -343,7 +343,7 @@ public: assert(m_buffer); assert(m_offset == 0); auto payloadSize = *reinterpret_cast(m_buffer); - + if (payloadSize > m_bufferSize) ReserveMessageSize(payloadSize); diff --git a/srcs/common/protocols.cpp b/srcs/common/protocols.cpp index 27cfed3..36cfbcb 100644 --- a/srcs/common/protocols.cpp +++ b/srcs/common/protocols.cpp @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License * - * + * * @file protocols.cpp * @version 1.0 * @brief List of all protocols supported by webauthn diff --git a/srcs/common/protocols.h b/srcs/common/protocols.h index 2f6f861..d14ef4f 100644 --- a/srcs/common/protocols.h +++ b/srcs/common/protocols.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License * - * + * * @file protocols.h * @version 1.0 * @brief This file contains list of all protocols suported by webauthn diff --git a/srcs/common/serialization.cpp b/srcs/common/serialization.cpp index 1e0d0b2..654a31e 100644 --- a/srcs/common/serialization.cpp +++ b/srcs/common/serialization.cpp @@ -42,7 +42,7 @@ void __checkArraySize(size_t size) { // For struct body itself void WAuthnCtypeSerializer::serializeStructBody(IStream& stream, const void *data, size_t struct_size) { - size_t lengh = (data == nullptr) ? 0 : struct_size; + size_t lengh = (data == nullptr) ? 0 : struct_size; serialize(stream, reinterpret_cast(data), lengh); } void WAuthnCtypeSerializer::deserializeStructBody(IStream& stream, void **data, size_t struct_size) { @@ -51,7 +51,7 @@ void WAuthnCtypeSerializer::deserializeStructBody(IStream& stream, void **data, size_t length = 0; deserialize(stream, reinterpret_cast(data), &length); if (length != 0 && length != struct_size) - ThrowMsg(SerializationException::InvalidStreamData, "Invalid length: length=" << length + ThrowMsg(SerializationException::InvalidStreamData, "Invalid length: length=" << length << ", struct_size=" << struct_size); } diff --git a/srcs/common/utils.h b/srcs/common/utils.h index 038b159..31da31a 100644 --- a/srcs/common/utils.h +++ b/srcs/common/utils.h @@ -103,10 +103,10 @@ void checkParameters(wauthn_mc_callbacks_s *callbacks); void checkParameters(wauthn_ga_callbacks_s *callbacks); void checkParameters(wauthn_hybrid_linked_data_s *linked_device, wauthn_cb_display_qrcode qrcode_callback); -void checkParameters(const wauthn_client_data_s *client_data, +void checkParameters(const wauthn_client_data_s *client_data, const wauthn_pubkey_cred_creation_options_s *options, wauthn_mc_callbacks_s *callbacks); -void checkParameters(const wauthn_client_data_s *client_data, +void checkParameters(const wauthn_client_data_s *client_data, const wauthn_pubkey_cred_request_options_s *options, wauthn_ga_callbacks_s *callbacks); diff --git a/srcs/server/request.h b/srcs/server/request.h index 976109d..3bedeb7 100644 --- a/srcs/server/request.h +++ b/srcs/server/request.h @@ -39,7 +39,7 @@ public: Serialization::Serialize(buffer, WAUTHN_ERROR_INVALID_STATE); else Serialization::Serialize(buffer, ret, std::string(qr_contents)); - + userData->service->GetSocketmanager()->Write(userData->connectionID, std::move(buffer)); } diff --git a/srcs/server/service.cpp b/srcs/server/service.cpp index 173435e..0462f72 100644 --- a/srcs/server/service.cpp +++ b/srcs/server/service.cpp @@ -118,7 +118,7 @@ void Service::Process(Event &&msg) wauthn_client_data_s *clientData; typename T::Options *options; Deserialization::Deserialize(msg.buffer, &clientData, &options); - + MessageBuffer responseBuffer(m_serviceManager->newMessage()); responseBuffer.ModeStreaming(); int ret = WAUTHN_ERROR_NONE; @@ -135,7 +135,7 @@ void Service::Process(Event &&msg) } Serialization::Serialize(responseBuffer, ret); - m_serviceManager->Write(msg.connectionID, std::move(responseBuffer)); + m_serviceManager->Write(msg.connectionID, std::move(responseBuffer)); if (0 == isBusy) { std::thread worker(&Service::Worker, this, msg.connectionID, clientData, options); diff --git a/srcs/server/socket-manager.cpp b/srcs/server/socket-manager.cpp index 1409752..0ca886a 100644 --- a/srcs/server/socket-manager.cpp +++ b/srcs/server/socket-manager.cpp @@ -367,7 +367,7 @@ void SocketManager::Write(ConnectionID connectionID, MessageBuffer &&buffer) { desc.isActiveThisGeneration = true; desc.buffer = std::move(buffer); desc.buffer.ModeOutput(); - + LogDebug("Calling ReadyforWrite"); ReadyForWrite(connectionID.sock); } diff --git a/tests/serialization-test.cpp b/tests/serialization-test.cpp index fcea9f0..852c28e 100644 --- a/tests/serialization-test.cpp +++ b/tests/serialization-test.cpp @@ -281,7 +281,7 @@ void __testDeserializeInvalidMember(T data) { MessageBuffer buffer; T *deserialized = nullptr; - __fillBufferWithTestData(buffer, sizeof(T), + __fillBufferWithTestData(buffer, sizeof(T), reinterpret_cast(&data), sizeof(T)); try { @@ -528,7 +528,7 @@ TEST_F(WAuthnSerializationTest, wauthn_authenticator_attestation_response_s_P) __compareWAuthnAuthenticatorAttestationResponseS); __testSerialization(&SerializationTestData::emptyAuthenticatorAttestationResponse, __compareWAuthnAuthenticatorAttestationResponseS); - __testSerialization(static_cast(nullptr), + __testSerialization(static_cast(nullptr), __compareWAuthnAuthenticatorAttestationResponseS); } @@ -562,7 +562,7 @@ TEST_F(WAuthnSerializationTest, wauthn_authenticator_assertion_response_s_P) __compareWAuthnAuthenticatorAssertionResponseS); __testSerialization(&SerializationTestData::emptyAuthenticatorAssertionResponse, __compareWAuthnAuthenticatorAssertionResponseS); - __testSerialization(static_cast(nullptr), + __testSerialization(static_cast(nullptr), __compareWAuthnAuthenticatorAssertionResponseS); } TEST_F(WAuthnSerializationTest, wauthn_authenticator_assertion_response_s_N1) diff --git a/tests/webauthn-client-test.cpp b/tests/webauthn-client-test.cpp index 4869c9d..15e2177 100644 --- a/tests/webauthn-client-test.cpp +++ b/tests/webauthn-client-test.cpp @@ -236,9 +236,9 @@ void test_cb_mc_on_response(const wauthn_pubkey_credential_attestaion_s *pubkey_ std::cout << "user_data is null" << std::endl; else std::cout << "user_data is not null:" << - (static_cast(user_data))->test_data << + (static_cast(user_data))->test_data << ", " << (static_cast(user_data))->test_int << std::endl; - + } void test_cb_ga_on_response(const wauthn_pubkey_credential_assertion_s *pubkey_cred, @@ -253,8 +253,8 @@ void test_cb_ga_on_response(const wauthn_pubkey_credential_assertion_s *pubkey_c if (user_data == nullptr) std::cout << "user_data is null" << std::endl; else - std::cout << "user_data is not null:" << - (static_cast(user_data))->test_data << + std::cout << "user_data is not null:" << + (static_cast(user_data))->test_data << ", " << (static_cast(user_data))->test_int << std::endl; } @@ -262,7 +262,7 @@ void test_cb_ga_on_response(const wauthn_pubkey_credential_assertion_s *pubkey_c TEST_F(WebAuthnTest, testMCRequest) { int ret = WAUTHN_ERROR_NONE; - + wauthn_mc_callbacks_s *callbacks = nullptr; callbacks = (wauthn_mc_callbacks_s*) calloc(1, sizeof(wauthn_mc_callbacks_s)); callbacks->qrcode_callback = test_cb_display_qrcode; @@ -283,7 +283,7 @@ TEST_F(WebAuthnTest, testMCRequest) TEST_F(WebAuthnTest, testMCRequestQR) { int ret = WAUTHN_ERROR_NONE; - + wauthn_mc_callbacks_s *callbacks = nullptr; callbacks = (wauthn_mc_callbacks_s*) calloc(1, sizeof(wauthn_mc_callbacks_s)); callbacks->qrcode_callback = test_cb_display_qrcode; @@ -305,7 +305,7 @@ TEST_F(WebAuthnTest, testMCRequestQR) TEST_F(WebAuthnTest, testGARequest) { int ret = WAUTHN_ERROR_NONE; - + wauthn_ga_callbacks_s *callbacks = nullptr; callbacks = (wauthn_ga_callbacks_s*) calloc(1, sizeof(wauthn_ga_callbacks_s)); callbacks->qrcode_callback = test_cb_display_qrcode; @@ -326,7 +326,7 @@ TEST_F(WebAuthnTest, testGARequest) TEST_F(WebAuthnTest, testGARequestQR) { int ret = WAUTHN_ERROR_NONE; - + wauthn_ga_callbacks_s *callbacks = nullptr; callbacks = (wauthn_ga_callbacks_s*) calloc(1, sizeof(wauthn_ga_callbacks_s)); callbacks->qrcode_callback = test_cb_display_qrcode; @@ -347,7 +347,7 @@ TEST_F(WebAuthnTest, testGARequestQR) TEST_F(WebAuthnTest, testNotAllowedByBusy) { int ret = WAUTHN_ERROR_NONE; - + wauthn_mc_callbacks_s *mc_callbacks = nullptr; mc_callbacks = (wauthn_mc_callbacks_s*) calloc(1, sizeof(wauthn_mc_callbacks_s)); mc_callbacks->qrcode_callback = test_cb_display_qrcode; @@ -379,7 +379,7 @@ TEST_F(WebAuthnTest, testNotAllowedByBusy) TEST_F(WebAuthnTest, testCancelOK) { int ret = WAUTHN_ERROR_NONE; - + wauthn_mc_callbacks_s *mc_callbacks = nullptr; mc_callbacks = (wauthn_mc_callbacks_s*) calloc(1, sizeof(wauthn_mc_callbacks_s)); mc_callbacks->qrcode_callback = test_cb_display_qrcode; -- 2.7.4