mirror of https://github.com/winsw/winsw
Fix file length accumulation
parent
6c966cecc9
commit
37aee80a8a
|
@ -4,6 +4,7 @@ using System.Diagnostics;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
#endif
|
#endif
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
#if !VNEXT
|
#if !VNEXT
|
||||||
using ICSharpCode.SharpZipLib.Zip;
|
using ICSharpCode.SharpZipLib.Zip;
|
||||||
|
@ -264,7 +265,7 @@ namespace WinSW
|
||||||
string? line;
|
string? line;
|
||||||
while ((line = reader.ReadLine()) != null)
|
while ((line = reader.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
int lengthToWrite = (line.Length + Environment.NewLine.Length) * sizeof(char);
|
int lengthToWrite = Encoding.UTF8.GetByteCount(line) + 2; // CRLF
|
||||||
if (fileLength + lengthToWrite > this.SizeTheshold)
|
if (fileLength + lengthToWrite > this.SizeTheshold)
|
||||||
{
|
{
|
||||||
writer.Dispose();
|
writer.Dispose();
|
||||||
|
@ -437,7 +438,7 @@ namespace WinSW
|
||||||
{
|
{
|
||||||
lock (fileLock)
|
lock (fileLock)
|
||||||
{
|
{
|
||||||
int lengthToWrite = (line.Length + Environment.NewLine.Length) * sizeof(char);
|
int lengthToWrite = Encoding.UTF8.GetByteCount(line) + 2; // CRLF
|
||||||
if (fileLength + lengthToWrite > this.SizeTheshold)
|
if (fileLength + lengthToWrite > this.SizeTheshold)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in New Issue