[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : gerry
Repository : xara
Revision : 1576
Date : Thu Jul 27 18:03:07 BST 2006
Changed paths:
M /Trunk/XaraLX/xarlib/ensure.cpp
M /Trunk/XaraLX/xarlib/ensure.h
M /Trunk/XaraLX/xarlib/xarlib.cpp
M /Trunk/XaraLX/xarlib/xarlib.h
Updates to some xarlib specific files
Diff:
Index: Trunk/XaraLX/xarlib/ensure.cpp
===================================================================
--- Trunk/XaraLX/xarlib/ensure.cpp (revision 1575)
+++ Trunk/XaraLX/xarlib/ensure.cpp (revision 1576)
@@ -60,7 +60,15 @@
called from the ASSERT macro.
*/
-void EnsureFailedLine(LPCSTR AssertDescription, LPCSTR lpszFileName, int nLine)
+void EnsureFailedLine(LPCTSTR AssertDescription, LPCSTR lpszFileName, int nLine)
{
- TRACE(_T("Ensure failed at %s (%d): %s
"), lpszFileName, nLine, AssertDescription);
+#if 0 != wxUSE_UNICODE
+ // Need to convert the filename string to TCHAR
+ TCHAR tFile[512];
+ camMbstowcs(tFile, lpszFileName, 512);
+#else
+ TCHAR * tFile = lpszFileName;
+#endif
+
+ TRACE(_T("Ensure failed at %s (%d): %s
"), tFile, nLine, AssertDescription);
}
Index: Trunk/XaraLX/xarlib/xarlib.cpp
===================================================================
--- Trunk/XaraLX/xarlib/xarlib.cpp (revision 1575)
+++ Trunk/XaraLX/xarlib/xarlib.cpp (revision 1576)
@@ -25,7 +25,7 @@
===========================XARAHEADEREND===================================*/
-#include "camtypes.h"
+//#include "camtypes.h"
#include "xarlib.h"
#include "cxfile.h"
#include "ccfile.h"
@@ -37,7 +37,7 @@
virtual ~CImporter();
virtual BOOL PrepareImport();
- virtual BOOL PrepareImport(char* pFileName);
+ virtual BOOL PrepareImport(TCHAR* pFileName);
#if defined(USE_COM_STREAM)
virtual BOOL PrepareImport(IStream* pStream);
#endif // defined(USE_COM_STREAM)
@@ -62,7 +62,7 @@
virtual ~CExporter();
virtual BOOL StartExport();
- virtual BOOL StartExport(char* pFileName);
+ virtual BOOL StartExport(TCHAR* pFileName);
#if defined(USE_COM_STREAM)
virtual BOOL StartExport(IStream* pStream);
#endif // defined(USE_COM_STREAM)
@@ -96,7 +96,7 @@
{
m_pCXImpFile = NULL;
m_pCCImpDiskFile = NULL;
- m_pCCImpStreamFile = NULL;
+ m_pCCImpStreamFile = NULL;
m_pCCImpMemFile = NULL;
#if defined(USE_COM_STREAM)
m_pCCImpOleFile = NULL;
@@ -144,7 +144,7 @@
#endif // defined(USE_COM_STREAM)
}
-
+
BOOL CImporter::PrepareImport()
{
if (m_pCXImpFile || m_pCCImpDiskFile || m_pCCImpStreamFile || m_pCCImpMemFile
@@ -156,10 +156,12 @@
return(FALSE);
}
+ // TODOG: This needs fixing first!!!
+
// First off, we have to connect to stdin (cin is the iostream equivalent)
- fstream* pStream = new fstream("test.xar", ios::in);
-// ((iostream*)pStream)->rdbuf(cin.rdbuf());
-
+ fstream* pStream = new fstream();
+ ((iostream*)pStream)->rdbuf(cin.rdbuf());
+
m_pCCImpStreamFile = new CCStreamFile(pStream, 1024, FALSE, TRUE);
if (!m_pCCImpStreamFile)
return(FALSE);
@@ -177,10 +179,10 @@
return(ok);
}
-
-
-BOOL CImporter::PrepareImport(char* pFileName)
+
+
+BOOL CImporter::PrepareImport(TCHAR* pFileName)
{
if (m_pCXImpFile || m_pCCImpDiskFile || m_pCCImpStreamFile || m_pCCImpMemFile
#if defined(USE_COM_STREAM)
@@ -201,7 +203,7 @@
if (!m_pCCImpDiskFile->open(FileName, ios::in | ios::binary))
{
// Failed to open the file...
- TRACE("Failed to open file in PrepareImport
");
+ TRACE(_T("Failed to open file in PrepareImport
"));
return(FALSE);
}
@@ -267,6 +269,7 @@
return(FALSE);
}
+#if FALSE
#if defined(_WIN32)
char PathBuf[MAX_PATH];
if (GetTempPath(MAX_PATH, PathBuf) == 0)
@@ -281,19 +284,22 @@
char Buffer[MAX_PATH];
tsprintf( Buffer, sizeof(Buffer), "%s/libXar-%d-%d-%ld", PathBuf, random(), getpid(), time(NULL) % 1000 );
#endif
+#endif
+
+ wxString TempFileName = wxFileName::CreateTempFileName(_T("libXar"));
CCDiskFile TempFile(1024,FALSE,TRUE);
- PathName FileName(Buffer);
+ PathName FileName(TempFileName.c_str());
if (!TempFile.open(FileName, ios::out | ios::binary))
{
// Failed to open the file...
- TRACE("Failed to open temp file in PrepareImport
");
+ TRACE(_T("Failed to open temp file in PrepareImport
"));
return(FALSE);
}
if (TempFile.write(pBuffer, Size).bad())
{
// Failed to write the file...
- TRACE("Failed to write temp file in PrepareImport
");
+ TRACE(_T("Failed to write temp file in PrepareImport
"));
return(FALSE);
}
@@ -305,7 +311,7 @@
if (!m_pCCImpDiskFile->open(FileName, ios::in | ios::binary))
{
// Failed to open the file...
- TRACE("Failed to open temp file in PrepareImport
");
+ TRACE(_T("Failed to open temp file in PrepareImport
"));
return(FALSE);
}
@@ -317,7 +323,7 @@
// if (!m_pCCImpMemFile->open(pBuffer, Size, CCMemRead))
// {
// // Failed to open the file...
-// TRACE("Failed to open file in PrepareImport
");
+// TRACE(_T("Failed to open file in PrepareImport
"));
// return(FALSE);
// }
@@ -377,7 +383,7 @@
{
m_pCXExpFile = NULL;
m_pCCExpDiskFile = NULL;
- m_pCCExpStreamFile = NULL;
+ m_pCCExpStreamFile = NULL;
m_pCCExpMemFile = NULL;
#if defined(USE_COM_STREAM)
m_pCCExpOleFile = NULL;
@@ -406,7 +412,7 @@
delete m_pCCExpStreamFile;
m_pCCExpStreamFile = NULL;
}
-
+
if (m_pCCExpMemFile)
{
m_pCCExpMemFile->close();
@@ -423,8 +429,8 @@
}
#endif // defined(USE_COM_STREAM)
}
-
-
+
+
BOOL CExporter::StartExport()
{
if (m_pCXExpFile || m_pCCExpDiskFile || m_pCCExpStreamFile || m_pCCExpMemFile
@@ -437,9 +443,9 @@
}
// First off, we have to connect to stdout (cout is the iostream equivalent)
- fstream* pStream = new fstream;
- ((iostream*)pStream)->rdbuf(cout.rdbuf());
-
+ fstream* pStream = new fstream;
+ ((iostream*)pStream)->rdbuf(cout.rdbuf());
+
m_pCCExpStreamFile = new CCStreamFile(pStream, 1024, FALSE, FALSE);
if (!m_pCCExpStreamFile)
return(FALSE);
@@ -453,10 +459,10 @@
return(ok);
}
-
-
-BOOL CExporter::StartExport(char* pFileName)
+
+
+BOOL CExporter::StartExport(TCHAR* pFileName)
{
if (m_pCXExpFile || m_pCCExpDiskFile || m_pCCExpStreamFile || m_pCCExpMemFile
#if defined(USE_COM_STREAM)
@@ -477,7 +483,7 @@
if (!m_pCCExpDiskFile->open(FileName, ios::out | ios::binary))
{
// Failed to open the file...
- TRACE("Failed to open file in PrepareExport
");
+ TRACE(_T("Failed to open file in PrepareExport
"));
return(FALSE);
}
@@ -541,7 +547,7 @@
if (!m_pCCExpMemFile->open(NULL, 0, CCMemWrite))
{
// Failed to open the file...
- TRACE("Failed to open file in PrepareExport
");
+ TRACE(_T("Failed to open file in PrepareExport
"));
return(FALSE);
}
@@ -597,3 +603,9 @@
return(TRUE);
}
+
+void CamResource::GetBinaryFileInfo(void **pPtr, UINT32 *pSize)
+{
+ *pPtr = NULL;
+ *pSize = 0;
+}
Index: Trunk/XaraLX/xarlib/ensure.h
===================================================================
--- Trunk/XaraLX/xarlib/ensure.h (revision 1575)
+++ Trunk/XaraLX/xarlib/ensure.h (revision 1576)
@@ -50,14 +50,14 @@
#ifndef INC_ENSURE
#define INC_ENSURE
- void CCAPI EnsureFailedLine(LPCSTR AssertDescription, LPCSTR lpszFileName, int nLine);
+ void CCAPI EnsureFailedLine(LPCTSTR AssertDescription, LPCSTR lpszFileName, int nLine);
// Set this #define to build ensures into retail builds too
//#define _INCLUDE_ENSURES_IN_RETAIL
#ifdef _DEBUG
// Debug ensure
- #define ENSURE(expr,description) ((expr) ? (void)0: EnsureFailedLine(description,__FILE__,__LINE__))
+ #define ENSURE(expr,description) ((expr) ? (void)0: EnsureFailedLine(_T(description),__FILE__,__LINE__))
#define _ENSURES
#else
#ifdef _INCLUDE_ENSURES_IN_RETAIL
Index: Trunk/XaraLX/xarlib/xarlib.h
===================================================================
--- Trunk/XaraLX/xarlib/xarlib.h (revision 1575)
+++ Trunk/XaraLX/xarlib/xarlib.h (revision 1576)
@@ -28,6 +28,7 @@
#ifndef INC_XARLIB
#define INC_XARLIB
+#include "camtypes.h"
#include "cxftags.h"
#include "cxfrec.h"
@@ -36,14 +37,14 @@
class CCDiskFile;
class CCMemFile;
-typedef HRESULT (RecordHandler)(void*, CXaraFileRecord*);
+typedef BOOL (RecordHandler)(void*, CXaraFileRecord*);
class CXarImport
{
public:
virtual ~CXarImport() {};
virtual BOOL PrepareImport() = 0;
- virtual BOOL PrepareImport(char* pFileName) = 0;
+ virtual BOOL PrepareImport(TCHAR* pFileName) = 0;
#if defined(USE_COM_STREAM)
virtual BOOL PrepareImport(IStream* pStream) = 0;
#endif // defined(USE_COM_STREAM)
@@ -57,7 +58,7 @@
public:
virtual ~CXarExport() {};
virtual BOOL StartExport() = 0;
- virtual BOOL StartExport(char* pFileName) = 0;
+ virtual BOOL StartExport(TCHAR* pFileName) = 0;
#if defined(USE_COM_STREAM)
virtual BOOL StartExport(IStream* pStream) = 0;
#endif // defined(USE_COM_STREAM)
Xara