1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-08 01:17:10 +01:00

Fix errors

This commit is contained in:
Daniel Winzen
2015-04-22 14:53:01 +02:00
parent 592f8408c7
commit d3a308ff2b
3 changed files with 36 additions and 36 deletions

View File

@@ -1985,7 +1985,7 @@ bool AudioIO::StartPortMidiStream()
const PmDeviceInfo *info = Pm_GetDeviceInfo(i); const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
if (!info) continue; if (!info) continue;
if (!info->output) continue; if (!info->output) continue;
wxString interf = wxSafeConvertMB2WX((info->interf); wxString interf = wxSafeConvertMB2WX(info->interf);
wxString name = wxSafeConvertMB2WX(info->name); wxString name = wxSafeConvertMB2WX(info->name);
interf.Append(wxT(": ")).Append(name); interf.Append(wxT(": ")).Append(name);
if (wxStrcmp(interf, playbackDeviceName) == 0) { if (wxStrcmp(interf, playbackDeviceName) == 0) {

View File

@@ -587,7 +587,7 @@ void AutoSaveFile::CheckSpace(wxMemoryOutputStream & os)
size_t origPos = buf->GetIntPosition(); size_t origPos = buf->GetIntPosition();
char *temp = new char[mAllocSize]; char *temp = new char[mAllocSize];
buf->Write(temp, mAllocSize); buf->Write(temp, mAllocSize);
delete temp; delete[] temp;
buf->SetIntPosition(origPos); 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 // Close the file so we can reopen it in read/write mode
file.Close(); file.Close();
// Add </project> tag, if necessary // Add </project> tag, if necessary
if (!file.Open(fn.GetFullPath(), wxT("r+b"))) if (!file.Open(fn.GetFullPath(), wxT("r+b")))
{ {
// Really shouldn't happen, but let the caller deal with it // Really shouldn't happen, but let the caller deal with it
return false; return false;
} }
// Read the last 16 bytes of the file and check if they contain // Read the last 16 bytes of the file and check if they contain
// "</project>" somewhere. // "</project>" somewhere.
const int bufsize = 16; const int bufsize = 16;
char buf[bufsize + 1]; char buf[bufsize + 1];
if (file.SeekEnd(-bufsize) != wxInvalidOffset) if (file.SeekEnd(-bufsize) != wxInvalidOffset)
{ {
if (file.Read(buf, bufsize) == bufsize) if (file.Read(buf, bufsize) == bufsize)
{ {
buf[bufsize] = 0; buf[bufsize] = 0;
if (strstr(buf, "</project>") == 0) if (strstr(buf, "</project>") == 0)
{ {
// End of file does not contain closing </project> tag, so add it // End of file does not contain closing </project> tag, so add it
if (file.Seek(0, wxFromEnd) != wxInvalidOffset) if (file.Seek(0, wxFromEnd) != wxInvalidOffset)
{ {
strcpy(buf, "</project>\n"); strcpy(buf, "</project>\n");
file.Write(buf, strlen(buf)); file.Write(buf, strlen(buf));
} }
} }
} }
} }
file.Close(); file.Close();
@@ -682,7 +682,7 @@ bool AutoSaveFile::Decode(const wxString & fileName)
if (file.Read(buf, len) != len) if (file.Read(buf, len) != len)
{ {
delete buf; delete[] buf;
return false; return false;
} }
@@ -698,7 +698,7 @@ bool AutoSaveFile::Decode(const wxString & fileName)
out.Open(tempName, wxT("wb")); out.Open(tempName, wxT("wb"));
if (!out.IsOpened()) if (!out.IsOpened())
{ {
delete buf; delete[] buf;
wxRemoveFile(tempName); wxRemoveFile(tempName);
@@ -737,7 +737,7 @@ bool AutoSaveFile::Decode(const wxString & fileName)
in.Read(name, len); in.Read(name, len);
mIds[id] = wxString(name, len / sizeof(wxChar)); mIds[id] = wxString(name, len / sizeof(wxChar));
delete name; delete[] name;
} }
break; break;
@@ -767,7 +767,7 @@ bool AutoSaveFile::Decode(const wxString & fileName)
in.Read(val, len); in.Read(val, len);
out.WriteAttr(mIds[id], wxString(val, len / sizeof(wxChar))); out.WriteAttr(mIds[id], wxString(val, len / sizeof(wxChar)));
delete val; delete[] val;
} }
break; break;
@@ -861,7 +861,7 @@ bool AutoSaveFile::Decode(const wxString & fileName)
in.Read(val, len); in.Read(val, len);
out.WriteData(wxString(val, len / sizeof(wxChar))); out.WriteData(wxString(val, len / sizeof(wxChar)));
delete val; delete[] val;
} }
break; break;
@@ -874,7 +874,7 @@ bool AutoSaveFile::Decode(const wxString & fileName)
in.Read(val, len); in.Read(val, len);
out.Write(wxString(val, len / sizeof(wxChar))); out.Write(wxString(val, len / sizeof(wxChar)));
delete val; delete[] val;
} }
break; break;
@@ -884,7 +884,7 @@ bool AutoSaveFile::Decode(const wxString & fileName)
} }
} }
delete buf; delete[] buf;
bool error = out.Error(); bool error = out.Error();

View File

@@ -1113,7 +1113,7 @@ void ToolBarArea::OnSize(wxSizeEvent & WXUNUSED(event))
wxSize currentSize = GetClientSize(); 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), // If they resize by more than 100 pixels (horizontally),
// we totally redo the layout, preserving the order of the // we totally redo the layout, preserving the order of the
// toolbars but not the exact position. // toolbars but not the exact position.