From a58b7b93de0d904286632804f01647fdeba47f98 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 18 Apr 2009 14:56:56 +0000 Subject: Reformat some functions. git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@550 7dcaeef0-15fb-0310-b436-a5af3365683c --- libssh/keyfiles.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c index b23e445..c6c9cae 100644 --- a/libssh/keyfiles.c +++ b/libssh/keyfiles.c @@ -62,8 +62,7 @@ static int load_iv(char *header, unsigned char *iv, int iv_len) { int k; memset(iv, 0, iv_len); - for (i=0; i < iv_len; i++) - { + for (i = 0; i < iv_len; i++) { if ((header[2*i] >= '0') && (header[2*i] <= '9')) j = header[2*i] - '0'; else if ((header[2*i] >= 'A') && (header[2*i] <= 'F')) @@ -89,7 +88,7 @@ static u32 char_to_u32(unsigned char *data, u32 size) { u32 ret; u32 i; - for (i=0,ret=0;i 127) - { - len=tmp[0] & 127; - if (len>4) + } + + if (tmp[0] > 127) { + len = tmp[0] & 127; + if (len > 4) { return 0; /* Length doesn't fit in u32. Can this really happen? */ - if (!buffer_get_data(buffer,tmp,len)) + } + if (buffer_get_data(buffer,tmp,len) == 0) { return 0; - len=char_to_u32(tmp,len); + } + len = char_to_u32(tmp, len); + } else { + len = char_to_u32(tmp, 1); } - else - len=char_to_u32(tmp,1); + return len; } -- cgit