Merge pull request #3 from maksqwe/master

Some of the fixes and optimization
This commit is contained in:
Moritz Bunkus 2014-05-12 20:02:47 +02:00
commit ef3f1430dd
2 changed files with 8 additions and 7 deletions

View File

@ -65,7 +65,7 @@ EbmlMaster::EbmlMaster(const EbmlMaster & ElementToClone)
while (Itr != ElementToClone.ElementList.end())
{
*myItr = (*Itr)->Clone();
Itr++; myItr++;
++Itr; ++myItr;
}
}
@ -524,7 +524,7 @@ bool EbmlMaster::InsertElement(EbmlElement & element, size_t position)
std::vector<EbmlElement *>::iterator Itr = ElementList.begin();
while (Itr != ElementList.end() && position--)
{
Itr++;
++Itr;
}
if ((Itr == ElementList.end()) && position)
return false;
@ -538,7 +538,7 @@ bool EbmlMaster::InsertElement(EbmlElement & element, const EbmlElement & before
std::vector<EbmlElement *>::iterator Itr = ElementList.begin();
while (Itr != ElementList.end() && *Itr != &before)
{
Itr++;
++Itr;
}
if (Itr == ElementList.end())
return false;

View File

@ -153,10 +153,11 @@ bool WinIOCallback::open(const wchar_t* Path, const open_mode aMode, DWORD dwFla
mFile = CreateFileW(Path, AccessMode, ShareMode, NULL, Disposition, dwFlags, NULL);
} else {
int errCode;
unsigned int bufferSize = wcslen(Path) + sizeof(wchar_t) * 2;
int pathSize = wcslen(Path);
unsigned int bufferSize = pathSize + sizeof(wchar_t) * 2;
std::string PathA;
PathA.resize(bufferSize);
errCode = WideCharToMultiByte(CP_ACP, 0, Path, wcslen(Path), (char *)PathA.c_str(), bufferSize, NULL, NULL);
errCode = WideCharToMultiByte(CP_ACP, 0, Path, pathSize, (char *)PathA.c_str(), bufferSize, NULL, NULL);
if (errCode == 0)
errCode = GetLastError();
#ifdef _DEBUG
@ -168,7 +169,7 @@ bool WinIOCallback::open(const wchar_t* Path, const open_mode aMode, DWORD dwFla
// Increase the buffer size
bufferSize += MAX_PATH;
PathA.resize(bufferSize);
errCode = WideCharToMultiByte(CP_ACP, WC_SEPCHARS, Path, wcslen(Path), (char *)PathA.c_str(), bufferSize, NULL, NULL);
errCode = WideCharToMultiByte(CP_ACP, WC_SEPCHARS, Path, pathSize, (char *)PathA.c_str(), bufferSize, NULL, NULL);
if (errCode == 0)
errCode = GetLastError();
}
@ -251,7 +252,7 @@ void WinIOCallback::setFilePointer(int64 Offset, seek_mode Mode)
}
else
{
mCurrentPosition |= uint64(High<<32);
mCurrentPosition |= uint64(High)<<32;
}
}