Script: Fixed that SKIN:ParseFormula didn't work with numbers

NowPlaying.dll: Fixed a few TagLib memory leaks.
This commit is contained in:
Birunthan Mohanathas 2012-03-12 18:11:10 +00:00
parent a57d75399c
commit 476eaf1679
5 changed files with 20 additions and 14 deletions

View File

@ -106,13 +106,14 @@ static int ParseFormula(lua_State* L)
std::wstring strTmp = LuaManager::ToWide(L, 2); std::wstring strTmp = LuaManager::ToWide(L, 2);
double result; double result;
if (self->GetParser().ParseFormula(strTmp, &result)) if (!self->GetParser().ParseFormula(strTmp, &result))
{ {
lua_pushnumber(L, result); result = lua_tonumber(L, 2);
return 1;
} }
return 0; lua_pushnumber(L, result);
return 1;
} }
static int MoveWindow(lua_State* L) static int MoveWindow(lua_State* L)

View File

@ -27,7 +27,6 @@
#include "PlayerWinamp.h" #include "PlayerWinamp.h"
#include "PlayerWLM.h" #include "PlayerWLM.h"
#include "PlayerWMP.h" #include "PlayerWMP.h"
#include "id3v1tag.h"
static std::vector<ParentMeasure*> g_ParentMeasures; static std::vector<ParentMeasure*> g_ParentMeasures;
std::wstring g_SettingsFile; std::wstring g_SettingsFile;
@ -43,10 +42,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
// Disable DLL_THREAD_ATTACH and DLL_THREAD_DETACH notification calls // Disable DLL_THREAD_ATTACH and DLL_THREAD_DETACH notification calls
DisableThreadLibraryCalls(hinstDLL); DisableThreadLibraryCalls(hinstDLL);
break; break;
case DLL_PROCESS_DETACH:
TagLib::ID3v1::Tag::setStringHandler(NULL);
break;
} }
return TRUE; return TRUE;

View File

@ -141,11 +141,19 @@ class ASF::File::HeaderExtensionObject : public ASF::File::BaseObject
{ {
public: public:
List<ASF::File::BaseObject *> objects; List<ASF::File::BaseObject *> objects;
~HeaderExtensionObject();
ByteVector guid(); ByteVector guid();
void parse(ASF::File *file, uint size); void parse(ASF::File *file, uint size);
ByteVector render(ASF::File *file); ByteVector render(ASF::File *file);
}; };
ASF::File::HeaderExtensionObject::~HeaderExtensionObject()
{
for(unsigned int i = 0; i < objects.size(); i++) {
delete objects[i];
}
}
void ASF::File::BaseObject::parse(ASF::File *file, unsigned int size) void ASF::File::BaseObject::parse(ASF::File *file, unsigned int size)
{ {
data.clear(); data.clear();

View File

@ -51,7 +51,8 @@ public:
static const StringHandler *stringHandler; static const StringHandler *stringHandler;
}; };
const ID3v1::StringHandler *ID3v1::Tag::TagPrivate::stringHandler = new StringHandler; static const StringHandler defaultStringHandler;
const ID3v1::StringHandler *ID3v1::Tag::TagPrivate::stringHandler = &defaultStringHandler;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// StringHandler implementation // StringHandler implementation
@ -189,7 +190,9 @@ void ID3v1::Tag::setTrack(uint i)
void ID3v1::Tag::setStringHandler(const StringHandler *handler) void ID3v1::Tag::setStringHandler(const StringHandler *handler)
{ {
if(TagPrivate::stringHandler != &defaultStringHandler)
delete TagPrivate::stringHandler; delete TagPrivate::stringHandler;
TagPrivate::stringHandler = handler; TagPrivate::stringHandler = handler;
} }

View File

@ -73,9 +73,8 @@ FrameFactory *FrameFactory::factory = 0;
FrameFactory *FrameFactory::instance() FrameFactory *FrameFactory::instance()
{ {
if(!factory) static FrameFactory factory;
factory = new FrameFactory; return &factory;
return factory;
} }
Frame *FrameFactory::createFrame(const ByteVector &data, bool synchSafeInts) const Frame *FrameFactory::createFrame(const ByteVector &data, bool synchSafeInts) const