summaryrefslogtreecommitdiffstats
path: root/libssh/misc.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-07-30 10:45:58 +0200
committerAndreas Schneider <mail@cynapses.org>2009-07-30 10:45:58 +0200
commit766bae9d7626bb596fc3b60d2cd5fe5a7fc356db (patch)
treeec6aa6d9ea44d8eea5c47a8d1245c4fbe2930d96 /libssh/misc.c
parent94a57df0c9eceda18679b2823de74837fb5a73c1 (diff)
downloadlibssh-766bae9d7626bb596fc3b60d2cd5fe5a7fc356db.tar.gz
libssh-766bae9d7626bb596fc3b60d2cd5fe5a7fc356db.tar.xz
libssh-766bae9d7626bb596fc3b60d2cd5fe5a7fc356db.zip
Fix build with MSVC.
Diffstat (limited to 'libssh/misc.c')
-rw-r--r--libssh/misc.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/libssh/misc.c b/libssh/misc.c
index 0df1146..03fd3c3 100644
--- a/libssh/misc.c
+++ b/libssh/misc.c
@@ -24,7 +24,6 @@
#include <limits.h>
#include <stdio.h>
-#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -33,8 +32,8 @@
#ifdef _WIN32
#define _WIN32_IE 0x0400 //SHGetSpecialFolderPath
+#include <winsock2.h> // Must be the first to include
#include <shlobj.h>
-#include <winsock2.h>
#else
#include <pwd.h>
#include <arpa/inet.h>
@@ -67,7 +66,6 @@
* @{ */
#ifdef _WIN32
-
char *ssh_get_user_home_dir(void) {
static char szPath[MAX_PATH] = {0};
@@ -77,7 +75,7 @@ char *ssh_get_user_home_dir(void) {
return NULL;
}
-
+
/* we have read access on file */
int ssh_file_readaccess_ok(const char *file) {
if (_access(file, 4) < 0) {
@@ -85,9 +83,8 @@ char *ssh_get_user_home_dir(void) {
}
return 1;
-}
+}
#else /* _WIN32 */
-
char *ssh_get_user_home_dir(void) {
static char szPath[PATH_MAX] = {0};
struct passwd *pwd = NULL;
@@ -102,8 +99,6 @@ char *ssh_get_user_home_dir(void) {
return szPath;
}
-#endif
-
/* we have read access on file */
int ssh_file_readaccess_ok(const char *file) {
if (access(file, R_OK) < 0) {
@@ -112,13 +107,14 @@ int ssh_file_readaccess_ok(const char *file) {
return 1;
}
+#endif
uint64_t ntohll(uint64_t a) {
#ifdef WORDS_BIGENDIAN
return a;
#else
- uint32_t low = a & 0xffffffff;
- uint32_t high = a >> 32 ;
+ uint32_t low = (uint32_t)(a & 0xffffffff);
+ uint32_t high = (uint32_t)(a >> 32);
low = ntohl(low);
high = ntohl(high);