Fix compilation on Android with the bionic C library

https://bugzilla.gnome.org/show_bug.cgi?id=689223
This commit is contained in:
Sebastian Dröge
2012-11-28 16:55:54 +01:00
parent 5e2cad9de9
commit bcbaf1bef0
11 changed files with 349 additions and 27 deletions

View File

@@ -23,10 +23,10 @@
#include "config.h"
#include <glib.h>
#include <glib/gprintf.h>
#include <string.h>
#ifdef G_OS_WIN32
#include <glib/gprintf.h>
#include <conio.h>
#endif
@@ -40,8 +40,12 @@
G_DEFINE_TYPE (GTlsConsoleInteraction, g_tls_console_interaction, G_TYPE_TLS_INTERACTION);
#ifdef G_OS_WIN32
#if defined(G_OS_WIN32) || defined(__BIONIC__)
/* win32 doesn't have getpass() */
#include <stdio.h>
#ifndef BUFSIZ
#define BUFSIZ 8192
#endif
static gchar *
getpass (const gchar *prompt)
{
@@ -53,7 +57,11 @@ getpass (const gchar *prompt)
for (i = 0; i < BUFSIZ - 1; ++i)
{
#ifdef __BIONIC__
buf[i] = getc (stdin);
#else
buf[i] = _getch ();
#endif
if (buf[i] == '\r')
break;
}