Skip to content

Commit

Permalink
feat: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
ikpil committed Oct 2, 2023
1 parent b0d77ab commit cc15ea1
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/DotFastLZ.Packaging/SixPack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public static int UnpackFile(string input_file)

/* initialize */
string output_file = string.Empty;
FileStream f = null;
FileStream ofs = null;
long total_extracted = 0;
long decompressed_size = 0;
long percent = 0;
Expand Down Expand Up @@ -414,10 +414,10 @@ out var chunk_extra
{
/* close current file, if any */
Console.WriteLine("");
if (null != f)
if (null != ofs)
{
f.Close();
f = null;
ofs.Close();
ofs = null;
}

/* file entry */
Expand All @@ -441,18 +441,18 @@ out var chunk_extra
output_file = output_file.Trim();

/* check if already exists */
f = OpenFile(output_file, FileMode.Open);
if (null != f)
ofs = OpenFile(output_file, FileMode.Open);
if (null != ofs)
{
f.Close();
f = null;
ofs.Close();
ofs = null;
Console.WriteLine($"File {output_file} already exists. Skipped.");
}
else
{
/* create the file */
f = OpenFile(output_file, FileMode.CreateNew, FileAccess.Write, FileShare.Write);
if (null == f)
ofs = OpenFile(output_file, FileMode.CreateNew, FileAccess.Write, FileShare.Write);
if (null == ofs)
{
Console.WriteLine($"Can't create file {output_file} Skipped.");
}
Expand Down Expand Up @@ -484,7 +484,7 @@ out var chunk_extra
}
}

if ((chunk_id == 17) && null != f && !string.IsNullOrEmpty(output_file) && 0 < decompressed_size)
if ((chunk_id == 17) && null != ofs && !string.IsNullOrEmpty(output_file) && 0 < decompressed_size)
{
long remaining;

Expand All @@ -506,7 +506,7 @@ out var chunk_extra
break;
}

f.Write(buffer, 0, (int)bytes_read);
ofs.Write(buffer, 0, (int)bytes_read);
checksum = Adler32(checksum, buffer, bytes_read);
remaining -= bytes_read;
}
Expand Down Expand Up @@ -557,7 +557,7 @@ out var chunk_extra
}
else
{
f.Write(decompressed_buffer, 0, (int)chunk_extra);
ofs.Write(decompressed_buffer, 0, (int)chunk_extra);
}
}

Expand Down Expand Up @@ -598,9 +598,9 @@ out var chunk_extra
Console.WriteLine("");

/* close working files */
if (null != f)
if (null != ofs)
{
f.Close();
ofs.Close();
}

/* so far so good */
Expand Down

0 comments on commit cc15ea1

Please sign in to comment.