From 1e7477cdd673aeb159aa04d8ff53be3743ded67b Mon Sep 17 00:00:00 2001 From: r-zakarya <82443831+r-zakarya@users.noreply.github.com> Date: Sat, 15 Aug 2026 00:49:37 +0100 Subject: [PATCH] fix(android): overload both Cipher.init declarations, restore CRLF line endings Delphi refuses a second declaration when the first is not marked overload, so the three-argument init was reported as too many parameters. Also adds Androidapi.Jni to silence the non-inlined TJavaArray.Length hints. My ASCII normalisation had rewritten the sources in LF, which RAD Studio flags on every unit; a .gitattributes rule now pins CRLF for Pascal sources so git does not undo it. --- .gitattributes | 7 +++++++ android-client/PMA.Crypto.pas | 4 +++- android-client/PMA.Store.pas | 6 ++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitattributes b/.gitattributes index 03c23b6..2d9fa44 100644 --- a/.gitattributes +++ b/.gitattributes @@ -31,3 +31,10 @@ *.ico binary *.png binary *.rar binary + +# RAD Studio exige CRLF dans les sources Pascal — sans cette regle, git les +# normalise en LF au commit et le compilateur le signale a chaque unite. +*.pas text eol=crlf +*.dpr text eol=crlf +*.dproj text eol=crlf +*.fmx text eol=crlf diff --git a/android-client/PMA.Crypto.pas b/android-client/PMA.Crypto.pas index a8f0a86..22aaa5e 100644 --- a/android-client/PMA.Crypto.pas +++ b/android-client/PMA.Crypto.pas @@ -70,7 +70,9 @@ implementation {$IF DEFINED(ANDROID)} uses - Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, Androidapi.Helpers; + // Androidapi.Jni : sans elle, TJavaArray.Length reste un appel non inline + // et le compilateur emet un avertissement a chaque usage. + Androidapi.Jni, Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, Androidapi.Helpers; {$ENDIF} var diff --git a/android-client/PMA.Store.pas b/android-client/PMA.Store.pas index a28aad8..012204d 100644 --- a/android-client/PMA.Store.pas +++ b/android-client/PMA.Store.pas @@ -62,7 +62,7 @@ implementation {$IF DEFINED(ANDROID)} uses - Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, Androidapi.Helpers; + Androidapi.Jni, Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, Androidapi.Helpers; {$ENDIF} const @@ -213,7 +213,9 @@ type [JavaSignature('javax/crypto/Cipher')] JCipherX = interface(JObject) ['{3D2B1C4E-5F60-7B82-9DA4-192031425364}'] - procedure init(opmode: Integer; key: JKeyX); cdecl; + // Les DEUX surcharges doivent porter la directive : Delphi refuse une + // seconde declaration si la premiere ne l'a pas. + procedure init(opmode: Integer; key: JKeyX); cdecl; overload; procedure init(opmode: Integer; key: JKeyX; params: JAlgorithmParameterSpecX); cdecl; overload; function doFinal(input: TJavaArray): TJavaArray; cdecl; function getIV: TJavaArray; cdecl;