mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:32:57 +00:00
[NOTEPAD] Avoid a cast.
This commit is contained in:
parent
534a309edc
commit
97df61edfa
3 changed files with 8 additions and 7 deletions
|
@ -362,7 +362,7 @@ VOID DoOpenFile(LPCTSTR szFileName)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ReadText(hFile, (LPWSTR *)&pszText, &dwTextLen, (int *)&Globals.encFile, &Globals.iEoln))
|
if (!ReadText(hFile, (LPWSTR *)&pszText, &dwTextLen, &Globals.encFile, &Globals.iEoln))
|
||||||
{
|
{
|
||||||
ShowLastError();
|
ShowLastError();
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
@ -91,8 +91,8 @@ extern NOTEPAD_GLOBALS Globals;
|
||||||
VOID SetFileName(LPCTSTR szFileName);
|
VOID SetFileName(LPCTSTR szFileName);
|
||||||
|
|
||||||
/* from text.c */
|
/* from text.c */
|
||||||
BOOL ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *pencFile, int *piEoln);
|
BOOL ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, ENCODING *pencFile, int *piEoln);
|
||||||
BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int encFile, int iEoln);
|
BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, ENCODING encFile, int iEoln);
|
||||||
|
|
||||||
/* from settings.c */
|
/* from settings.c */
|
||||||
void NOTEPAD_LoadSettingsFromRegistry(void);
|
void NOTEPAD_LoadSettingsFromRegistry(void);
|
||||||
|
|
|
@ -48,7 +48,7 @@ static BOOL Append(LPWSTR *ppszText, DWORD *pdwTextLen, LPCWSTR pszAppendText, D
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *pencFile, int *piEoln)
|
ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, ENCODING *pencFile, int *piEoln)
|
||||||
{
|
{
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
LPBYTE pBytes = NULL;
|
LPBYTE pBytes = NULL;
|
||||||
|
@ -58,7 +58,7 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *pencFile, int *
|
||||||
DWORD dwCharCount;
|
DWORD dwCharCount;
|
||||||
BOOL bSuccess = FALSE;
|
BOOL bSuccess = FALSE;
|
||||||
BYTE b = 0;
|
BYTE b = 0;
|
||||||
int encFile = ENCODING_ANSI;
|
ENCODING encFile = ENCODING_ANSI;
|
||||||
int iCodePage = 0;
|
int iCodePage = 0;
|
||||||
WCHAR szCrlf[2] = {'\r', '\n'};
|
WCHAR szCrlf[2] = {'\r', '\n'};
|
||||||
DWORD adwEolnCount[3] = {0, 0, 0};
|
DWORD adwEolnCount[3] = {0, 0, 0};
|
||||||
|
@ -147,6 +147,7 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *pencFile, int *
|
||||||
pszAllocText[dwCharCount] = '\0';
|
pszAllocText[dwCharCount] = '\0';
|
||||||
pszText = pszAllocText;
|
pszText = pszAllocText;
|
||||||
break;
|
break;
|
||||||
|
DEFAULT_UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwPos = 0;
|
dwPos = 0;
|
||||||
|
@ -221,7 +222,7 @@ done:
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL WriteEncodedText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int encFile)
|
static BOOL WriteEncodedText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, ENCODING encFile)
|
||||||
{
|
{
|
||||||
LPBYTE pBytes = NULL;
|
LPBYTE pBytes = NULL;
|
||||||
LPBYTE pAllocBuffer = NULL;
|
LPBYTE pAllocBuffer = NULL;
|
||||||
|
@ -315,7 +316,7 @@ done:
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int encFile, int iEoln)
|
BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, ENCODING encFile, int iEoln)
|
||||||
{
|
{
|
||||||
WCHAR wcBom;
|
WCHAR wcBom;
|
||||||
LPCWSTR pszLF = L"\n";
|
LPCWSTR pszLF = L"\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue