From 456cf2344a2ec1b4e6a68980569e7767e5fb5f3d Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Fri, 15 Mar 2019 11:03:52 +0100 Subject: [HICN-118] Add .clang-format file, format all libtransport project. Change-Id: I61392567b648014eaa111fc2567770192fccffa6 Signed-off-by: Mauro Sardara --- libtransport/.clang-format | 14 ++++++++++++++ libtransport/format_all.sh | 8 ++++++++ libtransport/src/hicn/transport/core/portal.h | 5 +++-- .../transport/interfaces/socket_options_default_values.h | 4 ++-- libtransport/src/hicn/transport/utils/fd_deadline_timer.h | 3 ++- 5 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 libtransport/.clang-format create mode 100644 libtransport/format_all.sh (limited to 'libtransport') diff --git a/libtransport/.clang-format b/libtransport/.clang-format new file mode 100644 index 000000000..513da4d69 --- /dev/null +++ b/libtransport/.clang-format @@ -0,0 +1,14 @@ +# Copyright (c) 2017-2019 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +BasedOnStyle: Google \ No newline at end of file diff --git a/libtransport/format_all.sh b/libtransport/format_all.sh new file mode 100644 index 000000000..0591413e0 --- /dev/null +++ b/libtransport/format_all.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -xue + +SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P ) + +pushd ${SCRIPT_PATH} +find src/ -type f '(' -name '*.c' -o -name '*.cc' -o -name '*.h' ')' -exec clang-format -style=file -i {} \; +popd \ No newline at end of file diff --git a/libtransport/src/hicn/transport/core/portal.h b/libtransport/src/hicn/transport/core/portal.h index a88bac964..07f84075e 100644 --- a/libtransport/src/hicn/transport/core/portal.h +++ b/libtransport/src/hicn/transport/core/portal.h @@ -407,8 +407,9 @@ class Portal { } } - - TRANSPORT_ALWAYS_INLINE void killConnection() { forwarder_interface_.closeConnection(); } + TRANSPORT_ALWAYS_INLINE void killConnection() { + forwarder_interface_.closeConnection(); + } TRANSPORT_ALWAYS_INLINE void clear() { for (auto &pend_interest : pending_interest_hash_table_) { diff --git a/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h b/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h index 046fea892..13029e83a 100644 --- a/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h +++ b/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h @@ -61,8 +61,8 @@ static constexpr uint32_t rate_choice = 0; static constexpr uint32_t transport_protocol_min_retransmissions = 0; static constexpr uint32_t transport_protocol_max_retransmissions = 128; static constexpr uint32_t max_content_object_size = 8096; -static constexpr uint32_t min_window_size = 1; // Interests -static constexpr uint32_t max_window_size = 256 * 2; // Interests +static constexpr uint32_t min_window_size = 1; // Interests +static constexpr uint32_t max_window_size = 256 * 2; // Interests } // namespace default_values diff --git a/libtransport/src/hicn/transport/utils/fd_deadline_timer.h b/libtransport/src/hicn/transport/utils/fd_deadline_timer.h index 6fb823a05..1c14513c9 100644 --- a/libtransport/src/hicn/transport/utils/fd_deadline_timer.h +++ b/libtransport/src/hicn/transport/utils/fd_deadline_timer.h @@ -53,7 +53,8 @@ class FdDeadlineTimer : public DeadlineTimer { reactor_.addFileDescriptor( timer_fd_, events, - [callback = std::forward(callback)](const Event &event) -> int { + [callback = std::forward(callback)]( + const Event &event) -> int { uint64_t s = 0; std::error_code ec; -- cgit 1.2.3-korg