From d3a308ff2b6d3f643d2a417fecdb09036d2a1d0d Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Wed, 22 Apr 2015 14:53:01 +0200 Subject: [PATCH] Fix errors --- src/AudioIO.cpp | 2 +- src/AutoRecovery.cpp | 68 ++++++++++++++++---------------- src/widgets/ExpandingToolBar.cpp | 2 +- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index ac998f062..a9faa3557 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -1985,7 +1985,7 @@ bool AudioIO::StartPortMidiStream() const PmDeviceInfo *info = Pm_GetDeviceInfo(i); if (!info) continue; if (!info->output) continue; - wxString interf = wxSafeConvertMB2WX((info->interf); + wxString interf = wxSafeConvertMB2WX(info->interf); wxString name = wxSafeConvertMB2WX(info->name); interf.Append(wxT(": ")).Append(name); if (wxStrcmp(interf, playbackDeviceName) == 0) { diff --git a/src/AutoRecovery.cpp b/src/AutoRecovery.cpp index d72d8060d..0b803db2f 100644 --- a/src/AutoRecovery.cpp +++ b/src/AutoRecovery.cpp @@ -587,7 +587,7 @@ void AutoSaveFile::CheckSpace(wxMemoryOutputStream & os) size_t origPos = buf->GetIntPosition(); char *temp = new char[mAllocSize]; buf->Write(temp, mAllocSize); - delete temp; + delete[] temp; buf->SetIntPosition(origPos); } } @@ -644,33 +644,33 @@ bool AutoSaveFile::Decode(const wxString & fileName) // Close the file so we can reopen it in read/write mode file.Close(); - // Add tag, if necessary + // Add tag, if necessary if (!file.Open(fn.GetFullPath(), wxT("r+b"))) - { - // Really shouldn't happen, but let the caller deal with it - return false; - } - - // Read the last 16 bytes of the file and check if they contain - // "" somewhere. - const int bufsize = 16; - char buf[bufsize + 1]; - if (file.SeekEnd(-bufsize) != wxInvalidOffset) - { - if (file.Read(buf, bufsize) == bufsize) - { - buf[bufsize] = 0; - if (strstr(buf, "") == 0) - { - // End of file does not contain closing tag, so add it - if (file.Seek(0, wxFromEnd) != wxInvalidOffset) - { - strcpy(buf, "\n"); - file.Write(buf, strlen(buf)); - } - } - } - } + { + // Really shouldn't happen, but let the caller deal with it + return false; + } + + // Read the last 16 bytes of the file and check if they contain + // "" somewhere. + const int bufsize = 16; + char buf[bufsize + 1]; + if (file.SeekEnd(-bufsize) != wxInvalidOffset) + { + if (file.Read(buf, bufsize) == bufsize) + { + buf[bufsize] = 0; + if (strstr(buf, "") == 0) + { + // End of file does not contain closing tag, so add it + if (file.Seek(0, wxFromEnd) != wxInvalidOffset) + { + strcpy(buf, "\n"); + file.Write(buf, strlen(buf)); + } + } + } + } file.Close(); @@ -682,7 +682,7 @@ bool AutoSaveFile::Decode(const wxString & fileName) if (file.Read(buf, len) != len) { - delete buf; + delete[] buf; return false; } @@ -698,7 +698,7 @@ bool AutoSaveFile::Decode(const wxString & fileName) out.Open(tempName, wxT("wb")); if (!out.IsOpened()) { - delete buf; + delete[] buf; wxRemoveFile(tempName); @@ -737,7 +737,7 @@ bool AutoSaveFile::Decode(const wxString & fileName) in.Read(name, len); mIds[id] = wxString(name, len / sizeof(wxChar)); - delete name; + delete[] name; } break; @@ -767,7 +767,7 @@ bool AutoSaveFile::Decode(const wxString & fileName) in.Read(val, len); out.WriteAttr(mIds[id], wxString(val, len / sizeof(wxChar))); - delete val; + delete[] val; } break; @@ -861,7 +861,7 @@ bool AutoSaveFile::Decode(const wxString & fileName) in.Read(val, len); out.WriteData(wxString(val, len / sizeof(wxChar))); - delete val; + delete[] val; } break; @@ -874,7 +874,7 @@ bool AutoSaveFile::Decode(const wxString & fileName) in.Read(val, len); out.Write(wxString(val, len / sizeof(wxChar))); - delete val; + delete[] val; } break; @@ -884,7 +884,7 @@ bool AutoSaveFile::Decode(const wxString & fileName) } } - delete buf; + delete[] buf; bool error = out.Error(); diff --git a/src/widgets/ExpandingToolBar.cpp b/src/widgets/ExpandingToolBar.cpp index 1814d26d7..cd7431752 100644 --- a/src/widgets/ExpandingToolBar.cpp +++ b/src/widgets/ExpandingToolBar.cpp @@ -1113,7 +1113,7 @@ void ToolBarArea::OnSize(wxSizeEvent & WXUNUSED(event)) wxSize currentSize = GetClientSize(); - if (abs(currentSize.x - mLastLayoutSize.x >= 100)) { + if (abs(currentSize.x - mLastLayoutSize.x) >= 100) { // If they resize by more than 100 pixels (horizontally), // we totally redo the layout, preserving the order of the // toolbars but not the exact position.