diff options
author | Armada <jules.blok@gmail.com> | 2013-02-02 00:25:18 +0400 |
---|---|---|
committer | Armada <jules.blok@gmail.com> | 2013-02-02 02:42:37 +0400 |
commit | d0a74937a8315104a46b62968b1a30bf2bac959f (patch) | |
tree | 135646586cc15a66b48f8be2696ee51b7a7fcb8f | |
parent | 19b94b05379e04858b8ff38f48964a9f4c29056f (diff) |
Renamed classes to use less generic names.
Allows for easier integration by reducing conflicts.
-rw-r--r-- | File.cpp | 12 | ||||
-rw-r--r-- | File.h | 24 | ||||
-rw-r--r-- | List.cpp | 18 | ||||
-rw-r--r-- | List.h | 30 | ||||
-rw-r--r-- | Mediatype.cpp | 4 | ||||
-rw-r--r-- | Mediatype.h | 10 | ||||
-rw-r--r-- | OutputPin.cpp | 2 | ||||
-rw-r--r-- | OutputPin.h | 16 | ||||
-rw-r--r-- | RFS.cpp | 30 | ||||
-rw-r--r-- | RFS.h | 4 |
10 files changed, 75 insertions, 75 deletions
@@ -22,16 +22,16 @@ static int compare (const void *pos, const void *part) { - if (*((LONGLONG *) pos) < ((FilePart *) part)->in_file_offset) + if (*((LONGLONG *) pos) < ((CRFSFilePart *) part)->in_file_offset) return -1; - if (*((LONGLONG *) pos) >= ((FilePart *) part)->in_file_offset + ((FilePart *) part)->size) + if (*((LONGLONG *) pos) >= ((CRFSFilePart *) part)->in_file_offset + ((CRFSFilePart *) part)->size) return 1; return 0; } -int File::FindStartPart (LONGLONG position) +int CRFSFile::FindStartPart (LONGLONG position) { if (position > size) return -1; @@ -40,7 +40,7 @@ int File::FindStartPart (LONGLONG position) if (m_prev_part && !compare (&position, m_prev_part)) return (int) (m_prev_part - array); - m_prev_part = (FilePart *) bsearch (&position, array, parts, sizeof (FilePart), compare); + m_prev_part = (CRFSFilePart *) bsearch (&position, array, parts, sizeof (CRFSFilePart), compare); if (!m_prev_part) return -1; @@ -48,7 +48,7 @@ int File::FindStartPart (LONGLONG position) return (int) (m_prev_part - array); } -HRESULT File::SyncRead (LONGLONG llPosition, DWORD lLength, BYTE* pBuffer, LONG *cbActual) +HRESULT CRFSFile::SyncRead (LONGLONG llPosition, DWORD lLength, BYTE* pBuffer, LONG *cbActual) { OVERLAPPED o; LARGE_INTEGER offset; @@ -76,7 +76,7 @@ HRESULT File::SyncRead (LONGLONG llPosition, DWORD lLength, BYTE* pBuffer, LONG last_pos = pos; } #endif - FilePart *part = array + pos; + CRFSFilePart *part = array + pos; offset2 = llPosition - part->in_file_offset; offset.QuadPart = part->in_rar_offset + offset2; @@ -19,14 +19,14 @@ #include "List.h" -class FilePart +class CRFSFilePart { public: - FilePart (void) : next (NULL), file (INVALID_HANDLE_VALUE), + CRFSFilePart (void) : next (NULL), file (INVALID_HANDLE_VALUE), in_rar_offset (0), in_file_offset (0), size (0) { } - ~FilePart (void) { if (file != INVALID_HANDLE_VALUE) CloseHandle (file); } + ~CRFSFilePart (void) { if (file != INVALID_HANDLE_VALUE) CloseHandle (file); } - FilePart *next; + CRFSFilePart *next; HANDLE file; @@ -35,18 +35,18 @@ public: LONGLONG size; }; -class File : public Node<File> +class CRFSFile : public CRFSNode<CRFSFile> { public: - File (void) : size (0), parts (0), list (NULL), array (NULL), m_prev_part (NULL), filename (NULL), + CRFSFile (void) : size (0), parts (0), list (NULL), array (NULL), m_prev_part (NULL), filename (NULL), type_known (false), unsupported (false) { } - ~File (void) + ~CRFSFile (void) { - FilePart *fp = list; + CRFSFilePart *fp = list; while (fp) { - FilePart *tmp = fp; + CRFSFilePart *tmp = fp; fp = fp->next; delete tmp; } @@ -61,9 +61,9 @@ public: LONGLONG size; int parts; - FilePart *list; - FilePart *array; - FilePart *m_prev_part; + CRFSFilePart *list; + CRFSFilePart *array; + CRFSFilePart *m_prev_part; char *filename; bool type_known; @@ -14,7 +14,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -template <class T> void List<T>::InsertFirst (Node<T> *n) +template <class T> void CRFSList<T>::InsertFirst (CRFSNode<T> *n) { n->next = anchor.next; n->prev = &anchor; @@ -23,7 +23,7 @@ template <class T> void List<T>::InsertFirst (Node<T> *n) anchor.next = n; } -template <class T> void List<T>::InsertLast (Node<T> *n) +template <class T> void CRFSList<T>::InsertLast (CRFSNode<T> *n) { n->next = &anchor; n->prev = anchor.prev; @@ -32,39 +32,39 @@ template <class T> void List<T>::InsertLast (Node<T> *n) anchor.prev = n; } -template <class T> T *List<T>::UnlinkFirst (void) +template <class T> T *CRFSList<T>::UnlinkFirst (void) { - Node<T> *n = First (); + CRFSNode<T> *n = First (); if (!n) return NULL; n->Unlink (); return (T *) n; } -template <class T> T *List<T>::UnlinkLast (void) +template <class T> T *CRFSList<T>::UnlinkLast (void) { - Node<T> *n = Last (); + CRFSNode<T> *n = Last (); if (!n) return NULL; n->Unlink (); return (T *) n; } -template <class T> T *List<T>::Next (Node<T> *n) +template <class T> T *CRFSList<T>::Next (CRFSNode<T> *n) { if (n->next == &anchor) return NULL; return (T *) n->next; } -template <class T> T *List<T>::Prev (Node<T> *n) +template <class T> T *CRFSList<T>::Prev (CRFSNode<T> *n) { if (n->prev == &anchor) return NULL; return (T *) n->prev; } -template <class T> void List<T>::Clear () +template <class T> void CRFSList<T>::Clear () { T *node; @@ -17,14 +17,14 @@ #ifndef LIST_H #define LIST_H -template <class T> class List; +template <class T> class CRFSList; -template <class T> class Node +template <class T> class CRFSNode { - friend class List<T>; + friend class CRFSList<T>; public: - Node (void) : next (NULL), prev (NULL) { } + CRFSNode (void) : next (NULL), prev (NULL) { } void Unlink (void) { @@ -33,36 +33,36 @@ public: } private: - Node (Node *next, Node *prev) : next (next), prev (prev) { } + CRFSNode (CRFSNode *next, CRFSNode *prev) : next (next), prev (prev) { } - Node *next; - Node *prev; + CRFSNode *next; + CRFSNode *prev; }; -template <class T> class List +template <class T> class CRFSList { public: - List (bool auto_clear = false) : anchor (&anchor, &anchor), clear (auto_clear) { } - ~List () { if (clear) Clear (); } + CRFSList (bool auto_clear = false) : anchor (&anchor, &anchor), clear (auto_clear) { } + ~CRFSList () { if (clear) Clear (); } bool IsEmpty (void) { return anchor.next == &anchor; } T *First (void) { return Next (&anchor); } T *Last (void) { return Prev (&anchor); } - void InsertFirst (Node<T> *n); - void InsertLast (Node<T> *n); + void InsertFirst (CRFSNode<T> *n); + void InsertLast (CRFSNode<T> *n); T *UnlinkFirst (void); T *UnlinkLast (void); - T *Next (Node<T> *n); - T *Prev (Node<T> *n); + T *Next (CRFSNode<T> *n); + T *Prev (CRFSNode<T> *n); void Clear (void); private: - Node<T> anchor; + CRFSNode<T> anchor; bool clear; }; diff --git a/Mediatype.cpp b/Mediatype.cpp index 2bfd536..611888b 100644 --- a/Mediatype.cpp +++ b/Mediatype.cpp @@ -123,7 +123,7 @@ static int parseCheckBytes (wchar_t *valueData, CheckByteDetails **checkBytes) /* parses the HKEY_CLASSES_ROOT\Media Type registry key and fills the mediaTypeList with all valid byte marks and their corresponding major/subtypes */ -int getMediaTypeList (List<MediaType> *mediaTypeList) +int getMediaTypeList (CRFSList<MediaType> *mediaTypeList) { //these values come from http://msdn.microsoft.com/en-us/library/ms724872(VS.85).aspx #define MAX_VALUE_SIZE 16384 @@ -243,7 +243,7 @@ int getMediaTypeList (List<MediaType> *mediaTypeList) return mediaTypeCount; } -int checkFileForMediaType (File *file, List<MediaType> *mediaTypeList, MediaType **foundMediaType) +int checkFileForMediaType (CRFSFile *file, CRFSList<MediaType> *mediaTypeList, MediaType **foundMediaType) { MediaType *mt; CheckByteGroup *cbg; diff --git a/Mediatype.h b/Mediatype.h index e1ed800..2a8edad 100644 --- a/Mediatype.h +++ b/Mediatype.h @@ -38,7 +38,7 @@ public: BYTE *value; }; -class CheckByteGroup : public Node<CheckByteGroup> +class CheckByteGroup : public CRFSNode<CheckByteGroup> { public: CheckByteGroup () : checkBytes (NULL), checkByteCount (0) { } @@ -53,7 +53,7 @@ public: unsigned int checkByteCount; }; -class MediaType : public Node<MediaType> +class MediaType : public CRFSNode<MediaType> { public: MediaType () : majorType (GUID_NULL), subType (GUID_NULL), checkByteGroupCount (0) { } @@ -65,11 +65,11 @@ public: GUID majorType; GUID subType; - List<CheckByteGroup> checkByteGroups; + CRFSList<CheckByteGroup> checkByteGroups; unsigned int checkByteGroupCount; }; -int getMediaTypeList (List<MediaType> *mediaTypeList); -int checkFileForMediaType (File *file, List<MediaType> *mediaTypeList, MediaType **foundMediaType); +int getMediaTypeList (CRFSList<MediaType> *mediaTypeList); +int checkFileForMediaType (CRFSFile *file, CRFSList<MediaType> *mediaTypeList, MediaType **foundMediaType); #endif // MEDIATYPE_H diff --git a/OutputPin.cpp b/OutputPin.cpp index 3ecd191..7c42e18 100644 --- a/OutputPin.cpp +++ b/OutputPin.cpp @@ -294,7 +294,7 @@ STDMETHODIMP CRFSOutputPin::Request (IMediaSample* pSample, DWORD_PTR dwUser) request->pSample = pSample; request->count = 0; - FilePart *part = m_file->array + pos; + CRFSFilePart *part = m_file->array + pos; offset2 = llPosition - part->in_file_offset; offset.QuadPart = part->in_rar_offset + offset2; diff --git a/OutputPin.h b/OutputPin.h index f6668fe..ebc7f03 100644 --- a/OutputPin.h +++ b/OutputPin.h @@ -20,10 +20,10 @@ #include "List.h" class CRARFileSource; -class File; -class FilePart; +class CRFSFile; +class CRFSFilePart; -class SubRequest : public Node<SubRequest> +class SubRequest : public CRFSNode<SubRequest> { public: SubRequest (void) : file (INVALID_HANDLE_VALUE), expected (0) @@ -35,7 +35,7 @@ public: OVERLAPPED o; }; -class ReadRequest : public Node<ReadRequest> +class ReadRequest : public CRFSNode<ReadRequest> { public: ~ReadRequest (void) { subreqs.Clear (); } @@ -44,7 +44,7 @@ public: IMediaSample *pSample; DWORD count; - List<SubRequest> subreqs; + CRFSList<SubRequest> subreqs; }; class CRFSOutputPin : @@ -84,16 +84,16 @@ public: STDMETHODIMP BeginFlush (void); STDMETHODIMP EndFlush (void); - void SetFile (File *file) { m_file = file; } + void SetFile (CRFSFile *file) { m_file = file; } private: DWORD m_align; BOOL m_asked_for_reader; - File *m_file; + CRFSFile *m_file; BOOL m_flush; HANDLE m_event; - List<ReadRequest> m_requests; + CRFSList<ReadRequest> m_requests; CCritSec m_lock; HRESULT ConvertSample (IMediaSample *sample, LONGLONG *pos, DWORD *length, BYTE **buffer); @@ -254,7 +254,7 @@ void CRARFileSource::UpdateArchiveName (wchar_t *ext, size_t len, int volume, bo SetFilePointerEx (hFile, rh.bytesRemaining, NULL, FILE_CURRENT); \ continue; -int CRARFileSource::ScanArchive (wchar_t *archive_name, List<File> *file_list, int *ok_files_found) +int CRARFileSource::ScanArchive (wchar_t *archive_name, CRFSList<CRFSFile> *file_list, int *ok_files_found) { DWORD dwBytesRead; char *filename = NULL; @@ -264,20 +264,20 @@ int CRARFileSource::ScanArchive (wchar_t *archive_name, List<File> *file_list, i rar_header_t rh; BYTE marker [7]; BYTE expected [7] = { 0x52, 0x61, 0x72, 0x21, 0x1A, 0x07, 0x00 }; - FilePart *new_part, *prev_part; + CRFSFilePart *new_part, *prev_part; LONGLONG collected; DWORD ret; DWORD files = 0, volumes = 0; int volume_digits; - File *file = NULL; + CRFSFile *file = NULL; *ok_files_found = 0; LARGE_INTEGER zero = {0}; MediaType *mType; - List<MediaType> mediaTypeList (true); + CRFSList<MediaType> mediaTypeList (true); - Anchor<File> af (&file); + Anchor<CRFSFile> af (&file); ArrayAnchor<wchar_t> acrf (¤t_rar_filename); HANDLE hFile = INVALID_HANDLE_VALUE; @@ -488,7 +488,7 @@ int CRARFileSource::ScanArchive (wchar_t *archive_name, List<File> *file_list, i ASSERT (!file); - file = new File (); + file = new CRFSFile (); if (!file) { @@ -518,7 +518,7 @@ int CRARFileSource::ScanArchive (wchar_t *archive_name, List<File> *file_list, i if (!file->unsupported) { - new_part = new FilePart (); + new_part = new CRFSFilePart (); if (!new_part) { @@ -562,7 +562,7 @@ int CRARFileSource::ScanArchive (wchar_t *archive_name, List<File> *file_list, i if (file->parts) { - file->array = new FilePart [file->parts]; + file->array = new CRFSFilePart [file->parts]; if (!file->array) { @@ -570,12 +570,12 @@ int CRARFileSource::ScanArchive (wchar_t *archive_name, List<File> *file_list, i return files; } - FilePart *fp = file->list; + CRFSFilePart *fp = file->list; file->list = NULL; for (int i = 0; i < file->parts; i ++) { - FilePart *tmp; - memcpy (file->array + i, fp, sizeof (FilePart)); + CRFSFilePart *tmp; + memcpy (file->array + i, fp, sizeof (CRFSFilePart)); tmp = fp; fp = fp->next; tmp->file = INVALID_HANDLE_VALUE; @@ -685,8 +685,8 @@ INT_PTR CALLBACK CRARFileSource::DlgFileList (HWND hwndDlg, UINT uMsg, WPARAM wP case WM_INITDIALOG: { int len; - List<File> *file_list = (List<File> *) lParam; - File *file = file_list->First (); + CRFSList<CRFSFile> *file_list = (CRFSList<CRFSFile> *) lParam; + CRFSFile *file = file_list->First (); wchar_t *tempString; while (file) @@ -742,7 +742,7 @@ INT_PTR CALLBACK CRARFileSource::DlgFileList (HWND hwndDlg, UINT uMsg, WPARAM wP STDMETHODIMP CRARFileSource::Load (LPCOLESTR lpwszFileName, const AM_MEDIA_TYPE *pmt) { - List <File> file_list; + CRFSList <CRFSFile> file_list; int num_files, num_ok_files; CAutoLock lck (&m_lock); @@ -788,7 +788,7 @@ STDMETHODIMP CRARFileSource::Load (LPCOLESTR lpwszFileName, const AM_MEDIA_TYPE } else { - m_file = (File *) DialogBoxParam (g_hInst, MAKEINTRESOURCE(IDD_FILELIST), 0, DlgFileList, (LPARAM) &file_list); + m_file = (CRFSFile *) DialogBoxParam (g_hInst, MAKEINTRESOURCE(IDD_FILELIST), 0, DlgFileList, (LPARAM) &file_list); if (!m_file) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); @@ -54,13 +54,13 @@ public: private: static void UpdateArchiveName (wchar_t *ext, size_t len, int volume, bool new_numbering); - int ScanArchive (wchar_t *archive_name, List<File> *file_list, int *known_files_found); + int ScanArchive (wchar_t *archive_name, CRFSList<CRFSFile> *file_list, int *known_files_found); static INT_PTR CALLBACK DlgFileList (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); CRFSOutputPin m_pin; CCritSec m_lock; LPWSTR m_file_name; - File *m_file; + CRFSFile *m_file; static file_type_t s_file_types []; }; |