Skip to content

Commit 58fa10d

Browse files
authored
[NOTEPAD] Minor formatting (reactos#8965)
Follow-up of reactos#8938. JIRA issue: N/A Just indent some lines of a switch block in ReactOS style.
1 parent a2e1e1d commit 58fa10d

1 file changed

Lines changed: 69 additions & 69 deletions

File tree

  • base/applications/notepad

base/applications/notepad/text.c

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* COPYRIGHT: Copyright 1998,99 Marcel Baur <mbaur@g26.ethz.ch>
66
* Copyright 2002 Sylvain Petreolle <spetreolle@yahoo.fr>
77
* Copyright 2002 Andriy Palamarchuk
8-
* Copyright 2019-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
8+
* Copyright 2019-2026 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
99
*/
1010

1111
#include "notepad.h"
@@ -230,89 +230,89 @@ ReadText(HANDLE hFile, ENCODING *pencFile, EOLN *piEoln)
230230

231231
switch(encFile)
232232
{
233-
case ENCODING_UTF16BE:
234-
case ENCODING_UTF16LE:
235-
{
236-
/* Allocate the buffer for EM_SETHANDLE */
237-
pszText = (LPWSTR)&pBytes[dwPos];
238-
cchText = (dwSize - dwPos) / sizeof(WCHAR);
239-
if (cchText >= MAXLONG / sizeof(WCHAR))
233+
case ENCODING_UTF16BE:
234+
case ENCODING_UTF16LE:
240235
{
241-
SetLastError(ERROR_FILE_TOO_LARGE);
242-
goto done;
243-
}
236+
/* Allocate the buffer for EM_SETHANDLE */
237+
pszText = (LPWSTR)&pBytes[dwPos];
238+
cchText = (dwSize - dwPos) / sizeof(WCHAR);
239+
if (cchText >= MAXLONG / sizeof(WCHAR))
240+
{
241+
SetLastError(ERROR_FILE_TOO_LARGE);
242+
goto done;
243+
}
244244

245-
hNewLocal = LocalAlloc(LMEM_MOVEABLE, (cchText + 1) * sizeof(WCHAR));
246-
if (!hNewLocal)
247-
{
248-
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
249-
goto done;
250-
}
245+
hNewLocal = LocalAlloc(LMEM_MOVEABLE, (cchText + 1) * sizeof(WCHAR));
246+
if (!hNewLocal)
247+
{
248+
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
249+
goto done;
250+
}
251251

252-
pszNewText = LocalLock(hNewLocal);
253-
if (!pszNewText)
254-
{
255-
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
256-
goto done;
257-
}
252+
pszNewText = LocalLock(hNewLocal);
253+
if (!pszNewText)
254+
{
255+
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
256+
goto done;
257+
}
258258

259-
CopyMemory(pszNewText, pszText, cchText * sizeof(WCHAR));
259+
CopyMemory(pszNewText, pszText, cchText * sizeof(WCHAR));
260260

261-
if (encFile == ENCODING_UTF16BE) /* big endian; Swap bytes */
262-
{
263-
BYTE tmp, *pb = (LPBYTE)pszNewText;
264-
for (i = 0; i < cchText * 2; i += 2)
261+
if (encFile == ENCODING_UTF16BE) /* big endian; Swap bytes */
265262
{
266-
tmp = pb[i];
267-
pb[i] = pb[i + 1];
268-
pb[i + 1] = tmp;
263+
BYTE tmp, *pb = (LPBYTE)pszNewText;
264+
for (i = 0; i < cchText * 2; i += 2)
265+
{
266+
tmp = pb[i];
267+
pb[i] = pb[i + 1];
268+
pb[i + 1] = tmp;
269+
}
269270
}
270-
}
271-
break;
272-
}
273-
274-
case ENCODING_ANSI:
275-
case ENCODING_UTF8:
276-
case ENCODING_UTF8BOM:
277-
{
278-
iCodePage = ((encFile == ENCODING_UTF8 || encFile == ENCODING_UTF8BOM)
279-
? CP_UTF8 : CP_ACP);
280-
cbContent = dwSize - dwPos;
281-
if (cbContent >= MAXLONG / sizeof(WCHAR))
282-
{
283-
SetLastError(ERROR_FILE_TOO_LARGE);
284-
goto done;
271+
break;
285272
}
286273

287-
/* Allocate the buffer for EM_SETHANDLE */
288-
hNewLocal = LocalAlloc(LMEM_MOVEABLE, (cbContent + 1) * sizeof(WCHAR));
289-
if (!hNewLocal)
274+
case ENCODING_ANSI:
275+
case ENCODING_UTF8:
276+
case ENCODING_UTF8BOM:
290277
{
291-
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
292-
goto done;
293-
}
278+
iCodePage = ((encFile == ENCODING_UTF8 || encFile == ENCODING_UTF8BOM)
279+
? CP_UTF8 : CP_ACP);
280+
cbContent = dwSize - dwPos;
281+
if (cbContent >= MAXLONG / sizeof(WCHAR))
282+
{
283+
SetLastError(ERROR_FILE_TOO_LARGE);
284+
goto done;
285+
}
294286

295-
pszNewText = LocalLock(hNewLocal);
296-
if (!pszNewText)
297-
{
298-
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
299-
goto done;
300-
}
287+
/* Allocate the buffer for EM_SETHANDLE */
288+
hNewLocal = LocalAlloc(LMEM_MOVEABLE, (cbContent + 1) * sizeof(WCHAR));
289+
if (!hNewLocal)
290+
{
291+
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
292+
goto done;
293+
}
301294

302-
/* Do conversion */
303-
cchText = 0;
304-
if (cbContent > 0)
305-
{
306-
cchText = MultiByteToWideChar(iCodePage, 0,
307-
(LPCSTR)&pBytes[dwPos], (INT)cbContent,
308-
pszNewText, (INT)cbContent);
309-
if (!cchText)
295+
pszNewText = LocalLock(hNewLocal);
296+
if (!pszNewText)
297+
{
298+
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
310299
goto done;
300+
}
301+
302+
/* Do conversion */
303+
cchText = 0;
304+
if (cbContent > 0)
305+
{
306+
cchText = MultiByteToWideChar(iCodePage, 0,
307+
(LPCSTR)&pBytes[dwPos], (INT)cbContent,
308+
pszNewText, (INT)cbContent);
309+
if (!cchText)
310+
goto done;
311+
}
312+
break;
311313
}
312-
break;
313-
}
314314

315-
DEFAULT_UNREACHABLE;
315+
DEFAULT_UNREACHABLE;
316316
}
317317

318318
pszNewText[cchText] = UNICODE_NULL;

0 commit comments

Comments
 (0)