jbm: it compiles... but bombs in unit tests
5 * Created by Jens Alfke on 8/18/09.
6 * Copyright 2009 Jens Alfke. All rights reserved.
7 * BSD-Licensed: See the file "LICENSE.txt" for details.
16 #include <CoreFoundation/CFUUID.h>
24 Blob::Blob (const char *str)
26 length(str ?strlen(str) :0)
30 struct MutableBlob :public Blob {
31 MutableBlob(void *b, size_t len) :Blob(b,len) { }
32 void* mutableBytes() {return (void*)bytes;}
33 void freeBytes() {::free(mutableBytes()); bytes=NULL; length=0;}
35 MutableBlob Blob::copyBytes() const {
36 MutableBlob copy( malloc(length), length);
37 memcpy(copy.mutableBytes(), bytes, length);
46 /** Typical 128-bit universally-unique identifier. */
50 const void *bytes() const {return _bytes;}
51 bool operator== (const UUID&) const;
58 CFUUIDRef u = CFUUIDCreate(NULL);
59 CFUUIDBytes bytes = CFUUIDGetUUIDBytes(u);
60 memcpy(&_bytes, &bytes, sizeof(_bytes));
64 bool UUID::operator== (const UUID& u) const {
65 return memcmp(_bytes, u._bytes, sizeof(_bytes)) == 0;