more stable string trim

This commit is contained in:
Jack Andersen 2015-09-01 09:26:55 -10:00
parent 714f81352d
commit c98ebe2fbe
3 changed files with 17 additions and 29 deletions

View File

@ -138,17 +138,14 @@ void PAKBridge::build()
areaDeps.name = areaName.getSystemString(FOURCC('ENGL'), 0);
/* Trim possible trailing whitespace */
if (areaDeps.name.size())
{
#if HECL_UCS2
while (iswblank(areaDeps.name.back()))
while (areaDeps.name.size() && iswblank(areaDeps.name.back()))
areaDeps.name.pop_back();
#else
while (isblank(areaDeps.name.back()))
while (areaDeps.name.size() && isblank(areaDeps.name.back()))
areaDeps.name.pop_back();
#endif
}
}
if (areaDeps.name.empty())
{
#if HECL_UCS2
@ -166,16 +163,13 @@ void PAKBridge::build()
Area::Layer& layer = areaDeps.layers.back();
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
/* Trim possible trailing whitespace */
if (layer.name.size())
{
#if HECL_UCS2
while (iswblank(layer.name.back()))
while (layer.name.size() && iswblank(layer.name.back()))
layer.name.pop_back();
#else
while (isblank(layer.name.back()))
while (layer.name.size() && isblank(layer.name.back()))
layer.name.pop_back();
#endif
}
layer.resources.reserve(area.depLayers[l] - r);
for (; r<area.depLayers[l] ; ++r)

View File

@ -137,17 +137,14 @@ void PAKBridge::build()
areaDeps.name = areaName.getSystemString(FOURCC('ENGL'), 0);
/* Trim possible trailing whitespace */
if (areaDeps.name.size())
{
#if HECL_UCS2
while (iswblank(areaDeps.name.back()))
while (areaDeps.name.size() && iswblank(areaDeps.name.back()))
areaDeps.name.pop_back();
#else
while (isblank(areaDeps.name.back()))
while (areaDeps.name.size() && isblank(areaDeps.name.back()))
areaDeps.name.pop_back();
#endif
}
}
if (areaDeps.name.empty())
{
#if HECL_UCS2
@ -173,16 +170,13 @@ void PAKBridge::build()
Area::Layer& layer = areaDeps.layers.back();
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
/* Trim possible trailing whitespace */
if (layer.name.size())
{
#if HECL_UCS2
while (iswblank(layer.name.back()))
while (layer.name.size() && iswblank(layer.name.back()))
layer.name.pop_back();
#else
while (isblank(layer.name.back()))
while (layer.name.size() && isblank(layer.name.back()))
layer.name.pop_back();
#endif
}
layer.resources.reserve(area.depLayers[l] - r);
for (; r<area.depLayers[l] ; ++r)

2
hecl

@ -1 +1 @@
Subproject commit 66f39d1b8fbc79f88e71ad06eafbbd5f09c76d78
Subproject commit 3755f82b91bcd950d12a94cbb05ec296677bcc34