New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[trivial] Fixed in contract for Base64.decode for arrays #4720
Conversation
Current coverage is 88.74% (diff: 100%)@@ master #4720 diff @@
==========================================
Files 121 121
Lines 74037 74037
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 65705 65705
Misses 8332 8332
Partials 0 0
|
Looks reasonable to me. For the lazy people
What about the other input contract here? CC @jpf91. |
It does not work for the other input contract, because realDecodeLength needs to access the last two elements of the imput (https://github.com/dlang/phobos/blob/master/std/base64.d#L954). One could do this for randomaccess ranges that support opDollar, but not for all input ranges. Also, there is even an issue/enhancement request which suggests to allow decode to be used on ranges, which don't even have length() (https://issues.dlang.org/show_bug.cgi?id=9543), so we would need to drop the in contract completely in that case. |
Could you elaborate why you think it should be in std.digest? My reasoning is base64 shouldn't be a top level module though, moving it to a new package |
Oh that was my question. Sorry for the confusion :/
Fair enough, I was just confused that it's in it's own top-level module.
👍 |
Unfortunately no, I'm quite busy with GDC and some other stuff right now :-( |
Alrighty -> http://forum.dlang.org/post/cobspypjiwizfrmucwyq@forum.dlang.org (I was pretty lazy). @ghost91 sorry for the OT discussion. Pinging due to git blame @quickfur @monarchdodra @CyberShadow. |
(Edit: removed comment due to reading fail)
|
Yes, it was my intention to simply fix it for dchar arrays (because this is trivial). I guess we should probably review the other contracts, too (possibly use realDecodeLength for ranges, too, when they have random acces and opDollar) and also consider the enhancement request I linked earlier. But then, while reading through the module, I saw lots of things, which need some attention (e.g. I noticed unittests, which were obviously missing some cases; the range interaces use enforce(!empty) instead of assert in popFront and have no check in front etc...). I might have a look at the whole module and try to fix those things, if I find the time. I just ran into a problem with decoding of dchar arrays in a project of my own, and in this case it's trivial to fix, so I thought I'd just do that quickly. That's also the reason why I did not bother with adding additional unitests (because no funcionality is changed actually...) |
|
I'll pull this because it makes no claim to fix an issue and marks a little progress. Please revisit. |
Auto-merge toggled on |
FWIW:
|
Forum thread: https://forum.dlang.org/thread/nnkik5$1nfq$1@digitalmars.com