Skip to content
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

Format checked like a invocation expression with an argument list #270

Closed
belav opened this issue Jun 7, 2021 · 3 comments · Fixed by #329
Closed

Format checked like a invocation expression with an argument list #270

belav opened this issue Jun 7, 2021 · 3 comments · Fixed by #329
Labels
area:formatting type:bug Something isn't working
Milestone

Comments

@belav
Copy link
Owner

belav commented Jun 7, 2021

var retVal = new byte[
    checked(1 /* KDF alg */
    + 1 /* chaining mode */
    + sizeof(uint) /* sym alg key size */
    + sizeof(uint) /* sym alg block size */
    + sizeof(uint) /* hmac alg key size */
    + sizeof(uint) /* hmac alg digest size */
    + _symmetricAlgorithmBlockSizeInBytes /* ciphertext of encrypted empty string */
    + _hmacAlgorithmDigestLengthInBytes /* digest of HMACed empty string */
    )
];
// should maybe be this? or should we break after the checked( ?
var retVal = new byte[
    checked(1 /* KDF alg */
        + 1 /* chaining mode */
        + sizeof(uint) /* sym alg key size */
        + sizeof(uint) /* sym alg block size */
        + sizeof(uint) /* hmac alg key size */
        + sizeof(uint) /* hmac alg digest size */
        + _symmetricAlgorithmBlockSizeInBytes /* ciphertext of encrypted empty string */
        + _hmacAlgorithmDigestLengthInBytes /* digest of HMACed empty string */
    )
];
@belav belav added type:bug Something isn't working area:formatting labels Jun 7, 2021
@belav
Copy link
Owner Author

belav commented Jun 7, 2021

It appears the comments don't affect this, see

                    var retVal = new byte[
                        checked(cbPreBuffer
                        + KEY_MODIFIER_SIZE_IN_BYTES
                        + _symmetricAlgorithmBlockSizeInBytes
                        + cbOutputCiphertext
                        + _hmacAlgorithmDigestLengthInBytes
                        + cbPostBuffer)
                    ];

@shocklateboy92
Copy link
Collaborator

I'm guessing checked has its own syntax type (like await did) and we're not doing anything special to handle it.

@belav belav changed the title ArrayRank + Checked with lots of concatentation. Format checked like a invocation expression with an argument list Jun 20, 2021
@belav
Copy link
Owner Author

belav commented Jun 20, 2021

This was resolved by having checked print the same way as an invocation expression with an argument list

        checked(
            cbPreBuffer
            + KEY_MODIFIER_SIZE_IN_BYTES
            + _symmetricAlgorithmBlockSizeInBytes
            + cbOutputCiphertext
            + _hmacAlgorithmDigestLengthInBytes
            + cbPostBuffer
        );

        callMethod(
            cbPreBuffer
            + KEY_MODIFIER_SIZE_IN_BYTES
            + _symmetricAlgorithmBlockSizeInBytes
            + cbOutputCiphertext
            + _hmacAlgorithmDigestLengthInBytes
            + cbPostBuffer
        );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:formatting type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants