diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/psp/display_manager.cpp | 2 | ||||
-rw-r--r-- | backends/platform/psp/tests.cpp | 31 |
2 files changed, 32 insertions, 1 deletions
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index fd94827e04..9643063294 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -117,9 +117,9 @@ void VramAllocator::deallocate(void *address) { // Find the Allocator to deallocate for (i = _allocList.begin(); i != _allocList.end(); ++i) { if ((*i).address == address) { + PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); _bytesAllocated -= (*i).size; _allocList.erase(i); - PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); return; } } diff --git a/backends/platform/psp/tests.cpp b/backends/platform/psp/tests.cpp index 92a18e58d0..450a48e563 100644 --- a/backends/platform/psp/tests.cpp +++ b/backends/platform/psp/tests.cpp @@ -566,6 +566,7 @@ bool PspUnitTests::testFileSystem() { wrStream = file.createWriteStream(); if (!wrStream) { PSP_ERROR("%s couldn't be created.\n", path); + delete[] buffer; return false; } @@ -579,6 +580,8 @@ bool PspUnitTests::testFileSystem() { while(totalLength - curLength > 0) { if ((int)wrStream->write(index, curLength) != curLength) { PSP_ERROR("couldn't write %d bytes\n", curLength); + delete[] buffer; + delete wrStream; return false; } totalLength -= curLength; @@ -590,6 +593,8 @@ bool PspUnitTests::testFileSystem() { // write the rest if ((int)wrStream->write(index, totalLength) != totalLength) { PSP_ERROR("couldn't write %d bytes\n", curLength); + delete[] buffer; + delete wrStream; return false; } @@ -600,12 +605,15 @@ bool PspUnitTests::testFileSystem() { rdStream = file.createReadStream(); if (!rdStream) { PSP_ERROR("%s couldn't be created.\n", path); + delete[] buffer; return false; } // seek to beginning if (!rdStream->seek(0, SEEK_SET)) { PSP_ERROR("couldn't seek to the beginning after writing the file\n"); + delete[] buffer; + delete rdStream; return false; } @@ -619,6 +627,9 @@ bool PspUnitTests::testFileSystem() { if (!rdStream->eos()) { PSP_ERROR("didn't find EOS at end of stream\n"); + delete[] buffer; + delete rdStream; + delete[] readBuffer; return false; } @@ -626,6 +637,9 @@ bool PspUnitTests::testFileSystem() { for (i=0; i<(int)BufSize; i++) if (buffer[i] != readBuffer[i]) { PSP_ERROR("reading/writing mistake at %x. Got %x instead of %x\n", i, readBuffer[i], buffer[i]); + delete[] buffer; + delete rdStream; + delete[] readBuffer; return false; } @@ -636,7 +650,9 @@ bool PspUnitTests::testFileSystem() { } } + delete[] buffer; delete rdStream; + delete[] readBuffer; PSP_INFO_PRINT("writing...\n"); @@ -652,12 +668,14 @@ bool PspUnitTests::testFileSystem() { int ret; if ((ret = wrStream->write(phrase, phraseLen)) != (int)phraseLen) { PSP_ERROR("couldn't write phrase. Got %d instead of %d\n", ret, phraseLen); + delete wrStream; return false; } PSP_INFO_PRINT("reading...\n"); delete wrStream; + rdStream = file.createReadStream(); if (!rdStream) { PSP_ERROR("%s couldn't be created.\n", path); @@ -669,12 +687,16 @@ bool PspUnitTests::testFileSystem() { if ((ret = rdStream->read(readPhrase, phraseLen) != phraseLen)) { PSP_ERROR("read error on phrase. Got %d instead of %d\n", ret, phraseLen); + delete rdStream; + delete[] readPhrase; return false; } for (i=0; i<(int)phraseLen; i++) { if (readPhrase[i] != phrase[i]) { PSP_ERROR("bad read/write in phrase. At %d, %x != %x\n", i, readPhrase[i], phrase[i]); + delete rdStream; + delete[] readPhrase; return false; } } @@ -682,6 +704,8 @@ bool PspUnitTests::testFileSystem() { // check for exceeding if (readPhrase[i] != 0) { PSP_ERROR("found excessive copy in phrase. %c at %d\n", readPhrase[i], i); + delete rdStream; + delete[] readPhrase; return false; } @@ -690,15 +714,22 @@ bool PspUnitTests::testFileSystem() { // seek to end if (!rdStream->seek(0, SEEK_END)) { PSP_ERROR("couldn't seek to end for append\n"); + delete rdStream; + delete[] readPhrase; return false; }; // try to read if (rdStream->read(readPhrase, 2) || !rdStream->eos()) { PSP_ERROR("was able to read at end of file\n"); + delete rdStream; + delete[] readPhrase; return false; } + delete rdStream; + delete[] readPhrase; + PSP_INFO_PRINT("ok\n"); return true; } |