Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1254)

Unified Diff: core/include/fxcrt/fx_system.h

Issue 1265503005: clang-format all pdfium code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: sigh Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/include/fxcrt/fx_system.h
diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h
index 8bc2b4ab2a32fd37d52973295f8ce8ba06f52640..f0d403501c5917c61061b782037a3d2fa5438b59 100644
--- a/core/include/fxcrt/fx_system.h
+++ b/core/include/fxcrt/fx_system.h
@@ -18,17 +18,17 @@
#include <wchar.h>
// _FX_OS_ values:
-#define _FX_WIN32_DESKTOP_ 1
-#define _FX_WIN64_DESKTOP_ 2
-#define _FX_LINUX_DESKTOP_ 4
-#define _FX_MACOSX_ 7
-#define _FX_ANDROID_ 12
+#define _FX_WIN32_DESKTOP_ 1
+#define _FX_WIN64_DESKTOP_ 2
+#define _FX_LINUX_DESKTOP_ 4
+#define _FX_MACOSX_ 7
+#define _FX_ANDROID_ 12
// _FXM_PLATFORM_ values;
-#define _FXM_PLATFORM_WINDOWS_ 1 // _FX_WIN32_DESKTOP_ or _FX_WIN64_DESKTOP_.
-#define _FXM_PLATFORM_LINUX_ 2 // _FX_LINUX_DESKTOP_ always.
-#define _FXM_PLATFORM_APPLE_ 3 // _FX_MACOSX_ always.
-#define _FXM_PLATFORM_ANDROID_ 4 // _FX_ANDROID_ always.
+#define _FXM_PLATFORM_WINDOWS_ 1 // _FX_WIN32_DESKTOP_ or _FX_WIN64_DESKTOP_.
+#define _FXM_PLATFORM_LINUX_ 2 // _FX_LINUX_DESKTOP_ always.
+#define _FXM_PLATFORM_APPLE_ 3 // _FX_MACOSX_ always.
+#define _FXM_PLATFORM_ANDROID_ 4 // _FX_ANDROID_ always.
#ifndef _FX_OS_
#if defined(__ANDROID__)
@@ -67,13 +67,13 @@
#ifdef __cplusplus
extern "C" {
#endif
-typedef void* FX_POSITION; // Keep until fxcrt containers gone
-typedef unsigned short FX_WORD; // Keep - "an efficient small type"
-typedef unsigned int FX_DWORD; // Keep - "an efficient type"
-typedef float FX_FLOAT; // Keep, allow upgrade to doubles.
-typedef int FX_BOOL; // Keep, sadly not always 0 or 1.
-typedef char FX_CHAR; // Keep, questionable signedness.
-typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars.
+typedef void* FX_POSITION; // Keep until fxcrt containers gone
+typedef unsigned short FX_WORD; // Keep - "an efficient small type"
+typedef unsigned int FX_DWORD; // Keep - "an efficient type"
+typedef float FX_FLOAT; // Keep, allow upgrade to doubles.
+typedef int FX_BOOL; // Keep, sadly not always 0 or 1.
+typedef char FX_CHAR; // Keep, questionable signedness.
+typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars.
// PDFium string sizes are limited to 2^31-1, and the value is signed to
// allow -1 as a placeholder for "unknown".
@@ -85,15 +85,15 @@ typedef int FX_STRSIZE;
#endif
#ifndef TRUE
-#define TRUE 1
+#define TRUE 1
#endif
#ifndef FALSE
-#define FALSE 0
+#define FALSE 0
#endif
#ifndef NULL
-#define NULL 0
+#define NULL 0
#endif
#define FXSYS_assert assert
@@ -107,38 +107,41 @@ typedef int FX_STRSIZE;
#define FX_MAX(a, b) (((a) > (b)) ? (a) : (b))
#define FX_MIN(a, b) (((a) < (b)) ? (a) : (b))
-#define FX_PI 3.1415926535897932384626433832795f
+#define FX_PI 3.1415926535897932384626433832795f
// NOTE: prevent use of the return value from snprintf() since some platforms
// have different return values (e.g. windows _vsnprintf()), and provide
// versions that always NUL-terminate.
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900
-void FXSYS_snprintf(char *str, size_t size, _Printf_format_string_ const char* fmt, ...);
-void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap);
+void FXSYS_snprintf(char* str,
+ size_t size,
+ _Printf_format_string_ const char* fmt,
+ ...);
+void FXSYS_vsnprintf(char* str, size_t size, const char* fmt, va_list ap);
#else
-#define FXSYS_snprintf (void) snprintf
-#define FXSYS_vsnprintf (void) vsnprintf
+#define FXSYS_snprintf (void) snprintf
+#define FXSYS_vsnprintf (void) vsnprintf
#endif
-#define FXSYS_sprintf DO_NOT_USE_SPRINTF_DIE_DIE_DIE
-#define FXSYS_vsprintf DO_NOT_USE_VSPRINTF_DIE_DIE_DIE
-#define FXSYS_strchr strchr
-#define FXSYS_strncmp strncmp
-#define FXSYS_strcmp strcmp
-#define FXSYS_strcpy strcpy
-#define FXSYS_strncpy strncpy
-#define FXSYS_strstr strstr
-#define FXSYS_FILE FILE
-#define FXSYS_fopen fopen
-#define FXSYS_fclose fclose
-#define FXSYS_SEEK_END SEEK_END
-#define FXSYS_SEEK_SET SEEK_SET
-#define FXSYS_fseek fseek
-#define FXSYS_ftell ftell
-#define FXSYS_fread fread
-#define FXSYS_fwrite fwrite
-#define FXSYS_fprintf fprintf
-#define FXSYS_fflush fflush
+#define FXSYS_sprintf DO_NOT_USE_SPRINTF_DIE_DIE_DIE
+#define FXSYS_vsprintf DO_NOT_USE_VSPRINTF_DIE_DIE_DIE
+#define FXSYS_strchr strchr
+#define FXSYS_strncmp strncmp
+#define FXSYS_strcmp strcmp
+#define FXSYS_strcpy strcpy
+#define FXSYS_strncpy strncpy
+#define FXSYS_strstr strstr
+#define FXSYS_FILE FILE
+#define FXSYS_fopen fopen
+#define FXSYS_fclose fclose
+#define FXSYS_SEEK_END SEEK_END
+#define FXSYS_SEEK_SET SEEK_SET
+#define FXSYS_fseek fseek
+#define FXSYS_ftell ftell
+#define FXSYS_fread fread
+#define FXSYS_fwrite fwrite
+#define FXSYS_fprintf fprintf
+#define FXSYS_fflush fflush
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#ifdef _NATIVE_WCHAR_T_DEFINED
@@ -151,7 +154,7 @@ FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode);
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#ifdef __cplusplus
-} // extern "C"
+} // extern "C"
#include "../../../third_party/base/numerics/safe_conversions.h"
#define FXSYS_strlen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(strlen(ptr))
#define FXSYS_wcslen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(wcslen(ptr))
@@ -161,20 +164,20 @@ extern "C" {
#define FXSYS_wcslen(ptr) ((FX_STRSIZE)wcslen(ptr))
#endif
-#define FXSYS_wcscmp wcscmp
-#define FXSYS_wcschr wcschr
-#define FXSYS_wcsstr wcsstr
-#define FXSYS_wcsncmp wcsncmp
-#define FXSYS_vswprintf vswprintf
-#define FXSYS_mbstowcs mbstowcs
-#define FXSYS_wcstombs wcstombs
-#define FXSYS_memcmp memcmp
-#define FXSYS_memcpy memcpy
-#define FXSYS_memmove memmove
-#define FXSYS_memset memset
-#define FXSYS_memchr memchr
-#define FXSYS_qsort qsort
-#define FXSYS_bsearch bsearch
+#define FXSYS_wcscmp wcscmp
+#define FXSYS_wcschr wcschr
+#define FXSYS_wcsstr wcsstr
+#define FXSYS_wcsncmp wcsncmp
+#define FXSYS_vswprintf vswprintf
+#define FXSYS_mbstowcs mbstowcs
+#define FXSYS_wcstombs wcstombs
+#define FXSYS_memcmp memcmp
+#define FXSYS_memcpy memcpy
+#define FXSYS_memmove memmove
+#define FXSYS_memset memset
+#define FXSYS_memchr memchr
+#define FXSYS_qsort qsort
+#define FXSYS_bsearch bsearch
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#define FXSYS_GetACP GetACP
@@ -184,8 +187,10 @@ extern "C" {
#define FXSYS_stricmp _stricmp
#ifdef _NATIVE_WCHAR_T_DEFINED
#define FXSYS_wcsicmp(str1, str2) _wcsicmp((wchar_t*)(str1), (wchar_t*)(str2))
-#define FXSYS_WideCharToMultiByte(p1, p2, p3, p4, p5, p6, p7, p8) WideCharToMultiByte(p1, p2, (const wchar_t*)(p3), p4, p5, p6, p7, p8)
-#define FXSYS_MultiByteToWideChar(p1, p2, p3, p4, p5, p6) MultiByteToWideChar(p1, p2, p3, p4, (wchar_t*)(p5), p6)
+#define FXSYS_WideCharToMultiByte(p1, p2, p3, p4, p5, p6, p7, p8) \
+ WideCharToMultiByte(p1, p2, (const wchar_t*)(p3), p4, p5, p6, p7, p8)
+#define FXSYS_MultiByteToWideChar(p1, p2, p3, p4, p5, p6) \
+ MultiByteToWideChar(p1, p2, p3, p4, (wchar_t*)(p5), p6)
#define FXSYS_wcslwr(str) _wcslwr((wchar_t*)(str))
#define FXSYS_wcsupr(str) _wcsupr((wchar_t*)(str))
#else
@@ -198,58 +203,77 @@ extern "C" {
#define FXSYS_GetFullPathName GetFullPathName
#define FXSYS_GetModuleFileName GetModuleFileName
#else
-int FXSYS_GetACP(void);
-char* FXSYS_itoa(int value, char* string, int radix);
-int FXSYS_WideCharToMultiByte(FX_DWORD codepage, FX_DWORD dwFlags, const wchar_t* wstr, int wlen,
- char* buf, int buflen, const char* default_str, int* pUseDefault);
-int FXSYS_MultiByteToWideChar(FX_DWORD codepage, FX_DWORD dwFlags, const char* bstr, int blen,
- wchar_t* buf, int buflen);
-FX_DWORD FXSYS_GetFullPathName(const char* filename, FX_DWORD buflen, char* buf, char** filepart);
-FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize);
-char* FXSYS_strlwr(char* str);
-char* FXSYS_strupr(char* str);
-int FXSYS_stricmp(const char*, const char*);
-int FXSYS_wcsicmp(const wchar_t *string1, const wchar_t *string2);
-wchar_t* FXSYS_wcslwr(wchar_t* str);
-wchar_t* FXSYS_wcsupr(wchar_t* str);
+int FXSYS_GetACP(void);
+char* FXSYS_itoa(int value, char* string, int radix);
+int FXSYS_WideCharToMultiByte(FX_DWORD codepage,
+ FX_DWORD dwFlags,
+ const wchar_t* wstr,
+ int wlen,
+ char* buf,
+ int buflen,
+ const char* default_str,
+ int* pUseDefault);
+int FXSYS_MultiByteToWideChar(FX_DWORD codepage,
+ FX_DWORD dwFlags,
+ const char* bstr,
+ int blen,
+ wchar_t* buf,
+ int buflen);
+FX_DWORD FXSYS_GetFullPathName(const char* filename,
+ FX_DWORD buflen,
+ char* buf,
+ char** filepart);
+FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize);
+char* FXSYS_strlwr(char* str);
+char* FXSYS_strupr(char* str);
+int FXSYS_stricmp(const char*, const char*);
+int FXSYS_wcsicmp(const wchar_t* string1, const wchar_t* string2);
+wchar_t* FXSYS_wcslwr(wchar_t* str);
+wchar_t* FXSYS_wcsupr(wchar_t* str);
#endif // _FXM_PLATFORM == _FXM_PLATFORM_WINDOWS_
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-#define FXSYS_pow(a, b) (FX_FLOAT)powf(a, b)
+#define FXSYS_pow(a, b) (FX_FLOAT) powf(a, b)
#else
-#define FXSYS_pow(a, b) (FX_FLOAT)pow(a, b)
+#define FXSYS_pow(a, b) (FX_FLOAT) pow(a, b)
#endif
-#define FXSYS_sqrt(a) (FX_FLOAT)sqrt(a)
-#define FXSYS_fabs(a) (FX_FLOAT)fabs(a)
-#define FXSYS_atan2(a, b) (FX_FLOAT)atan2(a, b)
-#define FXSYS_ceil(a) (FX_FLOAT)ceil(a)
-#define FXSYS_floor(a) (FX_FLOAT)floor(a)
-#define FXSYS_cos(a) (FX_FLOAT)cos(a)
-#define FXSYS_acos(a) (FX_FLOAT)acos(a)
-#define FXSYS_sin(a) (FX_FLOAT)sin(a)
-#define FXSYS_log(a) (FX_FLOAT)log(a)
-#define FXSYS_log10(a) (FX_FLOAT)log10(a)
-#define FXSYS_fmod(a, b) (FX_FLOAT)fmod(a, b)
-#define FXSYS_abs abs
-#define FXDWORD_FROM_LSBFIRST(i) (i)
-#define FXDWORD_FROM_MSBFIRST(i) (((uint8_t)(i) << 24) | ((uint8_t)((i) >> 8) << 16) | ((uint8_t)((i) >> 16) << 8) | (uint8_t)((i) >> 24))
-#define FXDWORD_GET_LSBFIRST(p) ((((uint8_t*)(p))[3] << 24) | (((uint8_t*)(p))[2] << 16) | (((uint8_t*)(p))[1] << 8) | (((uint8_t*)(p))[0]))
-#define FXDWORD_GET_MSBFIRST(p) ((((uint8_t*)(p))[0] << 24) | (((uint8_t*)(p))[1] << 16) | (((uint8_t*)(p))[2] << 8) | (((uint8_t*)(p))[3]))
-#define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8))
-#define FXSYS_LOBYTE(word) ((uint8_t)(word))
-#define FXSYS_HIWORD(dword) ((FX_WORD)((dword) >> 16))
-#define FXSYS_LOWORD(dword) ((FX_WORD)(dword))
-int32_t FXSYS_atoi(const FX_CHAR* str);
-int32_t FXSYS_wtoi(const FX_WCHAR* str);
-int64_t FXSYS_atoi64(const FX_CHAR* str);
-int64_t FXSYS_wtoi64(const FX_WCHAR* str);
-const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix);
-const FX_WCHAR* FXSYS_i64tow(int64_t value, FX_WCHAR* str, int radix);
-int FXSYS_round(FX_FLOAT f);
-#define FXSYS_Mul(a, b) ((a) * (b))
-#define FXSYS_Div(a, b) ((a) / (b))
-#define FXSYS_MulDiv(a, b, c) ((a) * (b) / (c))
-#define FXSYS_sqrt2(a, b) (FX_FLOAT)FXSYS_sqrt((a)*(a) + (b)*(b))
+#define FXSYS_sqrt(a) (FX_FLOAT) sqrt(a)
+#define FXSYS_fabs(a) (FX_FLOAT) fabs(a)
+#define FXSYS_atan2(a, b) (FX_FLOAT) atan2(a, b)
+#define FXSYS_ceil(a) (FX_FLOAT) ceil(a)
+#define FXSYS_floor(a) (FX_FLOAT) floor(a)
+#define FXSYS_cos(a) (FX_FLOAT) cos(a)
+#define FXSYS_acos(a) (FX_FLOAT) acos(a)
+#define FXSYS_sin(a) (FX_FLOAT) sin(a)
+#define FXSYS_log(a) (FX_FLOAT) log(a)
+#define FXSYS_log10(a) (FX_FLOAT) log10(a)
+#define FXSYS_fmod(a, b) (FX_FLOAT) fmod(a, b)
+#define FXSYS_abs abs
+#define FXDWORD_FROM_LSBFIRST(i) (i)
+#define FXDWORD_FROM_MSBFIRST(i) \
+ (((uint8_t)(i) << 24) | ((uint8_t)((i) >> 8) << 16) | \
+ ((uint8_t)((i) >> 16) << 8) | (uint8_t)((i) >> 24))
+#define FXDWORD_GET_LSBFIRST(p) \
+ ((((uint8_t*)(p))[3] << 24) | (((uint8_t*)(p))[2] << 16) | \
+ (((uint8_t*)(p))[1] << 8) | (((uint8_t*)(p))[0]))
+#define FXDWORD_GET_MSBFIRST(p) \
+ ((((uint8_t*)(p))[0] << 24) | (((uint8_t*)(p))[1] << 16) | \
+ (((uint8_t*)(p))[2] << 8) | (((uint8_t*)(p))[3]))
+#define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8))
+#define FXSYS_LOBYTE(word) ((uint8_t)(word))
+#define FXSYS_HIWORD(dword) ((FX_WORD)((dword) >> 16))
+#define FXSYS_LOWORD(dword) ((FX_WORD)(dword))
+int32_t FXSYS_atoi(const FX_CHAR* str);
+int32_t FXSYS_wtoi(const FX_WCHAR* str);
+int64_t FXSYS_atoi64(const FX_CHAR* str);
+int64_t FXSYS_wtoi64(const FX_WCHAR* str);
+const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix);
+const FX_WCHAR* FXSYS_i64tow(int64_t value, FX_WCHAR* str, int radix);
+int FXSYS_round(FX_FLOAT f);
+#define FXSYS_Mul(a, b) ((a) * (b))
+#define FXSYS_Div(a, b) ((a) / (b))
+#define FXSYS_MulDiv(a, b, c) ((a) * (b) / (c))
+#define FXSYS_sqrt2(a, b) (FX_FLOAT) FXSYS_sqrt((a) * (a) + (b) * (b))
#ifdef __cplusplus
};
#endif
@@ -286,7 +310,7 @@ int FXSYS_round(FX_FLOAT f);
// Prevent a function from ever being inlined, typically because we'd
// like it to appear in stack traces.
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#define NEVER_INLINE __declspec(noinline)
#else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#define NEVER_INLINE __attribute__((__noinline__))

Powered by Google App Engine
This is Rietveld 408576698