Просмотр исходного кода

Adds file normalization

Signed-off-by: Martin Melik Merkumians <melik-merkumians@acin.tuwien.ac.at>
Martin Melik Merkumians 6 лет назад
Родитель
Сommit
399a774015
2 измененных файлов с 81 добавлено и 65 удалено
  1. 17 1
      .gitattributes
  2. 64 64
      source/src/ports/POSIX/networkhandler.c

+ 17 - 1
.gitattributes

@@ -1,4 +1,20 @@
+# Code formatter settings
 *.c filter=uncrustify
 *.cpp filter=uncrustify
 *.h filter=uncrustify
-*.hpp filter=uncrustify
+*.hpp filter=uncrustify
+
+# Set the default behavior, in case people don't have core.autocrlf set.
+* text=auto
+
+# Explicitly declare text files you want to always be normalized and converted
+# to native line endings on checkout.
+*.c text
+*.h text
+
+# Declare files that will always have CRLF line endings on checkout.
+*.sln text eol=crlf
+
+# Denote all files that are truly binary and should not be modified.
+*.png binary
+*.jpg binary

+ 64 - 64
source/src/ports/POSIX/networkhandler.c

@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2009, Rockwell Automation, Inc.
- * All rights reserved.
- *
- ******************************************************************************/
-#include <unistd.h>
-#include <sys/time.h>
-#include <time.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-
-#include "networkhandler.h"
-
-#include "opener_error.h"
-#include "trace.h"
-#include "encap.h"
-#include "opener_user_conf.h"
-
-MicroSeconds GetMicroSeconds(void) {
-  struct timespec now = { .tv_nsec = 0, .tv_sec = 0 };
-
-  int error = clock_gettime( CLOCK_MONOTONIC, &now );
-  OPENER_ASSERT(-1 != error)
-  MicroSeconds micro_seconds =  (MicroSeconds)now.tv_nsec / 1000ULL +
-                               now.tv_sec * 1000000ULL;
-  return micro_seconds;
-}
-
-MilliSeconds GetMilliSeconds(void) {
-  return (MilliSeconds) (GetMicroSeconds() / 1000ULL);
-}
-
-EipStatus NetworkHandlerInitializePlatform(void) {
-  /* Add platform dependent code here if necessary */
-  return kEipStatusOk;
-}
-
-void CloseSocketPlatform(int socket_handle) {
-  if(0 != shutdown(socket_handle, SHUT_RDWR) ) {
-    int error_code = GetSocketErrorNumber();
-    char *error_message = GetErrorMessage(error_code);
-    OPENER_TRACE_ERR("Could not close socket %d - Error Code: %d - %s\n",
-                     socket_handle,
-                     error_code,
-                     error_message);
-    FreeErrorMessage(error_message);
-  }
-  close(socket_handle);
-}
-
-int SetSocketToNonBlocking(int socket_handle) {
-  return fcntl(socket_handle, F_SETFL, fcntl(socket_handle,
-                                             F_GETFL,
-                                             0) | O_NONBLOCK);
-}
-
-int SetQosOnSocket(const int socket,
-                   CipUsint qos_value) {
-  int set_tos = qos_value;
-  return setsockopt(socket, IPPROTO_IP, IP_TOS, &set_tos, sizeof(set_tos) );
-}
+/*******************************************************************************
+ * Copyright (c) 2009, Rockwell Automation, Inc.
+ * All rights reserved.
+ *
+ ******************************************************************************/
+#include <unistd.h>
+#include <sys/time.h>
+#include <time.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#include "networkhandler.h"
+
+#include "opener_error.h"
+#include "trace.h"
+#include "encap.h"
+#include "opener_user_conf.h"
+
+MicroSeconds GetMicroSeconds(void) {
+  struct timespec now = { .tv_nsec = 0, .tv_sec = 0 };
+
+  int error = clock_gettime( CLOCK_MONOTONIC, &now );
+  OPENER_ASSERT(-1 != error)
+  MicroSeconds micro_seconds =  (MicroSeconds)now.tv_nsec / 1000ULL +
+                               now.tv_sec * 1000000ULL;
+  return micro_seconds;
+}
+
+MilliSeconds GetMilliSeconds(void) {
+  return (MilliSeconds) (GetMicroSeconds() / 1000ULL);
+}
+
+EipStatus NetworkHandlerInitializePlatform(void) {
+  /* Add platform dependent code here if necessary */
+  return kEipStatusOk;
+}
+
+void CloseSocketPlatform(int socket_handle) {
+  if(0 != shutdown(socket_handle, SHUT_RDWR) ) {
+    int error_code = GetSocketErrorNumber();
+    char *error_message = GetErrorMessage(error_code);
+    OPENER_TRACE_ERR("Could not close socket %d - Error Code: %d - %s\n",
+                     socket_handle,
+                     error_code,
+                     error_message);
+    FreeErrorMessage(error_message);
+  }
+  close(socket_handle);
+}
+
+int SetSocketToNonBlocking(int socket_handle) {
+  return fcntl(socket_handle, F_SETFL, fcntl(socket_handle,
+                                             F_GETFL,
+                                             0) | O_NONBLOCK);
+}
+
+int SetQosOnSocket(const int socket,
+                   CipUsint qos_value) {
+  int set_tos = qos_value;
+  return setsockopt(socket, IPPROTO_IP, IP_TOS, &set_tos, sizeof(set_tos) );
+}