1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-06 06:38:49 +02:00

51 Commits

Author SHA1 Message Date
James Crook
9eab948fb1 Bug 1905 - Labels with more than 260 characters fail to load (with no warning) 2018-08-07 11:46:21 +01:00
Paul Licameli
8be1e8fdad Remove wxArray(Int|Long|Double) except where wxWidgets fns need it 2018-02-21 19:33:31 -05:00
Paul Licameli
080dd34e61 Get rid of wx object arrays, use std::vector 2018-02-21 19:33:27 -05:00
Paul Licameli
8e0cffb7f2 Simplify GuardedCall and default its return type to void 2018-01-13 01:32:41 -05:00
Paul Licameli
c6696f1b49 Move definition of _ and related into Internat.h 2018-01-06 21:03:32 -05:00
James Crook
d2fe7b1757 Clean up most remaining MSVC warnings. 2018-01-06 13:03:48 +00:00
Paul Licameli
7fd78183d2 Remove needless uses of wxString::c_str() in wxString::Format...
... and similar wx "variadics," which all treat wxString smartly enough that
you don't need this.

Don't need c_str either to convert wxString to const wxChar * because
wxString has a conversion operator that does the same.
2018-01-01 20:34:33 -05:00
James Crook
52e9763337 Fix multiple bugs in IsGoodInt and IsGoodInt64
Alerted to this buggy code by Darrell Walisser's comment:
"Whoops, the range on the 64-bit signed integer check is incorrect."

After these fixes,  I saw that IsGoodInt was being used to test a dotted
version number, so I commented out that (bogus) test which was previously
always succeeding.

The IsGood{num} functions did no range checking if the numbers were shorter
than the max value.  Then, if the number was similar in length, the first digit could
be an invalid character and the code also previously accepted all 9's followed by 1.

My new code would benefit from code review and unit tests.
2017-12-29 20:15:29 +00:00
Yarn366
26a6815db8 Fixed the value of MAX_HIGH_SURROGATE 2017-11-06 21:15:56 +00:00
Yarn366
f667b9f269 When escaping characters for XML, don't escape valid surrogate pairs on platforms where wchar_t (and, by extension, wxUChar) is 2 bytes. Also, ignore invalid surrogates and the noncharacters U+FFFE and U+FFFF. 2017-11-06 21:15:56 +00:00
Paul Licameli
58f07d2021 Flush .aup before writing .au; no redundant out-of-space messages 2017-10-25 15:06:35 -04:00
Paul Licameli
fd2a242012 XMLFileWriter cleans up correctly in case of failure 2017-10-25 15:06:23 -04:00
Paul Licameli
c613a0bd40 revert last three 2017-10-24 04:32:46 -04:00
Paul Licameli
a6c69dec74 XMLFileWriter cleans up correctly in case of failure 2017-10-24 04:24:41 -04:00
Paul Licameli
e9a4fc8354 fix the XML writer -- don't throw if target path did not previously exist. 2017-03-21 14:11:17 -04:00
James Crook
5b9ae95930 Bug 1610 - Unable to save projects
We were throwing an exception for attempting to delete a file that was not there.
2017-03-20 11:53:39 +00:00
Paul Licameli
3bb04245c5 Strong exception safety in all uses of XMLFileWriter...
... Strong, meaning that the file at the specified path is created or modified
only if all write operations complete without exceptions, barring one very
unlikely possibility that a final file rename fails, but even in that case the
output is successfully written to some path.

This commit does not add throws, but changes the type thrown to a subclass of
AudacityException, so that GuardedCall will cause the user to see an error
dialog in all cases.

Duplicated logic for making temporary files and backups is now all in one
place, the class XMLWriter.

There may be more new GuardedCalls than necessary -- the catch-all for the
event loop, AudacityApp::OnExceptionInMainLoop, might be trusted instead in
some cases --  but they are sufficient.
2017-03-18 11:45:33 -04:00
Paul Licameli
b81cdee7e3 Comment where xml writing functions may throw 2017-03-18 11:45:05 -04:00
Paul Licameli
0c9deb398c Fix mac build. No standard headers in Audacity.h. 2016-03-01 12:22:37 -05:00
Paul Licameli
990080ae7d Replace virtual with override wherever possible; eliminate needless virtual...
... for functions in final classes.

override is like const -- it's not necessary, but it helps the compiler to
catch mistakes.

There may be some overriding functions not explicitly declared virtual and I did
not identify such cases, in which I might also add override.
2016-02-26 12:35:38 -05:00
Paul Licameli
7824e94030 Harmlessly qualify classes as final (or explicitly comment not)...
... Should have no effect on generated code, except perhaps some slight faster
virtual function calls.  Mostly useful as documentation of design intent.

Tried to mark every one of our classes that inherits from another, or is a
base for others, or has abstract virtual functions, and a few others besides.
2016-02-24 20:58:30 -05:00
Paul Licameli
4961006f1b Sweep unnecessary wxString copies: xml 2016-02-22 21:26:31 -05:00
Paul Licameli
f6e3c26535 XMLFileReader uses std::vector 2016-02-17 18:19:40 -05:00
Paul Licameli
7988e814bd Define make_unique properly, use in at least one commonly visited place...
Which is file opening.

So we can be sure it compiles and works on all platforms.
2016-02-15 14:30:41 -05:00
Paul Licameli
6052b5f9be Throw by value, catch by reference: don't use pointers...
... that's what the better books on C++ recommend.
2016-02-14 19:36:17 -05:00
Paul Licameli
7c4c45a0d5 "new"->"NEW" in comments, easier to find remaining naked operator new 2016-02-14 18:52:41 -05:00
Daniel Winzen
759ff8cd0d Performance improvements 2015-04-23 16:07:25 +02:00
Leland Lucius
3e1fbcd5ec Additional autosave speed improvement and 1 fix
This changes the autosave XML file to a binary representation
during writing to speed up autosave processing.  A lot of the
time used during autosave is a result of having to convert and
print all of the values to the XML file.

Writing the same information, but in binary format, reduces
all of that to just the bare essentials and the actual write
I/O.

During recovery, the binary file is read and converted to
the real xML representation and processing happens as it
did before.

It is a noticeable difference with very long or many tracks.

The included fix has to do with append recording.

Say you have 3 tracks and you want to append recorded audio
to the middle track.  Sometime later Audacity crashes and
upon recovery, the recorded audio is actually appended to
the third track, not the second one.

This fixes that by adding an "autosaveid" to each track as
it is written to the autosave file.  The same ID is written
to the recording recovery appends to the autosave file.

Then, during recovery, the IDs are matched up and the audio
gets appended to the proper track.

These autosaveid attributes are only present in the autosave
file and not in saved project files.
2015-04-17 16:58:26 -05:00
Leland Lucius
2457579091 Bug 765 - Delays using Edit commands and Draw Tool in long projects
A 4hr track used to take about 20s to cut a few samples. This is now significantly improved, to around 3s. Leland did this by

(a) moving the size calculation to when we examine the undo history, so it isn't slowing down the edits.
(b) in size calculation, using sizes that are cached rather than going to disk to find the sizes.
(c) writing the autosave file which is to an FFIle to a string first, i.e. using XMLStringWriter as a buffer for XMLFileWriter.

Step (c) may also make autosave marginally safer, as the risk of a partially updated autosave file is reduced.
2015-04-07 12:20:50 +01:00
james.k.crook@gmail.com
8a9987a0d9 From: martin@steghoefer.eu [PATCHES 02-15 of 15] Fix runtime problem with wxWidgets 3.0:
Correct string formatting for:
2/15  %d + enum => %d + int
3/15  %lld + int64_t => %lld + long long
4/15  %d + int64_t => %lld + long long
5/15  %d + double => %f + double
6/15  %d + int32_t => %d + int
7/15  %d + intptr_t => %p + void*
8/15  gint, guint
9/15  %d + long => %ld + long
10/15 %n + int => %d + int
11/15 %x + int => %x + unsigned int
12/15 %f + int => %d + int
13/15 %S + wxChar* => %s + wxChar*
14/15 %d + size_t => %d + int
15/15 %d + size_t => %lld + long long

"The functions wxString::Format, wxString::Printf (and others indirectly) have become stricter about parameter types that don't match (format specifier vs. function parameters). So the bugs (that were already present in audacity before) become visible in wx3.0 as error message dialogs. I've checked all occurrences of Printf, wxPrintf, PrintfV, Format, FormatV, wxLogDebug and wxLogError systematically and made the type match."

Note (9/15): In TrackPanel.cpp, ExportMP2.cpp and CompareAudioCommand.cpp this patch supersedes related change done in r13466 because the new solution requires fewer casts and therefore simplifies the code.

Note: Many .po files are affected, and we need to be very careful about this.  Incorrect "%d" and similar in translation files may lead to crashes in those languages (only).  This is something we should actually have been more careful about in the past.  We need to write a script to check that the "%d" and similar format specifiers match between English and translation.
2014-11-08 16:42:34 +00:00
james.k.crook@gmail.com
c68351706b Add include to fix problem in release build with overload void return in thread.h.
(From Andrew Hallendorff, e.mail on audacity-devel, 13-Oct-2014)
2014-10-13 18:33:55 +00:00
lllucius
bdcefb4850 Preliminary changes for wxWidgets 3.0.1
We can't go to 3.0.1 yet as there are still build issues on
Linux and OSX.  You can get Windows to build, but there's
still some display issues.

These changes should work with wxWidgets 2.8.12 as well, so
we can take our time to get things working properly before
switching over.
2014-10-06 08:10:50 +00:00
benjamin.drung@gmail.com
277932dccb Remove trailing spaces. 2014-06-03 20:30:19 +00:00
james.k.crook@gmail.com
94346902b3 Added include of Audacity.h (to get AUDACITY_DLL_API) to XML_Writer.cpp 2014-01-13 22:31:33 +00:00
james.k.crook@gmail.com
396486d3a6 Added AUDACITY_DLL_API and similar to export more of our classes. This is a tiny adaptation of a patch by Stephen Parry for enabling his Eutychus plug-in. See audacity-devel thread 'Second Exports Patch' of Jan 11th 2014. 2014-01-13 21:09:14 +00:00
lllucius
496aa450df Remove local copy of expat
Hasn't been used since 2008.  The wxexpat library is used instead.
2013-11-06 08:41:57 +00:00
RichardAsh1981@gmail.com
0413de548b fix the loading of projects with more than 2^31 samples in a waveclip, and possibly some other similar constraints on waveclips. This fixes a long-standing problem with long recordings being saved but unable to re-open them. Tested by Gale and Steve. 2013-11-03 15:49:12 +00:00
martynshaw99
4ce2643d5f Remove the
// Indentation settings for Vim and Emacs
etc. lines from all files, as Campbell's patch (except for other changes to Languages.cpp)
2013-09-24 00:14:37 +00:00
v.audacity
c26b3c6b49 Campbell Barton's further patch to turn many, many tabs to our 3-space convenbtion 2013-02-23 04:33:20 +00:00
richardash1981
72f6eded20 I got fed up of unused parameter warning from my compiler hiding the warnings I wanted to see, so have added WXUNUSED annotations to a lot of widely used header files, and cleaned up trailing junk on the way. 2012-12-31 16:57:15 +00:00
james.k.crook@gmail.com
cd54a2728b Fixed some smart quotes that can cause problems for .po file generation. 2012-03-20 21:59:30 +00:00
james.k.crook@gmail.com
6c71a5e170 Fixed more internationalisation hints. 2012-03-20 16:48:57 +00:00
v.audacity
59db8d4ad4 See http://bugzilla.audacityteam.org/show_bug.cgi?id=451#c31 and http://bugzilla.audacityteam.org/show_bug.cgi?id=451#c32. 2011-11-16 05:59:48 +00:00
v.audacity
1ceb0ef660 Apply modified version Roger Dannenberg's patch to remedy some problems from commit r10680 and fix some bugs. 2011-10-19 23:06:53 +00:00
v.audacity
0332c60a2a Define one constant, PLATFORM_MAX_PATH, for maximum path value, so we don't have to do platform-specific conditionals everywhere we want to check it. In fact, we were actually checking that only for Windows. This is follow-on to Richard's message on audacity-devel about "overflow vulns".
Remove unnecessary declaration of MAX_PATH in BlockFile.h.
2011-01-06 00:07:59 +00:00
rbdannenberg
a1f0e5ed5b Extensive changes to improve NoteTrack display and (some) editing, NoteTrack playback via MIDI, and Midi-to-Audio alignment. 2010-09-18 21:02:36 +00:00
v.audacity
874e530d84 more progress on bug 113
better handling of error conditions in PCMAliasBlockFile::BuildFromXML so that DirManager::ProjectFSCK can report cases of missing PCMAliasBlockFile files on opening projects where missing files were not corrected
2010-07-29 03:54:54 +00:00
v.audacity
92bdf970c5 Remove obsolete comment. 2010-07-28 22:58:16 +00:00
mchinen
52edf9ffc2 replacing expat lib-src include with a shorter copy of the table. this should restore linux builds to normal order. 2010-04-26 17:45:48 +00:00
mchinen
635931c6be fix for P2 Metadata in imported files can cause the .aup to store unhandled characters. 2010-04-24 20:54:39 +00:00