16 Commits

Author SHA1 Message Date
Pavel Nedev
a103151774
Fix NUL file-corruption bug after Windows shutdown brutally
Bypass Windows caching when flushing files after write.

According Microsoft documentation this fixes the issues with saved file corruption (all NULs)
on sudden power loss or restart.

Microsoft documentation for reference:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen?view=vs-2019
https://docs.microsoft.com/en-us/cpp/c-runtime-library/stream-i-o?view=vs-2019

Fix #6133, close #8952
2020-10-06 15:55:41 +02:00
Don HO
5356f648c2
Remove some ugly coding styles 2019-03-13 02:02:35 +01:00
Silent
ac09857656 Fix UTF-8 detection for 4 byte characters
This PR fixes UTF-8 detection for 4 byte characters (a 2002 code used by npp assumed characters longer than 3 bytes are invalid -.-). This means such files will not be erroreously displayed as ANSI anymore.

Steps to reproduce:

Create a new UTF-8 file (w/out BOM)
Paste eg. this character 🍪 and save.
Reopen the file again.
Prior to this PR, file is detected as ANSI (even if Notepad++ is configured to default-assume UTF-8!!!). After this fix, file gets opened as UTF-8 correctly.

Fixes #4730, Fixes #3986, Fixes #3441, Fixes #3405, Closes #4922
2018-11-09 13:39:00 +01:00
Don HO
64d7535be1 x64 ready
1. Remove all warning while compiling in x64
2. Treat warning as error (W4) while compiling in x64
2016-06-05 20:30:22 +02:00
Don Ho
88e390fbc0 Fix 3 bytes file open issue
(Fixes #725)
Open a file of 3 bytes length with '\0' in the middle, only 1 character
shown in editor.
Such file is detected as UTF16 w/o BOM, that makes the wrong length
interpretation. Adding the "len mod 2 == 0" condition to enhance the
detection is the only solution I can find so far.
2015-10-28 01:57:47 +01:00
Don Ho
246c8bd168 [UPDATE] Unprecompile headers (part 3) 2015-06-02 18:01:47 +02:00
milipili
d09947d22d Scintilla: Buffer: fixed invalid read via strlen when loading a file
When loading a file via `FileManager::loadFileData`, a fixed-length buffer
is filled via `fread`. Then, in some cases, a conversion is done with the help
of `Utf8_16_Read`. However, the method `Utf8_16_Read::convert` performs a call
to `strlen` on this buffer. This is obviously wrong: `\0` char should be
accepted (even if a bit strange) and the buffer is not zero-terminated.

The changes merely consist in adding an additional parameter `length` to
not have to guess the size of the buffer.
2015-05-30 21:28:51 +02:00
Don Ho
c866075f58 [BUG_FIXED] (Author: Dave Brotherstone) Fix UTF-8 (w/o BOM) detection bug.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1092 f5eea248-9336-0410-98b8-ebc06183d4e3
2013-07-31 11:35:43 +00:00
Don Ho
6264ef03d0 [ENHANCEMENT] Code optimization.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1073 f5eea248-9336-0410-98b8-ebc06183d4e3
2013-07-08 00:12:50 +00:00
Don Ho
b0f47da58b [BUG_FIXED] (Author: Jens Lorenz) Fix a detection error of UTF16 file from a binary file.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1046 f5eea248-9336-0410-98b8-ebc06183d4e3
2013-05-20 18:03:56 +00:00
Don Ho
5be72543f8 [BUG_FIXED] (Author: François-R Boyer) Fix saving UCS-2 text file corrupted bug.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@671 f5eea248-9336-0410-98b8-ebc06183d4e3
2010-09-25 18:14:22 +00:00
Don Ho
6d161a269e [BUG_FIXED] Fix xml/html encoding overrides BOM if present.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@597 f5eea248-9336-0410-98b8-ebc06183d4e3
2010-01-17 23:13:06 +00:00
Don Ho
f5cca1add9 [BUG_FIXED] Fix getting fonts problem under Chines/Korean/Japanese environment.
[BUG_FIXED] Fix wrong File encoding auto-detection problem : binary file is detected as UTF-16 big-endian.
[UPDATE] (Author : Christian Cuvier) Update NppHelp to v5.5.


git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@539 f5eea248-9336-0410-98b8-ebc06183d4e3
2009-09-19 21:43:11 +00:00
Don Ho
0c490dc55a [ENHANCE] Thanks to Jocelyn Legault (precompiled headers), the build time is sped up.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@529 f5eea248-9336-0410-98b8-ebc06183d4e3
2009-09-04 00:10:01 +00:00
Don Ho
9867d7b578 [NEW_FEATURE] Detect UTF16 encoding (BE and LE) w/o BOM.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@473 f5eea248-9336-0410-98b8-ebc06183d4e3
2009-04-29 18:07:30 +00:00
Don Ho
4dd3b257e0 Moved PowerEditor in trunk remotely
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@460 f5eea248-9336-0410-98b8-ebc06183d4e3
2009-04-24 23:34:47 +00:00