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,16 +138,13 @@ 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()))
areaDeps.name.pop_back();
while (areaDeps.name.size() && iswblank(areaDeps.name.back()))
areaDeps.name.pop_back();
#else
while (isblank(areaDeps.name.back()))
areaDeps.name.pop_back();
while (areaDeps.name.size() && isblank(areaDeps.name.back()))
areaDeps.name.pop_back();
#endif
}
}
if (areaDeps.name.empty())
{
@ -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()))
layer.name.pop_back();
while (layer.name.size() && iswblank(layer.name.back()))
layer.name.pop_back();
#else
while (isblank(layer.name.back()))
layer.name.pop_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,16 +137,13 @@ 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()))
areaDeps.name.pop_back();
while (areaDeps.name.size() && iswblank(areaDeps.name.back()))
areaDeps.name.pop_back();
#else
while (isblank(areaDeps.name.back()))
areaDeps.name.pop_back();
while (areaDeps.name.size() && isblank(areaDeps.name.back()))
areaDeps.name.pop_back();
#endif
}
}
if (areaDeps.name.empty())
{
@ -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()))
layer.name.pop_back();
while (layer.name.size() && iswblank(layer.name.back()))
layer.name.pop_back();
#else
while (isblank(layer.name.back()))
layer.name.pop_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