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

Side by Side Diff: xfa/fgas/crt/fgas_system.cpp

Issue 1992033002: fgas/ code cleanup. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fgas/crt/fgas_system.h" 7 #include "xfa/fgas/crt/fgas_system.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 25 matching lines...) Expand all
36 while (count-- > 0) { 36 while (count-- > 0) {
37 wch1 = (FX_WCHAR)FX_tolower(*s1++); 37 wch1 = (FX_WCHAR)FX_tolower(*s1++);
38 wch2 = (FX_WCHAR)FX_tolower(*s2++); 38 wch2 = (FX_WCHAR)FX_tolower(*s2++);
39 if (wch1 != wch2) { 39 if (wch1 != wch2) {
40 break; 40 break;
41 } 41 }
42 } 42 }
43 return wch1 - wch2; 43 return wch1 - wch2;
44 } 44 }
45 45
46 int32_t FX_filelength(FXSYS_FILE* file) {
47 ASSERT(file != NULL);
48 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
49 return _filelength(_fileno(file));
50 #else
51 int32_t iPos = FXSYS_ftell(file);
52 FXSYS_fseek(file, 0, FXSYS_SEEK_END);
53 int32_t iLen = FXSYS_ftell(file);
54 FXSYS_fseek(file, iPos, FXSYS_SEEK_SET);
55 return iLen;
56 #endif
57 }
58
59 FX_BOOL FX_fsetsize(FXSYS_FILE* file, int32_t size) {
60 ASSERT(file != NULL);
61 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
62 return _chsize(_fileno(file), size) == 0;
63 #elif _FX_OS_ == _FX_WIN32_MOBILE_
64 HANDLE hFile = _fileno(file);
65 uint32_t dwPos = ::SetFilePointer(hFile, 0, 0, FILE_CURRENT);
66 ::SetFilePointer(hFile, size, 0, FILE_BEGIN);
67 FX_BOOL bRet = ::SetEndOfFile(hFile);
68 ::SetFilePointer(hFile, (int32_t)dwPos, 0, FILE_BEGIN);
69 return bRet;
70 #else
71 return FALSE;
72 #endif
73 }
74
75 FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t* pUsedLen) { 46 FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t* pUsedLen) {
76 ASSERT(pwsStr != NULL); 47 ASSERT(pwsStr != NULL);
77 if (iLength < 0) { 48 if (iLength < 0) {
78 iLength = FXSYS_wcslen(pwsStr); 49 iLength = FXSYS_wcslen(pwsStr);
79 } 50 }
80 if (iLength == 0) { 51 if (iLength == 0) {
81 return 0.0f; 52 return 0.0f;
82 } 53 }
83 int32_t iUsedLen = 0; 54 int32_t iUsedLen = 0;
84 FX_BOOL bNegtive = FALSE; 55 FX_BOOL bNegtive = FALSE;
(...skipping 24 matching lines...) Expand all
109 } else { 80 } else {
110 break; 81 break;
111 } 82 }
112 } 83 }
113 } 84 }
114 if (pUsedLen) { 85 if (pUsedLen) {
115 *pUsedLen = iUsedLen; 86 *pUsedLen = iUsedLen;
116 } 87 }
117 return bNegtive ? -fValue : fValue; 88 return bNegtive ? -fValue : fValue;
118 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698