Skip to content

Commit 3ee6db5

Browse files
michaelsternbergtschak909
authored andcommitted
ATARI: Improve trailing slash in sio_set_prefix
1 parent af75c13 commit 3ee6db5

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/device/sio/network.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,13 @@ void sioNetwork::sio_set_prefix()
556556

557557
prefixSpec_str = string((const char *)prefixSpec);
558558
prefixSpec_str = prefixSpec_str.substr(prefixSpec_str.find_first_of(":") + 1);
559+
560+
// Append trailing slash if not found
561+
if (prefixSpec_str.back() != '/')
562+
{
563+
prefixSpec_str += "/";
564+
}
565+
559566
#ifdef VERBOSE_PROTOCOL
560567
Debug_printf("sioNetwork::sio_set_prefix(%s)\n", prefixSpec_str.c_str());
561568
#endif
@@ -568,7 +575,7 @@ void sioNetwork::sio_set_prefix()
568575
else
569576
{
570577
// For the remaining cases, append trailing slash if not found
571-
if (prefix[prefix.size()-1] != '/')
578+
if (prefix.back() != '/')
572579
{
573580
prefix += "/";
574581
}
@@ -600,11 +607,6 @@ void sioNetwork::sio_set_prefix()
600607
else if (prefixSpec_str.find_first_of(":") != string::npos)
601608
{
602609
prefix = prefixSpec_str;
603-
// Check for trailing slash. Append if missing.
604-
if (prefix[prefix.size()-1] != '/')
605-
{
606-
prefix += "/";
607-
}
608610
}
609611
else // append to path.
610612
{

0 commit comments

Comments
 (0)