player: add suport for Win64 builds

To make sure it works, add support to the example while we're at
it. Also fix compilation warnings.
This commit is contained in:
Erik Faye-Lund 2012-03-01 14:02:51 +01:00
parent 65c5c62e89
commit 8f94efbc62
8 changed files with 612 additions and 10 deletions

View File

@ -169,7 +169,7 @@ void setDocument(SyncDocument *newDoc)
// delete old key-frames
for (size_t i = 0; i < oldDoc->num_tracks; ++i) {
sync_track *t = oldDoc->tracks[i];
for (size_t j = 0; j < t->num_keys; ++j)
for (int j = 0; j < t->num_keys; ++j)
oldDoc->clientSocket.sendDeleteKeyCommand(t->name, t->keys[j].row);
}
@ -187,7 +187,7 @@ void setDocument(SyncDocument *newDoc)
for (size_t i = 0; i < newDoc->num_tracks; ++i) {
sync_track *t = newDoc->tracks[i];
for (size_t j = 0; j < t->num_keys; ++j)
for (int j = 0; j < t->num_keys; ++j)
newDoc->clientSocket.sendSetKeyCommand(t->name, t->keys[j]);
}
}

View File

@ -12,6 +12,9 @@
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
@ -325,6 +328,318 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;SYNC_PLAYER"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib glu32.lib SDL.lib bass.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="lib64"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
EmbedManifest="false"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;SYNC_PLAYER"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib glu32.lib SDL.lib bass.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="lib64"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug Client|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib glu32.lib SDL.lib bass.lib"
AdditionalLibraryDirectories="lib64"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
EmbedManifest="false"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release Client|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib glu32.lib SDL.lib bass.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="lib64"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>

View File

@ -11,27 +11,47 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug Client|Win32 = Debug Client|Win32
Debug Client|x64 = Debug Client|x64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release Client|Win32 = Release Client|Win32
Release Client|x64 = Release Client|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Debug Client|Win32.ActiveCfg = Debug Client|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Debug Client|Win32.Build.0 = Debug Client|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Debug Client|x64.ActiveCfg = Debug Client|x64
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Debug Client|x64.Build.0 = Debug Client|x64
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Debug|Win32.ActiveCfg = Debug|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Debug|Win32.Build.0 = Debug|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Debug|x64.ActiveCfg = Debug|x64
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Debug|x64.Build.0 = Debug|x64
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Release Client|Win32.ActiveCfg = Release Client|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Release Client|Win32.Build.0 = Release Client|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Release Client|x64.ActiveCfg = Release Client|x64
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Release Client|x64.Build.0 = Release Client|x64
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Release|Win32.ActiveCfg = Release|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Release|Win32.Build.0 = Release|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Release|x64.ActiveCfg = Release|x64
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Release|x64.Build.0 = Release|x64
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Debug Client|Win32.ActiveCfg = Debug Client|Win32
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Debug Client|Win32.Build.0 = Debug Client|Win32
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Debug Client|x64.ActiveCfg = Debug Client|x64
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Debug Client|x64.Build.0 = Debug Client|x64
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Debug|Win32.ActiveCfg = Debug|Win32
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Debug|Win32.Build.0 = Debug|Win32
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Debug|x64.ActiveCfg = Debug|x64
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Debug|x64.Build.0 = Debug|x64
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Release Client|Win32.ActiveCfg = Release Client|Win32
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Release Client|Win32.Build.0 = Release Client|Win32
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Release Client|x64.ActiveCfg = Release Client|x64
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Release Client|x64.Build.0 = Release Client|x64
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Release|Win32.ActiveCfg = Release|Win32
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Release|Win32.Build.0 = Release|Win32
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Release|x64.ActiveCfg = Release|x64
{5866042C-7FCB-4DB1-BAAD-44DF6567511F}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -21,6 +21,7 @@
#define snprintf _snprintf
/* int is 32-bit for both x86 and x64 */
typedef unsigned int uint32_t;
#define UINT32_MAX UINT_MAX
#elif defined(__GNUC__)
#include <stdint.h>
#elif defined(M68000)
@ -33,6 +34,7 @@
#define NOMINMAX
#include <winsock2.h>
#include <windows.h>
#include <limits.h>
#elif defined(USE_AMITCP)
#include <sys/socket.h>
#include <proto/exec.h>
@ -81,17 +83,29 @@ static inline int socket_poll(SOCKET socket)
#pragma warning(pop)
#endif
return select(socket + 1, &fds, NULL, NULL, &to) > 0;
return select((int)socket + 1, &fds, NULL, NULL, &to) > 0;
}
#include <assert.h>
static inline int xsend(SOCKET s, const void *buf, size_t len, int flags)
{
return send(s, (const char *)buf, len, flags) != (int)len;
#ifdef WIN32
assert(len <= INT_MAX);
return send(s, (const char *)buf, (int)len, flags) != (int)len;
#else
return send(s, (const char *)buf, len, flags) != len;
#endif
}
static inline int xrecv(SOCKET s, void *buf, size_t len, int flags)
{
return recv(s, (char *)buf, len, flags) != (int)len;
#ifdef WIN32
assert(len <= INT_MAX);
return recv(s, (char *)buf, (int)len, flags) != (int)len;
#else
return recv(s, (char *)buf, len, flags) != len;
#endif
}
#ifdef NEED_STRDUP

View File

@ -3,7 +3,6 @@
*/
#include "data.h"
#include <assert.h>
void sync_data_deinit(struct sync_data *d)
{

View File

@ -5,7 +5,6 @@
#include "device.h"
#include "sync.h"
#include <stdio.h>
#include <assert.h>
#include <math.h>
static const char *sync_track_path(const char *base, const char *name)
@ -180,7 +179,10 @@ void sync_save_tracks(const struct sync_device *d)
static int get_track_data(struct sync_device *d, struct sync_track *t)
{
unsigned char cmd = GET_TRACK;
uint32_t name_len = htonl(strlen(t->name));
uint32_t name_len;
assert(strlen(t->name) <= UINT32_MAX);
name_len = htonl((uint32_t)strlen(t->name));
/* send request data */
if (xsend(d->sock, (char *)&cmd, 1, 0) ||

View File

@ -26,7 +26,7 @@ struct track_key {
struct sync_track {
char *name;
struct track_key *keys;
size_t num_keys;
int num_keys;
};
int sync_find_key(const struct sync_track *, int);
@ -41,7 +41,7 @@ static inline int key_idx_floor(const struct sync_track *t, int row)
#ifndef SYNC_PLAYER
int sync_set_key(struct sync_track *, const struct track_key *);
int sync_del_key(struct sync_track *, int);
static inline int is_key_frame(const struct sync_track *t, size_t row)
static inline int is_key_frame(const struct sync_track *t, int row)
{
return sync_find_key(t, row) >= 0;
}

View File

@ -12,6 +12,9 @@
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
@ -258,6 +261,255 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;SYNC_PLAYER"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\$(ProjectName)-playerd.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;SYNC_PLAYER"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\$(ProjectName)-player.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug Client|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="$(OutDir)\$(ProjectName)d.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release Client|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>