Zero as null pointer
-
Hello,
I use libssh in my qt project.
after i updated my Qt and QtCreator versions i have this warnings :zero as null pointer constant
file = sftp_open(sftp, pathToSftpFile.toLatin1().data(), access_type, 0); if (file == NULL) { return SSH_ERROR; }
How to fix this please ?
Do i have to fix the code or change the Compilers warning level ?Thank you
windows
MinGW 64bit
Qt 5.12 -
@LeLev said in Zero as null pointer:
sftp_open(sftp, pathToSftpFile.toLatin1().data(),
access_type, 0);what is the signature of sftp_open ? Can appropriately typecast it.
-
hi,
@dheerendra said in Zero as null pointer:what is the signature of sftp_open
LIBSSH_API sftp_file sftp_open(sftp_session session, const char *file, int accesstype,mode_t mode);
-
Hi
I think it means you should dosftp_open(sftp, pathToSftpFile.toLatin1().data(),
access_type, nullptr );instead of using the (old) zero way.
-
Hi
I think it means you should dosftp_open(sftp, pathToSftpFile.toLatin1().data(),
access_type, nullptr );instead of using the (old) zero way.
-
hi,
@mrjj said in Zero as null pointer:I think it means you should do
sftp_open(sftp, pathToSftpFile.toLatin1().data(),
access_type, nullptr );so the test should look like this ?
if (file == nullptr)
@LeLev
Yes, anywhere you normally would put a 0 (zero) put
nullptr instead.btw: C++11 is needed to have nullptr
-
Hello,
I use libssh in my qt project.
after i updated my Qt and QtCreator versions i have this warnings :zero as null pointer constant
file = sftp_open(sftp, pathToSftpFile.toLatin1().data(), access_type, 0); if (file == NULL) { return SSH_ERROR; }
How to fix this please ?
Do i have to fix the code or change the Compilers warning level ?Thank you
windows
MinGW 64bit
Qt 5.12@mrjj said in Zero as null pointer:
C++11 is needed to have nullptr
C++11 is also needed for Qt 5.12, so that requirement is guaranteed in this case :)