[darwinbuild-changes] [74] trunk/darwinxref

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 01:42:58 PDT 2006


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

Log Message:
-----------
- changed DBSetPlist() to take a project name parameter
  - fixes bug in edit plugin and others

Modified Paths:
--------------
    trunk/darwinxref/DBDataStore.c
    trunk/darwinxref/DBPlugin.h
    trunk/darwinxref/plugins/edit.c
    trunk/darwinxref/plugins/loadIndex.c
    trunk/darwinxref/plugins/mergeBuild.c

Modified: trunk/darwinxref/DBDataStore.c
===================================================================
--- trunk/darwinxref/DBDataStore.c	2005-07-12 23:58:25 UTC (rev 73)
+++ trunk/darwinxref/DBDataStore.c	2006-10-04 08:42:58 UTC (rev 74)
@@ -533,10 +533,10 @@
 }
 
 
-int _DBSetPlist(CFStringRef buildParam, CFStringRef projectParam, CFPropertyListRef plist) {
+int DBSetPlist(CFStringRef buildParam, CFStringRef projectParam, CFPropertyListRef plist) {
 	int res = 0;
 	CFIndex i, count;
-	
+
 	if (!plist) return -1;
 	if (CFGetTypeID(plist) != CFDictionaryGetTypeID()) return -1;
 
@@ -553,6 +553,9 @@
 
 	CFArrayRef props = dictionaryGetSortedKeys(plist);
 
+	res = DBBeginTransaction();
+	if (res != 0) return res;
+
 	//
 	// Delete any properties which may have been removed
 	//
@@ -597,25 +600,15 @@
 		for (i = 0; i < count; ++i ) {
 			CFStringRef project = CFArrayGetValueAtIndex(projectNames, i);
 			CFDictionaryRef subplist = CFDictionaryGetValue(projects, project);
-			res = _DBSetPlist(build, project, subplist);
+			res = DBSetPlist(build, project, subplist);
 			if (res != 0) break;
 		}
 		CFRelease(projectNames);
 	}
 	if (props) CFRelease(props);
-	return res;
-}
 
-int DBSetPlist(CFStringRef buildParam, CFPropertyListRef plist) {
-	int res;
-	res = DBBeginTransaction();
-	if (res != 0) return res;
-	res = _DBSetPlist(buildParam, NULL, plist);
-	if (res != 0) {
-		DBRollbackTransaction();
-		return res;
-	}
 	DBCommitTransaction();
+
 	return res;
 }
 

Modified: trunk/darwinxref/DBPlugin.h
===================================================================
--- trunk/darwinxref/DBPlugin.h	2005-07-12 23:58:25 UTC (rev 73)
+++ trunk/darwinxref/DBPlugin.h	2006-10-04 08:42:58 UTC (rev 74)
@@ -148,7 +148,15 @@
 CFDictionaryRef DBCopyProjectPlist(CFStringRef build, CFStringRef project);
 CFDictionaryRef DBCopyBuildPlist(CFStringRef build);
 
-int DBSetPlist(CFStringRef build, CFPropertyListRef plist);
+/*!
+	@function DBSetPlist
+	Sets properties in the database according to the specified plist.
+	@param build The build number whose properties to set.
+	@param project The project whose properties to set, or if NULL, the entire build.
+	@param plist The plist containing the properties to set.
+	@result The status, 0 for success.
+*/
+int DBSetPlist(CFStringRef build, CFStringRef project, CFPropertyListRef plist);
 
 int DBBeginTransaction();
 int DBCommitTransaction();

Modified: trunk/darwinxref/plugins/edit.c
===================================================================
--- trunk/darwinxref/plugins/edit.c	2005-07-12 23:58:25 UTC (rev 73)
+++ trunk/darwinxref/plugins/edit.c	2006-10-04 08:42:58 UTC (rev 74)
@@ -112,7 +112,7 @@
                         while (!done) {
                                 p = read_plist(tmpfile);
                                 // Check if plist parsed successfully, if so import it
-								if (DBSetPlist(build, p) == 0) {
+								if (DBSetPlist(build, project, p) == 0) {
 										done = 1;
                                         CFRelease(p);
                                 } else {

Modified: trunk/darwinxref/plugins/loadIndex.c
===================================================================
--- trunk/darwinxref/plugins/loadIndex.c	2005-07-12 23:58:25 UTC (rev 73)
+++ trunk/darwinxref/plugins/loadIndex.c	2006-10-04 08:42:58 UTC (rev 74)
@@ -41,7 +41,7 @@
 	char* filename = strdup_cfstr(CFArrayGetValueAtIndex(argv, 0));
 	CFPropertyListRef plist = read_plist(filename);
 	if (plist) {
-		res = DBSetPlist(NULL, plist);
+		res = DBSetPlist(NULL, NULL, plist);
 	}
 	free(filename);
 	return res;

Modified: trunk/darwinxref/plugins/mergeBuild.c
===================================================================
--- trunk/darwinxref/plugins/mergeBuild.c	2005-07-12 23:58:25 UTC (rev 73)
+++ trunk/darwinxref/plugins/mergeBuild.c	2006-10-04 08:42:58 UTC (rev 74)
@@ -64,7 +64,7 @@
 			CFDictionaryApplyFunction(oldproj, addValues, (void*)newproj);
 		}
 	}
-	DBSetPlist(newbuild, newplist);
+	DBSetPlist(newbuild, NULL, newplist);
 	CFRelease(oldplist);
 	CFRelease(newplist);
 	

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


More information about the darwinbuild-changes mailing list