diff options
author | Nito Martinez <Nito@Qindel.ES> | 2015-02-10 19:47:58 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2015-02-10 19:47:58 +0100 |
commit | 79f218b563f6a4d3b17e92ee85ad242575daf8da (patch) | |
tree | 1f5290e0ba44b23228730d9261505e92a440cf5b /nxcomp | |
parent | 46c2aebca5196ad4c10bb4f6f2558d656c22f5d9 (diff) | |
download | nx-libs-79f218b563f6a4d3b17e92ee85ad242575daf8da.tar.gz nx-libs-79f218b563f6a4d3b17e92ee85ad242575daf8da.tar.bz2 nx-libs-79f218b563f6a4d3b17e92ee85ad242575daf8da.zip |
Fix FTBFS of nxproxy/nxcomp on Android (212_nxcomp_build-on-Android.full+lite.patch).
Diffstat (limited to 'nxcomp')
-rw-r--r-- | nxcomp/Jpeg.cpp | 3 | ||||
-rw-r--r-- | nxcomp/Loop.cpp | 12 | ||||
-rw-r--r-- | nxcomp/Pgn.cpp | 3 | ||||
-rw-r--r-- | nxcomp/Proxy.cpp | 7 | ||||
-rw-r--r-- | nxcomp/ServerChannel.cpp | 52 |
5 files changed, 64 insertions, 13 deletions
diff --git a/nxcomp/Jpeg.cpp b/nxcomp/Jpeg.cpp index 9f71cbadf..414d373ef 100644 --- a/nxcomp/Jpeg.cpp +++ b/nxcomp/Jpeg.cpp @@ -17,6 +17,9 @@ #include <X11/Xmd.h> +#ifdef ANDROID +#include <strings.h> +#endif #include <unistd.h> #include <setjmp.h> #include <zlib.h> diff --git a/nxcomp/Loop.cpp b/nxcomp/Loop.cpp index d5c8eb25d..05b514570 100644 --- a/nxcomp/Loop.cpp +++ b/nxcomp/Loop.cpp @@ -4187,7 +4187,7 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr, #endif - char *separator = rindex(display, ':'); + char *separator = strrchr(display, ':'); if ((separator == NULL) || !isdigit(*(separator + 1))) { @@ -8240,7 +8240,7 @@ int ParseEnvironmentOptions(const char *env, int force) char *name; char *value; - value = rindex(nextOpts, ':'); + value = strrchr(nextOpts, ':'); if (value != NULL) { @@ -11010,7 +11010,7 @@ int ParsePackOption(const char *opt) packMethod == PACK_LOSSLESS || packMethod == PACK_ADAPTIVE) { - const char *dash = rindex(opt, '-'); + const char *dash = strrchr(opt, '-'); if (dash != NULL && strlen(dash) == 2 && *(dash + 1) >= '0' && *(dash + 1) <= '9') @@ -12275,6 +12275,10 @@ int SetShmem() control -> ShmemServer = 0; } + // For android, no shared memory available + control -> ShmemServer = 0; + control -> ShmemClientSize = 0; + return 1; } @@ -13525,7 +13529,7 @@ int ParseHostOption(const char *opt, char *host, int &port) int newPort = port; - const char *separator = rindex(opt, ':'); + const char *separator = strrchr(opt, ':'); if (separator != NULL) { diff --git a/nxcomp/Pgn.cpp b/nxcomp/Pgn.cpp index af26724ef..cdcde84ce 100644 --- a/nxcomp/Pgn.cpp +++ b/nxcomp/Pgn.cpp @@ -23,6 +23,9 @@ #include <X11/Xmd.h> +#ifdef ANDROID +#include <strings.h> +#endif #include <unistd.h> #include <stdio.h> #include <png.h> diff --git a/nxcomp/Proxy.cpp b/nxcomp/Proxy.cpp index d6c67e0e8..9b38661b4 100644 --- a/nxcomp/Proxy.cpp +++ b/nxcomp/Proxy.cpp @@ -20,6 +20,11 @@ #include <cstdlib> #include <sys/types.h> #include <sys/stat.h> +#ifdef ANDROID +#include <netinet/in.h> +#include <netinet/ip.h> +#include <netinet/tcp.h> +#endif #include "Misc.h" @@ -31,9 +36,11 @@ #include <sys/un.h> #endif +#ifndef ANDROID #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/tcp.h> +#endif #if defined(__EMX__ ) || defined(__CYGWIN32__) diff --git a/nxcomp/ServerChannel.cpp b/nxcomp/ServerChannel.cpp index 4e6dea324..0f3a3e552 100644 --- a/nxcomp/ServerChannel.cpp +++ b/nxcomp/ServerChannel.cpp @@ -18,7 +18,9 @@ #include <string.h> #include <sys/types.h> #include <sys/ipc.h> +#ifndef ANDROID #include <sys/shm.h> +#endif #include <X11/X.h> #include <X11/Xatom.h> @@ -1079,7 +1081,6 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m priority_++; } - // // Account this data to the original opcode. // @@ -1500,7 +1501,6 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m continue; } } - // // Check if user pressed the CTRL+ALT+SHIFT+ESC key // sequence because was unable to kill the session @@ -5475,7 +5475,7 @@ int ServerChannel::handleColormap(unsigned char &opcode, unsigned char *&buffer, *logofs << "handleColormap: Dumping colormap entries:\n" << logofs_flush; - const unsigned char *p = unpackState_[resource] -> colormap -> data; + const unsigned char *p = (const unsigned char *) unpackState_[resource] -> colormap -> data; for (unsigned int i = 0; i < unpackState_[resource] -> colormap -> entries; i++) @@ -7100,7 +7100,12 @@ int ServerChannel::handleShmemReply(EncodeBuffer &encodeBuffer, const unsigned c { encodeBuffer.encodeValue(stage, 2); +#ifndef ANDROID shmemState_ -> present = *(buffer + 8); +#else + shmemState_ -> present = 0; + cerr << "Info: handleShmemReply: In android no shared memory. Setting present to 0 hardcoded\n"; +#endif shmemState_ -> opcode = *(buffer + 9); shmemState_ -> event = *(buffer + 10); shmemState_ -> error = *(buffer + 11); @@ -7128,7 +7133,12 @@ int ServerChannel::handleShmemReply(EncodeBuffer &encodeBuffer, const unsigned c cerr << "Info" << ": Using shared memory parameters 1/" << (shmemState_ -> size / 1024) << "K.\n"; +#ifndef ANDROID shmemState_ -> enabled = 1; +#else + cerr << "Info: handleShmemReply: In android no shared memory. Setting enabled to -1. This should not be displayed\n"; + shmemState_ -> enabled = -1; +#endif encodeBuffer.encodeBoolValue(1); } @@ -7241,7 +7251,7 @@ int ServerChannel::handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char // memory support is disabled by the // user. // - +#ifndef ANDROID if (control -> ShmemServer == 1 && control -> ShmemServerSize > 0 && enableServer == 1) @@ -7252,8 +7262,12 @@ int ServerChannel::handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char { memcpy(buffer + 8, "NO-MIT-", 7); } +#else + cerr << "Info: handleShmemRequest: In android no shared memory. Returning NO-MIT- answer\n"; - sequenceQueue_.push(clientSequence_, opcode, + memcpy(buffer + 8, "NO-MIT-", 7); +#endif + sequenceQueue_.push(clientSequence_, opcode, opcodeStore_ -> getShmemParameters, stage); // @@ -7289,9 +7303,13 @@ int ServerChannel::handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char shmemState_ -> size = control -> ShmemServerSize; +#ifndef ANDROID shmemState_ -> id = shmget(IPC_PRIVATE, shmemState_ -> size, IPC_CREAT | permissions); - +#else + cerr << "Info: handleShmemReqyest: In android no shared memory (shmget). This message should not be displayed present should never be 1 in android\n"; + shmemState_ -> id = -1; +#endif if (shmemState_ -> id >= 0) { #if defined(TEST) || defined(INFO) @@ -7302,8 +7320,12 @@ int ServerChannel::handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char #endif +#ifndef ANDROID shmemState_ -> address = shmat(shmemState_ -> id, 0, 0); - +#else + cerr << "Info: handleShmemReqyest: In android no shared memory (shmat). This message should not be displayed. present should never be 1 in android\n"; + shmemState_ -> address = NULL; +#endif if (shmemState_ -> address != NULL) { #ifdef TEST @@ -7437,6 +7459,10 @@ int ServerChannel::handleShmem(unsigned char &opcode, unsigned char *&buffer, return 0; } +#ifdef ANDROID + cerr << "Info: handleShmem: In android no shared memory. enabled should never be 1. This should not be displayed\n"; + return 0; +#endif // // Ignore null requests and requests that will not result @@ -8054,14 +8080,22 @@ void ServerChannel::handleShmemStateRemove() { if (shmemState_ != NULL) { - if (shmemState_ -> address != NULL) + if (shmemState_ -> address != NULL) { - shmdt((char *) shmemState_ -> address); +#ifndef ANDROID + shmdt((char *) shmemState_ -> address); +#else + cerr << "Info: handleShmemStateRemove: In android no shared memory. This should not be displayed. address should always be NULL\n"; +#endif } if (shmemState_ -> id > 0) { +#ifndef ANDROID shmctl(shmemState_ -> id, IPC_RMID, 0); +#else + cerr << "Info: handleShmemStateRemove: In android no shared memory. This should not be displayed. id should always be 0\n"; +#endif } delete shmemState_; |