diff --git a/doomsday/plugins/common/include/hexlex.h b/doomsday/plugins/common/include/hexlex.h index f458260103..983cfb1b1d 100644 --- a/doomsday/plugins/common/include/hexlex.h +++ b/doomsday/plugins/common/include/hexlex.h @@ -76,7 +76,7 @@ class HexLex int readNumber(); Str const *readString(); - Uri *readUri(char const *defaultScheme = ""); + de::Uri readUri(de::String const &defaultScheme = ""); /** * Returns the line number at the current position in the script. diff --git a/doomsday/plugins/common/src/animdefs.cpp b/doomsday/plugins/common/src/animdefs.cpp index cb01f1e54a..ebc7f0f97a 100644 --- a/doomsday/plugins/common/src/animdefs.cpp +++ b/doomsday/plugins/common/src/animdefs.cpp @@ -240,9 +240,8 @@ static void AnimDefsParser(ddstring_s const *path) // string(texture-scheme) string(texture-path) if(char const *scheme = textureScheme(lexer.token())) { - uri_s *uri = lexer.readUri(scheme); - int const texNumBase = Textures_UniqueId2(uri, !isCustom); - Uri_Delete(uri); + de::Uri uri = lexer.readUri(scheme); + int const texNumBase = Textures_UniqueId2(reinterpret_cast(&uri), !isCustom); bool const ignore = (texNumBase == -1); int groupNumber = 0; diff --git a/doomsday/plugins/common/src/hexlex.cpp b/doomsday/plugins/common/src/hexlex.cpp index 92160719e9..d07cf27c1b 100644 --- a/doomsday/plugins/common/src/hexlex.cpp +++ b/doomsday/plugins/common/src/hexlex.cpp @@ -23,6 +23,8 @@ #include #include +using namespace de; + #define T_COMMENT ';' ///< Single-line comment. #define T_QUOTE '"' @@ -43,12 +45,12 @@ void HexLex::syntaxError(char const *message) F_PrettyPath(Str_Text(&_sourcePath)), _lineNumber, message); } -HexLex::HexLex(Str const *script, Str const *sourcePath) - : _script(0) - , _readPos(0) +HexLex::HexLex(ddstring_s const *script, ddstring_s const *sourcePath) + : _script (0) + , _readPos (0) , _lineNumber(0) , _alreadyGot(false) - , _multiline(false) + , _multiline (false) { Str_InitStd(&_sourcePath); Str_InitStd(&_token); @@ -69,7 +71,7 @@ HexLex::~HexLex() Str_Free(&_token); } -void HexLex::parse(Str const *script) +void HexLex::parse(ddstring_s const *script) { _script = script; _readPos = 0; @@ -78,7 +80,7 @@ void HexLex::parse(Str const *script) Str_Clear(&_token); } -void HexLex::setSourcePath(Str const *sourcePath) +void HexLex::setSourcePath(ddstring_s const *sourcePath) { if(!sourcePath) { @@ -190,7 +192,7 @@ void HexLex::unreadToken() _alreadyGot = true; } -Str const *HexLex::token() +ddstring_s const *HexLex::token() { return &_token; } @@ -213,7 +215,7 @@ int HexLex::readNumber() return number; } -Str const *HexLex::readString() +ddstring_s const *HexLex::readString() { if(!readToken()) { @@ -222,16 +224,13 @@ Str const *HexLex::readString() return &_token; } -Uri *HexLex::readUri(char const *defaultScheme) +de::Uri HexLex::readUri(String const &defaultScheme) { if(!readToken()) { syntaxError("Missing uri"); } - - Uri *uri = Uri_SetScheme(Uri_New(), defaultScheme); - Uri_SetPath(uri, Str_Text(Str_PercentEncode(AutoStr_FromTextStd(Str_Text(&_token))))); - return uri; + return de::Uri(defaultScheme, Path(Str_Text(Str_PercentEncode(AutoStr_FromTextStd(Str_Text(&_token)))))); } int HexLex::lineNumber() const diff --git a/doomsday/plugins/common/src/mapinfo.cpp b/doomsday/plugins/common/src/mapinfo.cpp index 56503dcaf8..43140771d4 100644 --- a/doomsday/plugins/common/src/mapinfo.cpp +++ b/doomsday/plugins/common/src/mapinfo.cpp @@ -124,7 +124,7 @@ void MapInfoParser(ddstring_s const *path) lexer.token(), F_PrettyPath(Str_Text(path)), lexer.lineNumber()); } - de::Uri mapUri = G_ComposeMapUri(0, tmap - 1); + de::Uri const mapUri = G_ComposeMapUri(0, tmap - 1); mapinfo_t *info = P_MapInfo(&mapUri); if(!info) { @@ -149,22 +149,20 @@ void MapInfoParser(ddstring_s const *path) { if(!Str_CompareIgnoreCase(lexer.token(), "sky1")) { - uri_s *uri = lexer.readUri("Textures"); + de::Uri uri = lexer.readUri("Textures"); - info->sky1Material = Materials_ResolveUri(uri); + info->sky1Material = Materials_ResolveUri(reinterpret_cast(&uri)); info->sky1ScrollDelta = (float) lexer.readNumber() / 256; - Uri_Delete(uri); continue; } if(!Str_CompareIgnoreCase(lexer.token(), "sky2")) { - uri_s *uri = lexer.readUri("Textures"); + de::Uri uri = lexer.readUri("Textures"); - info->sky2Material = Materials_ResolveUri(uri); + info->sky2Material = Materials_ResolveUri(reinterpret_cast(&uri)); info->sky2ScrollDelta = (float) lexer.readNumber() / 256; - Uri_Delete(uri); continue; } if(!Str_CompareIgnoreCase(lexer.token(), "doublesky"))