swfmill 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -0,0 +1,56 @@
1
+ BINARIES = base64
2
+
3
+ # Build flags (uncomment one)
4
+ #############################
5
+ # Release build flags
6
+ CFLAGS += -O3
7
+ #############################
8
+ # Debug build flags
9
+ #CFLAGS += -g
10
+ #############################
11
+
12
+ # select a buffersize
13
+ # a larger size should be faster, but takes more runtime memory
14
+ #BUFFERSIZE = 4096
15
+ #BUFFERSIZE = 65536
16
+ BUFFERSIZE = 16777216
17
+
18
+ SOURCES = base64.cc
19
+
20
+ TARGETS = $(BINARIES)
21
+
22
+ LINK.o = g++
23
+
24
+ CFLAGS += -Werror -pedantic
25
+ CFLAGS += -DBUFFERSIZE=$(BUFFERSIZE)
26
+ CFLAGS += -I../include
27
+
28
+ CXXFLAGS += $(CFLAGS)
29
+
30
+ vpath %.h ../include/b64
31
+ vpath %.a ../src
32
+
33
+ .PHONY : clean
34
+
35
+ all: $(TARGETS) #strip
36
+
37
+ base64: libb64.a
38
+
39
+ strip:
40
+ strip $(BINARIES) *.exe
41
+
42
+ clean: clean_VisualStudioProject
43
+ rm -f *.exe* *.o $(TARGETS) *.bak *~
44
+ clean_VisualStudioProject:
45
+ $(MAKE) -C VisualStudioProject clean
46
+
47
+ distclean: clean distclean_VisualStudioProject
48
+ rm -f depend
49
+ distclean_VisualStudioProject: clean_VisualStudioProject
50
+ $(MAKE) -C VisualStudioProject distclean
51
+
52
+ depend: $(SOURCES)
53
+ makedepend -f- $(CFLAGS) $(SOURCES) 2> /dev/null 1> depend
54
+
55
+ -include depend
56
+
@@ -0,0 +1,11 @@
1
+ DEBRIS = base64.sdf base64.suo base64.vcxproj.user
2
+
3
+ all:
4
+
5
+ clean:
6
+ rm -rf Debug Release
7
+
8
+ distclean: clean
9
+ rm -f $(DEBRIS)
10
+
11
+
@@ -0,0 +1,20 @@
1
+ 
2
+ Microsoft Visual Studio Solution File, Format Version 11.00
3
+ # Visual C++ Express 2010
4
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base64", "base64.vcxproj", "{0B094121-DC64-4D74-AFA0-750B83F800D0}"
5
+ EndProject
6
+ Global
7
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
8
+ Debug|Win32 = Debug|Win32
9
+ Release|Win32 = Release|Win32
10
+ EndGlobalSection
11
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
12
+ {0B094121-DC64-4D74-AFA0-750B83F800D0}.Debug|Win32.ActiveCfg = Debug|Win32
13
+ {0B094121-DC64-4D74-AFA0-750B83F800D0}.Debug|Win32.Build.0 = Debug|Win32
14
+ {0B094121-DC64-4D74-AFA0-750B83F800D0}.Release|Win32.ActiveCfg = Release|Win32
15
+ {0B094121-DC64-4D74-AFA0-750B83F800D0}.Release|Win32.Build.0 = Release|Win32
16
+ EndGlobalSection
17
+ GlobalSection(SolutionProperties) = preSolution
18
+ HideSolutionNode = FALSE
19
+ EndGlobalSection
20
+ EndGlobal
@@ -0,0 +1,92 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup Label="ProjectConfigurations">
4
+ <ProjectConfiguration Include="Debug|Win32">
5
+ <Configuration>Debug</Configuration>
6
+ <Platform>Win32</Platform>
7
+ </ProjectConfiguration>
8
+ <ProjectConfiguration Include="Release|Win32">
9
+ <Configuration>Release</Configuration>
10
+ <Platform>Win32</Platform>
11
+ </ProjectConfiguration>
12
+ </ItemGroup>
13
+ <PropertyGroup Label="Globals">
14
+ <ProjectGuid>{0B094121-DC64-4D74-AFA0-750B83F800D0}</ProjectGuid>
15
+ <Keyword>Win32Proj</Keyword>
16
+ <RootNamespace>base64</RootNamespace>
17
+ </PropertyGroup>
18
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
19
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
20
+ <ConfigurationType>Application</ConfigurationType>
21
+ <UseDebugLibraries>true</UseDebugLibraries>
22
+ <CharacterSet>Unicode</CharacterSet>
23
+ </PropertyGroup>
24
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
25
+ <ConfigurationType>Application</ConfigurationType>
26
+ <UseDebugLibraries>false</UseDebugLibraries>
27
+ <WholeProgramOptimization>true</WholeProgramOptimization>
28
+ <CharacterSet>Unicode</CharacterSet>
29
+ </PropertyGroup>
30
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
31
+ <ImportGroup Label="ExtensionSettings">
32
+ </ImportGroup>
33
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
34
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
35
+ </ImportGroup>
36
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
37
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
38
+ </ImportGroup>
39
+ <PropertyGroup Label="UserMacros" />
40
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
41
+ <LinkIncremental>true</LinkIncremental>
42
+ </PropertyGroup>
43
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
44
+ <LinkIncremental>false</LinkIncremental>
45
+ </PropertyGroup>
46
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
47
+ <ClCompile>
48
+ <PrecompiledHeader>
49
+ </PrecompiledHeader>
50
+ <WarningLevel>Level3</WarningLevel>
51
+ <Optimization>Disabled</Optimization>
52
+ <PreprocessorDefinitions>BUFFERSIZE=16777216;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
53
+ <AdditionalIncludeDirectories>H:\builds\libb64\working.libb64\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
54
+ </ClCompile>
55
+ <Link>
56
+ <SubSystem>Console</SubSystem>
57
+ <GenerateDebugInformation>true</GenerateDebugInformation>
58
+ </Link>
59
+ </ItemDefinitionGroup>
60
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
61
+ <ClCompile>
62
+ <WarningLevel>Level3</WarningLevel>
63
+ <PrecompiledHeader>
64
+ </PrecompiledHeader>
65
+ <Optimization>MaxSpeed</Optimization>
66
+ <FunctionLevelLinking>true</FunctionLevelLinking>
67
+ <IntrinsicFunctions>true</IntrinsicFunctions>
68
+ <PreprocessorDefinitions>BUFFERSIZE=16777216;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
69
+ <AdditionalIncludeDirectories>H:\builds\libb64\working.libb64\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
70
+ </ClCompile>
71
+ <Link>
72
+ <SubSystem>Console</SubSystem>
73
+ <GenerateDebugInformation>true</GenerateDebugInformation>
74
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
75
+ <OptimizeReferences>true</OptimizeReferences>
76
+ </Link>
77
+ </ItemDefinitionGroup>
78
+ <ItemGroup>
79
+ <ClCompile Include="..\..\src\cdecode.c" />
80
+ <ClCompile Include="..\..\src\cencode.c" />
81
+ <ClCompile Include="..\base64.cc" />
82
+ </ItemGroup>
83
+ <ItemGroup>
84
+ <ClInclude Include="..\..\include\b64\cdecode.h" />
85
+ <ClInclude Include="..\..\include\b64\cencode.h" />
86
+ <ClInclude Include="..\..\include\b64\decode.h" />
87
+ <ClInclude Include="..\..\include\b64\encode.h" />
88
+ </ItemGroup>
89
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
90
+ <ImportGroup Label="ExtensionTargets">
91
+ </ImportGroup>
92
+ </Project>
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup>
4
+ <Filter Include="Source Files">
5
+ <UniqueIdentifier>{12b9f2a2-b899-409a-a507-8cefe9c39b25}</UniqueIdentifier>
6
+ </Filter>
7
+ <Filter Include="Header Files">
8
+ <UniqueIdentifier>{ce5598bd-67f3-430f-890b-cefa880e9405}</UniqueIdentifier>
9
+ </Filter>
10
+ </ItemGroup>
11
+ <ItemGroup>
12
+ <ClCompile Include="..\base64.cc">
13
+ <Filter>Source Files</Filter>
14
+ </ClCompile>
15
+ <ClCompile Include="..\..\src\cencode.c">
16
+ <Filter>Source Files</Filter>
17
+ </ClCompile>
18
+ <ClCompile Include="..\..\src\cdecode.c">
19
+ <Filter>Source Files</Filter>
20
+ </ClCompile>
21
+ </ItemGroup>
22
+ <ItemGroup>
23
+ <ClInclude Include="..\..\include\b64\encode.h">
24
+ <Filter>Header Files</Filter>
25
+ </ClInclude>
26
+ <ClInclude Include="..\..\include\b64\cdecode.h">
27
+ <Filter>Header Files</Filter>
28
+ </ClInclude>
29
+ <ClInclude Include="..\..\include\b64\cencode.h">
30
+ <Filter>Header Files</Filter>
31
+ </ClInclude>
32
+ <ClInclude Include="..\..\include\b64\decode.h">
33
+ <Filter>Header Files</Filter>
34
+ </ClInclude>
35
+ </ItemGroup>
36
+ </Project>
@@ -0,0 +1,94 @@
1
+ /*
2
+ base64.cc - c++ source to a base64 reference encoder and decoder
3
+
4
+ This is part of the libb64 project, and has been placed in the public domain.
5
+ For details, see http://sourceforge.net/projects/libb64
6
+ */
7
+
8
+ #include <b64/encode.h>
9
+ #include <b64/decode.h>
10
+
11
+ #include <iostream>
12
+ #include <fstream>
13
+ #include <string>
14
+
15
+ #include <stdlib.h>
16
+
17
+ // Function which prints the usage of this executable
18
+ void usage()
19
+ {
20
+ std::cerr<< \
21
+ "base64: Encodes and Decodes files using base64\n" \
22
+ "Usage: base64 [-e|-d] [input] [output]\n" \
23
+ " Where [-e] will encode the input file into the output file,\n" \
24
+ " [-d] will decode the input file into the output file, and\n" \
25
+ " [input] and [output] are the input and output files, respectively.\n";
26
+ }
27
+ // Function which prints the usage of this executable, plus a short message
28
+ void usage(const std::string& message)
29
+ {
30
+ usage();
31
+ std::cerr<<"Incorrect invocation of base64:\n";
32
+ std::cerr<<message<<std::endl;
33
+ }
34
+
35
+ int main(int argc, char** argv)
36
+ {
37
+ // Quick check for valid arguments
38
+ if (argc == 1)
39
+ {
40
+ usage();
41
+ exit(-1);
42
+ }
43
+ if (argc != 4)
44
+ {
45
+ usage("Wrong number of arguments!");
46
+ exit(-1);
47
+ }
48
+
49
+ // So far so good; try to open the input file
50
+ std::string input = argv[2];
51
+ // Note that we have to open the input in binary mode.
52
+ // This is due to some operating systems not using binary mode by default.
53
+ // Since we will most likely be dealing with binary files when encoding, we
54
+ // have to be able to deal with zeros (and other invalid chars) in the input stream.
55
+ std::ifstream instream(input.c_str(), std::ios_base::in | std::ios_base::binary);
56
+ if (!instream.is_open())
57
+ {
58
+ usage("Could not open input file!");
59
+ exit(-1);
60
+ }
61
+
62
+ // Now try to open the output file
63
+ std::string output = argv[3];
64
+ // Again, note that we have to open the ouput in binary mode.
65
+ // Similiarly, we will most likely need to deal with zeros in the output stream when we
66
+ // are decoding, and the output stream has to be able to use these invalid text chars.
67
+ std::ofstream outstream(output.c_str(), std::ios_base::out | std::ios_base::binary);
68
+ if (!outstream.is_open())
69
+ {
70
+ usage("Could not open output file!");
71
+ exit(-1);
72
+ }
73
+
74
+ // determine whether we need to encode or decode:
75
+ std::string choice = argv[1];
76
+ if (choice == "-d")
77
+ {
78
+ base64::decoder D;
79
+ D.decode(instream, outstream);
80
+ }
81
+ else if (choice == "-e")
82
+ {
83
+ base64::encoder E;
84
+ E.encode(instream, outstream);
85
+ }
86
+ else
87
+ {
88
+ std::cout<<"["<<choice<<"]"<<std::endl;
89
+ usage("Please specify -d or -e as first argument!");
90
+ }
91
+
92
+ return 0;
93
+ }
94
+
@@ -0,0 +1,28 @@
1
+ /*
2
+ cdecode.h - c header for a base64 decoding algorithm
3
+
4
+ This is part of the libb64 project, and has been placed in the public domain.
5
+ For details, see http://sourceforge.net/projects/libb64
6
+ */
7
+
8
+ #ifndef BASE64_CDECODE_H
9
+ #define BASE64_CDECODE_H
10
+
11
+ typedef enum
12
+ {
13
+ step_a, step_b, step_c, step_d
14
+ } base64_decodestep;
15
+
16
+ typedef struct
17
+ {
18
+ base64_decodestep step;
19
+ char plainchar;
20
+ } base64_decodestate;
21
+
22
+ void base64_init_decodestate(base64_decodestate* state_in);
23
+
24
+ int base64_decode_value(char value_in);
25
+
26
+ int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in);
27
+
28
+ #endif /* BASE64_CDECODE_H */
@@ -0,0 +1,31 @@
1
+ /*
2
+ cencode.h - c header for a base64 encoding algorithm
3
+
4
+ This is part of the libb64 project, and has been placed in the public domain.
5
+ For details, see http://sourceforge.net/projects/libb64
6
+ */
7
+
8
+ #ifndef BASE64_CENCODE_H
9
+ #define BASE64_CENCODE_H
10
+
11
+ typedef enum
12
+ {
13
+ step_A, step_B, step_C
14
+ } base64_encodestep;
15
+
16
+ typedef struct
17
+ {
18
+ base64_encodestep step;
19
+ char result;
20
+ int stepcount;
21
+ } base64_encodestate;
22
+
23
+ void base64_init_encodestate(base64_encodestate* state_in);
24
+
25
+ char base64_encode_value(char value_in);
26
+
27
+ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in);
28
+
29
+ int base64_encode_blockend(char* code_out, base64_encodestate* state_in);
30
+
31
+ #endif /* BASE64_CENCODE_H */
@@ -0,0 +1,70 @@
1
+ // :mode=c++:
2
+ /*
3
+ decode.h - c++ wrapper for a base64 decoding algorithm
4
+
5
+ This is part of the libb64 project, and has been placed in the public domain.
6
+ For details, see http://sourceforge.net/projects/libb64
7
+ */
8
+ #ifndef BASE64_DECODE_H
9
+ #define BASE64_DECODE_H
10
+
11
+ #include <iostream>
12
+
13
+ namespace base64
14
+ {
15
+ extern "C"
16
+ {
17
+ #include "cdecode.h"
18
+ }
19
+
20
+ struct decoder
21
+ {
22
+ base64_decodestate _state;
23
+ int _buffersize;
24
+
25
+ decoder(int buffersize_in = BUFFERSIZE)
26
+ : _buffersize(buffersize_in)
27
+ {}
28
+
29
+ int decode(char value_in)
30
+ {
31
+ return base64_decode_value(value_in);
32
+ }
33
+
34
+ int decode(const char* code_in, const int length_in, char* plaintext_out)
35
+ {
36
+ return base64_decode_block(code_in, length_in, plaintext_out, &_state);
37
+ }
38
+
39
+ void decode(std::istream& istream_in, std::ostream& ostream_in)
40
+ {
41
+ base64_init_decodestate(&_state);
42
+ //
43
+ const int N = _buffersize;
44
+ char* code = new char[N];
45
+ char* plaintext = new char[N];
46
+ int codelength;
47
+ int plainlength;
48
+
49
+ do
50
+ {
51
+ istream_in.read((char*)code, N);
52
+ codelength = istream_in.gcount();
53
+ plainlength = decode(code, codelength, plaintext);
54
+ ostream_in.write((const char*)plaintext, plainlength);
55
+ }
56
+ while (istream_in.good() && codelength > 0);
57
+ //
58
+ base64_init_decodestate(&_state);
59
+
60
+ delete [] code;
61
+ delete [] plaintext;
62
+ }
63
+ };
64
+
65
+ } // namespace base64
66
+
67
+
68
+
69
+ #endif // BASE64_DECODE_H
70
+