summaryrefslogtreecommitdiff
path: root/plugins/Scriver
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-02 17:27:12 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-02 17:27:12 +0000
commitd3fc13db1e7588df70dea2bd891f140d71b93051 (patch)
treee0cb860fc02d4f95022e9e6d92a7d668801ad650 /plugins/Scriver
parentee283675f4916e09c91c315080b6b4287b5d89d0 (diff)
minus one unneeded mir_tstrlen
git-svn-id: http://svn.miranda-ng.org/main/trunk@11219 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver')
-rw-r--r--plugins/Scriver/src/msglog.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index d67f117092..0ca661d1f2 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -253,12 +253,13 @@ static void freeEvent(EventData *evt)
static int AppendUnicodeOrAnsiiToBufferL(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, const WCHAR *line, size_t maxLen, BOOL isAnsii)
{
- int textCharsCount = 0;
- int wasEOL = 0;
+ if (maxLen == -1)
+ maxLen = wcslen(line);
+
const WCHAR *maxLine = line + maxLen;
- int lineLen = (int)wcslen(line) * 9 + 8;
+ size_t lineLen = maxLen*9 + 8;
if (*cbBufferEnd + lineLen > *cbBufferAlloced) {
- cbBufferAlloced[0] += (lineLen + 1024 - lineLen % 1024);
+ cbBufferAlloced[0] += int(lineLen + 1024 - lineLen % 1024);
*buffer = (char*)mir_realloc(*buffer, *cbBufferAlloced);
}
@@ -272,7 +273,8 @@ static int AppendUnicodeOrAnsiiToBufferL(char **buffer, int *cbBufferEnd, int *c
d += 6;
}
- for (; *line && (maxLen == -1 || line < maxLine); line++, textCharsCount++) {
+ int wasEOL = 0, textCharsCount = 0;
+ for (; line < maxLine; line++, textCharsCount++) {
wasEOL = 0;
if (*line == '\r' && line[1] == '\n') {
CopyMemory(d, "\\line ", 6);
@@ -316,13 +318,12 @@ static int AppendUnicodeOrAnsiiToBufferL(char **buffer, int *cbBufferEnd, int *c
static int AppendAnsiToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, const char *line)
{
- ptrT tszLine(mir_a2t(line));
- return AppendUnicodeOrAnsiiToBufferL(buffer, cbBufferEnd, cbBufferAlloced, tszLine, mir_tstrlen(tszLine), TRUE);
+ return AppendUnicodeOrAnsiiToBufferL(buffer, cbBufferEnd, cbBufferAlloced, _A2T(line), -1, TRUE);
}
static int AppendUnicodeToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, const WCHAR *line)
{
- return AppendUnicodeOrAnsiiToBufferL(buffer, cbBufferEnd, cbBufferAlloced, line, mir_wstrlen(line), FALSE);
+ return AppendUnicodeOrAnsiiToBufferL(buffer, cbBufferEnd, cbBufferAlloced, line, -1, FALSE);
}
// mir_free() the return value