Skip to content

Commit 8d2bcab

Browse files
committed
Add missing changes to compile with Visual Studio
Add missing common.h.msvc80 file. Remove a small warning. Fix dos/unix termination (use only unix style).
1 parent 46a4818 commit 8d2bcab

File tree

3 files changed

+122
-22
lines changed

3 files changed

+122
-22
lines changed

rlog/rlog-1.4-win.diff

+20-20
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ diff -ru rlog-1.4.orig/rlog/rlog.h rlog-1.4/rlog/rlog.h
3737
inline bool isEnabled() { return *enabled; }
3838

3939
- ~PublishLoc();
40-
+ RLOG_DECL ~PublishLoc();
40+
+ RLOG_DECL ~PublishLoc();
4141
};
4242

4343
/*! @fn RLog_Register
@@ -48,10 +48,10 @@ diff -ru rlog-1.4.orig/rlog/RLogTime.cpp rlog-1.4/rlog/RLogTime.cpp
4848
*
4949
*/
5050

51-
+#if HAVE_CONFIG_H
51+
+#if HAVE_CONFIG_H
5252
#include "config.h"
53-
+#endif
54-
+
53+
+#endif
54+
+
5555
#include "RLogTime.h"
5656

5757
#ifdef _WIN32
@@ -63,7 +63,7 @@ diff -ru rlog-1.4.orig/rlog/RLogTime.h rlog-1.4/rlog/RLogTime.h
6363
typedef LARGE_INTEGER rlog_time;
6464

6565
-void sleep(int seconds);
66-
+RLOG_DECL void sleep(int seconds);
66+
+RLOG_DECL void sleep(int seconds);
6767
#else
6868

6969
#include <stdint.h>
@@ -73,11 +73,11 @@ diff -ru rlog-1.4.orig/rlog/RLogTime.h rlog-1.4/rlog/RLogTime.h
7373

7474
-void rlog_get_time(rlog_time *pt);
7575
-rlog_time_interval rlog_time_diff( const rlog_time &end, const rlog_time &start );
76-
+RLOG_DECL void rlog_get_time(rlog_time *pt);
77-
+RLOG_DECL rlog_time_interval rlog_time_diff( const rlog_time &end, const rlog_time &start );
76+
+RLOG_DECL void rlog_get_time(rlog_time *pt);
77+
+RLOG_DECL rlog_time_interval rlog_time_diff( const rlog_time &end, const rlog_time &start );
7878

7979
-const char *rlog_time_unit();
80-
+RLOG_DECL const char *rlog_time_unit();
80+
+RLOG_DECL const char *rlog_time_unit();
8181

8282
#endif // _rlog_time_incl
8383
Only in rlog-1.4/win32: common.h.msvc80
@@ -89,7 +89,7 @@ diff -ru rlog-1.4.orig/win32/rlog.vcproj rlog-1.4/win32/rlog.vcproj
8989
Optimization="0"
9090
AdditionalIncludeDirectories=".."
9191
- PreprocessorDefinitions="RLOG_COMPONENT=&quot;rlog&quot;;_CRT_SECURE_NO_WARNINGS"
92-
+ PreprocessorDefinitions="RLOG_COMPONENT=&quot;rlog&quot;;_CRT_SECURE_NO_WARNINGS;RLOG_EXPORTS"
92+
+ PreprocessorDefinitions="RLOG_COMPONENT=&quot;rlog&quot;;_CRT_SECURE_NO_WARNINGS;RLOG_EXPORTS"
9393
MinimalRebuild="true"
9494
BasicRuntimeChecks="3"
9595
RuntimeLibrary="3"
@@ -112,29 +112,29 @@ diff -ru rlog-1.4.orig/win32/rlog.vcproj rlog-1.4/win32/rlog.vcproj
112112
Name="VCCLCompilerTool"
113113
AdditionalIncludeDirectories=".."
114114
- PreprocessorDefinitions="RLOG_COMPONENT=&quot;rlog&quot;;_CRT_SECURE_NO_WARNINGS"
115-
+ PreprocessorDefinitions="RLOG_COMPONENT=&quot;rlog&quot;;_CRT_SECURE_NO_WARNINGS;RLOG_EXPORTS"
115+
+ PreprocessorDefinitions="RLOG_COMPONENT=&quot;rlog&quot;;_CRT_SECURE_NO_WARNINGS;RLOG_EXPORTS"
116116
RuntimeLibrary="2"
117117
UsePrecompiledHeader="0"
118118
WarningLevel="4"
119119
@@ -212,6 +205,10 @@
120120
>
121121
</File>
122122
<File
123-
+ RelativePath="..\rlog\RLogTime.cpp"
124-
+ >
125-
+ </File>
126-
+ <File
123+
+ RelativePath="..\rlog\RLogTime.cpp"
124+
+ >
125+
+ </File>
126+
+ <File
127127
RelativePath="..\rlog\StdioNode.cpp"
128128
>
129129
</File>
130130
@@ -258,6 +255,10 @@
131131
>
132132
</File>
133133
<File
134-
+ RelativePath="..\rlog\RLogTime.h"
135-
+ >
136-
+ </File>
137-
+ <File
134+
+ RelativePath="..\rlog\RLogTime.h"
135+
+ >
136+
+ </File>
137+
+ <File
138138
RelativePath="..\rlog\StdioNode.h"
139139
>
140140
</File>
@@ -143,7 +143,7 @@ diff -ru rlog-1.4.orig/win32/rlog.vcproj rlog-1.4/win32/rlog.vcproj
143143
Name="VCCustomBuildTool"
144144
Description="Creating common.h..."
145145
- CommandLine="copy $(InputPath) ..\rlog\common.h"
146-
+ CommandLine="copy &quot;$(InputPath)&quot; ..\rlog\common.h&#x0D;&#x0A;"
146+
+ CommandLine="copy &quot;$(InputPath)&quot; ..\rlog\common.h&#x0D;&#x0A;"
147147
Outputs="..\rlog\common.h"
148148
/>
149149
</FileConfiguration>
@@ -152,7 +152,7 @@ diff -ru rlog-1.4.orig/win32/rlog.vcproj rlog-1.4/win32/rlog.vcproj
152152
Name="VCCustomBuildTool"
153153
Description="Creating common.h..."
154154
- CommandLine="copy $(InputPath) ..\rlog\common.h"
155-
+ CommandLine="copy &quot;$(InputPath)&quot; ..\rlog\common.h&#x0D;&#x0A;"
155+
+ CommandLine="copy &quot;$(InputPath)&quot; ..\rlog\common.h&#x0D;&#x0A;"
156156
Outputs="..\rlog\common.h"
157157
/>
158158
</FileConfiguration>

rlog/rlog-1.4-win2.diff

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
diff -ruN rlog-1.4/rlog/RLogPublisher.cpp rlog-1.4.my/rlog/RLogPublisher.cpp
2+
--- rlog-1.4/rlog/RLogPublisher.cpp 2008-06-15 04:10:13.000000000 +0100
3+
+++ rlog-1.4.my/rlog/RLogPublisher.cpp 2013-02-17 16:35:24.476582710 +0000
4+
@@ -161,7 +161,7 @@
5+
va_end( args );
6+
7+
// if it worked, then return the buffer
8+
- if( ncpy > -1 && ncpy < bufSize )
9+
+ if( ncpy >= 0 && (unsigned) ncpy < bufSize )
10+
{
11+
data.msg = buf;
12+
break;
13+
diff -ruN rlog-1.4/win32/common.h.msvc80 rlog-1.4.my/win32/common.h.msvc80
14+
--- rlog-1.4/win32/common.h.msvc80 1970-01-01 01:00:00.000000000 +0100
15+
+++ rlog-1.4.my/win32/common.h.msvc80 2013-02-17 21:48:12.933731544 +0000
16+
@@ -0,0 +1,83 @@
17+
+/*****************************************************************************
18+
+ * Author: Valient Gough <vgough@pobox.com>
19+
+ *
20+
+ *****************************************************************************
21+
+ * Copyright (c) 2002-2004, Valient Gough
22+
+ * Copyright (c) 2004, Vadim Zeitlin
23+
+ *
24+
+ * This library is free software; you can distribute it and/or modify it under
25+
+ * the terms of the GNU Lesser General Public License (LGPL), as published by
26+
+ * the Free Software Foundation; either version 2.1 of the License, or (at your
27+
+ * option) any later version.
28+
+ *
29+
+ * This library is distributed in the hope that it will be useful, but WITHOUT
30+
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
31+
+ * FITNESS FOR A PARTICULAR PURPOSE. See the LGPL in the file COPYING for more
32+
+ * details.
33+
+ *
34+
+ */
35+
+
36+
+#ifndef _rlogconfig_incl_
37+
+#define _rlogconfig_incl_
38+
+
39+
+// we don't have GNU printf style attributes
40+
+#define HAVE_PRINTF_ATTR 0
41+
+#define HAVE_PRINTF_FP 0
42+
+# define RLOG_SECTION
43+
+
44+
+/* Defined by configure if our compiler understands VARIADAC macros. */
45+
+#define C99_VARIADAC_MACROS 1
46+
+#define PREC99_VARIADAC_MACROS 0
47+
+
48+
+#define RLOG_TIME_TSC 0
49+
+
50+
+# define PRINTF(FMT,X)
51+
+# define PRINTF_FP(FMT,X)
52+
+# define likely(x) (x)
53+
+# define unlikely(x) (x)
54+
+
55+
+/*! @def RLOG_COMPONENT
56+
+ @brief Specifies build-time component, eg -DRLOG_COMPONENT="component-name"
57+
+
58+
+ Define RLOG_COMPONENT as the name of the component being built.
59+
+ For example, as a compile flag, -DRLOG_COMPONENT="component-name"
60+
+
61+
+ If RLOG_COMPONENT is not specified, then it will be defined as "[unknown]"
62+
+*/
63+
+#ifndef RLOG_COMPONENT
64+
+# pragma message("rlog/common.h: RLOG_COMPONENT not defined - setting to UNKNOWN")
65+
+#define RLOG_COMPONENT "[unknown]"
66+
+#endif // RLOG_COMPONENT not defined
67+
+
68+
+// Use somewhat unique names (doesn't matter if they aren't as they are used in
69+
+// a private context, so the compiler will make them unique if it must)
70+
+# define LOGID CONCAT(_rL_, __LINE__)
71+
+
72+
+/*! @def RLOG_DECL
73+
+ @brief Macro used for declaring C++ clsas and functions to export from a
74+
+ shared library on Windows.
75+
+*/
76+
+#ifdef _WIN32
77+
+# ifdef RLOG_EXPORTS
78+
+# define RLOG_DECL __declspec(dllexport)
79+
+# else
80+
+# define RLOG_DECL __declspec(dllimport)
81+
+# endif // building/using DLL
82+
+#else // !_WIN32
83+
+# define RLOG_DECL
84+
+#endif
85+
+
86+
+#ifdef _MSC_VER
87+
+/* Visual Studio 2008 have it's own definition */
88+
+# if _MSC_VER < 1500
89+
+# define vsnprintf _vsnprintf
90+
+# endif /* _MSC_VER */
91+
+
92+
+ // suppress annoying warnings about using STL templates in DLL-exported
93+
+ // classes
94+
+# pragma warning(disable:4251)
95+
+# pragma warning(disable:4275)
96+
+#endif /* _MSC_VER */
97+
+
98+
+#endif // _rlogconfig_incl_
99+
+

rlog/rlog.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ NAME=rlog-1.4
44
OUT=$PWD/../out
55
rm -rf $NAME
66
tar zxvf $NAME.tar.gz
7-
patch -p0 < $NAME.diff
8-
patch -p0 < rlog-1.4-win.diff
97
cd $NAME
8+
patch -p1 < ../$NAME.diff
9+
patch -p1 < ../rlog-1.4-win.diff
10+
patch -p1 < ../rlog-1.4-win2.diff
1011
HOST=unknown
1112
for h in i386-mingw32 i586-mingw32msvc i686-w64-mingw32; do
1213
if $h-gcc --help &> /dev/null; then

0 commit comments

Comments
 (0)