Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

expand attr-mod-time tracking buffers to include catalog node-IDs, as…

… those are also disk-local and cannot be synced
  • Loading branch information...
commit ace11f0f843df525b49ddfabfd8f96517ccd082b 1 parent b6d7bde
@scrod authored
View
85 BufferUtils.c
@@ -298,80 +298,97 @@ CFStringRef GetRelativeDateStringFromTimeAndLocaleInfo(CFAbsoluteTime time, CFSt
}
#endif
-//these two methods manipulate notes' attrmodtime-disk-pair sets, changing the buffers in place
-//on return, pairCount will be set to the number of attrmodtdiskpair structs currently in the buffer
+//these two methods manipulate notes' perdiskinfo groups, changing the buffers in place
+//on return, groupCount will be set to the number of perdiskinfo structs currently in the buffer
-void RemoveAttrModTimeWithDiskIDIndex(UInt16 diskIndex, AttrModDiskPair **attrModPairs, unsigned int *pairCount) {
+void RemovePerDiskInfoWithTableIndex(UInt32 diskIndex, PerDiskInfo **perDiskGroups, unsigned int *groupCount) {
//used to periodically clean out attr-mod-times for disks that have not been seen in a while
//if an entry exists, push everything below it upward and resize the buffer (or just copy to a new buffer)
//otherwise do nothing
- NSUInteger i = 0, count = *pairCount;
+ NSUInteger i = 0, count = *groupCount;
- AttrModDiskPair *pairs = *attrModPairs;
+ PerDiskInfo *groups = *perDiskGroups;
for (i=0; i<count; i++) {
- if (pairs[i].diskIDIndex == diskIndex) {
+ if (groups[i].diskIDIndex == diskIndex) {
if (i < count - 1) {
//if pair isn't the last struct, then bring everything after pair up one spot
- memmove(&pairs[i], &pairs[i + 1], sizeof(AttrModDiskPair) * ((count - 1) - i));
+ memmove(&groups[i], &groups[i + 1], sizeof(PerDiskInfo) * ((count - 1) - i));
}
- ResizeArray(attrModPairs, count - 1, pairCount);
+ ResizeArray(perDiskGroups, count - 1, groupCount);
return;
}
}
}
-unsigned int SetAttrModTimeForDiskIDIndex(UTCDateTime *dateTime, UInt16 diskIndex, AttrModDiskPair **attrModPairs, unsigned int *pairCount) {
+unsigned int SetPerDiskInfoWithTableIndex(UTCDateTime *dateTime, UInt32 *nodeID, UInt32 diskIndex, PerDiskInfo **perDiskGroups, unsigned int *groupCount) {
//if an entry for this diskIndex already exists, then just update it in place
//if an entry does not exist, then resize the buffer and add one at the end
+ //if one of dateTime or nodeID is NULL, then do not set it
- NSUInteger i = 0, count = *pairCount;
+ assert(nodeID || dateTime);
- AttrModDiskPair *pairs = *attrModPairs;
+ NSUInteger i = 0, count = *groupCount;
+
+ PerDiskInfo *groups = *perDiskGroups;
for (i=0; i<count; i++) {
- //use this slot if the diskIndex matches OR it's the first one listed and its attrTime hasn't been touched
- if (pairs[i].diskIDIndex == diskIndex || (!i && *(int64_t*)&(pairs[i].attrTime) == 0LL)) {
- pairs[i].attrTime = *dateTime;
- pairs[i].diskIDIndex = diskIndex;
+ //use this slot if the diskIndex matches OR it's the first one listed and its attrTime and nodeID haven't been touched
+ if (groups[i].diskIDIndex == diskIndex || (!i && groups[i].nodeID == 0U && UTCDateTimeIsEmpty(groups[i].attrTime))) {
+ if (dateTime) groups[i].attrTime = *dateTime;
+ if (nodeID) groups[i].nodeID = *nodeID;
+ groups[i].diskIDIndex = diskIndex;
return i;
+ } else {
+ printf("[%d] diskIDIndex of %d != %d\n", (int)i, (int)groups[i].diskIDIndex, (int)diskIndex);
}
}
- ResizeArray(attrModPairs, count + 1, pairCount);
+// printf("table ID %u not found; expanding to %u\n", (unsigned)diskIndex, (unsigned)(count + 1));
+
+ //diskID not found in existing buffer; add a new entry one or both attributes
+ ResizeArray(perDiskGroups, count + 1, groupCount);
- pairs = *attrModPairs;
- pairs[count].attrTime = *dateTime;
- pairs[count].diskIDIndex = diskIndex;
+ //items not currently being set are initialized to a known value, so that they can be initialized later by attrsModifiedDateOfNote and fileNodeIDOfNote
+ //although those functions do not initialize these to anything particularly useful, anyway
+ groups = *perDiskGroups;
+ groups[count].attrTime = dateTime ? *dateTime : (UTCDateTime){0, 0, 0};
+ groups[count].nodeID = nodeID ? *nodeID : 0;
+ groups[count].diskIDIndex = diskIndex;
return count;
}
-void CopyAttrModPairsToOrder(AttrModDiskPair **flippedPairs, unsigned int *existingCount, AttrModDiskPair *attrModPairs, size_t bufferSize, int toHostOrder) {
- //for decoding and encoding an array of AttrModDiskPair structs as a single buffer
+COMPILE_ASSERT(sizeof(PerDiskInfo) == 16, PER_DISK_INFO_MUST_BE_16_BYTES);
+
+void CopyPerDiskInfoGroupsToOrder(PerDiskInfo **flippedGroups, unsigned int *existingCount, PerDiskInfo *perDiskGroups, size_t bufferSize, int toHostOrder) {
+ //for decoding and encoding an array of PerDiskInfo structs as a single buffer
//swap between host order and big endian
//resizes flippedPairs if it is too small (based on *existingCount)
- NSUInteger i, count = bufferSize / sizeof(AttrModDiskPair);
+ NSUInteger i, count = bufferSize / sizeof(PerDiskInfo);
- ResizeArray(flippedPairs, count, existingCount);
- AttrModDiskPair *newPairs = *flippedPairs;
+ ResizeArray(flippedGroups, count, existingCount);
+ PerDiskInfo *newGroups = *flippedGroups;
+ //does this need to flip the entire struct, too?
if (toHostOrder) {
for (i=0; i<count; i++) {
- AttrModDiskPair pair = attrModPairs[i];
- newPairs[i].attrTime.highSeconds = CFSwapInt16BigToHost(pair.attrTime.highSeconds);
- newPairs[i].attrTime.lowSeconds = CFSwapInt32BigToHost(pair.attrTime.lowSeconds);
- newPairs[i].attrTime.fraction = CFSwapInt16BigToHost(pair.attrTime.fraction);
- newPairs[i].diskIDIndex = CFSwapInt16BigToHost(pair.diskIDIndex);
+ PerDiskInfo group = perDiskGroups[i];
+ newGroups[i].attrTime.highSeconds = CFSwapInt16BigToHost(group.attrTime.highSeconds);
+ newGroups[i].attrTime.lowSeconds = CFSwapInt32BigToHost(group.attrTime.lowSeconds);
+ newGroups[i].attrTime.fraction = CFSwapInt16BigToHost(group.attrTime.fraction);
+ newGroups[i].nodeID = CFSwapInt32BigToHost(group.nodeID);
+ newGroups[i].diskIDIndex = CFSwapInt32BigToHost(group.diskIDIndex);
}
} else {
for (i=0; i<count; i++) {
- AttrModDiskPair pair = attrModPairs[i];
- newPairs[i].attrTime.highSeconds = CFSwapInt16HostToBig(pair.attrTime.highSeconds);
- newPairs[i].attrTime.lowSeconds = CFSwapInt32HostToBig(pair.attrTime.lowSeconds);
- newPairs[i].attrTime.fraction = CFSwapInt16HostToBig(pair.attrTime.fraction);
- newPairs[i].diskIDIndex = CFSwapInt16HostToBig(pair.diskIDIndex);
+ PerDiskInfo group = perDiskGroups[i];
+ newGroups[i].attrTime.highSeconds = CFSwapInt16HostToBig(group.attrTime.highSeconds);
+ newGroups[i].attrTime.lowSeconds = CFSwapInt32HostToBig(group.attrTime.lowSeconds);
+ newGroups[i].attrTime.fraction = CFSwapInt16HostToBig(group.attrTime.fraction);
+ newGroups[i].nodeID = CFSwapInt32HostToBig(group.nodeID);
+ newGroups[i].diskIDIndex = CFSwapInt32HostToBig(group.diskIDIndex);
}
}
}
View
17 BufferUtils.h
@@ -21,16 +21,21 @@
#define ResizeArray(__DirectBuffer, __objCount, __bufObjCount) _ResizeBuffer((void***)(__DirectBuffer), (__objCount), (__bufObjCount), sizeof(typeof(**(__DirectBuffer))))
-typedef struct _AttrModDiskPair {
+#define UTCDateTimeIsEmpty(__UTCDT) (*(int64_t*)&((__UTCDT)) == 0LL)
+
+typedef struct _PerDiskInfo {
//index in a table of disk UUIDs; should be the disk from which this time was gathered
//the disk UUIDs table is tracked separately in FrozenNotation; it should only ever be appended-to
- UInt16 diskIDIndex;
+ UInt32 diskIDIndex;
+
+ //catalog node ID of a file
+ UInt32 nodeID;
//the attribute modification time of a file
UTCDateTime attrTime;
-} AttrModDiskPair;
+} PerDiskInfo;
char *replaceString(char *oldString, const char *newString);
void _ResizeBuffer(void ***buffer, unsigned int objCount, unsigned int *bufSize, unsigned int elemSize);
@@ -46,9 +51,9 @@ NSInteger genericSortContextFirst(int (*context) (void*, void*), void* one, void
NSInteger genericSortContextLast(void* one, void* two, int (*context) (void*, void*));
void QuickSortBuffer(void **buffer, unsigned int objCount, int (*compar)(const void *, const void *));
-void RemoveAttrModTimeWithDiskIDIndex(UInt16 diskIndex, AttrModDiskPair **attrModPairs, unsigned int *pairCount);
-unsigned int SetAttrModTimeForDiskIDIndex(UTCDateTime *dateTime, UInt16 diskIndex, AttrModDiskPair **attrModPairs, unsigned int *pairCount);
-void CopyAttrModPairsToOrder(AttrModDiskPair **flippedPairs, unsigned int *existingCount, AttrModDiskPair *attrModPairs, size_t bufferSize, int toHostOrder);
+void RemovePerDiskInfoWithTableIndex(UInt32 diskIndex, PerDiskInfo **perDiskGroups, unsigned int *groupCount);
+unsigned int SetPerDiskInfoWithTableIndex(UTCDateTime *dateTime, UInt32 *nodeID, UInt32 diskIndex, PerDiskInfo **perDiskGroups, unsigned int *groupCount);
+void CopyPerDiskInfoGroupsToOrder(PerDiskInfo **flippedGroups, unsigned int *existingCount, PerDiskInfo *perDiskGroups, size_t bufferSize, int toHostOrder);
CFStringRef CreateRandomizedFileName();
OSStatus FSCreateFileIfNotPresentInDirectory(FSRef *directoryRef, FSRef *childRef, CFStringRef filename, Boolean *created);
View
2  NotationController.m
@@ -521,7 +521,7 @@ - (BOOL)flushAllNoteChanges {
}
//purge attr-mod-times for old disk uuids here
- [self purgeOldAttrModTimesFromNotes];
+ [self purgeOldPerDiskInfoFromNotes];
NSData *serializedData = [FrozenNotation frozenDataWithExistingNotes:allNotes deletedNotes:deletedNotes prefs:notationPrefs];
View
4 NotationFileManager.h
@@ -38,9 +38,9 @@ OSStatus CreateTemporaryFile(FSRef *parentRef, FSRef *childTempRef);
OSStatus CreateDirectoryIfNotPresent(FSRef *parentRef, CFStringRef subDirectoryName, FSRef *childRef);
CFUUIDRef CopyHFSVolumeUUIDForMount(const char *mntonname);
long BlockSizeForNotation(NotationController *controller);
-unsigned int diskUUIDIndexForNotation(NotationController *controller);
+UInt32 diskUUIDIndexForNotation(NotationController *controller);
-- (void)purgeOldAttrModTimesFromNotes;
+- (void)purgeOldPerDiskInfoFromNotes;
- (void)initializeDiskUUIDIfNecessary;
- (BOOL)notesDirectoryIsTrashed;
View
9 NotationFileManager.m
@@ -179,9 +179,9 @@ static BOOL VolumeSupportsExchangeObjects(NotationController *controller) {
return controller->volumeSupportsExchangeObjects;
}
-- (void)purgeOldAttrModTimesFromNotes {
- //here's where notes' AttrModDiskPair arrays would have older times removed, depending on -[DiskUUIDEntry lastAccessed]
- //each note will use RemoveAttrModTimeWithDiskIDIndex
+- (void)purgeOldPerDiskInfoFromNotes {
+ //here's where notes' PerDiskInfo arrays would have older times removed, depending on -[DiskUUIDEntry lastAccessed]
+ //each note will use RemovePerDiskInfoWithTableIndex
}
- (void)initializeDiskUUIDIfNecessary {
@@ -238,7 +238,7 @@ - (void)initializeDiskUUIDIfNecessary {
return controller->statfsInfo;
}
-unsigned int diskUUIDIndexForNotation(NotationController *controller) {
+UInt32 diskUUIDIndexForNotation(NotationController *controller) {
return controller->diskUUIDIndex;
}
@@ -404,7 +404,6 @@ + (OSStatus)getDefaultNotesDirectoryRef:(FSRef*)notesDir {
//whenever a note uses this method to change its filename, we will have to re-establish all the links to it
- (NSString*)uniqueFilenameForTitle:(NSString*)title fromNote:(NoteObject*)note {
//generate a unique filename based on title, varying numbers
-
BOOL isUnique = YES;
NSString *uniqueFilename = title;
View
2  NotationPrefs.m
@@ -829,7 +829,7 @@ - (NSUInteger)tableIndexOfDiskUUID:(CFUUIDRef)UUIDRef {
return idx;
}
- NSLog(@"saw new disk UUID: %@ (array was %@)", diskEntry, seenDiskUUIDEntries);
+ NSLog(@"saw new disk UUID: %@ (other disks are: %@)", diskEntry, seenDiskUUIDEntries);
[seenDiskUUIDEntries addObject:diskEntry];
preferencesChanged = YES;
View
7 Notation_Prefix.pch
@@ -36,6 +36,11 @@ typedef unsigned int NSUInteger;
#define NSINTEGER_DEFINED 1
#endif
+#define DebugPath(__p) (__p = ((!(__p)) ? __FILE__ : (__p)))
+#define _COMPILE_ASSERT_SYMBOL_INNER(line, msg) __COMPILE_ASSERT_ ## line ## __ ## msg
+#define _COMPILE_ASSERT_SYMBOL(line, msg) _COMPILE_ASSERT_SYMBOL_INNER(line, msg)
+#define COMPILE_ASSERT(test, msg) \
+typedef char _COMPILE_ASSERT_SYMBOL(__LINE__, msg) [ ((test) ? 1 : -1) ]
#define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
@@ -72,3 +77,5 @@ typedef unsigned int NSUInteger;
#define IsSnowLeopardOrLater (floor(NSFoundationVersionNumber) >= NSFoundationVersionNumber10_6)
#define NOTES_MENU_ID 89
+#define VIEW_MENU_ID 99
+
View
4 NoteObject.h
@@ -54,8 +54,8 @@ typedef struct _NoteFilterContext {
UInt32 nodeID;
UInt32 logicalSize;
UTCDateTime fileModifiedDate, *attrsModifiedDate;
- AttrModDiskPair *attrModDiskPairs;
- unsigned int attrModPairCount;
+ PerDiskInfo *perDiskInfoGroups;
+ unsigned int perDiskInfoGroupCount;
int currentFormatID;
NSStringEncoding fileEncoding;
BOOL shouldWriteToFile, didUnarchive;
View
83 NoteObject.m
@@ -51,13 +51,14 @@ @implementation NoteObject
static FSRef *noteFileRefInit(NoteObject* obj);
static void setAttrModifiedDate(NoteObject *note, UTCDateTime *dateTime);
+static void setCatalogNodeID(NoteObject *note, UInt32 cnid);
- (id)init {
if ([super init]) {
- attrModDiskPairs = calloc(1, sizeof(AttrModDiskPair));
- attrModDiskPairs[0].diskIDIndex = -1;
- attrModPairCount = 1;
+ perDiskInfoGroups = calloc(1, sizeof(PerDiskInfo));
+ perDiskInfoGroups[0].diskIDIndex = -1;
+ perDiskInfoGroupCount = 1;
currentFormatID = SingleDatabaseFormat;
fileEncoding = NSUTF8StringEncoding;
@@ -84,8 +85,8 @@ - (void)dealloc {
[dateCreatedString release];
[prefixParentNotes release];
- if (attrModDiskPairs)
- free(attrModDiskPairs);
+ if (perDiskInfoGroups)
+ free(perDiskInfoGroups);
if (cTitle)
free(cTitle);
@@ -121,35 +122,54 @@ - (void)setDelegate:(id)theDelegate {
}
static void setAttrModifiedDate(NoteObject *note, UTCDateTime *dateTime) {
- assert(note->delegate != nil);
- assert(note->attrModDiskPairs);
- unsigned int idx = SetAttrModTimeForDiskIDIndex(dateTime, (UInt16)diskUUIDIndexForNotation(note->delegate),
- &(note->attrModDiskPairs), &(note->attrModPairCount));
- note->attrsModifiedDate = &(note->attrModDiskPairs[idx].attrTime);
+ unsigned int idx = SetPerDiskInfoWithTableIndex(dateTime, NULL, diskUUIDIndexForNotation(note->delegate),
+ &(note->perDiskInfoGroups), &(note->perDiskInfoGroupCount));
+ note->attrsModifiedDate = &(note->perDiskInfoGroups[idx].attrTime);
+}
+static void setCatalogNodeID(NoteObject *note, UInt32 cnid) {
+ SetPerDiskInfoWithTableIndex(NULL, &cnid, diskUUIDIndexForNotation(note->delegate),
+ &(note->perDiskInfoGroups), &(note->perDiskInfoGroupCount));
+ note->nodeID = cnid;
}
UTCDateTime *attrsModifiedDateOfNote(NoteObject *note) {
//once unarchived, the disk UUID index won't change, so this pointer will always reflect the current attr mod time
if (!note->attrsModifiedDate) {
-
- assert(note->attrModDiskPairs);
- assert(note->delegate != nil);
//init from delegate based on disk table index
unsigned int i, tableIndex = diskUUIDIndexForNotation(note->delegate);
- for (i=0; i<note->attrModPairCount; i++) {
- if (note->attrModDiskPairs[i].diskIDIndex == tableIndex) {
- note->attrsModifiedDate = &(note->attrModDiskPairs[i].attrTime);
+ for (i=0; i<note->perDiskInfoGroupCount; i++) {
+ //check if this date has actually been initialized; this entry could be here only because setCatalogNodeID was called
+ if (note->perDiskInfoGroups[i].diskIDIndex == tableIndex && !UTCDateTimeIsEmpty(note->perDiskInfoGroups[i].attrTime)) {
+ note->attrsModifiedDate = &(note->perDiskInfoGroups[i].attrTime);
goto giveDate;
}
}
- //this note doesn't have a file-modified date, so initialize one here
+ //this note doesn't have a file-modified date, so initialize a fairly reasonable one here
setAttrModifiedDate(note, &(note->fileModifiedDate));
}
giveDate:
return note->attrsModifiedDate;
}
+UInt32 fileNodeIDOfNote(NoteObject *note) {
+ if (!note->nodeID) {
+ unsigned int i, tableIndex = diskUUIDIndexForNotation(note->delegate);
+
+ for (i=0; i<note->perDiskInfoGroupCount; i++) {
+ //check if this nodeID has actually been initialized; this entry could be here only because setAttrModifiedDate was called
+ if (note->perDiskInfoGroups[i].diskIDIndex == tableIndex && note->perDiskInfoGroups[i].nodeID != 0U) {
+ note->nodeID = note->perDiskInfoGroups[i].nodeID;
+ goto giveID;
+ }
+ }
+ //this note doesn't have a file-modified date, so initialize something that at least won't repeat this lookup
+ setCatalogNodeID(note, 1);
+ }
+giveID:
+ return note->nodeID;
+}
+
NSInteger compareFilename(id *one, id *two) {
return (NSInteger)CFStringCompare((CFStringRef)((*(NoteObject**)one)->filename),
@@ -212,7 +232,7 @@ NSInteger compareTitleStringReverse(id *a, id *b) {
}
NSInteger compareNodeID(id *a, id *b) {
- return (*(NoteObject**)a)->nodeID - (*(NoteObject**)b)->nodeID;
+ return fileNodeIDOfNote(*(NoteObject**)a) - fileNodeIDOfNote(*(NoteObject**)b);
}
NSInteger compareFileSize(id *a, id *b) {
return (*(NoteObject**)a)->logicalSize - (*(NoteObject**)b)->logicalSize;
@@ -224,7 +244,6 @@ NSInteger compareFileSize(id *a, id *b) {
//syncing w/ server and from journal;
DefModelAttrAccessor(filenameOfNote, filename)
-DefModelAttrAccessor(fileNodeIDOfNote, nodeID)
DefModelAttrAccessor(fileSizeOfNote, logicalSize)
DefModelAttrAccessor(titleOfNote, titleString)
DefModelAttrAccessor(labelsOfNote, labelString)
@@ -315,16 +334,15 @@ - (id)initWithCoder:(NSCoder*)decoder {
logSequenceNumber = [decoder decodeInt32ForKey:VAR_STR(logSequenceNumber)];
currentFormatID = [decoder decodeInt32ForKey:VAR_STR(currentFormatID)];
- nodeID = [decoder decodeInt32ForKey:VAR_STR(nodeID)];
logicalSize = [decoder decodeInt32ForKey:VAR_STR(logicalSize)];
int64_t fileModifiedDate64 = [decoder decodeInt64ForKey:VAR_STR(fileModifiedDate)];
memcpy(&fileModifiedDate, &fileModifiedDate64, sizeof(int64_t));
- NSUInteger decodedAttrModsByteCount = 0;
- const uint8_t *decodedAttrModsBytes = [decoder decodeBytesForKey:VAR_STR(attrModDiskPairs) returnedLength:&decodedAttrModsByteCount];
- if (decodedAttrModsBytes && decodedAttrModsByteCount) {
- CopyAttrModPairsToOrder(&attrModDiskPairs, &attrModPairCount, (AttrModDiskPair *)decodedAttrModsBytes, decodedAttrModsByteCount, 1);
+ NSUInteger decodedPerDiskByteCount = 0;
+ const uint8_t *decodedPerDiskBytes = [decoder decodeBytesForKey:VAR_STR(perDiskInfoGroups) returnedLength:&decodedPerDiskByteCount];
+ if (decodedPerDiskBytes && decodedPerDiskByteCount) {
+ CopyPerDiskInfoGroupsToOrder(&perDiskInfoGroups, &perDiskInfoGroupCount, (PerDiskInfo *)decodedPerDiskBytes, decodedPerDiskByteCount, 1);
}
fileEncoding = [decoder decodeInt32ForKey:VAR_STR(fileEncoding)];
@@ -424,14 +442,13 @@ - (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeInt32:logSequenceNumber forKey:VAR_STR(logSequenceNumber)];
[coder encodeInt32:currentFormatID forKey:VAR_STR(currentFormatID)];
- [coder encodeInt32:nodeID forKey:VAR_STR(nodeID)];
[coder encodeInt32:logicalSize forKey:VAR_STR(logicalSize)];
- uint8_t *flippedModDiskPairs = calloc(attrModPairCount, sizeof(AttrModDiskPair));
- CopyAttrModPairsToOrder((AttrModDiskPair**)&flippedModDiskPairs, &attrModPairCount, attrModDiskPairs, attrModPairCount * sizeof(AttrModDiskPair), 0);
+ uint8_t *flippedPerDiskInfoGroups = calloc(perDiskInfoGroupCount, sizeof(PerDiskInfo));
+ CopyPerDiskInfoGroupsToOrder((PerDiskInfo**)&flippedPerDiskInfoGroups, &perDiskInfoGroupCount, perDiskInfoGroups, perDiskInfoGroupCount * sizeof(PerDiskInfo), 0);
- [coder encodeBytes:flippedModDiskPairs length:attrModPairCount * sizeof(AttrModDiskPair) forKey:VAR_STR(attrModDiskPairs)];
- free(flippedModDiskPairs);
+ [coder encodeBytes:flippedPerDiskInfoGroups length:perDiskInfoGroupCount * sizeof(PerDiskInfo) forKey:VAR_STR(perDiskInfoGroups)];
+ free(flippedPerDiskInfoGroups);
[coder encodeInt64:*(int64_t*)&fileModifiedDate forKey:VAR_STR(fileModifiedDate)];
[coder encodeInt32:fileEncoding forKey:VAR_STR(fileEncoding)];
@@ -534,7 +551,7 @@ - (id)initWithCatalogEntry:(NoteCatalogEntry*)entry delegate:(id)aDelegate {
currentFormatID = [delegate currentNoteStorageFormat];
fileModifiedDate = entry->lastModified;
setAttrModifiedDate(self, &(entry->lastAttrModified));
- nodeID = entry->nodeID;
+ setCatalogNodeID(self, entry->nodeID);
logicalSize = entry->logicalSize;
CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault);
@@ -1299,7 +1316,7 @@ - (OSStatus)writeFileDatesAndUpdateTrackingInfo {
}
fileModifiedDate = catInfo.contentModDate;
setAttrModifiedDate(self, &catInfo.attributeModDate);
- nodeID = catInfo.nodeID;
+ setCatalogNodeID(self, catInfo.nodeID);
logicalSize = (UInt32)(catInfo.dataLogicalSize & 0xFFFFFFFF);
return noErr;
@@ -1401,7 +1418,7 @@ - (BOOL)updateFromFile {
if ([delegate fileInNotesDirectory:noteFileRefInit(self) isOwnedByUs:NULL hasCatalogInfo:&info] == noErr) {
fileModifiedDate = info.contentModDate;
setAttrModifiedDate(self, &info.attributeModDate);
- nodeID = info.nodeID;
+ setCatalogNodeID(self, info.nodeID);
logicalSize = (UInt32)(info.dataLogicalSize & 0xFFFFFFFF);
return YES;
@@ -1426,7 +1443,7 @@ - (BOOL)updateFromCatalogEntry:(NoteCatalogEntry*)catEntry {
fileModifiedDate = catEntry->lastModified;
setAttrModifiedDate(self, &(catEntry->lastAttrModified));
- nodeID = catEntry->nodeID;
+ setCatalogNodeID(self, catEntry->nodeID);
logicalSize = catEntry->logicalSize;
NSMutableData *pathData = [NSMutableData dataWithLength:4 * 1024];
Please sign in to comment.
Something went wrong with that request. Please try again.