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);
double result;
if (self->GetParser().ParseFormula(strTmp, &result))
if (!self->GetParser().ParseFormula(strTmp, &result))
{
lua_pushnumber(L, result);
return 1;
result = lua_tonumber(L, 2);
}
return 0;
lua_pushnumber(L, result);
return 1;
}
static int MoveWindow(lua_State* L)

View File

@ -27,7 +27,6 @@
#include "PlayerWinamp.h"
#include "PlayerWLM.h"
#include "PlayerWMP.h"
#include "id3v1tag.h"
static std::vector<ParentMeasure*> g_ParentMeasures;
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
DisableThreadLibraryCalls(hinstDLL);
break;
case DLL_PROCESS_DETACH:
TagLib::ID3v1::Tag::setStringHandler(NULL);
break;
}
return TRUE;

View File

@ -141,11 +141,19 @@ class ASF::File::HeaderExtensionObject : public ASF::File::BaseObject
{
public:
List<ASF::File::BaseObject *> objects;
~HeaderExtensionObject();
ByteVector guid();
void parse(ASF::File *file, uint size);
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)
{
data.clear();

View File

@ -51,7 +51,8 @@ public:
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
@ -189,7 +190,9 @@ void ID3v1::Tag::setTrack(uint i)
void ID3v1::Tag::setStringHandler(const StringHandler *handler)
{
delete TagPrivate::stringHandler;
if(TagPrivate::stringHandler != &defaultStringHandler)
delete TagPrivate::stringHandler;
TagPrivate::stringHandler = handler;
}

View File

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