Commit Graph

23 Commits

Author SHA1 Message Date
Vadim Zeitlin
023ee99ea7 Don't crash in wxTextFile::GetLastLine() if the file is empty
Just return a reference to an empty wxString, as GetFirstLine() already does
(although this is actually questionable -- what if this string is modified?).

See #17283.
2016-06-09 16:48:01 +02:00
Dimitri Schoolwerth
8f8d58d193 Use wx-prefixed macros throughout the repository.
Change {DECLARE,IMPLEMENT}_*CLASS and {DECLARE,BEGIN,END}_EVENT_TABLE
occurrences to use the wx-prefixed version of the macros.
2015-04-23 22:00:35 +04:00
Václav Slavík
f5d12dab44 Fix failing TextFileTestCase::ReadMixedWithFuzzing().
The test failed with 33% probability because it didn't account for
trailing non-newline character.  Fixed and also changed the test to
repeat itself a hundred times, to increase the probability of catching
problems like this.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75823 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-02-06 10:15:06 +00:00
Václav Slavík
4cbb78cf7d Add line-endings fuzzing test to TextFileTestCase.
Stress-test wxTextFile's handling of unusual CR,LF characters.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75800 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-02-05 18:29:03 +00:00
Václav Slavík
fe6f8254fb TextFileTestCase: test for \r\r\r\n parsing.
While r75387 fixed parsing of \r\r\n, it still didn't handle triple-\r correctly.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75798 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-02-05 18:28:51 +00:00
Václav Slavík
40eed079ec TextFileTestCase: test for correct parsing of empty Mac lines.
(This is failing both with and without r75387.)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75797 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-02-05 18:28:46 +00:00
Václav Slavík
e8c5400118 wxTextFile: don't loose data with CRCRLF line endings.
Previously, when reading files with completely nonstandard - but
occurring in the wild thanks to broken Notepad - files with CRCRLF, all
content would be replaced with empty lines.

Fix the code to do what many editors do with such files: treat this as
data line followed by an empty one. This is not ideal, but it is better
than discarding data - and arguably, silently cleaning up the endings
wouldn't be great either (and would add extra complications for what is
an obscure and broken case).

See http://stackoverflow.com/questions/6998506/text-file-with-0d-0d-0a-line-breaks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75387 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-12-16 18:54:42 +00:00
Vadim Zeitlin
b845aa636a Fix reading of files with Mac EOLs in wxTextFile.
The last CR-terminated line wasn't handled correctly.

Fix this now and add unit tests to ensure that it stays fixed.

Closes #15583.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-10-15 13:04:23 +00:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Dimitri Schoolwerth
e3778b4d9c No code changes, fixed some typos.
Changed several occurrences of "it's" where "its" is meant, as well as a few other minor typos.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-04-30 10:57:04 +00:00
Vadim Zeitlin
9a83f86094 Globally replace _T() with wxT().
Standardize on using a single macro across all wxWidgets sources and solve the name clash with Sun CC standard headers (see #10660).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-23 20:30:22 +00:00
Vadim Zeitlin
50a73bb104 use _unlink() instead of unlink() with VC
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-06-06 23:17:34 +00:00
Vadim Zeitlin
93a800a95e minor icc warning fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-19 09:55:27 +00:00
Vadim Zeitlin
14b4f6fcc0 ReadBig() should be defined in ANSI build too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53905 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-01 16:59:10 +00:00
Vadim Zeitlin
c6d36593cd add a test for reading files >4KB
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53556 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-05-11 17:43:56 +00:00
Vadim Zeitlin
5098c258b2 compilation fixes for VC6
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-13 01:13:03 +00:00
Vadim Zeitlin
5c763f5a23 corrected mistake in the UTF-16 test on big endian machines
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38548 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-04-04 14:25:59 +00:00
Vadim Zeitlin
0739e2eef9 Apple gcc compilation fixes: for it size_t and unsigned are not the same type for some reason
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38530 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-04-02 20:18:33 +00:00
Vadim Zeitlin
6ef5a7a370 fixed if/idef wxHAVE_U_ESCAPE mixup
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38482 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-03-31 19:15:46 +00:00
Vadim Zeitlin
ed177375b2 use wxHAVE_U_ESCAPE to accomodate old compilers
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38476 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-03-31 17:43:10 +00:00
Vadim Zeitlin
93a57d19fe added tests for UTF8 and UTF16 files
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38467 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-03-31 14:26:59 +00:00
Vadim Zeitlin
18230eb6b6 Unicode compilation fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-03-31 13:58:01 +00:00
Vadim Zeitlin
468c5a97ec added unit test for wxTextFile (reading only for now)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38463 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-03-31 13:46:38 +00:00