mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-28 01:41:49 +03:00
tidy-up: formatting nits
Whitespace and redundant parenthesis in `return`s. Closes #1029
This commit is contained in:
@ -436,7 +436,7 @@ int main(int argc, char *argv[])
|
|||||||
fds[0].revents = LIBSSH2_POLLFD_POLLIN;
|
fds[0].revents = LIBSSH2_POLLFD_POLLIN;
|
||||||
|
|
||||||
rc = libssh2_poll(fds, nfds, 0);
|
rc = libssh2_poll(fds, nfds, 0);
|
||||||
if(rc >0) {
|
if(rc > 0) {
|
||||||
libssh2_channel_read(channel, buf, sizeof(buf));
|
libssh2_channel_read(channel, buf, sizeof(buf));
|
||||||
fprintf(stdout, "%s", buf);
|
fprintf(stdout, "%s", buf);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -2314,7 +2314,7 @@ _libssh2_channel_packet_data_len(LIBSSH2_CHANNEL * channel, int stream_id)
|
|||||||
&& (channel->local.id == read_local_id)
|
&& (channel->local.id == read_local_id)
|
||||||
&& (channel->remote.extended_data_ignore_mode
|
&& (channel->remote.extended_data_ignore_mode
|
||||||
== LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE))) {
|
== 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;
|
read_packet = next_packet;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#define LIBSSH2_CRYPTO_C
|
#define LIBSSH2_CRYPTO_C
|
||||||
|
|
||||||
#include "libssh2_priv.h"
|
#include "libssh2_priv.h"
|
||||||
|
|
||||||
#if defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL)
|
#if defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL)
|
||||||
|
@ -821,7 +821,7 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out host format */
|
/* Figure out host format */
|
||||||
if((hostlen >2) && memcmp(host, "|1|", 3)) {
|
if((hostlen > 2) && memcmp(host, "|1|", 3)) {
|
||||||
/* old style plain text: [name]([,][name])*
|
/* old style plain text: [name]([,][name])*
|
||||||
|
|
||||||
for the sake of simplicity, we add them as separate hosts with the
|
for the sake of simplicity, we add them as separate hosts with the
|
||||||
|
@ -935,7 +935,7 @@ int _libssh2_check_length(struct string_buf *buf, size_t len)
|
|||||||
{
|
{
|
||||||
unsigned char *endp = &buf->data[buf->len];
|
unsigned char *endp = &buf->data[buf->len];
|
||||||
size_t left = endp - buf->dataptr;
|
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)
|
int _libssh2_eob(struct string_buf *buf)
|
||||||
|
@ -3280,7 +3280,7 @@ clean_exit:
|
|||||||
if(md_ctx)
|
if(md_ctx)
|
||||||
EVP_MD_CTX_free(md_ctx);
|
EVP_MD_CTX_free(md_ctx);
|
||||||
|
|
||||||
return (rc == 1 ? 0 : -1);
|
return (rc == 1) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
10
src/sftp.c
10
src/sftp.c
@ -632,11 +632,11 @@ sftp_packet_requirev(LIBSSH2_SFTP *sftp, int num_valid_responses,
|
|||||||
*/
|
*/
|
||||||
static int sftp_attrsize(unsigned long flags)
|
static int sftp_attrsize(unsigned long flags)
|
||||||
{
|
{
|
||||||
return (4 + /* flags(4) */
|
return 4 + /* flags(4) */
|
||||||
((flags & LIBSSH2_SFTP_ATTR_SIZE) ? 8 : 0) +
|
((flags & LIBSSH2_SFTP_ATTR_SIZE) ? 8 : 0) +
|
||||||
((flags & LIBSSH2_SFTP_ATTR_UIDGID) ? 8 : 0) +
|
((flags & LIBSSH2_SFTP_ATTR_UIDGID) ? 8 : 0) +
|
||||||
((flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) ? 4 : 0) +
|
((flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) ? 4 : 0) +
|
||||||
((flags & LIBSSH2_SFTP_ATTR_ACMODTIME) ? 8 : 0));
|
((flags & LIBSSH2_SFTP_ATTR_ACMODTIME) ? 8 : 0);
|
||||||
/* atime + mtime as u32 */
|
/* 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);
|
_libssh2_store_u32(&s, (uint32_t)attrs->mtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (s - p);
|
return s - p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sftp_bin2attr
|
/* 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;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(longentry && (longentry_maxlen>1)) {
|
if(longentry && (longentry_maxlen > 1)) {
|
||||||
longentry_len = real_longentry_len;
|
longentry_len = real_longentry_len;
|
||||||
|
|
||||||
if(longentry_len >= longentry_maxlen ||
|
if(longentry_len >= longentry_maxlen ||
|
||||||
|
@ -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_defname_size = 0;//strlen( inputfile );
|
||||||
|
|
||||||
pf->dnam.naml$l_long_filename = 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 = pf->expanded_filename;
|
||||||
pf->dnam.naml$l_long_expand_alloc = NAM$C_MAXRSS ;
|
pf->dnam.naml$l_long_expand_alloc = NAM$C_MAXRSS ;
|
||||||
|
|
||||||
pf->dnam.naml$b_nop |= NAML$M_SYNCHK | NAML$M_PWD;
|
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) ){
|
if ( !(status&1) ){
|
||||||
free( pf );
|
free( pf );
|
||||||
return( status );
|
return( status );
|
||||||
@ -137,7 +137,7 @@ manPtr addman( manPtr *manroot,char *filename )
|
|||||||
{
|
{
|
||||||
manPtr m,f;
|
manPtr m,f;
|
||||||
|
|
||||||
m = calloc( 1, sizeof( man) );
|
m = calloc( 1, sizeof( man ) );
|
||||||
if ( !m ) return( NULL );
|
if ( !m ) return( NULL );
|
||||||
|
|
||||||
m->filename = strdup( filename );
|
m->filename = strdup( filename );
|
||||||
@ -159,7 +159,7 @@ manPtr m,n;
|
|||||||
for( m = *manroot; m ; m = n ){
|
for( m = *manroot; m ; m = n ){
|
||||||
free( m->filename );
|
free( m->filename );
|
||||||
n = m->next;
|
n = m->next;
|
||||||
free ( m );
|
free( m );
|
||||||
}
|
}
|
||||||
*manroot = NULL;
|
*manroot = NULL;
|
||||||
}
|
}
|
||||||
@ -180,11 +180,11 @@ while(1){
|
|||||||
r = addman( manroot, gevonden );
|
r = addman( manroot, gevonden );
|
||||||
if ( r == NULL ) return(2);
|
if ( r == NULL ) return(2);
|
||||||
}else{
|
}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;
|
if ( status == RMS$_NMF) status = 1;
|
||||||
|
|
||||||
|
|
||||||
@ -207,14 +207,14 @@ uit = calloc( 1, maxlen + 1 );
|
|||||||
|
|
||||||
if ( in == NULL || uit == NULL ) return(2);
|
if ( in == NULL || uit == NULL ) return(2);
|
||||||
|
|
||||||
man = fopen( filespec, "r");
|
man = fopen( filespec, "r" );
|
||||||
if ( man == NULL ) return(vaxc$errno);
|
if ( man == NULL ) return(vaxc$errno);
|
||||||
|
|
||||||
for( len = 0; !feof( man ) && len < maxlen ; len += thislen ){
|
for( len = 0; !feof( man ) && len < maxlen ; len += thislen ){
|
||||||
thislen = fread( in + len, 1, maxlen - len, man );
|
thislen = fread( in + len, 1, maxlen - len, man );
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose (man);
|
fclose(man);
|
||||||
|
|
||||||
m = in;
|
m = in;
|
||||||
h = uit;
|
h = uit;
|
||||||
@ -404,7 +404,7 @@ if ( (return_status&2) ){
|
|||||||
free( m );
|
free( m );
|
||||||
free( h );
|
free( h );
|
||||||
|
|
||||||
return ( 1);
|
return ( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------*/
|
/*--------------------------------------------*/
|
||||||
|
Reference in New Issue
Block a user