]> git.lyx.org Git - lyx.git/blob - development/Win32/win32_kludge.diff
two more kludges bite the dust
[lyx.git] / development / Win32 / win32_kludge.diff
1 Index: src/frontends/qt2/QLyXKeySym.C
2 ===================================================================
3 RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLyXKeySym.C,v
4 retrieving revision 1.32
5 diff -u -a -u -r1.32 QLyXKeySym.C
6 --- src/frontends/qt2/QLyXKeySym.C      7 Jul 2004 09:32:19 -0000       1.32
7 +++ src/frontends/qt2/QLyXKeySym.C      18 Apr 2005 17:37:02 -0000
8 @@ -74,7 +74,7 @@
9  void initEncodings()
10  {
11         // when no document open
12 -       encoding_map[""] = QTextCodec::codecForLocale();
13 +       encoding_map[std::string()] = QTextCodec::codecForLocale();
14  
15         encoding_map["iso8859-1"] = QTextCodec::codecForName("ISO 8859-1");
16         encoding_map["iso8859-2"] = QTextCodec::codecForName("ISO 8859-2");
17 Index: src/support/filetools.C
18 ===================================================================
19 RCS file: /cvs/lyx/lyx-devel/src/support/filetools.C,v
20 retrieving revision 1.209
21 diff -u -r1.209 filetools.C
22 --- src/support/filetools.C     2005/04/21 14:03:30     1.209
23 +++ src/support/filetools.C     2005/04/26 15:43:13
24 @@ -1051,6 +1051,11 @@
25  
26  cmd_ret const RunCommand(string const & cmd)
27  {
28 +#ifdef _WIN32
29 +       // TODO: Implement this, or merge it into forkedcall.
30 +       // Used for lyx2lyx in buffer.C, echo in math_extern and kpse in this file
31 +       return make_pair(-1, string());
32 +#else
33         // FIXME: replace all calls to RunCommand with ForkedCall
34         // (if the output is not needed) or the code in ispell.C
35         // (if the output is needed).
36 @@ -1080,6 +1085,7 @@
37                 perror("RunCommand:: could not terminate child process");
38  
39         return make_pair(pret, ret);
40 +#endif
41  }
42  
43  
44 Index: src/support/tempname.C
45 ===================================================================
46 RCS file: /cvs/lyx/lyx-devel/src/support/tempname.C,v
47 retrieving revision 1.26
48 diff -u -r1.26 tempname.C
49 --- src/support/tempname.C      2005/04/26 10:30:24     1.26
50 +++ src/support/tempname.C      2005/04/26 15:51:22
51 @@ -32,6 +32,10 @@
52  # endif
53  #endif
54  
55 +#ifdef _WIN32
56 +# include <io.h>
57 +#endif
58 +
59  using boost::scoped_array;
60  
61  using std::string;
62 @@ -44,6 +48,9 @@
63  {
64  #if defined(HAVE_MKSTEMP)
65         return ::mkstemp(templ);
66 +#elif defined(_WIN32)
67 +    ::_mktemp(templ);
68 +    return (int) ::fopen(templ, "w");
69  #elif defined(HAVE_MKTEMP)
70         // This probably just barely works...
71         ::mktemp(templ);
72 @@ -60,7 +67,9 @@
73  {
74         string const tmpdir(dir.empty() ? package().temp_dir() : dir);
75         string tmpfl(AddName(tmpdir, mask));
76 +#ifndef _WIN32
77         tmpfl += convert<string>(getpid());
78 +#endif
79         tmpfl += "XXXXXX";
80  
81         // The supposedly safe mkstemp version
82 @@ -71,7 +80,11 @@
83         int const tmpf = make_tempfile(tmpl.get());
84         if (tmpf != -1) {
85                 string const t(tmpl.get());
86 +#ifdef _WIN32
87 +        ::fclose((FILE *) tmpf);
88 +#else
89                 ::close(tmpf);
90 +#endif
91                 lyxerr[Debug::FILES] << "Temporary file `" << t
92                                      << "' created." << endl;
93                 return t;