Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
fx_system.h
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef CORE_FXCRT_FX_SYSTEM_H_
8#define CORE_FXCRT_FX_SYSTEM_H_
9
10#include <stddef.h>
11#include <stdint.h>
12#include <stdio.h>
13#include <stdlib.h>
14#include <wchar.h>
15
16#include "build/build_config.h"
17#include "core/fxcrt/fx_types.h"
18
19#if defined(_MSC_VER) && _MSC_VER < 1900
20#error Sorry, VC++ 2015 or later is required to compile PDFium.
21#endif // defined(_MSC_VER) && _MSC_VER < 1900
22
23#if defined(__wasm__) && defined(PDF_ENABLE_V8)
24#error Cannot compile v8 with wasm.
25#endif // PDF_ENABLE_V8
26
27#if BUILDFLAG(IS_WIN)
28#include <windows.h>
29#endif // BUILDFLAG(IS_WIN)
30
31#ifdef __cplusplus
32extern "C" {
33#endif // __cplusplus
34
35#define FXSYS_IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
36#define FXSYS_IsFloatBigger(fa, fb)
37 ((fa) > (fb) && !FXSYS_IsFloatZero((fa) - (fb)))
38#define FXSYS_IsFloatSmaller(fa, fb)
39 ((fa) < (fb) && !FXSYS_IsFloatZero((fa) - (fb)))
40#define FXSYS_IsFloatEqual(fa, fb) FXSYS_IsFloatZero((fa) - (fb))
41
42// M_PI not universally present on all platforms.
43#define FXSYS_PI 3.1415926535897932384626433832795f
44#define FXSYS_BEZIER 0.5522847498308f
45
46// NOTE: prevent use of the return value from snprintf() since some platforms
47// have different return values.
48#define FXSYS_snprintf (void)snprintf
49#define FXSYS_vsnprintf (void)vsnprintf
50#define FXSYS_sprintf DO_NOT_USE_SPRINTF_DIE_DIE_DIE
51#define FXSYS_vsprintf DO_NOT_USE_VSPRINTF_DIE_DIE_DIE
52
53#if BUILDFLAG(IS_WIN)
54#define FXSYS_itoa _itoa
55#define FXSYS_strlwr _strlwr
56#define FXSYS_strupr _strupr
57#define FXSYS_stricmp _stricmp
58#define FXSYS_wcsicmp _wcsicmp
59#define FXSYS_wcslwr _wcslwr
60#define FXSYS_wcsupr _wcsupr
61size_t FXSYS_wcsftime(wchar_t* strDest,
62 size_t maxsize,
63 const wchar_t* format,
64 const struct tm* timeptr);
65#define FXSYS_SetLastError SetLastError
66#define FXSYS_GetLastError GetLastError
67#else // BUILDFLAG(IS_WIN)
68char* FXSYS_itoa(int value, char* str, int radix);
69char* FXSYS_strlwr(char* str);
70char* FXSYS_strupr(char* str);
71int FXSYS_stricmp(const char* str1, const char* str2);
72int FXSYS_wcsicmp(const wchar_t* str1, const wchar_t* str2);
73wchar_t* FXSYS_wcslwr(wchar_t* str);
74wchar_t* FXSYS_wcsupr(wchar_t* str);
75#define FXSYS_wcsftime wcsftime
76void FXSYS_SetLastError(uint32_t err);
77uint32_t FXSYS_GetLastError();
78#endif // BUILDFLAG(IS_WIN)
79
80int32_t FXSYS_atoi(const char* str);
81uint32_t FXSYS_atoui(const char* str);
82int32_t FXSYS_wtoi(const wchar_t* str);
83int64_t FXSYS_atoi64(const char* str);
84const char* FXSYS_i64toa(int64_t value, char* str, int radix);
85int FXSYS_roundf(float f);
86int FXSYS_round(double d);
87float FXSYS_sqrt2(float a, float b);
88
89#ifdef __cplusplus
90} // extern "C"
91
92// C++-only section
93
94// Could be C, but uses C++-style casting.
95#define FXSYS_UINT16_GET_LSBFIRST(p)
96 (static_cast<uint16_t>(
97 (static_cast<uint32_t>(static_cast<uint8_t>((p)[1])) << 8) |
98 (static_cast<uint32_t>(static_cast<uint8_t>((p)[0])))))
99#define FXSYS_UINT16_GET_MSBFIRST(p)
100 (static_cast<uint16_t>(
101 (static_cast<uint32_t>(static_cast<uint8_t>((p)[0])) << 8) |
102 (static_cast<uint32_t>(static_cast<uint8_t>((p)[1])))))
103#define FXSYS_UINT32_GET_LSBFIRST(p)
104 ((static_cast<uint32_t>(static_cast<uint8_t>((p)[3])) << 24) |
105 (static_cast<uint32_t>(static_cast<uint8_t>((p)[2])) << 16) |
106 (static_cast<uint32_t>(static_cast<uint8_t>((p)[1])) << 8) |
107 (static_cast<uint32_t>(static_cast<uint8_t>((p)[0]))))
108#define FXSYS_UINT32_GET_MSBFIRST(p)
109 ((static_cast<uint32_t>(static_cast<uint8_t>((p)[0])) << 24) |
110 (static_cast<uint32_t>(static_cast<uint8_t>((p)[1])) << 16) |
111 (static_cast<uint32_t>(static_cast<uint8_t>((p)[2])) << 8) |
112 (static_cast<uint32_t>(static_cast<uint8_t>((p)[3]))))
113#endif // __cplusplus
114
115#endif // CORE_FXCRT_FX_SYSTEM_H_
void CRYPT_AESSetIV(CRYPT_aes_context *context, const uint8_t *iv)
void CRYPT_AESEncrypt(CRYPT_aes_context *context, uint8_t *dest, const uint8_t *src, uint32_t size)
void CRYPT_AESSetKey(CRYPT_aes_context *context, const uint8_t *key, uint32_t keylen)
void CRYPT_AESDecrypt(CRYPT_aes_context *context, uint8_t *dest, const uint8_t *src, uint32_t size)
#define MOVEWORD(i)
#define LASTWORD(i)
#define FMAKEWORD(i)
#define PUT_32BIT_MSB_FIRST(cp, value)
#define ADD_ROUND_KEY_4()
#define mulby2(x)
int32_t FXSYS_atoi(const char *str)
char * FXSYS_strlwr(char *str)
wchar_t * FXSYS_wcsupr(wchar_t *str)
char * FXSYS_strupr(char *str)
uint32_t FXSYS_atoui(const char *str)
int FXSYS_wcsicmp(const wchar_t *str1, const wchar_t *str2)
wchar_t * FXSYS_wcslwr(wchar_t *str)
int32_t FXSYS_wtoi(const wchar_t *str)
#define FXSYS_IsFloatZero(f)
Definition fx_system.h:35
uint32_t FXSYS_GetLastError()
const char * FXSYS_i64toa(int64_t value, char *str, int radix)
int FXSYS_stricmp(const char *str1, const char *str2)
int64_t FXSYS_atoi64(const char *str)
int FXSYS_roundf(float f)
Definition fx_system.cpp:92
int FXSYS_round(double d)
char * FXSYS_itoa(int value, char *str, int radix)
void FXSYS_SetLastError(uint32_t err)
float FXSYS_sqrt2(float a, float b)
unsigned int iv[kMaxNb]
Definition fx_crypt.h:31
unsigned int keysched[kSchedSize]
Definition fx_crypt.h:29
unsigned int invkeysched[kSchedSize]
Definition fx_crypt.h:30