mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-02 10:42:14 -04:00
byuu says: New update. Most of the work today went into eliminating hiro::Image from all objects in all ports, replacing with nall::image. That took an eternity. Changelog: - fixed crashing bug when loading games [thanks endrift!!] - toggling "show status bar" option adjusts window geometry (not supposed to recenter the window, though) - button sizes improved; icon-only button icons no longer being cut off
22 lines
711 B
C++
22 lines
711 B
C++
#pragma once
|
|
|
|
namespace nall { namespace Encode {
|
|
|
|
inline auto URL(const string& input) -> string {
|
|
string output;
|
|
for(auto c : input) {
|
|
if(c >= 'A' && c <= 'Z') { output.append(c); continue; }
|
|
if(c >= 'a' && c <= 'z') { output.append(c); continue; }
|
|
if(c >= '0' && c <= '9') { output.append(c); continue; }
|
|
if(c == '-' || c == '_' || c == '.' || c == '~') { output.append(c); continue; }
|
|
if(c == ' ') { output.append('+'); continue; }
|
|
unsigned hi = (c >> 4) & 15;
|
|
unsigned lo = (c >> 0) & 15;
|
|
output.append('%');
|
|
output.append((char)(hi < 10 ? ('0' + hi) : ('a' + hi - 10)));
|
|
output.append((char)(lo < 10 ? ('0' + lo) : ('a' + lo - 10)));
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}}
|