This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient.
commit 5f97cd638c67247ea573fa74e87bfc9a5bcef7c0 Author: Mihai Moldovan <io...@ionic.de> Date: Sat Mar 21 23:30:54 2015 +0100 compat.{cpp,h}: new files. Implements strndup on OS X 10.6 and below. Add to x2goclient.cpp, x2goclient.pro and x2goclient.pro.maemo. --- debian/changelog | 2 ++ src/compat.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ src/compat.h | 38 ++++++++++++++++++++++++++++++++++++++ src/x2goclient.cpp | 1 + x2goclient.pro | 6 ++++-- x2goclient.pro.maemo | 6 ++++-- 6 files changed, 98 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8b4cb1d..0a40358 100644 --- a/debian/changelog +++ b/debian/changelog @@ -92,6 +92,8 @@ x2goclient (4.0.5.2-0x2go1) UNRELEASED; urgency=medium starting sshd in user mode. Put the authorized_keys file in there. Check and set correct permissions for both the directory and authorized_keys file. Generalize some Windows-specific sections by using QDir and QFile. + - compat.{cpp,h}: new files. Implements strndup on OS X 10.6 and below. + Add to x2goclient.cpp, x2goclient.pro and x2goclient.pro.maemo. * debian/control: - Maintainer change in package: X2Go Developers <x2go-...@lists.x2go.org>. - Uploaders: add myself. Also, force a rebuild due to the changed diff --git a/src/compat.cpp b/src/compat.cpp new file mode 100644 index 0000000..877d07b --- /dev/null +++ b/src/compat.cpp @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2015 by Mihai Moldovan <io...@ionic.de> +49 721 14595728 * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "compat.h" + +#ifdef Q_OS_DARWIN +/* + * strndup() is not available on 10.6 and below, define a compat version here. + * Shameless copy from libiberty. + */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 +#include <stddef.h> +#include <string.h> +#include <stdlib.h> + +inline char *strndup (const char *s, size_t n) { + char *result; + size_t len = strlen (s); + + if (n < len) { + len = n; + } + + result = (char *) malloc (len + 1); + if (!result) { + return (0); + } + + result[len] = '\0'; + return ((char *) memcpy (result, s, len)); +} +#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */ +#endif /* defined (Q_OS_DARWIN) */ diff --git a/src/compat.h b/src/compat.h new file mode 100644 index 0000000..8b9d77e --- /dev/null +++ b/src/compat.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2015 by Mihai Moldovan <io...@ionic.de> +49 721 14595728 * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + + +#ifndef COMPAT_H +#define COMPAT_H + +#ifdef Q_OS_DARWIN +/* + * strndup() is not available on 10.6 and below, define a compat version here. + * Shameless copy from libiberty. + */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 +#include <stddef.h> +#include <string.h> +#include <stdlib.h> + +inline char *strndup (const char *s, size_t n); +#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */ +#endif /* defined (Q_OS_DARWIN) */ + +#endif /* !defined (COMPAT_H) */ diff --git a/src/x2goclient.cpp b/src/x2goclient.cpp index df53ba1..b201a4e 100644 --- a/src/x2goclient.cpp +++ b/src/x2goclient.cpp @@ -30,6 +30,7 @@ #include "unixhelper.h" #include "ongetpass.h" +#include "compat.h" int wrap_x2go_main (int argc, char **argv) { return (x2goMain (argc, argv)); diff --git a/x2goclient.pro b/x2goclient.pro index 34da16e..d0486e9 100644 --- a/x2goclient.pro +++ b/x2goclient.pro @@ -80,7 +80,8 @@ HEADERS += src/configdialog.h \ src/folderexplorer.h \ src/non_modal_messagebox.h \ src/help.h \ - src/unixhelper.h + src/unixhelper.h \ + src/compat.h SOURCES += src/sharewidget.cpp \ src/settingswidget.cpp \ @@ -124,7 +125,8 @@ SOURCES += src/sharewidget.cpp \ src/folderexplorer.cpp \ src/non_modal_messagebox.cpp \ src/help.cpp \ - src/unixhelper.cpp + src/unixhelper.cpp \ + src/compat.cpp LIBS += -lssh win32:LIBS += -lAdvAPI32 -lshell32 -lUser32 diff --git a/x2goclient.pro.maemo b/x2goclient.pro.maemo index 63cc3d8..905ef77 100644 --- a/x2goclient.pro.maemo +++ b/x2goclient.pro.maemo @@ -36,7 +36,8 @@ HEADERS += src/configdialog.h \ src/sharewidget.h \ src/clicklineedit.h \ src/help.h \ - src/unixhelper.h + src/unixhelper.h \ + src/compat.h SOURCES += src/sharewidget.cpp \ src/settingswidget.cpp \ @@ -64,7 +65,8 @@ SOURCES += src/sharewidget.cpp \ src/wapi.cpp \ src/clicklineedit.cpp \ src/help.cpp \ - src/unixhelper.cpp + src/unixhelper.cpp \ + src/compat.cpp TEMPLATE = app TARGET = -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git _______________________________________________ x2go-commits mailing list x2go-commits@lists.x2go.org http://lists.x2go.org/listinfo/x2go-commits