Skip to content

Commit

Permalink
Port icepatch2server icepatch2client icepatch2calc to C++11 mapping (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Jan 4, 2024
1 parent 6e5ce3f commit 4c7f76e
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 82 deletions.
2 changes: 2 additions & 0 deletions cpp/config/Make.rules
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ static_excludes = test/Ice/library test/Ice/plugin
cpp98_projects = %
cpp98_excludes = glacier2router \
icebridge \
icepatch2server icepatch2client icepatch2calc \
icegridnode icegridregistry icegridadmin icegriddb \
IceStormService icestormadmin icestormdb \
IceXML \
Expand All @@ -79,6 +80,7 @@ cpp98_excludes = glacier2router \
cpp11_components = $(coreandstub_components) \
glacier2router Glacier2CryptPermissionsVerifier \
icebox icebridge \
icepatch2server icepatch2client icepatch2calc \
IceDB \
IceXML \
icegridnode icegridregistry icegridadmin icegriddb \
Expand Down
84 changes: 42 additions & 42 deletions cpp/msbuild/ice.v143.sln
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iceboxadmin", "..\src\IceBo
{588F90CA-62AC-4101-83FC-19AB9DB6B509} = {588F90CA-62AC-4101-83FC-19AB9DB6B509}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icepatch2server", "..\src\IcePatch2\msbuild\icepatch2server\icepatch2server.vcxproj", "{7E1D6372-D417-4143-A7AF-BE3E77550238}"
ProjectSection(ProjectDependencies) = postProject
{994ADD25-20A0-4715-A3EC-9F86AFD481D0} = {994ADD25-20A0-4715-A3EC-9F86AFD481D0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icepatch2client", "..\src\IcePatch2\msbuild\icepatch2client\icepatch2client.vcxproj", "{43D54B43-526E-40CE-9945-81420C54A415}"
ProjectSection(ProjectDependencies) = postProject
{994ADD25-20A0-4715-A3EC-9F86AFD481D0} = {994ADD25-20A0-4715-A3EC-9F86AFD481D0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icepatch2calc", "..\src\IcePatch2\msbuild\icepatch2calc\icepatch2calc.vcxproj", "{8BCB4793-C004-459D-9605-272470D53A40}"
ProjectSection(ProjectDependencies) = postProject
{994ADD25-20A0-4715-A3EC-9F86AFD481D0} = {994ADD25-20A0-4715-A3EC-9F86AFD481D0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iceserviceinstall", "..\src\iceserviceinstall\msbuild\iceserviceinstall.vcxproj", "{0E22B627-F1A6-4771-89DE-9E45FD51F124}"
ProjectSection(ProjectDependencies) = postProject
{6485EC94-6B47-428D-B42D-AAA11F08DB59} = {6485EC94-6B47-428D-B42D-AAA11F08DB59}
Expand Down Expand Up @@ -291,6 +276,21 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icepatch2++11", "..\src\Ice
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glacier2cryptpermissionsverifier++11", "..\src\Glacier2CryptPermissionsVerifier\msbuild\glacier2cryptpermissionsverifier++11\glacier2cryptpermissionsverifier++11.vcxproj", "{BF2077E4-D837-486B-9356-24FA5F659808}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icepatch2server++11", "..\src\IcePatch2\msbuild\icepatch2server++11\icepatch2server++11.vcxproj", "{7E1D6372-D417-4143-A7AF-BE3E77550238}"
ProjectSection(ProjectDependencies) = postProject
{18F381D8-BA61-4E6A-B877-9F6BC28C07E5} = {18F381D8-BA61-4E6A-B877-9F6BC28C07E5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icepatch2calc++11", "..\src\IcePatch2\msbuild\icepatch2calc++11\icepatch2calc++11.vcxproj", "{8BCB4793-C004-459D-9605-272470D53A40}"
ProjectSection(ProjectDependencies) = postProject
{18F381D8-BA61-4E6A-B877-9F6BC28C07E5} = {18F381D8-BA61-4E6A-B877-9F6BC28C07E5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icepatch2client++11", "..\src\IcePatch2\msbuild\icepatch2client++11\icepatch2client++11.vcxproj", "{43D54B43-526E-40CE-9945-81420C54A415}"
ProjectSection(ProjectDependencies) = postProject
{18F381D8-BA61-4E6A-B877-9F6BC28C07E5} = {18F381D8-BA61-4E6A-B877-9F6BC28C07E5}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Expand Down Expand Up @@ -515,30 +515,6 @@ Global
{1B745EA3-C97A-41BB-8E6F-64AAE992BE55}.Release|Win32.Build.0 = Release|Win32
{1B745EA3-C97A-41BB-8E6F-64AAE992BE55}.Release|x64.ActiveCfg = Release|x64
{1B745EA3-C97A-41BB-8E6F-64AAE992BE55}.Release|x64.Build.0 = Release|x64
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Debug|Win32.ActiveCfg = Debug|Win32
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Debug|Win32.Build.0 = Debug|Win32
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Debug|x64.ActiveCfg = Debug|x64
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Debug|x64.Build.0 = Debug|x64
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Release|Win32.ActiveCfg = Release|Win32
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Release|Win32.Build.0 = Release|Win32
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Release|x64.ActiveCfg = Release|x64
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Release|x64.Build.0 = Release|x64
{43D54B43-526E-40CE-9945-81420C54A415}.Debug|Win32.ActiveCfg = Debug|Win32
{43D54B43-526E-40CE-9945-81420C54A415}.Debug|Win32.Build.0 = Debug|Win32
{43D54B43-526E-40CE-9945-81420C54A415}.Debug|x64.ActiveCfg = Debug|x64
{43D54B43-526E-40CE-9945-81420C54A415}.Debug|x64.Build.0 = Debug|x64
{43D54B43-526E-40CE-9945-81420C54A415}.Release|Win32.ActiveCfg = Release|Win32
{43D54B43-526E-40CE-9945-81420C54A415}.Release|Win32.Build.0 = Release|Win32
{43D54B43-526E-40CE-9945-81420C54A415}.Release|x64.ActiveCfg = Release|x64
{43D54B43-526E-40CE-9945-81420C54A415}.Release|x64.Build.0 = Release|x64
{8BCB4793-C004-459D-9605-272470D53A40}.Debug|Win32.ActiveCfg = Debug|Win32
{8BCB4793-C004-459D-9605-272470D53A40}.Debug|Win32.Build.0 = Debug|Win32
{8BCB4793-C004-459D-9605-272470D53A40}.Debug|x64.ActiveCfg = Debug|x64
{8BCB4793-C004-459D-9605-272470D53A40}.Debug|x64.Build.0 = Debug|x64
{8BCB4793-C004-459D-9605-272470D53A40}.Release|Win32.ActiveCfg = Release|Win32
{8BCB4793-C004-459D-9605-272470D53A40}.Release|Win32.Build.0 = Release|Win32
{8BCB4793-C004-459D-9605-272470D53A40}.Release|x64.ActiveCfg = Release|x64
{8BCB4793-C004-459D-9605-272470D53A40}.Release|x64.Build.0 = Release|x64
{0E22B627-F1A6-4771-89DE-9E45FD51F124}.Debug|Win32.ActiveCfg = Debug|Win32
{0E22B627-F1A6-4771-89DE-9E45FD51F124}.Debug|Win32.Build.0 = Debug|Win32
{0E22B627-F1A6-4771-89DE-9E45FD51F124}.Debug|x64.ActiveCfg = Debug|x64
Expand Down Expand Up @@ -715,6 +691,30 @@ Global
{BF2077E4-D837-486B-9356-24FA5F659808}.Release|Win32.Build.0 = Release|Win32
{BF2077E4-D837-486B-9356-24FA5F659808}.Release|x64.ActiveCfg = Release|x64
{BF2077E4-D837-486B-9356-24FA5F659808}.Release|x64.Build.0 = Release|x64
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Debug|Win32.ActiveCfg = Debug|Win32
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Debug|Win32.Build.0 = Debug|Win32
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Debug|x64.ActiveCfg = Debug|x64
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Debug|x64.Build.0 = Debug|x64
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Release|Win32.ActiveCfg = Release|Win32
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Release|Win32.Build.0 = Release|Win32
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Release|x64.ActiveCfg = Release|x64
{7E1D6372-D417-4143-A7AF-BE3E77550238}.Release|x64.Build.0 = Release|x64
{8BCB4793-C004-459D-9605-272470D53A40}.Debug|Win32.ActiveCfg = Debug|Win32
{8BCB4793-C004-459D-9605-272470D53A40}.Debug|Win32.Build.0 = Debug|Win32
{8BCB4793-C004-459D-9605-272470D53A40}.Debug|x64.ActiveCfg = Debug|x64
{8BCB4793-C004-459D-9605-272470D53A40}.Debug|x64.Build.0 = Debug|x64
{8BCB4793-C004-459D-9605-272470D53A40}.Release|Win32.ActiveCfg = Release|Win32
{8BCB4793-C004-459D-9605-272470D53A40}.Release|Win32.Build.0 = Release|Win32
{8BCB4793-C004-459D-9605-272470D53A40}.Release|x64.ActiveCfg = Release|x64
{8BCB4793-C004-459D-9605-272470D53A40}.Release|x64.Build.0 = Release|x64
{43D54B43-526E-40CE-9945-81420C54A415}.Debug|Win32.ActiveCfg = Debug|Win32
{43D54B43-526E-40CE-9945-81420C54A415}.Debug|Win32.Build.0 = Debug|Win32
{43D54B43-526E-40CE-9945-81420C54A415}.Debug|x64.ActiveCfg = Debug|x64
{43D54B43-526E-40CE-9945-81420C54A415}.Debug|x64.Build.0 = Debug|x64
{43D54B43-526E-40CE-9945-81420C54A415}.Release|Win32.ActiveCfg = Release|Win32
{43D54B43-526E-40CE-9945-81420C54A415}.Release|Win32.Build.0 = Release|Win32
{43D54B43-526E-40CE-9945-81420C54A415}.Release|x64.ActiveCfg = Release|x64
{43D54B43-526E-40CE-9945-81420C54A415}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -747,9 +747,6 @@ Global
{81C8FC6A-CAC3-4B6D-AE4D-5DEAD29726C5} = {2DC2B270-B7AE-48CF-8FB0-41A55A9747E9}
{96161748-CE5E-4548-BC1D-AFD2F137A1DC} = {F48CC091-6F26-4EC8-A2FB-485975E7C908}
{1B745EA3-C97A-41BB-8E6F-64AAE992BE55} = {2DC2B270-B7AE-48CF-8FB0-41A55A9747E9}
{7E1D6372-D417-4143-A7AF-BE3E77550238} = {2DC2B270-B7AE-48CF-8FB0-41A55A9747E9}
{43D54B43-526E-40CE-9945-81420C54A415} = {2DC2B270-B7AE-48CF-8FB0-41A55A9747E9}
{8BCB4793-C004-459D-9605-272470D53A40} = {2DC2B270-B7AE-48CF-8FB0-41A55A9747E9}
{0E22B627-F1A6-4771-89DE-9E45FD51F124} = {2DC2B270-B7AE-48CF-8FB0-41A55A9747E9}
{F0B74B00-F252-4D38-A352-ED379CB196E9} = {F48CC091-6F26-4EC8-A2FB-485975E7C908}
{9E13C4B5-5DA9-43C1-9304-AEAC035E854D} = {F48CC091-6F26-4EC8-A2FB-485975E7C908}
Expand All @@ -772,6 +769,9 @@ Global
{519CB7EF-8E49-4BC1-B3DB-181BEF5AC3B3} = {2DC2B270-B7AE-48CF-8FB0-41A55A9747E9}
{18F381D8-BA61-4E6A-B877-9F6BC28C07E5} = {F48CC091-6F26-4EC8-A2FB-485975E7C908}
{BF2077E4-D837-486B-9356-24FA5F659808} = {F48CC091-6F26-4EC8-A2FB-485975E7C908}
{7E1D6372-D417-4143-A7AF-BE3E77550238} = {F48CC091-6F26-4EC8-A2FB-485975E7C908}
{8BCB4793-C004-459D-9605-272470D53A40} = {F48CC091-6F26-4EC8-A2FB-485975E7C908}
{43D54B43-526E-40CE-9945-81420C54A415} = {F48CC091-6F26-4EC8-A2FB-485975E7C908}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AAB39BE9-A7ED-4C54-80FE-D63A173ABB06}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/IcePatch2/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ run(const Ice::StringSeq& args)

try
{
IcePatch2::PatcherFeedbackPtr feedback = new TextPatcherFeedback;
IcePatch2::PatcherFeedbackPtr feedback = make_shared<TextPatcherFeedback>();
IcePatch2::PatcherPtr patcher = IcePatch2::PatcherFactory::create(communicator, feedback);

aborted = !patcher->prepare();
Expand Down
46 changes: 30 additions & 16 deletions cpp/src/IcePatch2/FileServerI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,55 +66,69 @@ IcePatch2::FileServerI::getChecksum(const Current&) const
}

void
IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileCompressedPtr& cb,
const string& pa, Int pos, Int num, const Current&) const
IcePatch2::FileServerI::getFileCompressedAsync(
string pa,
Int pos,
Int num,
function<void(const pair<const ::Ice::Byte*, const ::Ice::Byte*>& returnValue)> response,
function<void(exception_ptr)> exception,
const Current&) const
{
try
{
vector<Byte> buffer;
getFileCompressedInternal(pa, pos, num, buffer, false);
getFileCompressedInternal(std::move(pa), pos, num, buffer, false);
if(buffer.empty())
{
cb->ice_response(make_pair<const Byte*, const Byte*>(0, 0));
response(make_pair<const Byte*, const Byte*>(0, 0));
}
else
{
cb->ice_response(make_pair<const Byte*, const Byte*>(&buffer[0], &buffer[0] + buffer.size()));
response(make_pair<const Byte*, const Byte*>(&buffer[0], &buffer[0] + buffer.size()));
}
}
catch(const std::exception& ex)
catch(const std::exception&)
{
cb->ice_exception(ex);
exception(current_exception());
}
}

void
IcePatch2::FileServerI::getLargeFileCompressed_async(const AMD_FileServer_getLargeFileCompressedPtr& cb,
const string& pa, Long pos, Int num, const Current&) const
IcePatch2::FileServerI::getLargeFileCompressedAsync(
string pa,
Long pos,
Int num,
function<void(const pair<const ::Ice::Byte*, const ::Ice::Byte*>& returnValue)> response,
function<void(exception_ptr)> exception,
const Current&) const
{
try
{
vector<Byte> buffer;
getFileCompressedInternal(pa, pos, num, buffer, true);
getFileCompressedInternal(std::move(pa), pos, num, buffer, true);
if(buffer.empty())
{
cb->ice_response(make_pair<const Byte*, const Byte*>(0, 0));
response(make_pair<const Byte*, const Byte*>(0, 0));
}
else
{
cb->ice_response(make_pair<const Byte*, const Byte*>(&buffer[0], &buffer[0] + buffer.size()));
response(make_pair<const Byte*, const Byte*>(&buffer[0], &buffer[0] + buffer.size()));
}

}
catch(const std::exception& ex)
catch(const std::exception&)
{
cb->ice_exception(ex);
exception(current_exception());
}
}

void
IcePatch2::FileServerI::getFileCompressedInternal(const std::string& pa, Ice::Long pos, Ice::Int num,
vector<Byte>& buffer, bool largeFile) const
IcePatch2::FileServerI::getFileCompressedInternal(
std::string pa,
Ice::Long pos,
Ice::Int num,
vector<Byte>& buffer,
bool largeFile) const
{
if(IceUtilInternal::isAbsolutePath(pa))
{
Expand Down
37 changes: 21 additions & 16 deletions cpp/src/IcePatch2/FileServerI.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,31 @@ class FileServerI : public FileServer

Ice::ByteSeq getChecksum(const Ice::Current&) const;

void getFileCompressed_async(const AMD_FileServer_getFileCompressedPtr&,
const std::string&,
Ice::Int,
Ice::Int,
const Ice::Current&) const;

void getLargeFileCompressed_async(const AMD_FileServer_getLargeFileCompressedPtr&,
const std::string&,
Ice::Long,
Ice::Int,
const Ice::Current&) const;
void getFileCompressedAsync(
std::string,
Ice::Int,
Ice::Int,
std::function<void(const std::pair<const Ice::Byte*, const Ice::Byte*>& returnValue)>,
std::function<void(std::exception_ptr)>,
const Ice::Current&) const;

void getLargeFileCompressedAsync(
std::string,
Ice::Long,
Ice::Int,
std::function<void(const std::pair<const Ice::Byte*, const Ice::Byte*>& returnValue)>,
std::function<void(std::exception_ptr)>,
const Ice::Current&) const;

private:

void
getFileCompressedInternal(const std::string&,
Ice::Long,
Ice::Int,
std::vector<Ice::Byte>&,
bool) const;
getFileCompressedInternal(
std::string,
Ice::Long,
Ice::Int,
std::vector<Ice::Byte>&,
bool) const;

const std::string _dataDir;
const IcePatch2Internal::FileTree0 _tree0;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/IcePatch2/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ IcePatch2::PatcherService::start(int argc, char* argv[], int& status)
Identity id;
id.category = instanceName;
id.name = "server";
adapter->add(new FileServerI(dataDir, infoSeq), id);
adapter->add(make_shared<FileServerI>(dataDir, infoSeq), id);

adapter->activate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\..\..\msbuild\ice.cpp98.props" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\..\..\msbuild\ice.cpp11.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\..\..\msbuild\ice.cpp98.props" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\..\..\msbuild\ice.cpp11.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\..\..\msbuild\ice.cpp98.props" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\..\..\msbuild\ice.cpp11.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
Expand Down
6 changes: 3 additions & 3 deletions scripts/IcePatch2Util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
class IcePatch2Calc(ProcessFromBinDir, ProcessIsReleaseOnly, Process):

def __init__(self, *args, **kargs):
Process.__init__(self, exe="icepatch2calc", mapping=Mapping.getByName("cpp"), *args, **kargs)
Process.__init__(self, exe="icepatch2calc++11", mapping=Mapping.getByName("cpp"), *args, **kargs)

def getExe(self, current):
return self.exe + "_32" if current.config.buildPlatform == "ppc" else self.exe

class IcePatch2Client(ProcessFromBinDir, ProcessIsReleaseOnly, Process):

def __init__(self, *args, **kargs):
Process.__init__(self, exe="icepatch2client", mapping=Mapping.getByName("cpp"), *args, **kargs)
Process.__init__(self, exe="icepatch2client++11", mapping=Mapping.getByName("cpp"), *args, **kargs)

def getExe(self, current):
return self.exe + "_32" if current.config.buildPlatform == "ppc" else self.exe

class IcePatch2Server(ProcessFromBinDir, ProcessIsReleaseOnly, Process):

def __init__(self, *args, **kargs):
Process.__init__(self, exe="icepatch2server", mapping=Mapping.getByName("cpp"), *args, **kargs)
Process.__init__(self, exe="icepatch2server++11", mapping=Mapping.getByName("cpp"), *args, **kargs)

def getExe(self, current):
return self.exe + "_32" if current.config.buildPlatform == "ppc" else self.exe

0 comments on commit 4c7f76e

Please sign in to comment.