Git Product home page Git Product logo

Comments (7)

bagder avatar bagder commented on June 23, 2024

I agree, no warnings would be ideal. But remember that we cannot change any types in the public API/ABI so where unsigned int is used today we cannot freely change it to size_t.

In the (1) case we need a typecast in that macro. The (2) thing is part of the protocol, isn't it?

Feel free to submit pull requests to fix warnings.

from libssh2.

Zenju avatar Zenju commented on June 23, 2024

remember that we cannot change any types in the public API/ABI so where unsigned int is used today we cannot freely change it to size_t.

I'm primarily interested in a practical solution to my current problem, which is that I see lots of compiler warnings, all of which are extremely useful to find 64-bit bugs in general. So I don't want to disable them, not even for a single translation unit.

On the other hand this means I cannot use the libssh2 function macros since they are not type-correct. One mitigation might be to add type casts to the macros.

This leaves the problem to the _ex functions only, but at least I can then type-cast on my own code, which is still wordy and ugly since I would prefer an API without the "len" parameters, which seem about CPU-perf optimization only.

The (2) thing is part of the protocol, isn't it?

Yes, maybe it's time to upgrade to a newer version of the spec?
https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-13.txt

Just to clarify, I'm no expert in this area at all, basically I know SFTP and libssh2 for a week now :)

Feel free to submit pull requests to fix warnings.

I'm a C++ programmer, so I would probably fail to get the C style right. Still I created a patch adding the C-casts, but chances are it won't work since I use code-formatting in my projects.
I'l try to attach it...

from libssh2.

bagder avatar bagder commented on June 23, 2024

Sure we could implement support for a newer SFTP version. I don't think anyone will object to that. But that is a rather big undertaking that I'm not personally prepared to do anytime soon. We'll welcome help and patches of course!

from libssh2.

eschaton avatar eschaton commented on June 23, 2024

Would it be reasonable to define a new type, say libssh2_size_t, and use that instead? Then it could be a configuration option whether to stay ABI-compatible with the deployed library (via typedef unsigned int libssh2_size_t) or to use the system size_t.

The latter would be useful to those embedding libssh2 who don't have to worry about ABI-compatibility, and it would also allow building it with the system size_t locally just to run tests.

from libssh2.

bagder avatar bagder commented on June 23, 2024

Seems like a reasonable approach to me!

from libssh2.

eschaton avatar eschaton commented on June 23, 2024

I wrote that up as a separate issue (#29) since it wouldn't actually address these compiler warnings in many cases, but (I think) it would be a good general cleanup.

from libssh2.

stale avatar stale commented on June 23, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from libssh2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.