/[tivodecode]/tivocom/trunk/CTivoFile.cpp
ViewVC logotype

Diff of /tivocom/trunk/CTivoFile.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 248 by jeremyd2019, Wed Aug 15 06:53:07 2007 UTC revision 249 by jeremyd2019, Wed Aug 29 06:53:05 2007 UTC
# Line 17  int fread_wrapper (void* mem, int size, void* fh) Line 17  int fread_wrapper (void* mem, int size, void* fh)
17    
18  STDMETHODIMP CTivoFile::Init(const std::string & mak, BSTR filename)  STDMETHODIMP CTivoFile::Init(const std::string & mak, BSTR filename)
19  {  {
20          USES_CONVERSION;          try
21          m_fname = OLE2CA(filename);          {
22          m_mak = mak;                  USES_CONVERSION;
23          m_fh = fopen(m_fname.c_str(), "rb");                  m_fname = OLE2CA(filename);
24          if (m_fh == NULL)                  m_mak = mak;
25                  return AtlHresultFromLastError();                  _com_util::CheckError(AtlHresultFromWin32(fopen_s(&m_fh, m_fname.c_str(), "rb")));
         if (read_tivo_header(m_fh, &m_fileheader, &fread_wrapper) < 0)  
                 return E_FAIL;  
26    
27          m_endoffileheader = ftell(m_fh);                  if (read_tivo_header(m_fh, &m_fileheader, &fread_wrapper) < 0)
28                            _com_raise_error(E_FAIL);
29    
30                    m_endoffileheader = ftell(m_fh);
31            }
32            catch (const _com_error & ex)
33            {
34                    return ex.Error();
35            }
36    
37          return S_OK;          return S_OK;
38  }  }
39    
# Line 112  STDMETHODIMP CTivoFile::get_chunks(IChunkCollection** Line 118  STDMETHODIMP CTivoFile::get_chunks(IChunkCollection**
118    
119  STDMETHODIMP CTivoFile::get_mak(BSTR* pVal)  STDMETHODIMP CTivoFile::get_mak(BSTR* pVal)
120  {  {
121          CComBSTR mak (m_mak.size(), m_mak.data());          CComBSTR mak (static_cast<int>(m_mak.size()), m_mak.data());
122          return mak.CopyTo(pVal);          return mak.CopyTo(pVal);
123  }  }
124    

Legend:
Removed from v.248  
changed lines
  Added in v.249

cvs@jdrake.com
ViewVC Help
Powered by ViewVC 1.1.13