[darwinbuild-changes] [13] trunk/darwinxref/plugins

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 01:36:59 PDT 2006


Revision: 13
          http://trac.macosforge.org/projects/darwinbuild/changeset/13
Author:   kevin
Date:     2006-10-04 01:36:59 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
- fixed pointer dereferencing bug

Modified Paths:
--------------
    trunk/darwinxref/plugins/exportFiles.c
    trunk/darwinxref/plugins/findFile.c

Modified: trunk/darwinxref/plugins/exportFiles.c
===================================================================
--- trunk/darwinxref/plugins/exportFiles.c	2005-06-16 21:29:41 UTC (rev 12)
+++ trunk/darwinxref/plugins/exportFiles.c	2006-10-04 08:36:59 UTC (rev 13)
@@ -75,12 +75,7 @@
 }
 
 int printFiles(void* pArg, int argc, char **argv, char** columnNames) {
-	char* project = ((char**)pArg)[0];
-	if (strcmp(project, argv[0]) != 0) {
-		strncpy(project, argv[0], BUFSIZ);
-		fprintf(stdout, "%s:\n", project);
-	}
-	fprintf(stdout, "\t%s\n", argv[3]);
+	fprintf(stdout, "\t%s\n", argv[0]);
 	return 0;
 }
 
@@ -94,17 +89,26 @@
 
 	fprintf(stdout, "# BUILD %s\n", build);
 
-	CFArrayRef projects = DBCopyProjectNames(session, DBGetCurrentBuild(session));
-	if (projects) {
-		CFIndex i, count = CFArrayGetCount(projects);
-		for (i = 0; i < count; ++i) {
-			CFStringRef name = CFArrayGetValueAtIndex(projects, i);
-			char projbuf[BUFSIZ];
-			res = SQL_CALLBACK(session, &printFiles, projbuf,
-				"SELECT project,path FROM files WHERE build=%Q AND project=%Q",
-				build, project);
+	if (project) {
+		fprintf(stdout, "%s:\n", project);
+		res = SQL_CALLBACK(session, &printFiles, NULL,
+			"SELECT path FROM files WHERE build=%Q AND project=%Q",
+			build, project);
+	} else {
+		CFArrayRef projects = DBCopyProjectNames(session, DBGetCurrentBuild(session));
+		if (projects) {
+			CFIndex i, count = CFArrayGetCount(projects);
+			for (i = 0; i < count; ++i) {
+				CFStringRef name = CFArrayGetValueAtIndex(projects, i);
+				char* project = strdup_cfstr(name);
+				fprintf(stdout, "%s:\n", project);
+				res = SQL_CALLBACK(session, &printFiles, NULL,
+					"SELECT path FROM files WHERE build=%Q AND project=%Q",
+					build, project);
+				free(project);
+			}
+			CFRelease(projects);
 		}
-		CFRelease(projects);
 	}
 	
 	return 0;

Modified: trunk/darwinxref/plugins/findFile.c
===================================================================
--- trunk/darwinxref/plugins/findFile.c	2005-06-16 21:29:41 UTC (rev 12)
+++ trunk/darwinxref/plugins/findFile.c	2006-10-04 08:36:59 UTC (rev 13)
@@ -73,7 +73,7 @@
 }
 
 int printFiles(void* pArg, int argc, char **argv, char** columnNames) {
-	char* project = ((char**)pArg)[0];
+	char* project = (char*)pArg;
 	if (strcmp(project, argv[0]) != 0) {
 		strncpy(project, argv[0], BUFSIZ);
 		fprintf(stdout, "%s:\n", project);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/99644192/attachment.html


More information about the darwinbuild-changes mailing list