1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-29 13:01:14 +03:00

example: silence MSVS 2013 C4127 warnings (#828)

This commit is contained in:
Viktor Szakats
2023-03-09 10:46:40 +01:00
committed by GitHub
parent 33b6d5f89d
commit 99c1333ba7
11 changed files with 30 additions and 7 deletions

View File

@ -256,7 +256,7 @@ int main(int argc, char *argv[])
/* Must use non-blocking IO hereafter due to the current libssh2 API */ /* Must use non-blocking IO hereafter due to the current libssh2 API */
libssh2_session_set_blocking(session, 0); libssh2_session_set_blocking(session, 0);
while(1) { for(;;) {
FD_ZERO(&fds); FD_ZERO(&fds);
FD_SET(forwardsock, &fds); FD_SET(forwardsock, &fds);
tv.tv_sec = 0; tv.tv_sec = 0;
@ -290,7 +290,7 @@ int main(int argc, char *argv[])
wr += i; wr += i;
} }
} }
while(1) { for(;;) {
len = libssh2_channel_read(channel, buf, sizeof(buf)); len = libssh2_channel_read(channel, buf, sizeof(buf));
if(LIBSSH2_ERROR_EAGAIN == len) if(LIBSSH2_ERROR_EAGAIN == len)
break; break;

View File

@ -36,6 +36,10 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#pragma warning(disable:4127)
#endif
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
unsigned long hostaddr; unsigned long hostaddr;

View File

@ -42,6 +42,9 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#pragma warning(disable:4127)
#endif
const char *keyfile1 = "~/.ssh/id_rsa.pub"; const char *keyfile1 = "~/.ssh/id_rsa.pub";
const char *keyfile2 = "~/.ssh/id_rsa"; const char *keyfile2 = "~/.ssh/id_rsa";

View File

@ -39,6 +39,10 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#pragma warning(disable:4127)
#endif
#define STORAGE "/tmp/sftp-storage" /* this is the local file name this #define STORAGE "/tmp/sftp-storage" /* this is the local file name this
example uses to store the downloaded example uses to store the downloaded
file in */ file in */

View File

@ -45,6 +45,10 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#pragma warning(disable:4127)
#endif
#ifdef HAVE_GETTIMEOFDAY #ifdef HAVE_GETTIMEOFDAY
/* diff in ms */ /* diff in ms */
static long tvdiff(struct timeval newer, struct timeval older) static long tvdiff(struct timeval newer, struct timeval older)

View File

@ -42,6 +42,10 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#pragma warning(disable:4127)
#endif
#ifdef WIN32 #ifdef WIN32
#define __FILESIZE "I64u" #define __FILESIZE "I64u"
#else #else

View File

@ -42,6 +42,10 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#pragma warning(disable:4127)
#endif
#ifdef WIN32 #ifdef WIN32
#define __FILESIZE "I64u" #define __FILESIZE "I64u"
#else #else

View File

@ -150,7 +150,7 @@ int main(int argc, char *argv[])
rc = 1; rc = 1;
goto shutdown; goto shutdown;
} }
while(1) { for(;;) {
rc = libssh2_agent_get_identity(agent, &identity, prev_identity); rc = libssh2_agent_get_identity(agent, &identity, prev_identity);
if(rc == 1) if(rc == 1)
break; break;

View File

@ -164,7 +164,7 @@ int main(int argc, char *argv[])
rc = 1; rc = 1;
goto shutdown; goto shutdown;
} }
while(1) { for(;;) {
rc = libssh2_agent_get_identity(agent, &identity, prev_identity); rc = libssh2_agent_get_identity(agent, &identity, prev_identity);
if(rc == 1) if(rc == 1)
break; break;

View File

@ -246,7 +246,7 @@ int main(int argc, char *argv[])
/* Must use non-blocking IO hereafter due to the current libssh2 API */ /* Must use non-blocking IO hereafter due to the current libssh2 API */
libssh2_session_set_blocking(session, 0); libssh2_session_set_blocking(session, 0);
while(1) { for(;;) {
FD_ZERO(&fds); FD_ZERO(&fds);
FD_SET(forwardsock, &fds); FD_SET(forwardsock, &fds);
tv.tv_sec = 0; tv.tv_sec = 0;
@ -277,7 +277,7 @@ int main(int argc, char *argv[])
wr += i; wr += i;
} while(i > 0 && wr < len); } while(i > 0 && wr < len);
} }
while(1) { for(;;) {
len = libssh2_channel_read(channel, buf, sizeof(buf)); len = libssh2_channel_read(channel, buf, sizeof(buf));
if(LIBSSH2_ERROR_EAGAIN == len) if(LIBSSH2_ERROR_EAGAIN == len)
break; break;

View File

@ -389,7 +389,7 @@ main (int argc, char *argv[])
memset(&w_size, 0, sizeof(struct winsize)); memset(&w_size, 0, sizeof(struct winsize));
memset(&w_size_bck, 0, sizeof(struct winsize)); memset(&w_size_bck, 0, sizeof(struct winsize));
while(1) { for(;;) {
FD_ZERO(&set); FD_ZERO(&set);
FD_SET(fileno(stdin), &set); FD_SET(fileno(stdin), &set);