Re: Bug in octstr_shrink_blanks
[email protected] Thu, 19 Jul 2018 14:30:54 +0200
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_E9725952-2987-414E-9389-FC837F534B14 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Werner, patch is very welcome=E2=80=A6 Thanks, Alex > Am 19.07.2018 um 14:19 schrieb Werner Coetzee = <[email protected]>: >=20 >=20 > Hi all > =20 > I believe there's a bug in octstr_shrink_blanks() in gwlib/octstr.c > =20 > It does not shrink 2 whitespaces into 1, only when there's more than = 2. > The issue is with the line "if (j - i > 1)", it should test for > 0 > =20 > It's very easy to write a small test binary to see that it doesn't = work. > After fixing it in my local repo it's working correctly (for 1, 2, 3+ = consecutive spaces). > =20 > Regards > Werner Coetzee > =20 >=20 >=20 > Werner Coetzee > Senior Message Engine Engineer >=20 > Tel:+27219107878 > Email: [email protected] = <mailto:[email protected]> >=20 >=20 > <image56bcaa.JPG> <https://www.clickatell.com/> >=20 >=20 > Note: This disclaimer = <https://www.clickatell.com/legal/general-terms-notices/privacy-notice/> = applies to this email and its attachments >=20 --Apple-Mail=_E9725952-2987-414E-9389-FC837F534B14 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D"">Hi = Werner,<div class=3D""><br class=3D""></div><div class=3D"">patch is = very welcome=E2=80=A6</div><div class=3D""><br class=3D""></div><div = class=3D"">Thanks,</div><div class=3D"">Alex</div><div class=3D""><br = class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div = class=3D"">Am 19.07.2018 um 14:19 schrieb Werner Coetzee <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>>:</div><br = class=3D"Apple-interchange-newline"><div class=3D""><div = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: = normal; letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><br = class=3D"webkit-block-placeholder"></div><div class=3D"WordSection1" = style=3D"page: WordSection1; caret-color: rgb(0, 0, 0); font-family: = Helvetica; font-size: 12px; font-style: normal; font-variant-caps: = normal; font-weight: normal; letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: = none;"><div style=3D"margin: 0cm 0cm 0.0001pt; font-size: 11pt; = font-family: Calibri, sans-serif;" class=3D"">Hi all<o:p = class=3D""></o:p></div><div style=3D"margin: 0cm 0cm 0.0001pt; = font-size: 11pt; font-family: Calibri, sans-serif;" class=3D""><o:p = class=3D""> </o:p></div><div style=3D"margin: 0cm 0cm 0.0001pt; = font-size: 11pt; font-family: Calibri, sans-serif;" class=3D"">I believe = there's a bug in octstr_shrink_blanks() in gwlib/octstr.c<o:p = class=3D""></o:p></div><div style=3D"margin: 0cm 0cm 0.0001pt; = font-size: 11pt; font-family: Calibri, sans-serif;" class=3D""><o:p = class=3D""> </o:p></div><div style=3D"margin: 0cm 0cm 0.0001pt; = font-size: 11pt; font-family: Calibri, sans-serif;" class=3D"">It does = not shrink 2 whitespaces into 1, only when there's more than 2.<o:p = class=3D""></o:p></div><div style=3D"margin: 0cm 0cm 0.0001pt; = font-size: 11pt; font-family: Calibri, sans-serif;" class=3D"">The issue = is with the line "if (j - i > 1)", it should test for > 0<o:p = class=3D""></o:p></div><div style=3D"margin: 0cm 0cm 0.0001pt; = font-size: 11pt; font-family: Calibri, sans-serif;" class=3D""><o:p = class=3D""> </o:p></div><div style=3D"margin: 0cm 0cm 0.0001pt; = font-size: 11pt; font-family: Calibri, sans-serif;" class=3D"">It's very = easy to write a small test binary to see that it doesn't work.<o:p = class=3D""></o:p></div><div style=3D"margin: 0cm 0cm 0.0001pt; = font-size: 11pt; font-family: Calibri, sans-serif;" class=3D"">After = fixing it in my local repo it's working correctly (for 1, 2, 3+ = consecutive spaces).<o:p class=3D""></o:p></div><div style=3D"margin: = 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" = class=3D""><o:p class=3D""> </o:p></div><div style=3D"margin: 0cm = 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" = class=3D"">Regards<o:p class=3D""></o:p></div><div style=3D"margin: 0cm = 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" = class=3D"">Werner Coetzee<o:p class=3D""></o:p></div><div style=3D"margin:= 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" = class=3D""><o:p class=3D""> </o:p></div></div><br = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: = normal; letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><br = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: = normal; letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><font = style=3D"font-style: normal; font-variant-caps: normal; letter-spacing: = normal; orphans: auto; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; widows: auto; word-spacing: = 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; = text-decoration: none; font-family: Calibri; font-size: 14pt; color: = rgb(49, 53, 56); font-weight: bold;" class=3D"">Werner Coetzee</font><br = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: = normal; letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><font = style=3D"font-style: normal; font-variant-caps: normal; letter-spacing: = normal; orphans: auto; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; widows: auto; word-spacing: = 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; = text-decoration: none; font-family: Calibri; font-size: 12pt; color: = rgb(44, 196, 236); font-weight: bold;" class=3D"">Senior Message Engine = Engineer</font><br style=3D"caret-color: rgb(0, 0, 0); font-family: = Helvetica; font-size: 12px; font-style: normal; font-variant-caps: = normal; font-weight: normal; letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: = none;" class=3D""><font size=3D"2" style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-style: normal; font-variant-caps: normal; = font-weight: normal; letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: = none;" class=3D""><br class=3D""><font face=3D"Calibri" class=3D""><strong= class=3D""><font size=3D"3" class=3D"">Tel:<font style=3D"font-family: = Calibri; font-size: 11pt; font-weight: bold;" = class=3D"">+27219107878</font></font></strong><br class=3D""></font><font = style=3D"font-family: Calibri; font-size: 11pt; font-weight: bold;" = class=3D"">Email:<span = class=3D"Apple-converted-space"> </span></font><span = style=3D"font-family: Calibri; font-size: 11pt; font-weight: bold;" = class=3D""><a href=3D"mailto:[email protected]" title=3D"Click= to send email to Werner Coetzee" target=3D"" style=3D"color: rgb(149, = 79, 114); text-decoration: underline; font-family: Calibri; font-size: = 11pt; font-weight: bold;" class=3D""><span style=3D"font-family: = Calibri; font-size: 11pt; font-weight: bold;" = class=3D"">[email protected]</span></a></span><br = class=3D""><br class=3D""><br class=3D""><a = href=3D"https://www.clickatell.com/" target=3D"" style=3D"color: = rgb(149, 79, 114); text-decoration: underline;" class=3D""><span = id=3D"cid:[email protected]"><image56bcaa.JPG></span= ></a></font><div style=3D"caret-color: rgb(0, 0, 0); font-family: = Helvetica; font-size: 12px; font-style: normal; font-variant-caps: = normal; font-weight: normal; letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: = none;" class=3D""><br class=3D"webkit-block-placeholder"></div><div = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: = normal; letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><br = class=3D"webkit-block-placeholder"></div><p style=3D"caret-color: rgb(0, = 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: normal; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;" class=3D""><font face=3D"Calibri" class=3D""><font= size=3D"1" class=3D"">Note: This<span = class=3D"Apple-converted-space"> </span></font><span = style=3D"font-size: 8pt; color: rgb(44, 196, 236);" class=3D""><a = href=3D"https://www.clickatell.com/legal/general-terms-notices/privacy-not= ice/" title=3D"" target=3D"" style=3D"color: rgb(44, 196, 236); = text-decoration: underline; font-size: 8pt;" class=3D""><span = style=3D"font-size: 8pt; color: rgb(44, 196, 236);" = class=3D"">disclaimer</span></a></span><font size=3D"1" class=3D""><span = class=3D"Apple-converted-space"> </span>applies to this email and = its attachments</font></font></p></div></blockquote></div><br = class=3D""></div></body></html>= --Apple-Mail=_E9725952-2987-414E-9389-FC837F534B14--