Notepad2e icon indicating copy to clipboard operation
Notepad2e copied to clipboard

Drop unused base64 code

Open csware opened this issue 6 years ago • 8 comments

There are two base64 implementations in the Notepad2e source code.

Those files were moved to another folder in commit 42c30cd01a6f9f7489bf7d0bbf8b770498a7e163 and not deleted, despite another implementation was added.

csware avatar Feb 20 '19 18:02 csware

@cshnik We don't actually use that base64 library anymore? See commit 42c30cd. Have you copied part of their code or was it rewritten from scratch? Do you remember why?

ProgerXP avatar Feb 21 '19 07:02 ProgerXP

@cshnik We don't actually use that base64 library anymore? See commit 42c30cd. Have you copied part of their code or was it rewritten from scratch? Do you remember why?

The algorithm originally represented by base64_encode, base64_decode methods in this module (base64.h/cpp) was re-implemented for our recoding engine. Later it was moved to StrToBase64.h/cpp. If such a reuse of the code can't treated as Redistribution and use in source and binary forms, with or without modification than we can remove these files. base54-license.txt

Copyright (c) 2002-2012, Jouni Malinen [email protected] and contributors All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. Neither the name(s) of the above-listed copyright holder(s) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cshnik avatar Feb 21 '19 15:02 cshnik

If the algorithm in StrToBase64.h/cpp is directly based/copied from base64.c/h, then this file needs the header.

csware avatar Feb 21 '19 16:02 csware

You could also use ATL for base64 to get rid of any dependency (https://msdn.microsoft.com/vstudio/ezec6x4e(v=vs.100)).

csware avatar Feb 21 '19 16:02 csware

If the algorithm in StrToBase64.h/cpp is directly based/copied from base64.c/h, then this file needs the header.

Yes, that's why I'm asking.

@cshnik Why did you have to reimplement base64 functions? Was it to skip whitespace and other invalid symbols during decoding? (#181)

ProgerXP avatar Feb 21 '19 20:02 ProgerXP

@cshnik Why did you have to reimplement base64 functions? Was it to skip whitespace and other invalid symbols during decoding? (#181)

For()-cycle presented in the original base64_encoded/base64_decode functions can't be directly used in our transcoding engine (which uses block-by-block scheme to provide UI responsiveness (no window freeze, provide progress bar updates)). Additional feature is input data filter which allow to skip invalid char sequence when decoding. But the core idea/implementation is absolutely the same as provided in the original code.

cshnik avatar Feb 25 '19 17:02 cshnik

What do you mean with "core idea"? Base64 is standardized.

csware avatar Feb 26 '19 09:02 csware

What do you mean with "core idea"? Base64 is standardized.

He probably means that the code was adapted from base64.h/c. Don't worry, we'll add the copyright notice later to this unit when I get time.

ProgerXP avatar Feb 26 '19 10:02 ProgerXP