From 0fccd33019dec2c5e19310831511bffb732e80f2 Mon Sep 17 00:00:00 2001 From: Angel Ortega Date: Tue, 3 Feb 2009 07:27:38 +0100 Subject: [PATCH] Fix disappearing ampersands (Closes: #1109). --- RELEASE_NOTES | 7 +++++++ TODO | 4 +++- VERSION | 2 +- mpdm_r.c | 8 ++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index f19c4dc..5cc152b 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -1,6 +1,13 @@ MPDM Release Notes ================== +1.0.7 +----- + + * Fixed a bug when processing backslashes in the substitution + string in sregex(), that made them dissappear if they were + not escaping an ampersand. + 1.0.6 ----- diff --git a/TODO b/TODO index af76ee8..60e553d 100644 --- a/TODO +++ b/TODO @@ -4,7 +4,7 @@ Minimum Profit Data Manager (MPDM) TODO / Bug List Release Critical Bugs --------------------- - * 1109: expand_ampersands() kills all backslashes. +None! Open Bugs --------- @@ -232,5 +232,7 @@ Closed is practically the same and it works, so there should be some workaround to use it whenever "WCHAR_T" fails (Mon, 07 Apr 2008 14:55:30 +0200). + * 1109: expand_ampersands() kills all backslashes + (Tue, 03 Feb 2009 07:25:21 +0100). Email bugs to angel@triptico.com diff --git a/VERSION b/VERSION index 8f8fcd4..8d342c2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -#define VERSION "1.0.6" +#define VERSION "1.0.7-dev" diff --git a/mpdm_r.c b/mpdm_r.c index f3b5812..9a1269a 100644 --- a/mpdm_r.c +++ b/mpdm_r.c @@ -308,8 +308,12 @@ static mpdm_t expand_ampersands(const mpdm_t s, const mpdm_t t) /* add the leading part */ r = mpdm_strcat(r, MPDM_NS(sptr, n)); - if (*wptr == '\\') - r = mpdm_strcat(r, MPDM_NS(++wptr, 1)); + if (*wptr == L'\\') { + if (*(wptr + 1) == '&') + wptr++; + + r = mpdm_strcat(r, MPDM_NS(wptr, 1)); + } else if (*wptr == '&') r = mpdm_strcat(r, t); -- 2.11.4.GIT