mirror of
https://github.com/kiwix/libkiwix.git
synced 2026-10-23 01:25:20 -04:00
1 parent
433a47c3fe
commit
c0b1c6013e
3 files changed
+88
-18
No files matched your search
+14
-18
@@ -411,30 +411,26 @@ bool _parseUrl(const string& url, char* ns, string& title)
|
||||
unsigned int urlLength = url.size();
|
||||
unsigned int offset = 0;
|
||||
|
||||
/* Ignore the '/' */
|
||||
while ((offset < urlLength) && (url[offset] == '/')) {
|
||||
/* Ignore the first '/' */
|
||||
if (url[offset] == '/')
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (url[offset] == '/' || offset >= urlLength)
|
||||
return false;
|
||||
|
||||
/* Get namespace */
|
||||
while ((offset < urlLength) && (url[offset] != '/')) {
|
||||
*ns = url[offset];
|
||||
offset++;
|
||||
}
|
||||
*ns = url[offset++];
|
||||
|
||||
/* Ignore the '/' */
|
||||
while ((offset < urlLength) && (url[offset] == '/')) {
|
||||
offset++;
|
||||
}
|
||||
if (url[offset] != '/' || offset >= urlLength)
|
||||
return false;
|
||||
|
||||
offset++;
|
||||
|
||||
if ( offset >= urlLength)
|
||||
return false;
|
||||
|
||||
/* Get content title */
|
||||
unsigned int titleOffset = offset;
|
||||
while (offset < urlLength) {
|
||||
offset++;
|
||||
}
|
||||
|
||||
/* unescape title */
|
||||
title = url.substr(titleOffset, offset - titleOffset);
|
||||
title = url.substr(offset, urlLength - offset);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user