summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-03 14:53:05 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-03 20:37:46 +0000
commitba8ac3f14e5eecb0c37b0df67370304cc1682755 (patch)
tree0d347837349d7034747ddf7741ac1a0c137a379b /core
parent669a418f75c05d4a39e2bcaff2b7b93dec1c5764 (diff)
downloadpdfium-ba8ac3f14e5eecb0c37b0df67370304cc1682755.tar.xz
Drop FXSYS_ from file methods
This Cl drops the FXSYS_ from file methods which are the same on all platforms. Bug: pdfium:694 Change-Id: I095c64fed69bf70e00a2594fa94a1fdc71a7060e Reviewed-on: https://pdfium-review.googlesource.com/3610 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fxcrt/fx_basic_gcc.cpp6
-rw-r--r--core/fxcrt/fx_system.h14
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.cpp42
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.h2
4 files changed, 26 insertions, 38 deletions
diff --git a/core/fxcrt/fx_basic_gcc.cpp b/core/fxcrt/fx_basic_gcc.cpp
index 98a6ead64b..2033265f10 100644
--- a/core/fxcrt/fx_basic_gcc.cpp
+++ b/core/fxcrt/fx_basic_gcc.cpp
@@ -135,9 +135,9 @@ uint32_t FXSYS_GetModuleFileName(void* hModule, char* buf, uint32_t bufsize) {
#ifdef __cplusplus
extern "C" {
#endif
-FXSYS_FILE* FXSYS_wfopen(const wchar_t* filename, const wchar_t* mode) {
- return FXSYS_fopen(CFX_ByteString::FromUnicode(filename).c_str(),
- CFX_ByteString::FromUnicode(mode).c_str());
+FILE* FXSYS_wfopen(const wchar_t* filename, const wchar_t* mode) {
+ return fopen(CFX_ByteString::FromUnicode(filename).c_str(),
+ CFX_ByteString::FromUnicode(mode).c_str());
}
char* FXSYS_strlwr(char* str) {
if (!str) {
diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h
index c471085e25..15b81f4778 100644
--- a/core/fxcrt/fx_system.h
+++ b/core/fxcrt/fx_system.h
@@ -122,18 +122,6 @@ void FXSYS_vsnprintf(char* str, size_t size, const char* fmt, va_list ap);
#define FXSYS_sprintf DO_NOT_USE_SPRINTF_DIE_DIE_DIE
#define FXSYS_vsprintf DO_NOT_USE_VSPRINTF_DIE_DIE_DIE
-#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
#define FXSYS_wfopen(f, m) _wfopen((const wchar_t*)(f), (const wchar_t*)(m))
@@ -141,7 +129,7 @@ void FXSYS_vsnprintf(char* str, size_t size, const char* fmt, va_list ap);
#define FXSYS_wfopen _wfopen
#endif // _NATIVE_WCHAR_T_DEFINED
#else
-FXSYS_FILE* FXSYS_wfopen(const wchar_t* filename, const wchar_t* mode);
+FILE* FXSYS_wfopen(const wchar_t* filename, const wchar_t* mode);
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#ifdef __cplusplus
diff --git a/core/fxge/ge/cfx_folderfontinfo.cpp b/core/fxge/ge/cfx_folderfontinfo.cpp
index 52dfc2d243..15a8daf95c 100644
--- a/core/fxge/ge/cfx_folderfontinfo.cpp
+++ b/core/fxge/ge/cfx_folderfontinfo.cpp
@@ -33,15 +33,15 @@ const struct {
{"Times-Italic", "Times New Roman Italic"},
};
-CFX_ByteString FPDF_ReadStringFromFile(FXSYS_FILE* pFile, uint32_t size) {
+CFX_ByteString FPDF_ReadStringFromFile(FILE* pFile, uint32_t size) {
CFX_ByteString buffer;
- if (!FXSYS_fread(buffer.GetBuffer(size), size, 1, pFile))
+ if (!fread(buffer.GetBuffer(size), size, 1, pFile))
return CFX_ByteString();
buffer.ReleaseBuffer(size);
return buffer;
}
-CFX_ByteString FPDF_LoadTableFromTT(FXSYS_FILE* pFile,
+CFX_ByteString FPDF_LoadTableFromTT(FILE* pFile,
const uint8_t* pTables,
uint32_t nTables,
uint32_t tag) {
@@ -50,7 +50,7 @@ CFX_ByteString FPDF_LoadTableFromTT(FXSYS_FILE* pFile,
if (GET_TT_LONG(p) == tag) {
uint32_t offset = GET_TT_LONG(p + 8);
uint32_t size = GET_TT_LONG(p + 12);
- FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET);
+ fseek(pFile, offset, SEEK_SET);
return FPDF_ReadStringFromFile(pFile, size);
}
}
@@ -149,34 +149,34 @@ void CFX_FolderFontInfo::ScanPath(const CFX_ByteString& path) {
}
void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) {
- FXSYS_FILE* pFile = FXSYS_fopen(path.c_str(), "rb");
+ FILE* pFile = fopen(path.c_str(), "rb");
if (!pFile)
return;
- FXSYS_fseek(pFile, 0, FXSYS_SEEK_END);
+ fseek(pFile, 0, SEEK_END);
- uint32_t filesize = FXSYS_ftell(pFile);
+ uint32_t filesize = ftell(pFile);
uint8_t buffer[16];
- FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET);
+ fseek(pFile, 0, SEEK_SET);
- size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile);
+ size_t readCnt = fread(buffer, 12, 1, pFile);
if (readCnt != 1) {
- FXSYS_fclose(pFile);
+ fclose(pFile);
return;
}
if (GET_TT_LONG(buffer) == kTableTTCF) {
uint32_t nFaces = GET_TT_LONG(buffer + 8);
if (nFaces > std::numeric_limits<uint32_t>::max() / 4) {
- FXSYS_fclose(pFile);
+ fclose(pFile);
return;
}
uint32_t face_bytes = nFaces * 4;
uint8_t* offsets = FX_Alloc(uint8_t, face_bytes);
- readCnt = FXSYS_fread(offsets, 1, face_bytes, pFile);
+ readCnt = fread(offsets, 1, face_bytes, pFile);
if (readCnt != face_bytes) {
FX_Free(offsets);
- FXSYS_fclose(pFile);
+ fclose(pFile);
return;
}
for (uint32_t i = 0; i < nFaces; i++) {
@@ -187,16 +187,16 @@ void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) {
} else {
ReportFace(path, pFile, filesize, 0);
}
- FXSYS_fclose(pFile);
+ fclose(pFile);
}
void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path,
- FXSYS_FILE* pFile,
+ FILE* pFile,
uint32_t filesize,
uint32_t offset) {
- FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET);
+ fseek(pFile, offset, SEEK_SET);
char buffer[16];
- if (!FXSYS_fread(buffer, 12, 1, pFile))
+ if (!fread(buffer, 12, 1, pFile))
return;
uint32_t nTables = GET_TT_SHORT(buffer + 4);
@@ -353,15 +353,15 @@ uint32_t CFX_FolderFontInfo::GetFontData(void* hFont,
if (!datasize || size < datasize)
return datasize;
- FXSYS_FILE* pFile = FXSYS_fopen(pFont->m_FilePath.c_str(), "rb");
+ FILE* pFile = fopen(pFont->m_FilePath.c_str(), "rb");
if (!pFile)
return 0;
- if (FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET) < 0 ||
- FXSYS_fread(buffer, datasize, 1, pFile) != 1) {
+ if (fseek(pFile, offset, SEEK_SET) < 0 ||
+ fread(buffer, datasize, 1, pFile) != 1) {
datasize = 0;
}
- FXSYS_fclose(pFile);
+ fclose(pFile);
return datasize;
}
diff --git a/core/fxge/ge/cfx_folderfontinfo.h b/core/fxge/ge/cfx_folderfontinfo.h
index 9e9a1a2a6a..17940bdbee 100644
--- a/core/fxge/ge/cfx_folderfontinfo.h
+++ b/core/fxge/ge/cfx_folderfontinfo.h
@@ -48,7 +48,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
void ScanPath(const CFX_ByteString& path);
void ScanFile(const CFX_ByteString& path);
void ReportFace(const CFX_ByteString& path,
- FXSYS_FILE* pFile,
+ FILE* pFile,
uint32_t filesize,
uint32_t offset);
void* GetSubstFont(const CFX_ByteString& face);