2012-11-06 12:21:37 -06:00
|
|
|
--- misc/liblangtag-0.4.0/liblangtag/lt-macros.h
|
|
|
|
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-macros.h
|
|
|
|
@@ -14,7 +14,9 @@
|
|
|
|
#error "Only <liblangtag/langtag.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifndef _WIN32
|
|
|
|
#include <sys/param.h>
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
#ifndef __LT_MACROS_H__
|
|
|
|
#define __LT_MACROS_H__
|
|
|
|
@@ -206,6 +206,14 @@
|
|
|
|
|
|
|
|
LT_BEGIN_DECLS
|
|
|
|
|
|
|
|
+#ifdef _MSC_VER
|
|
|
|
+#ifdef _M_AMD64
|
|
|
|
+typedef signed long long ssize_t;
|
|
|
|
+#else
|
|
|
|
+typedef signed int ssize_t;
|
|
|
|
+#endif
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
typedef void * lt_pointer_t;
|
|
|
|
typedef int lt_bool_t;
|
|
|
|
typedef lt_pointer_t (* lt_copy_func_t) (lt_pointer_t data);
|
|
|
|
--- misc/liblangtag-0.4.0/liblangtag/lt-atomic.h
|
|
|
|
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-atomic.h
|
|
|
|
@@ -17,7 +17,11 @@
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#if !defined(LT_HAVE_ATOMIC_BUILTINS) && !defined(_WIN32)
|
|
|
|
#include <pthread.h>
|
|
|
|
+#elif defined(_WIN32)
|
|
|
|
+#include <windows.h>
|
|
|
|
+#endif
|
|
|
|
#include "lt-messages.h"
|
|
|
|
|
|
|
|
LT_BEGIN_DECLS
|
|
|
|
@@ -26,14 +30,40 @@
|
|
|
|
LT_INLINE_FUNC int lt_atomic_int_inc (volatile int *v);
|
|
|
|
LT_INLINE_FUNC lt_bool_t lt_atomic_int_dec_and_test(volatile int *v);
|
|
|
|
|
|
|
|
-#ifndef LT_HAVE_ATOMIC_BUILTINS
|
|
|
|
+#if !defined(LT_HAVE_ATOMIC_BUILTINS) && !defined(_WIN32)
|
|
|
|
static pthread_mutex_t __lt_atomic_lock = PTHREAD_MUTEX_INITIALIZER;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
|
|
|
|
/*< public >*/
|
|
|
|
-#ifdef LT_HAVE_ATOMIC_BUILTINS
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+LT_INLINE_FUNC int
|
|
|
|
+lt_atomic_int_get(volatile int *v)
|
|
|
|
+{
|
|
|
|
+ lt_return_val_if_fail (v != NULL, 0);
|
|
|
|
+
|
2012-11-09 07:57:56 -06:00
|
|
|
+ return (int)InterlockedExchange((LONG*)v, (LONG)*v);
|
2012-11-06 12:21:37 -06:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+LT_INLINE_FUNC int
|
|
|
|
+lt_atomic_int_inc(volatile int *v)
|
|
|
|
+{
|
|
|
|
+ lt_return_val_if_fail (v != NULL, 0);
|
|
|
|
+
|
2012-11-09 07:57:56 -06:00
|
|
|
+ return (int)InterlockedIncrement((LONG*)v);
|
2012-11-06 12:21:37 -06:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+lt_bool_t
|
|
|
|
+lt_atomic_int_dec_and_test(volatile int *v)
|
|
|
|
+{
|
|
|
|
+ lt_return_val_if_fail (v != NULL, FALSE);
|
|
|
|
+
|
2012-11-09 07:57:56 -06:00
|
|
|
+ return !InterlockedDecrement((LONG*)v);
|
2012-11-06 12:21:37 -06:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+#elif defined(LT_HAVE_ATOMIC_BUILTINS)
|
|
|
|
LT_INLINE_FUNC int
|
|
|
|
lt_atomic_int_get(volatile int *v)
|
|
|
|
{
|
2012-11-13 04:17:28 -06:00
|
|
|
@@ -123,7 +153,7 @@
|
|
|
|
{
|
|
|
|
lt_bool_t retval;
|
|
|
|
|
|
|
|
- lt_return_if_fail (v != NULL, FALSE);
|
|
|
|
+ lt_return_val_if_fail (v != NULL, FALSE);
|
|
|
|
|
|
|
|
pthread_mutex_lock(&__lt_atomic_lock);
|
|
|
|
retval = --(*v) == 0;
|
2012-11-06 12:21:37 -06:00
|
|
|
--- misc/liblangtag-0.4.0/liblangtag/lt-messages.h
|
|
|
|
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-messages.h
|
|
|
|
@@ -298,10 +298,17 @@
|
|
|
|
_lt_return_after_eval_if_fail(__expr__,__eval__)
|
|
|
|
#define lt_return_val_after_eval_if_fail(__expr__,__val__,__eval__) \
|
|
|
|
_lt_return_val_after_eval_if_fail(__expr__,__val__,__eval__)
|
|
|
|
+#ifdef __GNUC__
|
|
|
|
#define lt_warn_if_reached() \
|
|
|
|
lt_message_printf(LT_MSG_WARNING, LT_MSG_FLAG_NONE, 0, \
|
|
|
|
"(%s:%d): %s: code should not be reached", \
|
|
|
|
__FILE__, __LINE__, __PRETTY_FUNCTION__)
|
|
|
|
+#else
|
|
|
|
+#define lt_warn_if_reached() \
|
|
|
|
+ lt_message_printf(LT_MSG_WARNING, LT_MSG_FLAG_NONE, 0, \
|
|
|
|
+ "(%s:%d): code should not be reached", \
|
|
|
|
+ __FILE__, __LINE__)
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
LT_END_DECLS
|
|
|
|
|
|
|
|
--- misc/liblangtag-0.4.0/liblangtag/lt-error.c
|
|
|
|
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-error.c
|
|
|
|
@@ -14,7 +14,9 @@
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifndef _WIN32
|
|
|
|
#include <execinfo.h>
|
|
|
|
+#endif
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "lt-list.h"
|
|
|
|
#include "lt-mem.h"
|
2012-11-07 08:14:45 -06:00
|
|
|
@@ -120,13 +120,18 @@
|
2012-11-06 12:21:37 -06:00
|
|
|
d->message = lt_strdup_vprintf(message, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+ size = 0;
|
|
|
|
+#else
|
|
|
|
size = backtrace(traces, 1024);
|
|
|
|
if (size > 0)
|
|
|
|
d->traces = backtrace_symbols(traces, size);
|
|
|
|
+#endif
|
|
|
|
d->stack_size = size;
|
|
|
|
|
|
|
|
lt_mem_add_ref(&d->parent, d->message, free);
|
2012-11-07 08:14:45 -06:00
|
|
|
- lt_mem_add_ref(&d->parent, d->traces, free);
|
|
|
|
+ if (d->traces != NULL)
|
|
|
|
+ lt_mem_add_ref(&d->parent, d->traces, free);
|
|
|
|
|
|
|
|
allocated = (*error)->data == NULL;
|
|
|
|
(*error)->data = lt_list_append((*error)->data, d, (lt_destroy_func_t)lt_mem_unref);
|
2012-11-06 12:21:37 -06:00
|
|
|
--- misc/liblangtag-0.4.0/liblangtag/lt-ext-module.c
|
|
|
|
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-ext-module.c
|
|
|
|
@@ -15,11 +15,15 @@
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
+#ifdef ENABLE_MODULE
|
|
|
|
#include <dirent.h>
|
|
|
|
+#endif
|
|
|
|
#ifdef HAVE_DLFCN_H
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#endif
|
|
|
|
+#ifndef _WIN32
|
|
|
|
#include <libgen.h>
|
|
|
|
+#endif
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
--- misc/liblangtag-0.4.0/liblangtag/lt-xml.c
|
|
|
|
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-xml.c
|
|
|
|
@@ -14,7 +14,11 @@
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifndef _WIN32
|
|
|
|
#include <pthread.h>
|
|
|
|
+#else
|
|
|
|
+#include <windows.h>
|
|
|
|
+#endif
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <libxml/parser.h>
|
|
|
|
#include <libxml/xpath.h>
|
|
|
|
@@ -40,7 +44,9 @@
|
|
|
|
};
|
|
|
|
|
|
|
|
static lt_xml_t *__xml = NULL;
|
|
|
|
+#ifndef _WIN32
|
|
|
|
static pthread_mutex_t __lt_xml_lock = PTHREAD_MUTEX_INITIALIZER;
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
static lt_bool_t
|
|
|
|
@@ -309,11 +315,18 @@
|
|
|
|
{
|
|
|
|
lt_error_t *err = NULL;
|
|
|
|
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+ HANDLE __lt_xml_lock = CreateMutex(NULL, FALSE, NULL);
|
|
|
|
+#else
|
|
|
|
pthread_mutex_lock(&__lt_xml_lock);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
if (__xml) {
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+ ReleaseMutex(__lt_xml_lock);
|
|
|
|
+#else
|
|
|
|
pthread_mutex_unlock(&__lt_xml_lock);
|
|
|
|
-
|
|
|
|
+#endif
|
|
|
|
return lt_xml_ref(__xml);
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -389,8 +402,11 @@
|
|
|
|
lt_xml_unref(__xml);
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+ ReleaseMutex(__lt_xml_lock);
|
|
|
|
+#else
|
|
|
|
pthread_mutex_unlock(&__lt_xml_lock);
|
|
|
|
-
|
|
|
|
+#endif
|
|
|
|
return __xml;
|
|
|
|
}
|
|
|
|
|
|
|
|
--- misc/liblangtag-0.4.0/liblangtag/lt-messages.c
|
|
|
|
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-messages.c
|
|
|
|
@@ -17,7 +17,9 @@
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifndef _WIN32
|
|
|
|
#include <execinfo.h>
|
|
|
|
+#endif
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
@@ -98,6 +98,7 @@
|
|
|
|
static void
|
|
|
|
_lt_message_stacktrace(void)
|
|
|
|
{
|
|
|
|
+#ifndef _WIN32
|
|
|
|
void *traces[1024];
|
|
|
|
char **strings;
|
|
|
|
int size, i;
|
|
|
|
@@ -119,6 +119,7 @@
|
|
|
|
}
|
|
|
|
free(strings);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-11-07 04:05:42 -06:00
|
|
|
--- misc/liblangtag-0.4.0/liblangtag/lt-string.c
|
|
|
|
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-string.c
|
|
|
|
@@ -302,8 +302,10 @@
|
|
|
|
lt_return_val_if_fail (string != NULL, NULL);
|
|
|
|
lt_return_val_if_fail (path != NULL, string);
|
|
|
|
|
|
|
|
+#ifndef _WIN32
|
|
|
|
if (lt_string_length(string) == 0 && path[0] != LT_DIR_SEPARATOR)
|
|
|
|
lt_string_append(string, LT_DIR_SEPARATOR_S);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
va_start(ap, path);
|
|
|
|
p = path;
|
2012-11-06 12:21:37 -06:00
|
|
|
--- misc/liblangtag-0.4.0/liblangtag/lt-tag.c
|
|
|
|
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-tag.c
|
|
|
|
@@ -15,9 +15,15 @@
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
+#ifndef _WIN32
|
|
|
|
#include <langinfo.h>
|
|
|
|
+#endif
|
|
|
|
#include <locale.h>
|
2012-11-06 16:02:38 -06:00
|
|
|
+#ifndef HAVE_STDINT_H
|
2012-11-06 12:21:37 -06:00
|
|
|
+typedef int int32_t;
|
|
|
|
+#else
|
|
|
|
#include <stdint.h>
|
|
|
|
+#endif
|
|
|
|
#include <string.h>
|
|
|
|
#include <libxml/xpath.h>
|
|
|
|
#include "lt-database.h"
|