make Windows Visual Studio project compile again; modify some dynamic memory allocations to work in C90 standard (damn it MSVC...);

pull/12/head
Bryan Biedenkapp 4 years ago
parent 06be179efe
commit 468079dcc8

@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.28729.10
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dvmhost", "DVMHost.vcxproj", "{1D34E8C1-CFA5-4D60-B509-9DB58DC4AE92}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dvmhost", "DVMHost.vcxproj", "{1D34E8C1-CFA5-4D60-B509-9DB58DC4AE92}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dvmcmd", "remote\DVMCmd.vcxproj", "{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -27,12 +29,23 @@ Global
{1D34E8C1-CFA5-4D60-B509-9DB58DC4AE92}.Release|x64.Build.0 = Release|x64 {1D34E8C1-CFA5-4D60-B509-9DB58DC4AE92}.Release|x64.Build.0 = Release|x64
{1D34E8C1-CFA5-4D60-B509-9DB58DC4AE92}.Release|x86.ActiveCfg = Release|Win32 {1D34E8C1-CFA5-4D60-B509-9DB58DC4AE92}.Release|x86.ActiveCfg = Release|Win32
{1D34E8C1-CFA5-4D60-B509-9DB58DC4AE92}.Release|x86.Build.0 = Release|Win32 {1D34E8C1-CFA5-4D60-B509-9DB58DC4AE92}.Release|x86.Build.0 = Release|Win32
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Debug|Any CPU.ActiveCfg = Debug|Win32
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Debug|Any CPU.Build.0 = Debug|Win32
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Debug|x64.ActiveCfg = Debug|x64
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Debug|x64.Build.0 = Debug|x64
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Debug|x86.ActiveCfg = Debug|Win32
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Debug|x86.Build.0 = Debug|Win32
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Release|Any CPU.ActiveCfg = Release|Win32
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Release|Any CPU.Build.0 = Release|Win32
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Release|x64.ActiveCfg = Release|x64
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Release|x64.Build.0 = Release|x64
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Release|x86.ActiveCfg = Release|Win32
{7686FC39-EC3C-4FAC-8C7D-32CF98D14F16}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3CD6A8DC-348C-4B31-99A0-91AEE2F79121}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

@ -244,7 +244,6 @@
<ClCompile Include="dmr\data\DataHeader.cpp" /> <ClCompile Include="dmr\data\DataHeader.cpp" />
<ClCompile Include="dmr\data\EMB.cpp" /> <ClCompile Include="dmr\data\EMB.cpp" />
<ClCompile Include="dmr\data\EmbeddedData.cpp" /> <ClCompile Include="dmr\data\EmbeddedData.cpp" />
<ClCompile Include="dmr\dfsi\LC.cpp" />
<ClCompile Include="dmr\Control.cpp" /> <ClCompile Include="dmr\Control.cpp" />
<ClCompile Include="dmr\DataPacket.cpp" /> <ClCompile Include="dmr\DataPacket.cpp" />
<ClCompile Include="dmr\lc\PrivacyLC.cpp" /> <ClCompile Include="dmr\lc\PrivacyLC.cpp" />
@ -292,6 +291,7 @@
<ClCompile Include="p25\data\DataBlock.cpp" /> <ClCompile Include="p25\data\DataBlock.cpp" />
<ClCompile Include="p25\data\DataHeader.cpp" /> <ClCompile Include="p25\data\DataHeader.cpp" />
<ClCompile Include="p25\data\LowSpeedData.cpp" /> <ClCompile Include="p25\data\LowSpeedData.cpp" />
<ClCompile Include="p25\dfsi\LC.cpp" />
<ClCompile Include="p25\edac\Trellis.cpp" /> <ClCompile Include="p25\edac\Trellis.cpp" />
<ClCompile Include="p25\lc\LC.cpp" /> <ClCompile Include="p25\lc\LC.cpp" />
<ClCompile Include="p25\lc\TDULC.cpp" /> <ClCompile Include="p25\lc\TDULC.cpp" />
@ -313,28 +313,26 @@
<ClCompile Include="yaml\Yaml.cpp" /> <ClCompile Include="yaml\Yaml.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="iden_table.dat"> <None Include="config.example.yml">
<FileType>Document</FileType> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</CopyFileToFolders> </None>
<CopyFileToFolders Include="config.yml">
<FileType>Document</FileType>
</CopyFileToFolders>
<None Include="cpp.hint" /> <None Include="cpp.hint" />
<None Include="iden_channel_calc.py" /> <None Include="iden_channel_calc.py" />
<None Include="iden_table.example.dat">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="Makefile" /> <None Include="Makefile" />
<None Include="Makefile.arm" />
<None Include="Makefile.rpi-arm" />
<CopyFileToFolders Include="rid_acl.dat">
<FileType>Document</FileType>
</CopyFileToFolders>
<CopyFileToFolders Include="RSSI.dat"> <CopyFileToFolders Include="RSSI.dat">
<FileType>Document</FileType> <FileType>Document</FileType>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="tg_acl.dat"> <None Include="rid_acl.example.dat">
<FileType>Document</FileType> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</CopyFileToFolders> </None>
<None Include="tg_acl.example.dat">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

@ -595,22 +595,23 @@
<ClCompile Include="host\setup\HostSetup.cpp"> <ClCompile Include="host\setup\HostSetup.cpp">
<Filter>Source Files\host\setup</Filter> <Filter>Source Files\host\setup</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="dmr\dfsi\LC.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="p25\dfsi\LC.cpp"> <ClCompile Include="p25\dfsi\LC.cpp">
<Filter>Source Files\p25\dfsi</Filter> <Filter>Source Files\p25\dfsi</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Makefile" /> <None Include="Makefile" />
<None Include="Makefile.arm" />
<None Include="Makefile.rpi-arm" />
<None Include="cpp.hint" /> <None Include="cpp.hint" />
<None Include="iden_channel_calc.py" /> <None Include="iden_channel_calc.py" />
<None Include="iden_table.example.dat" />
<None Include="rid_acl.example.dat" />
<None Include="tg_acl.example.dat" />
<None Include="config.example.yml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="iden_table.dat" />
<CopyFileToFolders Include="rid_acl.dat" />
<CopyFileToFolders Include="RSSI.dat" /> <CopyFileToFolders Include="RSSI.dat" />
<CopyFileToFolders Include="tg_acl.dat" />
<CopyFileToFolders Include="config.yml" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1599,9 +1599,14 @@ bool Host::createModem()
} }
if (portType == PTY_PORT) { if (portType == PTY_PORT) {
#if !defined(_WIN32) && !defined(_WIN64)
modemPort = new port::PseudoPTYPort(uartPort, serialSpeed, true); modemPort = new port::PseudoPTYPort(uartPort, serialSpeed, true);
LogInfo(" PTY File: %s", uartPort.c_str()); LogInfo(" PTY File: %s", uartPort.c_str());
LogInfo(" PTY Speed: %u", uartSpeed); LogInfo(" PTY Speed: %u", uartSpeed);
#else
LogError(LOG_HOST, "Pseudo PTY is not supported on Windows!");
return false;
#endif
} }
else { else {
modemPort = new port::UARTPort(uartPort, serialSpeed, true); modemPort = new port::UARTPort(uartPort, serialSpeed, true);

@ -34,10 +34,10 @@
#include <cassert> #include <cassert>
#include <cstdlib> #include <cstdlib>
using namespace modem::port;
#if !defined(_WIN32) && !defined(_WIN64) #if !defined(_WIN32) && !defined(_WIN64)
using namespace modem::port;
#include <sys/types.h> #include <sys/types.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/stat.h> #include <sys/stat.h>

@ -531,7 +531,7 @@ bool Network::writeConfig()
json::value v = json::value(config); json::value v = json::value(config);
std::string json = v.serialize(); std::string json = v.serialize();
char buffer[json.length() + 8U]; char* buffer = new char[json.length() + 8U];
::memcpy(buffer + 0U, TAG_REPEATER_CONFIG, 4U); ::memcpy(buffer + 0U, TAG_REPEATER_CONFIG, 4U);
__SET_UINT32(m_id, buffer, 4U); __SET_UINT32(m_id, buffer, 4U);
@ -541,7 +541,9 @@ bool Network::writeConfig()
Utils::dump(1U, "Network Transmitted, Configuration", (uint8_t*)buffer, json.length() + 8U); Utils::dump(1U, "Network Transmitted, Configuration", (uint8_t*)buffer, json.length() + 8U);
} }
return write((uint8_t*)buffer, json.length() + 8U); bool ret = write((uint8_t*)buffer, json.length() + 8U);
delete[] buffer;
return ret;
} }
/// <summary> /// <summary>

@ -673,7 +673,7 @@ void DataPacket::writeRF_PDU_Buffered()
uint32_t bitLength = ((m_rfDataHeader.getBlocksToFollow() + 1U) * P25_PDU_FEC_LENGTH_BITS) + P25_PREAMBLE_LENGTH_BITS; uint32_t bitLength = ((m_rfDataHeader.getBlocksToFollow() + 1U) * P25_PDU_FEC_LENGTH_BITS) + P25_PREAMBLE_LENGTH_BITS;
uint32_t offset = P25_PREAMBLE_LENGTH_BITS; uint32_t offset = P25_PREAMBLE_LENGTH_BITS;
uint8_t data[bitLength / 8U]; uint8_t* data = new uint8_t[bitLength / 8U];
::memset(data, 0x00U, bitLength / 8U); ::memset(data, 0x00U, bitLength / 8U);
uint8_t block[P25_PDU_FEC_LENGTH_BYTES]; uint8_t block[P25_PDU_FEC_LENGTH_BYTES];
::memset(block, 0x00U, P25_PDU_FEC_LENGTH_BYTES); ::memset(block, 0x00U, P25_PDU_FEC_LENGTH_BYTES);
@ -712,6 +712,7 @@ void DataPacket::writeRF_PDU_Buffered()
} }
writeRF_PDU(data, bitLength); writeRF_PDU(data, bitLength);
delete[] data;
} }
/// <summary> /// <summary>
@ -728,7 +729,7 @@ void DataPacket::writeRF_PDU_Reg_Response(uint8_t regType, uint32_t llId, ulong6
uint32_t bitLength = (2U * P25_PDU_FEC_LENGTH_BITS) + P25_PREAMBLE_LENGTH_BITS; uint32_t bitLength = (2U * P25_PDU_FEC_LENGTH_BITS) + P25_PREAMBLE_LENGTH_BITS;
uint32_t offset = P25_PREAMBLE_LENGTH_BITS; uint32_t offset = P25_PREAMBLE_LENGTH_BITS;
uint8_t data[bitLength / 8U]; uint8_t* data = new uint8_t[bitLength / 8U];
::memset(data, 0x00U, bitLength / 8U); ::memset(data, 0x00U, bitLength / 8U);
uint8_t block[P25_PDU_FEC_LENGTH_BYTES]; uint8_t block[P25_PDU_FEC_LENGTH_BYTES];
::memset(block, 0x00U, P25_PDU_FEC_LENGTH_BYTES); ::memset(block, 0x00U, P25_PDU_FEC_LENGTH_BYTES);
@ -775,6 +776,7 @@ void DataPacket::writeRF_PDU_Reg_Response(uint8_t regType, uint32_t llId, ulong6
Utils::setBitRange(block, data, offset, P25_PDU_FEC_LENGTH_BITS); Utils::setBitRange(block, data, offset, P25_PDU_FEC_LENGTH_BITS);
writeRF_PDU(data, bitLength); writeRF_PDU(data, bitLength);
delete[] data;
} }
/// <summary> /// <summary>
@ -791,7 +793,7 @@ void DataPacket::writeRF_PDU_Ack_Response(uint8_t ackClass, uint8_t ackType, uin
uint32_t bitLength = (2U * P25_PDU_FEC_LENGTH_BITS) + P25_PREAMBLE_LENGTH_BITS; uint32_t bitLength = (2U * P25_PDU_FEC_LENGTH_BITS) + P25_PREAMBLE_LENGTH_BITS;
uint32_t offset = P25_PREAMBLE_LENGTH_BITS; uint32_t offset = P25_PREAMBLE_LENGTH_BITS;
uint8_t data[bitLength / 8U]; uint8_t* data = new uint8_t[bitLength / 8U];
::memset(data, 0x00U, bitLength / 8U); ::memset(data, 0x00U, bitLength / 8U);
uint8_t block[P25_PDU_FEC_LENGTH_BYTES]; uint8_t block[P25_PDU_FEC_LENGTH_BYTES];
::memset(block, 0x00U, P25_PDU_FEC_LENGTH_BYTES); ::memset(block, 0x00U, P25_PDU_FEC_LENGTH_BYTES);
@ -818,6 +820,7 @@ void DataPacket::writeRF_PDU_Ack_Response(uint8_t ackClass, uint8_t ackType, uin
Utils::setBitRange(block, data, offset, P25_PDU_FEC_LENGTH_BITS); Utils::setBitRange(block, data, offset, P25_PDU_FEC_LENGTH_BITS);
writeRF_PDU(data, bitLength); writeRF_PDU(data, bitLength);
delete[] data;
} }
/// <summary> /// <summary>

@ -382,7 +382,7 @@ void LC::encodeLDU1(uint8_t* data, const uint8_t* imbe)
break; break;
} }
uint8_t dfsiFrame[frameLength]; uint8_t* dfsiFrame = new uint8_t[frameLength];
::memset(dfsiFrame, 0x00U, frameLength); ::memset(dfsiFrame, 0x00U, frameLength);
dfsiFrame[0U] = m_frameType; // Frame Type dfsiFrame[0U] = m_frameType; // Frame Type
@ -469,6 +469,7 @@ void LC::encodeLDU1(uint8_t* data, const uint8_t* imbe)
#endif #endif
::memcpy(data, dfsiFrame, frameLength); ::memcpy(data, dfsiFrame, frameLength);
delete[] dfsiFrame;
} }
/// <summary> /// <summary>
@ -619,7 +620,7 @@ void LC::encodeLDU2(uint8_t* data, const uint8_t* imbe)
break; break;
} }
uint8_t dfsiFrame[frameLength]; uint8_t* dfsiFrame = new uint8_t[frameLength];
::memset(dfsiFrame, 0x00U, frameLength); ::memset(dfsiFrame, 0x00U, frameLength);
dfsiFrame[0U] = m_frameType; // Frame Type dfsiFrame[0U] = m_frameType; // Frame Type
@ -708,6 +709,7 @@ void LC::encodeLDU2(uint8_t* data, const uint8_t* imbe)
#endif #endif
::memcpy(data, dfsiFrame, frameLength); ::memcpy(data, dfsiFrame, frameLength);
delete[] dfsiFrame;
} }
/// <summary> /// <summary>

@ -72,7 +72,7 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir);$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)..;$(ProjectDir);$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
@ -80,7 +80,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir);$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)..;$(ProjectDir);$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
@ -152,20 +152,17 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Defines.h" /> <ClInclude Include="..\Defines.h" />
<ClInclude Include="edac\SHA256.h" /> <ClInclude Include="..\edac\SHA256.h" />
<ClInclude Include="..\Log.h" />
<ClInclude Include="..\network\UDPSocket.h" />
<ClInclude Include="RemoteCommand.h" /> <ClInclude Include="RemoteCommand.h" />
<ClInclude Include="network\UDPSocket.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="edac\SHA256.cpp" /> <ClCompile Include="..\edac\SHA256.cpp" />
<ClCompile Include="..\Log.cpp" />
<ClCompile Include="..\network\UDPSocket.cpp" />
<ClCompile Include="RemoteCommand.cpp" /> <ClCompile Include="RemoteCommand.cpp" />
<ClCompile Include="network\UDPSocket.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile" />
<None Include="Makefile.arm" />
<None Include="Makefile.rpi-arm" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

@ -26,30 +26,31 @@
<ClInclude Include="RemoteCommand.h"> <ClInclude Include="RemoteCommand.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="network\UDPSocket.h"> <ClInclude Include="..\edac\SHA256.h">
<Filter>Header Files\edac</Filter>
</ClInclude>
<ClInclude Include="..\network\UDPSocket.h">
<Filter>Header Files\network</Filter> <Filter>Header Files\network</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Defines.h"> <ClInclude Include="..\Defines.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="edac\SHA256.h"> <ClInclude Include="..\Log.h">
<Filter>Header Files\edac</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="RemoteCommand.cpp"> <ClCompile Include="RemoteCommand.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="network\UDPSocket.cpp"> <ClCompile Include="..\edac\SHA256.cpp">
<Filter>Source Files\edac</Filter>
</ClCompile>
<ClCompile Include="..\network\UDPSocket.cpp">
<Filter>Source Files\network</Filter> <Filter>Source Files\network</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="edac\SHA256.cpp"> <ClCompile Include="..\Log.cpp">
<Filter>Source Files\edac</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Makefile" />
<None Include="Makefile.arm" />
<None Include="Makefile.rpi-arm" />
</ItemGroup>
</Project> </Project>
Loading…
Cancel
Save

Powered by TurnKey Linux.