From 36e293456f3db1b5e2d7303c7accd09cb3bc2533 Mon Sep 17 00:00:00 2001 From: n-a-c-h <> Date: Wed, 29 Mar 2006 02:00:21 +0000 Subject: [PATCH] Improved hex handling. --- zsnes/src/parsegen.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zsnes/src/parsegen.cpp b/zsnes/src/parsegen.cpp index ea2b908b..8cb8a7e8 100644 --- a/zsnes/src/parsegen.cpp +++ b/zsnes/src/parsegen.cpp @@ -210,6 +210,15 @@ string hex_convert(string str) str.insert(h_pos-h_len+1, "0x"); } + for (size_t i = 0; i < str.size(); i++) + { + if ((!i || !isxdigit(str[i-1])) && (str[i] == '0') && (str[i+1] != 'x')) + { + str.erase(i, 1); + i--; + } + } + return(str); }