aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xquartz/pbproxy
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xquartz/pbproxy')
-rw-r--r--xorg-server/hw/xquartz/pbproxy/app-main.m11
-rw-r--r--xorg-server/hw/xquartz/pbproxy/pbproxy.h15
-rw-r--r--xorg-server/hw/xquartz/pbproxy/x-selection.m27
3 files changed, 46 insertions, 7 deletions
diff --git a/xorg-server/hw/xquartz/pbproxy/app-main.m b/xorg-server/hw/xquartz/pbproxy/app-main.m
index a8c3a6055..772c458a1 100644
--- a/xorg-server/hw/xquartz/pbproxy/app-main.m
+++ b/xorg-server/hw/xquartz/pbproxy/app-main.m
@@ -63,6 +63,17 @@ ErrorF(const char * f, ...)
va_end(args);
}
+/* TODO: Have this actually log to ASL */
+void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...) {
+#ifdef DEBUG
+ va_list args;
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+#endif
+}
+
int main (int argc, const char *argv[]) {
const char *s;
int i;
diff --git a/xorg-server/hw/xquartz/pbproxy/pbproxy.h b/xorg-server/hw/xquartz/pbproxy/pbproxy.h
index fcbf4c4ba..c80a660cc 100644
--- a/xorg-server/hw/xquartz/pbproxy/pbproxy.h
+++ b/xorg-server/hw/xquartz/pbproxy/pbproxy.h
@@ -32,6 +32,8 @@
#import <Foundation/Foundation.h>
+#include <asl.h>
+
#include <AvailabilityMacros.h>
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
#if __LP64__ || NS_BUILD_32_LIKE_64
@@ -80,13 +82,12 @@ extern BOOL xpbproxy_input_register (void);
/* os/log.c or app-main.m */
extern void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
-#ifdef DEBUG
-/* BEWARE: this can cause a string memory leak, according to the leaks program. */
-# define DebugF(msg, args...) ErrorF("%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args)
-#else
-# define DebugF(...) /* */
-#endif
+/* from darwin.h */
+_X_ATTRIBUTE_PRINTF(6,7)
+extern void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...);
-#define TRACE() DebugF("TRACE\n")
+#define ASL_LOG(level, subsystem, msg, args...) xq_asl_log(level, subsystem, __FILE__, __FUNCTION__, __LINE__, msg, ##args)
+#define DebugF(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "xpbproxy", msg, ##args)
+#define TRACE() DebugF("TRACE")
#endif /* PBPROXY_H */
diff --git a/xorg-server/hw/xquartz/pbproxy/x-selection.m b/xorg-server/hw/xquartz/pbproxy/x-selection.m
index 7964f5193..b5f4dde5c 100644
--- a/xorg-server/hw/xquartz/pbproxy/x-selection.m
+++ b/xorg-server/hw/xquartz/pbproxy/x-selection.m
@@ -683,7 +683,11 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
return;
}
+#ifdef __LP64__
+ DebugF ("pbtypes retainCount after containsObject: %lu\n", [pbtypes retainCount]);
+#else
DebugF ("pbtypes retainCount after containsObject: %u\n", [pbtypes retainCount]);
+#endif
data = [pb stringForType:NSStringPboardType];
@@ -704,7 +708,11 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if (length < 50) {
DebugF ("UTF-8: %s\n", bytes);
+#ifdef __LP64__
+ DebugF ("UTF-8 length: %lu\n", length);
+#else
DebugF ("UTF-8 length: %u\n", length);
+#endif
}
}
else
@@ -1223,8 +1231,13 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
return;
}
+#ifdef __LP64__
+ DebugF ("data retainCount before NSBitmapImageRep initWithData: %lu\n",
+ [data retainCount]);
+#else
DebugF ("data retainCount before NSBitmapImageRep initWithData: %u\n",
[data retainCount]);
+#endif
bmimage = [[NSBitmapImageRep alloc] initWithData:data];
@@ -1235,8 +1248,13 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
return;
}
+#ifdef __LP64__
+ DebugF ("data retainCount after NSBitmapImageRep initWithData: %lu\n",
+ [data retainCount]);
+#else
DebugF ("data retainCount after NSBitmapImageRep initWithData: %u\n",
[data retainCount]);
+#endif
@try
{
@@ -1251,7 +1269,11 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
return;
}
+#ifdef __LP64__
+ DebugF ("bmimage retainCount after TIFFRepresentation %lu\n", [bmimage retainCount]);
+#else
DebugF ("bmimage retainCount after TIFFRepresentation %u\n", [bmimage retainCount]);
+#endif
pbtypes = [NSArray arrayWithObjects:NSTIFFPboardType, nil];
@@ -1270,7 +1292,12 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
[data autorelease];
+#ifdef __LP64__
+ DebugF ("bmimage retainCount before release %lu\n", [bmimage retainCount]);
+#else
DebugF ("bmimage retainCount before release %u\n", [bmimage retainCount]);
+#endif
+
[bmimage autorelease];
}