Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/Common/Lang.cpp')
-rw-r--r--CPP/Common/Lang.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/CPP/Common/Lang.cpp b/CPP/Common/Lang.cpp
index 64e561a3..8c525cf7 100644
--- a/CPP/Common/Lang.cpp
+++ b/CPP/Common/Lang.cpp
@@ -120,15 +120,17 @@ bool CLang::Open(CFSTR fileName, const wchar_t *id)
return false;
if (length > (1 << 20))
return false;
+
AString s;
unsigned len = (unsigned)length;
- char *p = s.GetBuffer(len);
+ char *p = s.GetBuf(len);
UInt32 processed;
if (!file.Read(p, len, processed))
return false;
file.Close();
if (len != processed)
return false;
+
char *p2 = p;
for (unsigned i = 0; i < len; i++)
{
@@ -138,13 +140,16 @@ bool CLang::Open(CFSTR fileName, const wchar_t *id)
if (c != 0x0D)
*p2++ = c;
}
- s.ReleaseBuffer((unsigned)(p2 - p));
+ *p2 = 0;
+ s.ReleaseBuf_SetLen((unsigned)(p2 - p));
+
if (OpenFromString(s))
{
- const wchar_t *s = Get(0);
- if (s && wcscmp(s, id) == 0)
+ const wchar_t *name = Get(0);
+ if (name && wcscmp(name, id) == 0)
return true;
}
+
Clear();
return false;
}