You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2011/09/23 16:25:23 UTC

svn commit: r1174801 - in /thrift/trunk: compiler/cpp/ lib/cpp/ lib/cpp/src/ lib/cpp/src/transport/ lib/cpp/src/windows/

Author: roger
Date: Fri Sep 23 14:25:22 2011
New Revision: 1174801

URL: http://svn.apache.org/viewvc?rev=1174801&view=rev
Log:
THRIFT-1031 Patch to compile Thrift for vc++ 9.0 and 10.0
=> some more improvements

Patch: James Dickson

Added:
    thrift/trunk/compiler/cpp/compiler.sln
    thrift/trunk/compiler/cpp/compiler.vcxproj
    thrift/trunk/compiler/cpp/compiler.vcxproj.filters
Modified:
    thrift/trunk/lib/cpp/libthrift.vcxproj
    thrift/trunk/lib/cpp/src/Thrift.h
    thrift/trunk/lib/cpp/src/transport/TSocket.cpp
    thrift/trunk/lib/cpp/src/windows/TargetVersion.h
    thrift/trunk/lib/cpp/src/windows/config.h
    thrift/trunk/lib/cpp/src/windows/force_inc.h

Added: thrift/trunk/compiler/cpp/compiler.sln
URL: http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/compiler.sln?rev=1174801&view=auto
==============================================================================
--- thrift/trunk/compiler/cpp/compiler.sln (added)
+++ thrift/trunk/compiler/cpp/compiler.sln Fri Sep 23 14:25:22 2011
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "compiler", "compiler.vcxproj", "{89975A1A-F799-4556-98B8-64E30AB39A90}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{89975A1A-F799-4556-98B8-64E30AB39A90}.Debug|Win32.ActiveCfg = Debug|Win32
+		{89975A1A-F799-4556-98B8-64E30AB39A90}.Debug|Win32.Build.0 = Debug|Win32
+		{89975A1A-F799-4556-98B8-64E30AB39A90}.Release|Win32.ActiveCfg = Release|Win32
+		{89975A1A-F799-4556-98B8-64E30AB39A90}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Added: thrift/trunk/compiler/cpp/compiler.vcxproj
URL: http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/compiler.vcxproj?rev=1174801&view=auto
==============================================================================
--- thrift/trunk/compiler/cpp/compiler.vcxproj (added)
+++ thrift/trunk/compiler/cpp/compiler.vcxproj Fri Sep 23 14:25:22 2011
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="src\generate\t_generator.h" />
+    <ClInclude Include="src\generate\t_generator_registry.h" />
+    <ClInclude Include="src\generate\t_oop_generator.h" />
+    <ClInclude Include="src\globals.h" />
+    <ClInclude Include="src\main.h" />
+    <ClInclude Include="src\md5.h" />
+    <ClInclude Include="src\parse\t_base_type.h" />
+    <ClInclude Include="src\parse\t_const.h" />
+    <ClInclude Include="src\parse\t_const_value.h" />
+    <ClInclude Include="src\parse\t_container.h" />
+    <ClInclude Include="src\parse\t_doc.h" />
+    <ClInclude Include="src\parse\t_enum.h" />
+    <ClInclude Include="src\parse\t_enum_value.h" />
+    <ClInclude Include="src\parse\t_field.h" />
+    <ClInclude Include="src\parse\t_function.h" />
+    <ClInclude Include="src\parse\t_list.h" />
+    <ClInclude Include="src\parse\t_map.h" />
+    <ClInclude Include="src\parse\t_program.h" />
+    <ClInclude Include="src\parse\t_scope.h" />
+    <ClInclude Include="src\parse\t_service.h" />
+    <ClInclude Include="src\parse\t_set.h" />
+    <ClInclude Include="src\parse\t_struct.h" />
+    <ClInclude Include="src\parse\t_type.h" />
+    <ClInclude Include="src\parse\t_typedef.h" />
+    <ClInclude Include="src\platform.h" />
+    <ClInclude Include="src\thrifty.h" />
+    <ClInclude Include="src\windows\config.h" />
+    <ClInclude Include="src\windows\version.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="src\generate\t_as3_generator.cc" />
+    <ClCompile Include="src\generate\t_cocoa_generator.cc" />
+    <ClCompile Include="src\generate\t_cpp_generator.cc" />
+    <ClCompile Include="src\generate\t_csharp_generator.cc" />
+    <ClCompile Include="src\generate\t_c_glib_generator.cc" />
+    <ClCompile Include="src\generate\t_erl_generator.cc" />
+    <ClCompile Include="src\generate\t_generator.cc" />
+    <ClCompile Include="src\generate\t_go_generator.cc" />
+    <ClCompile Include="src\generate\t_hs_generator.cc" />
+    <ClCompile Include="src\generate\t_html_generator.cc" />
+    <ClCompile Include="src\generate\t_javame_generator.cc" />
+    <ClCompile Include="src\generate\t_java_generator.cc" />
+    <ClCompile Include="src\generate\t_js_generator.cc" />
+    <ClCompile Include="src\generate\t_ocaml_generator.cc" />
+    <ClCompile Include="src\generate\t_perl_generator.cc" />
+    <ClCompile Include="src\generate\t_php_generator.cc" />
+    <ClCompile Include="src\generate\t_py_generator.cc" />
+    <ClCompile Include="src\generate\t_rb_generator.cc" />
+    <ClCompile Include="src\generate\t_st_generator.cc" />
+    <ClCompile Include="src\generate\t_xsd_generator.cc" />
+    <ClCompile Include="src\main.cc" />
+    <ClCompile Include="src\md5.c" />
+    <ClCompile Include="src\parse\parse.cc" />
+    <ClCompile Include="src\thriftl.cc" />
+    <ClCompile Include="src\thrifty.cc" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="README_WINDOWS" />
+    <None Include="src\thriftl.ll" />
+    <None Include="src\thrifty.yy" />
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{89975A1A-F799-4556-98B8-64E30AB39A90}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>compiler</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(IncludePath)</IncludePath>
+    <TargetName>thrift</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(IncludePath)</IncludePath>
+    <TargetName>thrift</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;MINGW;YY_NO_UNISTD_H;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ForcedIncludeFiles>config.h</ForcedIncludeFiles>
+      <CompileAs>CompileAsCpp</CompileAs>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <PreBuildEvent>
+      <Command>flex -o "src/thriftl.cc" src/thriftl.ll
+bison -y -o "src/thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
+    </PreBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;MINGW;YY_NO_UNISTD_H;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ForcedIncludeFiles>config.h</ForcedIncludeFiles>
+      <CompileAs>CompileAsCpp</CompileAs>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+    <PreBuildEvent>
+      <Command>flex -o "src/thriftl.cc" src/thriftl.ll
+bison -y -o "src/thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
+    </PreBuildEvent>
+  </ItemDefinitionGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file

Added: thrift/trunk/compiler/cpp/compiler.vcxproj.filters
URL: http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/compiler.vcxproj.filters?rev=1174801&view=auto
==============================================================================
--- thrift/trunk/compiler/cpp/compiler.vcxproj.filters (added)
+++ thrift/trunk/compiler/cpp/compiler.vcxproj.filters Fri Sep 23 14:25:22 2011
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <ClInclude Include="src\main.h" />
+    <ClInclude Include="src\windows\version.h">
+      <Filter>windows</Filter>
+    </ClInclude>
+    <ClInclude Include="src\windows\config.h">
+      <Filter>windows</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_base_type.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_const.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_const_value.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_container.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_doc.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_enum.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_enum_value.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_field.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_function.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_list.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_map.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_program.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_scope.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_service.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_set.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_struct.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_type.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\parse\t_typedef.h">
+      <Filter>parse</Filter>
+    </ClInclude>
+    <ClInclude Include="src\generate\t_generator.h">
+      <Filter>generate</Filter>
+    </ClInclude>
+    <ClInclude Include="src\generate\t_generator_registry.h">
+      <Filter>generate</Filter>
+    </ClInclude>
+    <ClInclude Include="src\generate\t_oop_generator.h">
+      <Filter>generate</Filter>
+    </ClInclude>
+    <ClInclude Include="src\globals.h" />
+    <ClInclude Include="src\md5.h" />
+    <ClInclude Include="src\platform.h" />
+    <ClInclude Include="src\thrifty.h">
+      <Filter>generated</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <Filter Include="windows">
+      <UniqueIdentifier>{ae9d0a15-57ae-4f01-87a4-81f790249b83}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="resources">
+      <UniqueIdentifier>{c9be9380-57bb-438a-a647-4a6943326d6b}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="generated">
+      <UniqueIdentifier>{79697fe7-fdf0-4ed4-bb4f-3128632c3446}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="parse">
+      <UniqueIdentifier>{5df016bb-591b-420a-a535-4330d9187fbf}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="generate">
+      <UniqueIdentifier>{b5c626af-afa5-433c-8e10-ee734533cb68}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="src\main.cc" />
+    <ClCompile Include="src\parse\parse.cc">
+      <Filter>parse</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_as3_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_c_glib_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_cocoa_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_cpp_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_csharp_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_erl_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_hs_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_html_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_java_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_javame_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_js_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_ocaml_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_perl_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_php_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_rb_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_st_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_xsd_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\md5.c" />
+    <ClCompile Include="src\thriftl.cc">
+      <Filter>generated</Filter>
+    </ClCompile>
+    <ClCompile Include="src\thrifty.cc">
+      <Filter>generated</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_go_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+    <ClCompile Include="src\generate\t_py_generator.cc">
+      <Filter>generate</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="src\thriftl.ll">
+      <Filter>resources</Filter>
+    </None>
+    <None Include="src\thrifty.yy">
+      <Filter>resources</Filter>
+    </None>
+    <None Include="README_WINDOWS" />
+  </ItemGroup>
+</Project>
\ No newline at end of file

Modified: thrift/trunk/lib/cpp/libthrift.vcxproj
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/libthrift.vcxproj?rev=1174801&r1=1174800&r2=1174801&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/libthrift.vcxproj (original)
+++ thrift/trunk/lib/cpp/libthrift.vcxproj Fri Sep 23 14:25:22 2011
@@ -35,8 +35,8 @@
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="src\concurrency\Util.cpp">
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">HAVE_GETTIMEOFDAY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">HAVE_GETTIMEOFDAY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="src\processor\PeekProcessor.cpp">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -217,7 +217,8 @@
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;NOMINMAX;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ForcedIncludeFiles>force_inc.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -231,7 +232,8 @@
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;NOMINMAX;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ForcedIncludeFiles>force_inc.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>

Modified: thrift/trunk/lib/cpp/src/Thrift.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/Thrift.h?rev=1174801&r1=1174800&r2=1174801&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/Thrift.h (original)
+++ thrift/trunk/lib/cpp/src/Thrift.h Fri Sep 23 14:25:22 2011
@@ -20,6 +20,10 @@
 #ifndef _THRIFT_THRIFT_H_
 #define _THRIFT_THRIFT_H_ 1
 
+#ifdef _WIN32
+#include "windows/config.h"
+#endif
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif

Modified: thrift/trunk/lib/cpp/src/transport/TSocket.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/transport/TSocket.cpp?rev=1174801&r1=1174800&r2=1174801&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/transport/TSocket.cpp (original)
+++ thrift/trunk/lib/cpp/src/transport/TSocket.cpp Fri Sep 23 14:25:22 2011
@@ -181,10 +181,6 @@ bool TSocket::peek() {
 
 void TSocket::openConnection(struct addrinfo *res) {
 
-#ifdef _WIN32
-    TWinsockSingleton::create();
-#endif // _WIN32
-
   if (isOpen()) {
     return;
   }
@@ -276,7 +272,7 @@ void TSocket::openConnection(struct addr
     goto done;
   }
 
-  if (errno != EINPROGRESS) {
+  if ((errno != EINPROGRESS) && (errno != EWOULDBLOCK)) {
     int errno_copy = errno;
     GlobalOutput.perror("TSocket::open() connect() " + getSocketInfo(), errno_copy);
     throw TTransportException(TTransportException::NOT_OPEN, "connect() failed", errno_copy);
@@ -346,6 +342,11 @@ void TSocket::unix_open(){
 }
 
 void TSocket::local_open(){
+
+#ifdef _WIN32
+    TWinsockSingleton::create();
+#endif // _WIN32
+
   if (isOpen()) {
     return;
   }

Modified: thrift/trunk/lib/cpp/src/windows/TargetVersion.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/windows/TargetVersion.h?rev=1174801&r1=1174800&r2=1174801&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/windows/TargetVersion.h (original)
+++ thrift/trunk/lib/cpp/src/windows/TargetVersion.h Fri Sep 23 14:25:22 2011
@@ -28,6 +28,9 @@
 #error This is a MSVC header only.
 #endif
 
+#include <winsdkver.h>
+
+#define _WIN32_WINNT 0x0601
 #include <SDKDDKVer.h>
 
 #endif //_THIRFT_WINDOWS_TARGETVERSION_H_

Modified: thrift/trunk/lib/cpp/src/windows/config.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/windows/config.h?rev=1174801&r1=1174800&r2=1174801&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/windows/config.h (original)
+++ thrift/trunk/lib/cpp/src/windows/config.h Fri Sep 23 14:25:22 2011
@@ -28,6 +28,11 @@
 #error This is a MSVC header only.
 #endif
 
+#pragma warning(disable: 4996) // Depreciated posix name.
+#pragma warning(disable: 4250) // Inherits via dominance.
+
+#define HAVE_GETTIMEOFDAY 1
+
 #include "TargetVersion.h"
 #include "GetTimeOfDay.h"
 #include "Operators.h"
@@ -50,27 +55,31 @@ typedef boost::uint8_t  uint8_t;
 // pthreads
 #include <pthread.h>
 
-//"asm/posix_types.h"
-typedef unsigned int __kernel_size_t;
-typedef int          __kernel_ssize_t;
-
-//"linux/types.h"
-typedef __kernel_size_t  size_t;
-typedef __kernel_ssize_t ssize_t;
-
-// Missing defines.
-#define __BYTE_ORDER __LITTLE_ENDIAN
+typedef ptrdiff_t ssize_t;
 
 // Missing functions.
 #define usleep(ms) Sleep(ms)
 
-#if WINVER == 0x0501
-#   define poll(fds, nfds, timeout) \
-    select(0, NULL, fds, NULL, timeout)
-#else
-#   define poll(fds, nfds, timeout) \
-    WSAPoll(fds, nfds, timeout)
-#endif // WINVER
+#define poll(fds, nfds, timeout) \
+    poll_win32(fds, nfds, timeout)
+
+inline int poll_win32(LPWSAPOLLFD fdArray, ULONG fds, INT timeout)
+{
+    fd_set read_fds;
+    fd_set write_fds;
+    fd_set except_fds;
+
+    FD_ZERO(&read_fds);
+    FD_ZERO(&write_fds);
+    FD_ZERO(&except_fds);
+
+    FD_SET(fdArray[0].fd, &read_fds);
+    FD_SET(fdArray[0].fd, &write_fds);
+    FD_SET(fdArray[0].fd, &except_fds);
+
+    timeval time_out = {timeout * 0.001, timeout * 1000};
+    return select(1, &read_fds, &write_fds, &except_fds, &time_out);
+}
 
 inline void close(SOCKET socket)
 {

Modified: thrift/trunk/lib/cpp/src/windows/force_inc.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/windows/force_inc.h?rev=1174801&r1=1174800&r2=1174801&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/windows/force_inc.h (original)
+++ thrift/trunk/lib/cpp/src/windows/force_inc.h Fri Sep 23 14:25:22 2011
@@ -28,6 +28,10 @@
 #error This is a MSVC header only.
 #endif
 
+#define NOMINMAX
+
+#include "windows/config.h"
+
 #undef gai_strerror
 #define gai_strerror gai_strerrorA