ソースを参照

【删掉】宏定义空格

Ernest 6 年 前
コミット
64be9c9463

+ 2 - 2
examples/rws_example.c

@@ -25,9 +25,9 @@
 #include <stdlib.h>
 
 #if (RTTHREAD_VERSION < 30100)
-    #define DBG_SECTION_NAME "[LIBRWS.Test] "
+#define DBG_SECTION_NAME "[LIBRWS.Test] "
 #else
-    #define DBG_SECTION_NAME "LIBRWS.Test"
+#define DBG_SECTION_NAME "LIBRWS.Test"
 #endif
 #define DBG_ENABLE
 #define DBG_LEVEL DBG_LOG

+ 17 - 17
librws/inc/librws.h

@@ -31,44 +31,44 @@
 
 // check windows
 #if defined(WIN32) || defined(_WIN32) || defined(WIN32_LEAN_AND_MEAN) || defined(_WIN64) || defined(WIN64)
-    #define RWS_OS_WINDOWS 1
+#define RWS_OS_WINDOWS 1
 #endif
 
 // extern
 #if defined(__cplusplus) || defined(_cplusplus)
-    #define RWS_EXTERN extern "C"
+#define RWS_EXTERN extern "C"
 #else
-    #define RWS_EXTERN extern
+#define RWS_EXTERN extern
 #endif
 
 // attribute
 #if defined(__GNUC__)
-    #if (__GNUC__ >= 4)
-        #if defined(__cplusplus) || defined(_cplusplus)
-            #define RWS_ATTRIB __attribute__((visibility("default")))
-        #else
-            #define RWS_ATTRIB __attribute__((visibility("default")))
-        #endif
-    #endif
+#if (__GNUC__ >= 4)
+#if defined(__cplusplus) || defined(_cplusplus)
+#define RWS_ATTRIB __attribute__((visibility("default")))
+#else
+#define RWS_ATTRIB __attribute__((visibility("default")))
+#endif
+#endif
 #endif
 
 // check attrib and define empty if not defined
 #if !defined(RWS_ATTRIB)
-    #define RWS_ATTRIB
+#define RWS_ATTRIB
 #endif
 
 // dll api
 #if defined(RWS_OS_WINDOWS)
-    #if defined(RWS_BUILD)
-        #define RWS_DYLIB_API __declspec(dllexport)
-    #else
-        #define RWS_DYLIB_API __declspec(dllimport)
-    #endif
+#if defined(RWS_BUILD)
+#define RWS_DYLIB_API __declspec(dllexport)
+#else
+#define RWS_DYLIB_API __declspec(dllimport)
+#endif
 #endif
 
 // check dll api and define empty if not defined
 #if !defined(RWS_DYLIB_API)
-    #define RWS_DYLIB_API
+#define RWS_DYLIB_API
 #endif
 
 // combined lib api

+ 17 - 17
librws/inc/rws_common.h

@@ -27,9 +27,9 @@
 #include <rtthread.h>
 
 #if (RTTHREAD_VERSION <= 30100)
-    #define DBG_SECTION_NAME "[LIBRWS] "
+#define DBG_SECTION_NAME "[LIBRWS] "
 #else
-    #define DBG_SECTION_NAME "LIBRWS"
+#define DBG_SECTION_NAME "LIBRWS"
 #endif
 #define DBG_ENABLE
 #define DBG_LEVEL DBG_INFO
@@ -41,38 +41,38 @@
 /* gcc -dM -E - < /dev/null */
 /* check windows */
 #if !defined(RWS_OS_WINDOWS)
-    #if defined(WIN32) || defined(_WIN32) || defined(WIN32_LEAN_AND_MEAN) || defined(_WIN64) || defined(WIN64)
-        #define RWS_OS_WINDOWS 1
-    #endif
+#if defined(WIN32) || defined(_WIN32) || defined(WIN32_LEAN_AND_MEAN) || defined(_WIN64) || defined(WIN64)
+#define RWS_OS_WINDOWS 1
+#endif
 #endif
 /* end check windows */
 
 /* check Apple */
 #if !defined(RWS_OS_APPLE)
-    #if defined(__APPLE__) || defined(__MACH__)
-        #define RWS_OS_APPLE 1
-    #endif
+#if defined(__APPLE__) || defined(__MACH__)
+#define RWS_OS_APPLE 1
+#endif
 #endif
 
 /* check Unix */
 #if !defined(RWS_OS_UNIX)
-    #if defined(__unix) || defined(unix) || defined(__unix__)
-        #define RWS_OS_UNIX 1
-    #endif
+#if defined(__unix) || defined(unix) || defined(__unix__)
+#define RWS_OS_UNIX 1
+#endif
 #endif
 
 /* check Linux */
 #if !defined(RWS_OS_LINUX)
-    #if defined(__linux__) || defined(__linux)
-        #define RWS_OS_LINUX 1
-    #endif
+#if defined(__linux__) || defined(__linux)
+#define RWS_OS_LINUX 1
+#endif
 #endif
 
 /* check Android */
 #if !defined(RWS_OS_ANDROID)
-    #if defined(__ANDROID__) || defined(ANDROID)
-        #define RWS_OS_ANDROID 1
-    #endif
+#if defined(__ANDROID__) || defined(ANDROID)
+#define RWS_OS_ANDROID 1
+#endif
 #endif
 
 #endif

+ 17 - 17
librws/inc/rws_socket.h

@@ -26,15 +26,15 @@
 #include "rws_common.h"
 
 #if defined(RWS_OS_WINDOWS)
-    #include <winsock2.h>
-    #include <ws2tcpip.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
 #else
-    #include <netdb.h>
-    #include <sys/socket.h>
-    #include <sys/types.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <sys/types.h>
     //#include <netinet/tcp.h>
-    #include <fcntl.h>
-    #include <unistd.h>
+#include <fcntl.h>
+#include <unistd.h>
 #endif
 
 #include <assert.h>
@@ -46,22 +46,22 @@
 #include "rws_list.h"
 
 #ifdef LIBRWS_USING_MBED_TLS
-    #include "mbedtls/net.h"
-    #include "mbedtls/ssl.h"
-    #include "mbedtls/certs.h"
-    #include "mbedtls/entropy.h"
-    #include "mbedtls/ctr_drbg.h"
-    #include "mbedtls/debug.h"
+#include "mbedtls/net.h"
+#include "mbedtls/ssl.h"
+#include "mbedtls/certs.h"
+#include "mbedtls/entropy.h"
+#include "mbedtls/ctr_drbg.h"
+#include "mbedtls/debug.h"
 #endif
 
 #if defined(RWS_OS_WINDOWS)
     typedef SOCKET rws_socket_t;
-    #define RWS_INVALID_SOCKET INVALID_SOCKET
-    #define RWS_SOCK_CLOSE(sock) closesocket(sock)
+#define RWS_INVALID_SOCKET INVALID_SOCKET
+#define RWS_SOCK_CLOSE(sock) closesocket(sock)
 #else
     typedef int rws_socket_t;
-    #define RWS_INVALID_SOCKET -1
-    #define RWS_SOCK_CLOSE(sock) close(sock)
+#define RWS_INVALID_SOCKET -1
+#define RWS_SOCK_CLOSE(sock) close(sock)
 #endif
 
 #ifdef LIBRWS_USING_MBED_TLS

+ 6 - 6
librws/inc/rws_string.h

@@ -29,13 +29,13 @@
 #include "rws_common.h"
 
 #if defined(_MSC_VER)
-    #define rws_sprintf(s, l, f, ...) sprintf_s(s, l, f, __VA_ARGS__)
-    #define rws_sscanf(s, f, ...) sscanf_s(s, f, __VA_ARGS__)
-    #define rws_strerror(e) strerror(e)
+#define rws_sprintf(s, l, f, ...) sprintf_s(s, l, f, __VA_ARGS__)
+#define rws_sscanf(s, f, ...) sscanf_s(s, f, __VA_ARGS__)
+#define rws_strerror(e) strerror(e)
 #else
-    #define rws_sprintf(s, l, f, ...) sprintf(s, f, __VA_ARGS__)
-    #define rws_sscanf(s, f, ...) sscanf(s, f, __VA_ARGS__)
-    #define rws_strerror(e) strerror(e)
+#define rws_sprintf(s, l, f, ...) sprintf(s, f, __VA_ARGS__)
+#define rws_sscanf(s, f, ...) sscanf(s, f, __VA_ARGS__)
+#define rws_strerror(e) strerror(e)
 #endif
 
 char *rws_string_copy(const char *str);

+ 3 - 3
librws/src/rws_socketpriv.c

@@ -33,8 +33,8 @@
 #define RWS_RECEIVE_BUFF_SIZE   (2048) /* 接受buff分配内存大小 */
 
 #ifndef RWS_OS_WINDOWS
-    #define WSAEWOULDBLOCK EAGAIN
-    #define WSAEINPROGRESS EINPROGRESS
+#define WSAEWOULDBLOCK EAGAIN
+#define WSAEINPROGRESS EINPROGRESS
 #endif
 
 #if ((DBG_LEVEL) == (DBG_LOG))
@@ -1543,7 +1543,7 @@ void rws_socket_check_write_error(_rws_socket *s, int error_num)
 
 #ifdef LIBRWS_USING_MBED_TLS
 #if defined(MBEDTLS_DEBUG_C)
-    #define DEBUG_LEVEL 1
+#define DEBUG_LEVEL 1
 #endif
 
 void rws_debug(void *ctx, int level, const char *file, int line, const char *str)

+ 1 - 1
librws/src/rws_socketpub.c

@@ -27,7 +27,7 @@
 #include <assert.h>
 
 #if !defined(RWS_OS_WINDOWS)
-    #include <signal.h>
+#include <signal.h>
 #endif
 
 // public

+ 3 - 3
librws/src/rws_thread.c

@@ -28,10 +28,10 @@
 #include <assert.h>
 
 #if defined(RWS_OS_WINDOWS)
-    #include <windows.h>
+#include <windows.h>
 #else
-    #include <pthread.h>
-    #include <unistd.h>
+#include <pthread.h>
+#include <unistd.h>
 #endif
 #include "rtthread.h"