[darwinbuild-changes] [860] branches/PR-8279204

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 9 14:21:38 PDT 2010


Revision: 860
          http://trac.macosforge.org/projects/darwinbuild/changeset/860
Author:   wsiegrist at apple.com
Date:     2010-08-09 14:21:36 -0700 (Mon, 09 Aug 2010)
Log Message:
-----------
Use CC_SHA1_DIGEST_LENGTH where we hardcoded 20.

Modified Paths:
--------------
    branches/PR-8279204/darwinbuild/digest.c
    branches/PR-8279204/darwinbuild/manifest.c
    branches/PR-8279204/darwinup/DB.cpp
    branches/PR-8279204/darwinxref/plugins/register.c

Modified: branches/PR-8279204/darwinbuild/digest.c
===================================================================
--- branches/PR-8279204/darwinbuild/digest.c	2010-08-06 21:39:09 UTC (rev 859)
+++ branches/PR-8279204/darwinbuild/digest.c	2010-08-09 21:21:36 UTC (rev 860)
@@ -66,11 +66,11 @@
 }
 
 char* calculate_digest(int fd) {
-	unsigned char md[20];
+	unsigned char md[CC_SHA1_DIGEST_LENGTH];
 	CC_SHA1_CTX c;
 	CC_SHA1_Init(&c);
 	
-	memset(md, 0, 20);
+	memset(md, 0, CC_SHA1_DIGEST_LENGTH);
 	
 	ssize_t len;
 	const unsigned int blocklen = 8192;

Modified: branches/PR-8279204/darwinbuild/manifest.c
===================================================================
--- branches/PR-8279204/darwinbuild/manifest.c	2010-08-06 21:39:09 UTC (rev 859)
+++ branches/PR-8279204/darwinbuild/manifest.c	2010-08-09 21:21:36 UTC (rev 860)
@@ -63,11 +63,11 @@
 }
 
 static char* calculate_digest(int fd) {
-	unsigned char md[20];
+	unsigned char md[CC_SHA1_DIGEST_LENGTH];
 	CC_SHA1_CTX c;
 	CC_SHA1_Init(&c);
 	
-	memset(md, 0, 20);
+	memset(md, 0, CC_SHA1_DIGEST_LENGTH);
 	
 	ssize_t len;
 	const unsigned int blocklen = 8192;

Modified: branches/PR-8279204/darwinup/DB.cpp
===================================================================
--- branches/PR-8279204/darwinup/DB.cpp	2010-08-06 21:39:09 UTC (rev 859)
+++ branches/PR-8279204/darwinup/DB.cpp	2010-08-09 21:21:36 UTC (rev 860)
@@ -160,8 +160,8 @@
 	memcpy(&dp, &data[this->file_offset(7)], sizeof(uint8_t*));
 	if (dp) {
 		digest = new SHA1Digest();
-		digest->m_size = 20; // size of SHA1 hash
-		memcpy(digest->m_data, dp, 20);
+		digest->m_size = CC_SHA1_DIGEST_LENGTH;
+		memcpy(digest->m_data, dp, CC_SHA1_DIGEST_LENGTH);
 	}
 	
 	char* path;

Modified: branches/PR-8279204/darwinxref/plugins/register.c
===================================================================
--- branches/PR-8279204/darwinxref/plugins/register.c	2010-08-06 21:39:09 UTC (rev 859)
+++ branches/PR-8279204/darwinxref/plugins/register.c	2010-08-09 21:21:36 UTC (rev 860)
@@ -130,11 +130,11 @@
 }
 
 static char* calculate_digest(int fd) {
-	unsigned char md[20];
+	unsigned char md[CC_SHA1_DIGEST_LENGTH];
 	CC_SHA1_CTX c;
 	CC_SHA1_Init(&c);
 	
-	memset(md, 0, 20);
+	memset(md, 0, CC_SHA1_DIGEST_LENGTH);
 	
 	ssize_t len;
 	const unsigned int blocklen = 8192;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100809/74e83e4b/attachment.html>


More information about the darwinbuild-changes mailing list