1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-23 16:21:00 +03:00

tidy-up: formatting nits

Whitespace and redundant parenthesis in `return`s.

Closes #1029
This commit is contained in:
Viktor Szakats
2023-05-04 11:31:40 +00:00
parent 272a17ce26
commit fc003d4dc3
8 changed files with 22 additions and 23 deletions

View File

@ -436,7 +436,7 @@ int main(int argc, char *argv[])
fds[0].revents = LIBSSH2_POLLFD_POLLIN;
rc = libssh2_poll(fds, nfds, 0);
if(rc >0) {
if(rc > 0) {
libssh2_channel_read(channel, buf, sizeof(buf));
fprintf(stdout, "%s", buf);
fflush(stdout);

View File

@ -2314,7 +2314,7 @@ _libssh2_channel_packet_data_len(LIBSSH2_CHANNEL * channel, int stream_id)
&& (channel->local.id == read_local_id)
&& (channel->remote.extended_data_ignore_mode
== LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE))) {
return (read_packet->data_len - read_packet->data_head);
return read_packet->data_len - read_packet->data_head;
}
read_packet = next_packet;

View File

@ -1,5 +1,4 @@
#define LIBSSH2_CRYPTO_C
#include "libssh2_priv.h"
#if defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL)

View File

@ -821,7 +821,7 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts,
}
/* Figure out host format */
if((hostlen >2) && memcmp(host, "|1|", 3)) {
if((hostlen > 2) && memcmp(host, "|1|", 3)) {
/* old style plain text: [name]([,][name])*
for the sake of simplicity, we add them as separate hosts with the

View File

@ -935,7 +935,7 @@ int _libssh2_check_length(struct string_buf *buf, size_t len)
{
unsigned char *endp = &buf->data[buf->len];
size_t left = endp - buf->dataptr;
return ((len <= left) && (left <= buf->len));
return (len <= left) && (left <= buf->len);
}
int _libssh2_eob(struct string_buf *buf)

View File

@ -3280,7 +3280,7 @@ clean_exit:
if(md_ctx)
EVP_MD_CTX_free(md_ctx);
return (rc == 1 ? 0 : -1);
return (rc == 1) ? 0 : -1;
}
int

View File

@ -632,11 +632,11 @@ sftp_packet_requirev(LIBSSH2_SFTP *sftp, int num_valid_responses,
*/
static int sftp_attrsize(unsigned long flags)
{
return (4 + /* flags(4) */
((flags & LIBSSH2_SFTP_ATTR_SIZE) ? 8 : 0) +
((flags & LIBSSH2_SFTP_ATTR_UIDGID) ? 8 : 0) +
((flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) ? 4 : 0) +
((flags & LIBSSH2_SFTP_ATTR_ACMODTIME) ? 8 : 0));
return 4 + /* flags(4) */
((flags & LIBSSH2_SFTP_ATTR_SIZE) ? 8 : 0) +
((flags & LIBSSH2_SFTP_ATTR_UIDGID) ? 8 : 0) +
((flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) ? 4 : 0) +
((flags & LIBSSH2_SFTP_ATTR_ACMODTIME) ? 8 : 0);
/* atime + mtime as u32 */
}
@ -681,7 +681,7 @@ sftp_attr2bin(unsigned char *p, const LIBSSH2_SFTP_ATTRIBUTES * attrs)
_libssh2_store_u32(&s, (uint32_t)attrs->mtime);
}
return (s - p);
return s - p;
}
/* sftp_bin2attr
@ -758,7 +758,7 @@ sftp_bin2attr(LIBSSH2_SFTP_ATTRIBUTES *attrs, const unsigned char *p,
}
}
return (buf.dataptr - buf.data);
return buf.dataptr - buf.data;
}
/* ************
@ -1875,7 +1875,7 @@ static ssize_t sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer,
goto end;
}
if(longentry && (longentry_maxlen>1)) {
if(longentry && (longentry_maxlen > 1)) {
longentry_len = real_longentry_len;
if(longentry_len >= longentry_maxlen ||

View File

@ -68,14 +68,14 @@ pf->dnam.naml$l_long_defname = NULL; //inputfile;
pf->dnam.naml$l_long_defname_size = 0;//strlen( inputfile );
pf->dnam.naml$l_long_filename = inputfile;
pf->dnam.naml$l_long_filename_size = strlen( inputfile);
pf->dnam.naml$l_long_filename_size = strlen( inputfile );
pf->dnam.naml$l_long_expand = pf->expanded_filename;
pf->dnam.naml$l_long_expand_alloc = NAM$C_MAXRSS ;
pf->dnam.naml$b_nop |= NAML$M_SYNCHK | NAML$M_PWD;
status = sys$parse( &pf->dfab, 0,0);
status = sys$parse( &pf->dfab, 0, 0 );
if ( !(status&1) ){
free( pf );
return( status );
@ -137,7 +137,7 @@ manPtr addman( manPtr *manroot,char *filename )
{
manPtr m,f;
m = calloc( 1, sizeof( man) );
m = calloc( 1, sizeof( man ) );
if ( !m ) return( NULL );
m->filename = strdup( filename );
@ -159,7 +159,7 @@ manPtr m,n;
for( m = *manroot; m ; m = n ){
free( m->filename );
n = m->next;
free ( m );
free( m );
}
*manroot = NULL;
}
@ -180,11 +180,11 @@ while(1){
r = addman( manroot, gevonden );
if ( r == NULL ) return(2);
}else{
if ( !( status&1)) break;
if ( !( status&1 ) ) break;
}
}
lib$find_file_end( &ffindex);
lib$find_file_end( &ffindex );
if ( status == RMS$_NMF) status = 1;
@ -207,14 +207,14 @@ uit = calloc( 1, maxlen + 1 );
if ( in == NULL || uit == NULL ) return(2);
man = fopen( filespec, "r");
man = fopen( filespec, "r" );
if ( man == NULL ) return(vaxc$errno);
for( len = 0; !feof( man ) && len < maxlen ; len += thislen ){
thislen = fread( in + len, 1, maxlen - len, man );
}
fclose (man);
fclose(man);
m = in;
h = uit;
@ -404,7 +404,7 @@ if ( (return_status&2) ){
free( m );
free( h );
return ( 1);
return ( 1 );
}
/*--------------------------------------------*/