mirror of https://github.com/aria2/aria2
uri.cc: Use auto instead of adhoc typedef
parent
d2af91ed08
commit
8536f13cff
10
src/uri.cc
10
src/uri.cc
|
@ -235,16 +235,14 @@ namespace {
|
||||||
|
|
||||||
std::string normalizePath(std::string path)
|
std::string normalizePath(std::string path)
|
||||||
{
|
{
|
||||||
typedef std::string::iterator itr;
|
auto begin = path.begin(), out = begin;
|
||||||
|
|
||||||
itr begin = path.begin(), out = begin;
|
|
||||||
int state = NPATH_START;
|
int state = NPATH_START;
|
||||||
bool startWithSlash = false;
|
bool startWithSlash = false;
|
||||||
std::vector<int> range;
|
std::vector<int> range;
|
||||||
// 32 is arbitrary
|
// 32 is arbitrary
|
||||||
range.reserve(32);
|
range.reserve(32);
|
||||||
|
|
||||||
for(itr in = begin, eoi = path.end(); in != eoi; ++in) {
|
for(auto in = begin, eoi = path.end(); in != eoi; ++in) {
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case NPATH_START:
|
case NPATH_START:
|
||||||
switch(*in) {
|
switch(*in) {
|
||||||
|
@ -336,8 +334,8 @@ std::string normalizePath(std::string path)
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < (int)range.size(); i += 2) {
|
for(int i = 0; i < (int)range.size(); i += 2) {
|
||||||
itr a = begin + range[i];
|
auto a = begin + range[i];
|
||||||
itr b = begin + range[i+1];
|
auto b = begin + range[i+1];
|
||||||
if(a == out) {
|
if(a == out) {
|
||||||
out = b;
|
out = b;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue