Skip to content

Commit 8eb7a62

Browse files
authored
Merge pull request #350 from universal963/patch-fixfiltertext
Fix stubs for `FilterText()` and `InitFilterText()`
2 parents 6648ad4 + aa7333e commit 8eb7a62

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

dll/steam_utils.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ bool Steam_Utils::InitFilterText()
374374
{
375375
PRINT_DEBUG_TODO();
376376
std::lock_guard<std::recursive_mutex> lock(global_mutex);
377-
return false;
377+
return true;
378378
}
379379

380380
// Initializes text filtering.
@@ -384,7 +384,7 @@ bool Steam_Utils::InitFilterText( uint32 unFilterOptions )
384384
{
385385
PRINT_DEBUG_TODO();
386386
std::lock_guard<std::recursive_mutex> lock(global_mutex);
387-
return false;
387+
return true;
388388
}
389389

390390
// Filters the provided input message and places the filtered result into pchOutFilteredText.
@@ -411,16 +411,16 @@ int Steam_Utils::FilterText( ETextFilteringContext eContext, CSteamID sourceStea
411411
{
412412
PRINT_DEBUG_ENTRY();
413413
std::lock_guard<std::recursive_mutex> lock(global_mutex);
414-
if (!nByteSizeOutFilteredText) return 0;
415-
unsigned len = static_cast<unsigned>(strlen(pchInputMessage));
414+
if (!nByteSizeOutFilteredText || !pchInputMessage || !pchOutFilteredText) return 0;
415+
size_t len = strlen(pchInputMessage);
416416
if (!len) return 0;
417417
len += 1;
418418
if (len > nByteSizeOutFilteredText) len = nByteSizeOutFilteredText;
419419
len -= 1;
420420

421421
memcpy(pchOutFilteredText, pchInputMessage, len);
422422
pchOutFilteredText[len] = 0;
423-
return len;
423+
return 0; // NOTE: "Returns the number of characters (not bytes) filtered". Since all characters are copied, no characters are filtered.
424424
}
425425

426426

0 commit comments

Comments
 (0)