Skip to content

Commit 7e016e1

Browse files
committed
[libromdata] Xbox360_XDBF_Private::loadString_GPD(): Reduce the scope of s_ret.
Return {} instead of an empty s_ret (previously ret).
1 parent d39ae47 commit 7e016e1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/libromdata/Console/Xbox360_XDBF.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -534,17 +534,15 @@ string Xbox360_XDBF_Private::loadString_SPA(XDBF_Language_e langID, uint16_t str
534534
*/
535535
string Xbox360_XDBF_Private::loadString_GPD(uint16_t string_id)
536536
{
537-
string ret;
538-
539537
if (entryTable.empty()) {
540538
// Entry table isn't loaded...
541-
return ret;
539+
return {};
542540
}
543541

544542
// Can we load the string?
545543
if (!file || !isValid) {
546544
// Can't load the string.
547-
return ret;
545+
return {};
548546
}
549547

550548
#if SYS_BYTEORDER == SYS_LIL_ENDIAN
@@ -559,6 +557,7 @@ string Xbox360_XDBF_Private::loadString_GPD(uint16_t string_id)
559557

560558
// GPD doesn't have string tables.
561559
// Instead, each string is its own entry in the main resource table.
560+
string s_ret;
562561
for (const XDBF_Entry &p : entryTable) {
563562
if (p.namespace_id != cpu_to_be16(XDBF_GPD_NAMESPACE_STRING)) {
564563
// Not a string.
@@ -595,11 +594,11 @@ string Xbox360_XDBF_Private::loadString_GPD(uint16_t string_id)
595594
}
596595

597596
// Convert from UTF-16BE and DOS line endings.
598-
ret = dos2unix(utf16be_to_utf8(sbuf.get(), length / 2));
597+
s_ret = dos2unix(utf16be_to_utf8(sbuf.get(), length / 2));
599598
break;
600599
}
601600

602-
return ret;
601+
return s_ret;
603602
}
604603

605604
/**

0 commit comments

Comments
 (0)