diff options
Diffstat (limited to '3rdParty/libb64/base64')
-rw-r--r-- | 3rdParty/libb64/base64/Makefile | 56 | ||||
-rw-r--r-- | 3rdParty/libb64/base64/VisualStudioProject/Makefile | 11 | ||||
-rw-r--r-- | 3rdParty/libb64/base64/VisualStudioProject/base64.sln | 20 | ||||
-rw-r--r-- | 3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj | 92 | ||||
-rw-r--r-- | 3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj.filters | 36 | ||||
-rw-r--r-- | 3rdParty/libb64/base64/base64.cc | 94 |
6 files changed, 309 insertions, 0 deletions
diff --git a/3rdParty/libb64/base64/Makefile b/3rdParty/libb64/base64/Makefile new file mode 100644 index 0000000..30a2c5c --- /dev/null +++ b/3rdParty/libb64/base64/Makefile @@ -0,0 +1,56 @@ +BINARIES = base64 + +# Build flags (uncomment one) +############################# +# Release build flags +CFLAGS += -O3 +############################# +# Debug build flags +#CFLAGS += -g +############################# + +# select a buffersize +# a larger size should be faster, but takes more runtime memory +#BUFFERSIZE = 4096 +#BUFFERSIZE = 65536 +BUFFERSIZE = 16777216 + +SOURCES = base64.cc + +TARGETS = $(BINARIES) + +LINK.o = g++ + +CFLAGS += -Werror -pedantic +CFLAGS += -DBUFFERSIZE=$(BUFFERSIZE) +CFLAGS += -I../include + +CXXFLAGS += $(CFLAGS) + +vpath %.h ../include/b64 +vpath %.a ../src + +.PHONY : clean + +all: $(TARGETS) #strip + +base64: libb64.a + +strip: + strip $(BINARIES) *.exe + +clean: clean_VisualStudioProject + rm -f *.exe* *.o $(TARGETS) *.bak *~ +clean_VisualStudioProject: + $(MAKE) -C VisualStudioProject clean + +distclean: clean distclean_VisualStudioProject + rm -f depend +distclean_VisualStudioProject: clean_VisualStudioProject + $(MAKE) -C VisualStudioProject distclean + +depend: $(SOURCES) + makedepend -f- $(CFLAGS) $(SOURCES) 2> /dev/null 1> depend + +-include depend + diff --git a/3rdParty/libb64/base64/VisualStudioProject/Makefile b/3rdParty/libb64/base64/VisualStudioProject/Makefile new file mode 100644 index 0000000..047fcb9 --- /dev/null +++ b/3rdParty/libb64/base64/VisualStudioProject/Makefile @@ -0,0 +1,11 @@ +DEBRIS = base64.sdf base64.suo base64.vcxproj.user + +all: + +clean: + rm -rf Debug Release + +distclean: clean + rm -f $(DEBRIS) + +
\ No newline at end of file diff --git a/3rdParty/libb64/base64/VisualStudioProject/base64.sln b/3rdParty/libb64/base64/VisualStudioProject/base64.sln new file mode 100644 index 0000000..b357a9c --- /dev/null +++ b/3rdParty/libb64/base64/VisualStudioProject/base64.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base64", "base64.vcxproj", "{0B094121-DC64-4D74-AFA0-750B83F800D0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0B094121-DC64-4D74-AFA0-750B83F800D0}.Debug|Win32.ActiveCfg = Debug|Win32 + {0B094121-DC64-4D74-AFA0-750B83F800D0}.Debug|Win32.Build.0 = Debug|Win32 + {0B094121-DC64-4D74-AFA0-750B83F800D0}.Release|Win32.ActiveCfg = Release|Win32 + {0B094121-DC64-4D74-AFA0-750B83F800D0}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj b/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj new file mode 100644 index 0000000..530aec4 --- /dev/null +++ b/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj @@ -0,0 +1,92 @@ +<?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> + <PropertyGroup Label="Globals"> + <ProjectGuid>{0B094121-DC64-4D74-AFA0-750B83F800D0}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>base64</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</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> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>BUFFERSIZE=16777216;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>H:\builds\libb64\working.libb64\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>BUFFERSIZE=16777216;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>H:\builds\libb64\working.libb64\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\src\cdecode.c" /> + <ClCompile Include="..\..\src\cencode.c" /> + <ClCompile Include="..\base64.cc" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\b64\cdecode.h" /> + <ClInclude Include="..\..\include\b64\cencode.h" /> + <ClInclude Include="..\..\include\b64\decode.h" /> + <ClInclude Include="..\..\include\b64\encode.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj.filters b/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj.filters new file mode 100644 index 0000000..34a1105 --- /dev/null +++ b/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj.filters @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{12b9f2a2-b899-409a-a507-8cefe9c39b25}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{ce5598bd-67f3-430f-890b-cefa880e9405}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\base64.cc"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\cencode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\cdecode.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\b64\encode.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\include\b64\cdecode.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\include\b64\cencode.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\include\b64\decode.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/3rdParty/libb64/base64/base64.cc b/3rdParty/libb64/base64/base64.cc new file mode 100644 index 0000000..acab416 --- /dev/null +++ b/3rdParty/libb64/base64/base64.cc @@ -0,0 +1,94 @@ +/* +base64.cc - c++ source to a base64 reference encoder and decoder + +This is part of the libb64 project, and has been placed in the public domain. +For details, see http://sourceforge.net/projects/libb64 +*/ + +#include <b64/encode.h> +#include <b64/decode.h> + +#include <iostream> +#include <fstream> +#include <string> + +#include <stdlib.h> + +// Function which prints the usage of this executable +void usage() +{ + std::cerr<< \ + "base64: Encodes and Decodes files using base64\n" \ + "Usage: base64 [-e|-d] [input] [output]\n" \ + " Where [-e] will encode the input file into the output file,\n" \ + " [-d] will decode the input file into the output file, and\n" \ + " [input] and [output] are the input and output files, respectively.\n"; +} +// Function which prints the usage of this executable, plus a short message +void usage(const std::string& message) +{ + usage(); + std::cerr<<"Incorrect invocation of base64:\n"; + std::cerr<<message<<std::endl; +} + +int main(int argc, char** argv) +{ + // Quick check for valid arguments + if (argc == 1) + { + usage(); + exit(-1); + } + if (argc != 4) + { + usage("Wrong number of arguments!"); + exit(-1); + } + + // So far so good; try to open the input file + std::string input = argv[2]; + // Note that we have to open the input in binary mode. + // This is due to some operating systems not using binary mode by default. + // Since we will most likely be dealing with binary files when encoding, we + // have to be able to deal with zeros (and other invalid chars) in the input stream. + std::ifstream instream(input.c_str(), std::ios_base::in | std::ios_base::binary); + if (!instream.is_open()) + { + usage("Could not open input file!"); + exit(-1); + } + + // Now try to open the output file + std::string output = argv[3]; + // Again, note that we have to open the ouput in binary mode. + // Similiarly, we will most likely need to deal with zeros in the output stream when we + // are decoding, and the output stream has to be able to use these invalid text chars. + std::ofstream outstream(output.c_str(), std::ios_base::out | std::ios_base::binary); + if (!outstream.is_open()) + { + usage("Could not open output file!"); + exit(-1); + } + + // determine whether we need to encode or decode: + std::string choice = argv[1]; + if (choice == "-d") + { + base64::decoder D; + D.decode(instream, outstream); + } + else if (choice == "-e") + { + base64::encoder E; + E.encode(instream, outstream); + } + else + { + std::cout<<"["<<choice<<"]"<<std::endl; + usage("Please specify -d or -e as first argument!"); + } + + return 0; +} + |