]> git.saurik.com Git - wxWidgets.git/blame - utils/HelpGen/src/wx_extra_imps.cpp
fixed crash in XPM decoder when reading non XPM files
[wxWidgets.git] / utils / HelpGen / src / wx_extra_imps.cpp
CommitLineData
cecfc5e7
VZ
1////////////////////
2//
3// craeted by Alex
4//
5////////////////////
6
7// For compilers that support precompilation, includes "wx.h".
8#include "wx/wxprec.h"
9
10#include <memory.h>
11
12#ifndef WX_PRECOMP
13 #include "wx/defs.h"
14#endif
15
16char *
17copystring (const char *s)
18{
19 if (s == NULL) s = "";
20 size_t len = strlen (s) + 1;
21
22 char *news = new char[len];
23 memcpy (news, s, len); // Should be the fastest
24
25 return news;
26}
27
71432ef8
VZ
28#ifdef __WXMSW__
29// from filefn.cpp
30void WXDLLEXPORT wxSplitPath(const char *pszFileName,
31 wxString *pstrPath,
32 wxString *pstrName,
33 wxString *pstrExt)
34{
35 wxCHECK_RET( pszFileName, _("NULL file name in wxSplitPath") );
36
59734eb5
VZ
37 const char *pDot = strrchr(pszFileName, wxFILE_SEP_EXT);
38 const char *pSepUnix = strrchr(pszFileName, wxFILE_SEP_PATH_UNIX);
39 const char *pSepDos = strrchr(pszFileName, wxFILE_SEP_PATH_DOS);
71432ef8
VZ
40
41 // take the last of the two
42 size_t nPosUnix = pSepUnix ? pSepUnix - pszFileName : 0;
43 size_t nPosDos = pSepDos ? pSepDos - pszFileName : 0;
44 if ( nPosDos > nPosUnix )
45 nPosUnix = nPosDos;
46// size_t nLen = Strlen(pszFileName);
47
48 if ( pstrPath )
49 *pstrPath = wxString(pszFileName, nPosUnix);
50 if ( pDot ) {
51 size_t nPosDot = pDot - pszFileName;
52 if ( pstrName )
53 *pstrName = wxString(pszFileName + nPosUnix + 1, nPosDot - nPosUnix);
54 if ( pstrExt )
55 *pstrExt = wxString(pszFileName + nPosDot + 1);
56 }
57 else {
58 if ( pstrName )
59 *pstrName = wxString(pszFileName + nPosUnix + 1);
60 if ( pstrExt )
61 pstrExt->Empty();
62 }
63}
64
65wxLocale *wxGetLocale()
66{
67 return NULL;
68}
69
70const char *wxLocale::GetString(const char *szOrigString,
71 const char *) const
72{
73 return szOrigString;
74}
75
76#else // !MSW
cecfc5e7
VZ
77const char *wxGetTranslation(const char *str)
78{
79 return str;
80}
71432ef8 81#endif // MSW