Skip to content

Commit bb45e97

Browse files
committed
ExtendedServices: Improve string typedef usage
1 parent 665a230 commit bb45e97

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

plugins/ExtendedServices/trigger.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ PPH_STRING EspConvertNewLinesToNulls(
11621162
SIZE_T count;
11631163
SIZE_T i;
11641164

1165-
text = PhCreateStringEx(NULL, String->Length + 2); // plus one character for an extra null terminator (see below)
1165+
text = PhCreateStringEx(NULL, String->Length + sizeof(UNICODE_NULL)); // plus one character for an extra null terminator (see below)
11661166
text->Length = 0;
11671167
count = 0;
11681168

@@ -1176,7 +1176,7 @@ PPH_STRING EspConvertNewLinesToNulls(
11761176

11771177
if (String->Buffer[i] == '\n')
11781178
{
1179-
text->Buffer[count++] = 0;
1179+
text->Buffer[count++] = UNICODE_NULL;
11801180
continue;
11811181
}
11821182

@@ -1186,11 +1186,11 @@ PPH_STRING EspConvertNewLinesToNulls(
11861186
if (count != 0)
11871187
{
11881188
// Make sure we have an extra null terminator at the end, as required of multistrings.
1189-
if (text->Buffer[count - 1] != 0)
1190-
text->Buffer[count++] = 0;
1189+
if (text->Buffer[count - 1] != UNICODE_NULL)
1190+
text->Buffer[count++] = UNICODE_NULL;
11911191
}
11921192

1193-
text->Length = count * 2;
1193+
text->Length = count * sizeof(WCHAR);
11941194

11951195
return text;
11961196
}
@@ -1204,9 +1204,9 @@ PPH_STRING EspConvertNullsToSpaces(
12041204

12051205
text = PhDuplicateString(String);
12061206

1207-
for (j = 0; j < text->Length / 2; j++)
1207+
for (j = 0; j < text->Length / sizeof(WCHAR); j++)
12081208
{
1209-
if (text->Buffer[j] == 0)
1209+
if (text->Buffer[j] == UNICODE_NULL)
12101210
text->Buffer[j] = ' ';
12111211
}
12121212

0 commit comments

Comments
 (0)