[darwinbuild-changes] [713] branches/PR-7489777/darwinup
source_changes at macosforge.org
source_changes at macosforge.org
Tue Feb 23 09:44:25 PST 2010
Revision: 713
http://trac.macosforge.org/projects/darwinbuild/changeset/713
Author: wsiegrist at apple.com
Date: 2010-02-23 09:44:23 -0800 (Tue, 23 Feb 2010)
Log Message:
-----------
Correctly copy digest pointer from row data and check for null. Test suite passes.
Modified Paths:
--------------
branches/PR-7489777/darwinup/DB.cpp
branches/PR-7489777/darwinup/Depot.cpp
branches/PR-7489777/darwinup/Digest.h
branches/PR-7489777/darwinup/Utils.cpp
branches/PR-7489777/darwinup/main.cpp
Modified: branches/PR-7489777/darwinup/DB.cpp
===================================================================
--- branches/PR-7489777/darwinup/DB.cpp 2010-02-23 00:55:55 UTC (rev 712)
+++ branches/PR-7489777/darwinup/DB.cpp 2010-02-23 17:44:23 UTC (rev 713)
@@ -32,7 +32,6 @@
#include "DB.h"
-
DarwinupDatabase::DarwinupDatabase() {
this->connect();
}
@@ -128,9 +127,6 @@
memcpy(&serial, &data[this->file_offset(0)], sizeof(uint64_t));
uint64_t archive_serial;
memcpy(&archive_serial, &data[this->file_offset(1)], sizeof(uint64_t));
-
- IF_DEBUG("make_file offset %d found serial %llu \n", this->file_offset(1), archive_serial);
-
uint64_t info;
memcpy(&info, &data[this->file_offset(2)], sizeof(uint64_t));
uint64_t mode;
@@ -142,10 +138,15 @@
uint64_t size;
memcpy(&size, &data[this->file_offset(6)], sizeof(uint64_t));
- Digest* digest = new Digest();
- digest->m_size = 20; // size of SHA1 hash
- memcpy(digest->m_data, &data[this->file_offset(7)], 20);
-
+ Digest* digest = NULL;
+ uint8_t* dp;
+ memcpy(&dp, &data[this->file_offset(7)], sizeof(uint8_t*));
+ if (dp) {
+ digest = new Digest();
+ digest->m_size = 20; // size of SHA1 hash
+ memcpy(digest->m_data, dp, 20);
+ }
+
char* path;
memcpy(&path, &data[this->file_offset(8)], sizeof(char*));
Modified: branches/PR-7489777/darwinup/Depot.cpp
===================================================================
--- branches/PR-7489777/darwinup/Depot.cpp 2010-02-23 00:55:55 UTC (rev 712)
+++ branches/PR-7489777/darwinup/Depot.cpp 2010-02-23 17:44:23 UTC (rev 713)
@@ -390,7 +390,7 @@
uint32_t actual_flags = File::compare(file, actual);
uint32_t preceding_flags = File::compare(actual, preceding);
-
+
// If file == actual && actual == preceding then nothing needs to be done.
if (actual_flags == FILE_INFO_IDENTICAL && preceding_flags == FILE_INFO_IDENTICAL) {
state = ' ';
Modified: branches/PR-7489777/darwinup/Digest.h
===================================================================
--- branches/PR-7489777/darwinup/Digest.h 2010-02-23 00:55:55 UTC (rev 712)
+++ branches/PR-7489777/darwinup/Digest.h 2010-02-23 17:44:23 UTC (rev 713)
@@ -37,6 +37,8 @@
#include <stdint.h>
#include <openssl/evp.h>
+#include "Utils.h"
+
////
// Digest
//
Modified: branches/PR-7489777/darwinup/Utils.cpp
===================================================================
--- branches/PR-7489777/darwinup/Utils.cpp 2010-02-23 00:55:55 UTC (rev 712)
+++ branches/PR-7489777/darwinup/Utils.cpp 2010-02-23 17:44:23 UTC (rev 713)
@@ -245,3 +245,21 @@
if (res == 0) return localfile;
return NULL;
}
+
+void __data_hex(uint8_t* data, uint32_t size) {
+ if (!size) return;
+ for (uint32_t i=0; i < size; i++) {
+ if (!(i%8)) {
+ if (i<10) fprintf(stderr, " ");
+ fprintf(stderr, "%d", i);
+ } else {
+ fprintf(stderr, " ");
+ }
+ }
+ fprintf(stderr, "\n");
+ for (uint32_t i=0; i < size; i++) {
+ fprintf(stderr, "%02x", data[i]);
+ }
+ fprintf(stderr, "\n");
+}
+
Modified: branches/PR-7489777/darwinup/main.cpp
===================================================================
--- branches/PR-7489777/darwinup/main.cpp 2010-02-23 00:55:55 UTC (rev 712)
+++ branches/PR-7489777/darwinup/main.cpp 2010-02-23 17:44:23 UTC (rev 713)
@@ -46,22 +46,6 @@
#include <unistd.h>
#include <limits.h>
-void __data_hex(uint8_t* data, uint32_t size) {
- if (!size) return;
- for (uint32_t i=0; i < size; i++) {
- if (!(i%8)) {
- if (i<10) fprintf(stderr, " ");
- fprintf(stderr, "%d", i);
- } else {
- fprintf(stderr, " ");
- }
- }
- fprintf(stderr, "\n");
- for (uint32_t i=0; i < size; i++) {
- fprintf(stderr, "%02x", data[i]);
- }
- fprintf(stderr, "\n");
-}
void __str_hex(const char* str) {
int i = 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100223/5eea6494/attachment.html>
More information about the darwinbuild-changes
mailing list