Skip to content

Commit 2f44b84

Browse files
committed
Inlined dev10 workaround and switched nuget to use variable paths
1 parent 06fe048 commit 2f44b84

File tree

7 files changed

+38
-98
lines changed

7 files changed

+38
-98
lines changed

Release/include/cpprest/streams.h

Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -954,11 +954,34 @@ namespace Concurrency { namespace streams
954954
return pplx::task_from_exception<size_t>(std::make_exception_ptr(std::runtime_error("source buffer not set up for input of data")));
955955

956956
// Capture 'buffer' rather than 'helper' here due to VC++ 2010 limitations.
957-
auto buffer = helper()->m_buffer;
958-
957+
auto _buffer = helper()->m_buffer;
958+
auto bsz = this->buf_size;
959959
std::shared_ptr<_read_helper> _locals = std::make_shared<_read_helper>();
960960

961-
_dev10_ice_workaround wrkarnd(buffer, target, _locals, buf_size);
961+
auto wrkarnd = [_locals, target, _buffer, bsz]() mutable -> pplx::task<bool>
962+
{
963+
// We need to capture these, because the object itself may go away
964+
// before we're done processing the data.
965+
auto locs = _locals;
966+
auto trg = target;
967+
968+
return _buffer.getn(locs->outbuf, bsz).then([=](size_t rd) mutable -> pplx::task<bool>
969+
{
970+
if (rd == 0)
971+
return pplx::task_from_result(false);
972+
return trg.putn(locs->outbuf, rd).then([=](size_t wr) mutable -> pplx::task<bool>
973+
{
974+
locs->total += wr;
975+
return trg.sync().then([=]() -> bool
976+
{
977+
if (rd != wr)
978+
// Number of bytes written is less than number of bytes received.
979+
throw std::runtime_error("failed to write all bytes");
980+
return true;
981+
});
982+
});
983+
});
984+
};
962985

963986
auto loop = pplx::details::do_while(wrkarnd);
964987

@@ -1104,47 +1127,6 @@ namespace Concurrency { namespace streams
11041127
}
11051128
};
11061129

1107-
// To workaround a VS 2010 internal compiler error, we have to do our own
1108-
// "lambda" here...
1109-
class _dev10_ice_workaround
1110-
{
1111-
public:
1112-
_dev10_ice_workaround(streams::streambuf<CharType> buffer,
1113-
concurrency::streams::streambuf<CharType> target,
1114-
std::shared_ptr<typename basic_istream::_read_helper> locals,
1115-
size_t buf_size)
1116-
: _buffer(buffer), _target(target), _locals(locals), _buf_size(buf_size)
1117-
{
1118-
}
1119-
pplx::task<bool> operator()()
1120-
{
1121-
// We need to capture these, because the object itself may go away
1122-
// before we're done processing the data.
1123-
auto locs = _locals;
1124-
auto trg = _target;
1125-
1126-
return _buffer.getn(locs->outbuf, buf_size).then([=](size_t rd) mutable -> pplx::task<bool>
1127-
{
1128-
if ( rd == 0 )
1129-
return pplx::task_from_result(false);
1130-
return trg.putn(locs->outbuf, rd).then([=](size_t wr) mutable -> bool
1131-
{
1132-
locs->total += wr;
1133-
trg.sync().wait();
1134-
if (rd != wr)
1135-
// Number of bytes written is less than number of bytes received.
1136-
throw std::runtime_error("failed to write all bytes");
1137-
return true;
1138-
});
1139-
});
1140-
}
1141-
private:
1142-
size_t _buf_size;
1143-
concurrency::streams::streambuf<CharType> _buffer;
1144-
concurrency::streams::streambuf<CharType> _target;
1145-
std::shared_ptr<typename basic_istream::_read_helper> _locals;
1146-
};
1147-
11481130
std::shared_ptr<details::basic_istream_helper<CharType>> m_helper;
11491131
};
11501132

Release/tests/Functional/streams/VS11.winrt/streams110_test.winrt.vcxproj

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,7 @@
238238
</ItemGroup>
239239
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
240240
<ImportGroup Label="ExtensionTargets">
241-
<Import Project="..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" />
242-
<Import Project="..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets" Condition="Exists('..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets')" />
241+
<Import Project="$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets')" />
242+
<Import Project="$(PackagesRoot)\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets" Condition="Exists('$(PackagesRoot)\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets')" />
243243
</ImportGroup>
244-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
245-
<PropertyGroup>
246-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
247-
</PropertyGroup>
248-
<Error Condition="!Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets'))" />
249-
<Error Condition="!Exists('..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets'))" />
250-
</Target>
251244
</Project>

Release/tests/Functional/streams/VS11.xp/streams110_test.xp.vcxproj

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,7 @@
212212
</ItemGroup>
213213
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
214214
<ImportGroup Label="ExtensionTargets">
215-
<Import Project="..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" />
216-
<Import Project="..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets" Condition="Exists('..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets')" />
215+
<Import Project="$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets')" />
216+
<Import Project="$(PackagesRoot)\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets" Condition="Exists('$(PackagesRoot)\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets')" />
217217
</ImportGroup>
218-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
219-
<PropertyGroup>
220-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
221-
</PropertyGroup>
222-
<Error Condition="!Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets'))" />
223-
<Error Condition="!Exists('..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets'))" />
224-
</Target>
225218
</Project>

Release/tests/Functional/streams/VS11/streams110_test.vcxproj

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,7 @@
211211
</ItemGroup>
212212
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
213213
<ImportGroup Label="ExtensionTargets">
214-
<Import Project="..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" />
215-
<Import Project="..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets" Condition="Exists('..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets')" />
214+
<Import Project="$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets')" />
215+
<Import Project="$(PackagesRoot)\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets" Condition="Exists('$(PackagesRoot)\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets')" />
216216
</ImportGroup>
217-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
218-
<PropertyGroup>
219-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
220-
</PropertyGroup>
221-
<Error Condition="!Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets'))" />
222-
<Error Condition="!Exists('..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost_date_time-vc110.1.55.0.16\build\native\boost_date_time-vc110.targets'))" />
223-
</Target>
224217
</Project>

Release/tests/Functional/streams/vs12.winrt/streams120_test.winrt.vcxproj

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@
249249
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
250250
<Import Project="$(BuildRoot)\cpprest.razzle.targets" Condition="'$(BuildInRazzle)'!=''" />
251251
<ImportGroup Label="ExtensionTargets">
252-
<Import Project="..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" />
253-
<Import Project="..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets" Condition="Exists('..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets')" />
252+
<Import Project="$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets')" />
253+
<Import Project="$(PackagesRoot)\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets" Condition="Exists('$(PackagesRoot)\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets')" />
254254
</ImportGroup>
255255
<Target Name="StripAppContainer" AfterTargets="Build">
256256
<CallTarget Targets="StripAppContainerOnProjectDll" />
@@ -261,11 +261,4 @@
261261
<Target Name="RazzleAfterBuild" Condition="'$(BuildInRazzle)'!=''" AfterTargets="BuildLinked">
262262
<CallTarget Targets="StripAppContainer" />
263263
</Target>
264-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
265-
<PropertyGroup>
266-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
267-
</PropertyGroup>
268-
<Error Condition="!Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets'))" />
269-
<Error Condition="!Exists('..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets'))" />
270-
</Target>
271264
</Project>

Release/tests/Functional/streams/vs12.xp/streams120_test.xp.vcxproj

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,7 @@
168168
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
169169
<Import Project="$(BuildRoot)\cpprest.razzle.targets" Condition="'$(BuildInRazzle)'!=''" />
170170
<ImportGroup Label="ExtensionTargets">
171-
<Import Project="..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" />
172-
<Import Project="..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets" Condition="Exists('..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets')" />
171+
<Import Project="$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets')" />
172+
<Import Project="$(PackagesRoot)\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets" Condition="Exists('$(PackagesRoot)\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets')" />
173173
</ImportGroup>
174-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
175-
<PropertyGroup>
176-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
177-
</PropertyGroup>
178-
<Error Condition="!Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets'))" />
179-
<Error Condition="!Exists('..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets'))" />
180-
</Target>
181174
</Project>

Release/tests/Functional/streams/vs12/streams120_test.vcxproj

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,7 @@
223223
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
224224
<Import Project="$(BuildRoot)\cpprest.razzle.targets" Condition="'$(BuildInRazzle)'!=''" />
225225
<ImportGroup Label="ExtensionTargets">
226-
<Import Project="..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" />
227-
<Import Project="..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets" Condition="Exists('..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets')" />
226+
<Import Project="$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets" Condition="Exists('$(PackagesRoot)\boost.1.55.0.16\build\native\boost.targets')" />
227+
<Import Project="$(PackagesRoot)\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets" Condition="Exists('$(PackagesRoot)\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets')" />
228228
</ImportGroup>
229-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
230-
<PropertyGroup>
231-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
232-
</PropertyGroup>
233-
<Error Condition="!Exists('..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost.1.55.0.16\build\native\boost.targets'))" />
234-
<Error Condition="!Exists('..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\boost_date_time-vc120.1.55.0.16\build\native\boost_date_time-vc120.targets'))" />
235-
</Target>
236229
</Project>

0 commit comments

Comments
 (0)