Holger Hans Peter Freyther wrote:
On Sun, Jul 07, 2013 at 02:41:50PM +0200, Andreas Eversberg wrote:
hi holger,
Dear Andreas,
i just pushed a branch (jolly/7bit_ussd) i was working on the last hours. it is quite exactly what you prosed.
I don't think it needs much splitting my comments are:
- If it helps we can export 'shift' from the common function as well, maybe this simplifies your calculation.
maybe, it will, but this would require export over two functions and still requires some calculations. i think it is simpler to understand the code, when using the number of characters for calculation.
I would write ('\r' << 1), it is more obvious than 0x1A and modern compilers propagate such constants.
The decoding, it might be easier to verify this condition on the encoded data?
In the encoding. If you change octets you also want to modify 'y' as the number of septets.
see my branch.
also it includes a test case. the result is similar to your proposal.
What I don't understand is.. why the first broken version if you know it is not correct? It didn't save any of your time and it wasted plenty of mine.
if i would have known that it is not correct, i would have already fixed it. also it was not clear to me that SMS end USSD encoding is a bit different.