aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-03-15 11:03:52 +0100
committerMauro Sardara <msardara@cisco.com>2019-03-15 11:07:05 +0100
commit456cf2344a2ec1b4e6a68980569e7767e5fb5f3d (patch)
tree0f511f42db6f7d868d51b8862e902fc4b58416ef
parente1033d6fac2ad70891a96695284b2c1e7013c91c (diff)
[HICN-118] Add .clang-format file, format all libtransport project.
Change-Id: I61392567b648014eaa111fc2567770192fccffa6 Signed-off-by: Mauro Sardara <msardara@cisco.com>
-rw-r--r--libtransport/.clang-format14
-rw-r--r--libtransport/format_all.sh8
-rw-r--r--libtransport/src/hicn/transport/core/portal.h5
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_options_default_values.h4
-rw-r--r--libtransport/src/hicn/transport/utils/fd_deadline_timer.h3
5 files changed, 29 insertions, 5 deletions
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<FdDeadlineTimer> {
reactor_.addFileDescriptor(
timer_fd_, events,
- [callback = std::forward<WaitHandler &&>(callback)](const Event &event) -> int {
+ [callback = std::forward<WaitHandler &&>(callback)](
+ const Event &event) -> int {
uint64_t s = 0;
std::error_code ec;