Skip to content

Calling Decode multiple times from same instance corrupted results #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Ascii85ConsoleSolution.sln
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ascii85ConsoleSolution", "Ascii85ConsoleSolution\Ascii85ConsoleSolution.csproj", "{4C399EE9-78B2-43FC-8C12-2C40D506D05D}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{4C399EE9-78B2-43FC-8C12-2C40D506D05D}.Debug.ActiveCfg = Debug|.NET
{4C399EE9-78B2-43FC-8C12-2C40D506D05D}.Debug.Build.0 = Debug|.NET
{4C399EE9-78B2-43FC-8C12-2C40D506D05D}.Release.ActiveCfg = Release|.NET
{4C399EE9-78B2-43FC-8C12-2C40D506D05D}.Release.Build.0 = Release|.NET
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4C399EE9-78B2-43FC-8C12-2C40D506D05D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C399EE9-78B2-43FC-8C12-2C40D506D05D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C399EE9-78B2-43FC-8C12-2C40D506D05D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C399EE9-78B2-43FC-8C12-2C40D506D05D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
2 changes: 2 additions & 0 deletions Ascii85ConsoleSolution/Ascii85.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public byte[] Decode(string s)
s = s.Substring(0, s.Length - SuffixMark.Length);
}

_tuple = 0;

MemoryStream ms = new MemoryStream();
int count = 0;
bool processChar = false;
Expand Down
185 changes: 90 additions & 95 deletions Ascii85ConsoleSolution/Ascii85ConsoleSolution.csproj
Original file line number Diff line number Diff line change
@@ -1,95 +1,90 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{4C399EE9-78B2-43FC-8C12-2C40D506D05D}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "Ascii85ConsoleSolution"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Exe"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "Ascii85ConsoleSolution"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "Ascii85.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Class1.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>7.10.3077</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4C399EE9-78B2-43FC-8C12-2C40D506D05D}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon />
<AssemblyKeyContainerName />
<AssemblyName>Ascii85ConsoleSolution</AssemblyName>
<AssemblyOriginatorKeyFile />
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Exe</OutputType>
<RootNamespace>Ascii85ConsoleSolution</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject />
<FileUpgradeFlags>
</FileUpgradeFlags>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>0.0</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile />
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile />
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn />
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile />
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile />
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn />
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Ascii85.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Class1.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent />
<PostBuildEvent />
</PropertyGroup>
</Project>
9 changes: 8 additions & 1 deletion Ascii85ConsoleSolution/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,12 @@ static void TestString()
Console.WriteLine();
Console.WriteLine("Decoded " + decoded.Length + " chars");
Console.WriteLine();
}

byte[] decoded2 = a.Decode(encoded);
Console.WriteLine(Encoding.ASCII.GetString(decoded2));

Console.WriteLine("Equal results from multiple Decode calls?\t" + Encoding.ASCII.GetString(decoded) == Encoding.ASCII.GetString(decoded2));

Console.ReadKey();
}
}