diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-05-05 11:40:19 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-05-06 02:56:22 +0400 |
commit | b18faab4208d8368d28c7b51afe5a73bbc90b05e (patch) | |
tree | 1b198f2d7fee3047851477a08af1bf8a815e611b | |
parent | 0c9afa6dca90811c8cadb5da517c9abb9457c16b (diff) |
VobSubFile: Use the new unrar CallbackProc instead of the deprecated ProcessDataProc.
-rw-r--r-- | src/Subtitles/VobSubFile.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/Subtitles/VobSubFile.cpp b/src/Subtitles/VobSubFile.cpp index deb3a28bb..5f3ee50c5 100644 --- a/src/Subtitles/VobSubFile.cpp +++ b/src/Subtitles/VobSubFile.cpp @@ -752,12 +752,14 @@ bool CVobSubFile::ReadSub(CString fn) static unsigned char* RARbuff = NULL;
static unsigned int RARpos = 0;
-static int PASCAL MyProcessDataProc(unsigned char* Addr, int Size)
+static int CALLBACK MyCallbackProc(UINT msg, LPARAM UserData, LPARAM P1, LPARAM P2)
{
- ASSERT(RARbuff);
+ if (msg == UCM_PROCESSDATA) {
+ ASSERT(RARbuff);
- memcpy(&RARbuff[RARpos], Addr, Size);
- RARpos += Size;
+ memcpy(&RARbuff[RARpos], (char*)P1, (size_t)P2);
+ RARpos += (unsigned int)P2;
+ }
return 1;
}
@@ -778,9 +780,9 @@ bool CVobSubFile::ReadRar(CString fn) RARCloseArchive CloseArchive = (RARCloseArchive)GetProcAddress(h, "RARCloseArchive");
RARReadHeaderEx ReadHeaderEx = (RARReadHeaderEx)GetProcAddress(h, "RARReadHeaderEx");
RARProcessFile ProcessFile = (RARProcessFile)GetProcAddress(h, "RARProcessFile");
- RARSetProcessDataProc SetProcessDataProc = (RARSetProcessDataProc)GetProcAddress(h, "RARSetProcessDataProc");
+ RARSetCallback SetCallback = (RARSetCallback)GetProcAddress(h, "RARSetCallback");
- if (!(OpenArchiveEx && CloseArchive && ReadHeaderEx && ProcessFile && SetProcessDataProc)) {
+ if (!(OpenArchiveEx && CloseArchive && ReadHeaderEx && ProcessFile && SetCallback)) {
FreeLibrary(h);
return false;
}
@@ -791,7 +793,7 @@ bool CVobSubFile::ReadRar(CString fn) #define CloseArchive RARCloseArchive
#define ReadHeaderEx RARReadHeaderEx
#define ProcessFile RARProcessFile
-#define SetProcessDataProc RARSetProcessDataProc
+#define SetCallback RARSetCallback
#endif /* USE_UNRAR_STATIC */
RAROpenArchiveDataEx OpenArchiveData;
@@ -806,6 +808,7 @@ bool CVobSubFile::ReadRar(CString fn) OpenArchiveData.ArcName = fnA;
OpenArchiveData.OpenMode = RAR_OM_EXTRACT;
OpenArchiveData.CmtBuf = 0;
+ OpenArchiveData.Callback = MyCallbackProc;
HANDLE hArcData = OpenArchiveEx(&OpenArchiveData);
if (!hArcData) {
#ifndef USE_UNRAR_STATIC
@@ -814,8 +817,6 @@ bool CVobSubFile::ReadRar(CString fn) return false;
}
- SetProcessDataProc(hArcData, MyProcessDataProc);
-
RARHeaderDataEx HeaderDataEx;
HeaderDataEx.CmtBuf = NULL;
|