[Xquartz-changes] xserver: Branch 'master' - 2 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Wed Jun 1 21:58:38 PDT 2011


Rebased ref, commits from common ancestor:
commit 48b4b778f61daaa161483b510ab520f3fcb84925
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 1 21:55:06 2011 -0700

    XQuartz: xpbproxy: Correct NSUInteger format strings
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m
index 7964f51..b5f4dde 100644
--- a/hw/xquartz/pbproxy/x-selection.m
+++ b/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];
 }
 
commit 971193b2750b98b28597ba194ed388e79b3489b6
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 1 21:18:03 2011 -0700

    XQuartz: ASL: Use xpbproxy subsystem for logging xpbproxy messages
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m
index a8c3a60..772c458 100644
--- a/hw/xquartz/pbproxy/app-main.m
+++ b/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/hw/xquartz/pbproxy/pbproxy.h b/hw/xquartz/pbproxy/pbproxy.h
index fcbf4c4..c80a660 100644
--- a/hw/xquartz/pbproxy/pbproxy.h
+++ b/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 */


More information about the Xquartz-changes mailing list