Revision: 15793
http://sourceforge.net/p/skim-app/code/15793
Author: hofman
Date: 2025-11-12 16:32:07 +0000 (Wed, 12 Nov 2025)
Log Message:
-----------
Use enum macros to define enums. Replace xattr writing options removing leading
k.
Modified Paths:
--------------
trunk/SkimNotes/NSFileManager_SKNExtensions.h
trunk/SkimNotes/NSFileManager_SKNExtensions.m
trunk/SkimNotes/NSFileManager_SKNToolExtensions.h
trunk/SkimNotes/NSFileManager_SKNToolExtensions.m
trunk/SkimNotes/PDFAnnotation_SKNExtensions.h
trunk/SkimNotes/SKNExtendedAttributeManager.h
trunk/SkimNotes/SKNExtendedAttributeManager.m
Modified: trunk/SkimNotes/NSFileManager_SKNExtensions.h
===================================================================
--- trunk/SkimNotes/NSFileManager_SKNExtensions.h 2025-11-11 23:03:21 UTC
(rev 15792)
+++ trunk/SkimNotes/NSFileManager_SKNExtensions.h 2025-11-12 16:32:07 UTC
(rev 15793)
@@ -45,7 +45,7 @@
NS_ASSUME_NONNULL_BEGIN
-/*!
+/**
@enum SKNSkimNotesWritingOptions
@abstract Options for writing Skim notes.
@discussion These options can be passed to the main methods for writing Skim
notes to extended attributes or to file.
@@ -52,11 +52,10 @@
@constant SKNSkimNotesWritingPlist Write plist data rather than
archived data. Always implied on iOS.
@constant SKNSkimNotesWritingSyncable Hint to add a syncable flag to the
attribute names if available, when writing to extended attributes.
*/
-enum {
+typedef NS_OPTIONS(NSInteger, SKNSkimNotesWritingOptions) {
SKNSkimNotesWritingPlist = 1 << 0,
SKNSkimNotesWritingSyncable = 1 << 1
};
-typedef NSInteger SKNSkimNotesWritingOptions;
/*!
@abstract Provides methods to access Skim notes in extended attributes
or PDF bundles.
Modified: trunk/SkimNotes/NSFileManager_SKNExtensions.m
===================================================================
--- trunk/SkimNotes/NSFileManager_SKNExtensions.m 2025-11-11 23:03:21 UTC
(rev 15792)
+++ trunk/SkimNotes/NSFileManager_SKNExtensions.m 2025-11-12 16:32:07 UTC
(rev 15793)
@@ -72,7 +72,7 @@
[eam removeExtendedAttributeNamed:SKIM_RTF_NOTES_KEY atPath:path
traverseLink:YES error:NULL];
if ([notes count]) {
- SKNXattrFlags xattrOptions = (options &
SKNSkimNotesWritingSyncable) ? kSKNXattrSyncable : kSKNXattrDefault;
+ SKNXattrFlags xattrOptions = (options &
SKNSkimNotesWritingSyncable) ? SKNXattrSyncable : SKNXattrDefault;
if ([eam setExtendedAttributeNamed:SKIM_NOTES_KEY toValue:data
atPath:path options:xattrOptions error:&error] == NO) {
success = NO;
if (outError) *outError = error;
Modified: trunk/SkimNotes/NSFileManager_SKNToolExtensions.h
===================================================================
--- trunk/SkimNotes/NSFileManager_SKNToolExtensions.h 2025-11-11 23:03:21 UTC
(rev 15792)
+++ trunk/SkimNotes/NSFileManager_SKNToolExtensions.h 2025-11-12 16:32:07 UTC
(rev 15793)
@@ -40,12 +40,11 @@
NS_ASSUME_NONNULL_BEGIN
-enum {
+typedef NS_ENUM(NSInteger, SKNSyncability) {
SKNNonSyncable = -1,
SKNAnySyncable = 0,
SKNSyncable = 1
};
-typedef NSInteger SKNSyncability;
@interface NSFileManager (SKNToolExtensions)
Modified: trunk/SkimNotes/NSFileManager_SKNToolExtensions.m
===================================================================
--- trunk/SkimNotes/NSFileManager_SKNToolExtensions.m 2025-11-11 23:03:21 UTC
(rev 15792)
+++ trunk/SkimNotes/NSFileManager_SKNToolExtensions.m 2025-11-12 16:32:07 UTC
(rev 15793)
@@ -181,7 +181,7 @@
}
} else {
SKNExtendedAttributeManager *eam = [SKNExtendedAttributeManager
sharedManager];
- SKNXattrFlags options = syncable ? kSKNXattrSyncable :
kSKNXattrDefault;
+ SKNXattrFlags options = syncable ? SKNXattrSyncable :
SKNXattrDefault;
success = [eam setExtendedAttributeNamed:SKIM_NOTES_KEY
toValue:notesData atPath:path options:options error:&error];
if (textNotes)
[eam setExtendedAttributeNamed:SKIM_TEXT_NOTES_KEY
toPropertyListValue:textNotes atPath:path options:options error:NULL];
Modified: trunk/SkimNotes/PDFAnnotation_SKNExtensions.h
===================================================================
--- trunk/SkimNotes/PDFAnnotation_SKNExtensions.h 2025-11-11 23:03:21 UTC
(rev 15792)
+++ trunk/SkimNotes/PDFAnnotation_SKNExtensions.h 2025-11-12 16:32:07 UTC
(rev 15793)
@@ -246,7 +246,7 @@
*/
PDFKIT_EXTERN NSString * const SKNPDFAnnotationFieldNameKey;
-/*!
+/**
@enum SKNWidgetType
@abstract Type of widget annotations.
@discussion These enum values indicate the type of a widget annotation.
@@ -255,13 +255,12 @@
@constant kSKNPDFWidgetTypeButton A button widget annotation.
@constant kSKNPDFWidgetTypeChoice A choice widget annotation.
*/
-enum {
+typedef NS_ENUM(NSInteger, SKNPDFWidgetType) {
kSKNPDFWidgetTypeUnknown = -1,
kSKNPDFWidgetTypeText = 0,
kSKNPDFWidgetTypeButton = 1,
kSKNPDFWidgetTypeChoice = 2
};
-typedef NSInteger SKNPDFWidgetType;
/*!
@abstract Provides methods to translate between dictionary
representations of Skim notes and <code>PDFAnnotation</code> objects on macOS.
Modified: trunk/SkimNotes/SKNExtendedAttributeManager.h
===================================================================
--- trunk/SkimNotes/SKNExtendedAttributeManager.h 2025-11-11 23:03:21 UTC
(rev 15792)
+++ trunk/SkimNotes/SKNExtendedAttributeManager.h 2025-11-12 16:32:07 UTC
(rev 15793)
@@ -45,28 +45,35 @@
NS_ASSUME_NONNULL_BEGIN
-/*!
+/**
@enum SKNXattrFlags
@abstract Options for writing extended attributes.
@discussion These options can be passed to methods writing extended
attributes to modify the way these methods behave.
- @constant kSKNXattrDefault Create or replace, follow symlinks,
split data.
- @constant kSKNXattrNoFollow Don't follow symlinks.
- @constant kSKNXattrCreateOnly Setting will fail if the attribute
already exists.
- @constant kSKNXattrReplaceOnly Setting will fail if the attribute does
not exist.
- @constant kSKNXattrNoSplitData Don't split data objects into segments.
- @constant kSKNXattrNoCompress Don't compress data to reduce space for
long attributes.
- @constant kSKNXattrSyncable Add a syncable flag to the attribute
name if available.
+ @constant SKNXattrDefault Create or replace, follow symlinks,
split data.
+ @constant SKNXattrNoFollow Don't follow symlinks.
+ @constant SKNXattrCreateOnly Setting will fail if the attribute
already exists.
+ @constant SKNXattrReplaceOnly Setting will fail if the attribute does
not exist.
+ @constant SKNXattrNoSplitData Don't split data objects into segments.
+ @constant SKNXattrNoCompress Don't compress data to reduce space for
long attributes.
+ @constant SKNXattrSyncable Add a syncable flag to the attribute
name if available.
*/
-enum {
- kSKNXattrDefault = 0,
- kSKNXattrNoFollow = 1 << 1,
- kSKNXattrCreateOnly = 1 << 2,
- kSKNXattrReplaceOnly = 1 << 3,
- kSKNXattrNoSplitData = 1 << 4,
- kSKNXattrNoCompress = 1 << 5,
- kSKNXattrSyncable = 1 << 6
+typedef NS_OPTIONS(NSInteger, SKNXattrFlags) {
+ SKNXattrDefault = 0,
+ SKNXattrNoFollow = 1 << 1,
+ SKNXattrCreateOnly = 1 << 2,
+ SKNXattrReplaceOnly = 1 << 3,
+ SKNXattrNoSplitData = 1 << 4,
+ SKNXattrNoCompress = 1 << 5,
+ SKNXattrSyncable = 1 << 6,
+
+ kSKNXattrDefault NS_SWIFT_UNAVAILABLE("Use SKNXattr.Default instead")
= SKNXattrDefault,
+ kSKNXattrNoFollow NS_SWIFT_UNAVAILABLE("Use SKNXattr.NoFollow instead")
= SKNXattrNoFollow,
+ kSKNXattrCreateOnly NS_SWIFT_UNAVAILABLE("Use SKNXattr.CreateOnly
instead") = SKNXattrCreateOnly,
+ kSKNXattrReplaceOnly NS_SWIFT_UNAVAILABLE("Use SKNXattr.ReplaceOnly
instead") = SKNXattrReplaceOnly,
+ kSKNXattrNoSplitData NS_SWIFT_UNAVAILABLE("Use SKNXattr.NoSplitData
instead") = SKNXattrNoSplitData,
+ kSKNXattrNoCompress NS_SWIFT_UNAVAILABLE("Use SKNXattr.NoCompress
instead") = SKNXattrNoCompress,
+ kSKNXattrSyncable NS_SWIFT_UNAVAILABLE("Use SKNXattr.Syncable instead")
= SKNXattrSyncable
};
-typedef NSInteger SKNXattrFlags;
/*!
@discussion Error domain for the extended attribute manager used for
non-POSIX errors.
@@ -73,7 +80,7 @@
*/
FOUNDATION_EXTERN NSErrorDomain const SKNSkimNotesErrorDomain;
-/*!
+/**
@enum SKNErrorCodes
@abstract Error codes in the SKNSkimNotesErrorDomain.
@discussion These error codes are the non-POSIX errors returned by the
extended attribute manager. Apart from these, also errors from
NSPOSIXErrorDomain can be returned.
@@ -82,7 +89,7 @@
@constant SKNPlistDeserializationFailedError Property list
deserialization failed. Uses the description from NSPropertyListSerialization.
@constant SKNInvalidDataError The data that was found
was not valid.
*/
-enum {
+NS_ERROR_ENUM(SKNSkimNotesErrorDomain) {
SKNReassembleAttributeFailedError = 1,
SKNPlistSerializationFailedError = 2,
SKNPlistDeserializationFailedError = 3,
Modified: trunk/SkimNotes/SKNExtendedAttributeManager.m
===================================================================
--- trunk/SkimNotes/SKNExtendedAttributeManager.m 2025-11-11 23:03:21 UTC
(rev 15792)
+++ trunk/SkimNotes/SKNExtendedAttributeManager.m 2025-11-12 16:32:07 UTC
(rev 15793)
@@ -339,7 +339,7 @@
- (BOOL)setExtendedAttributeNamed:(NSString *)attr toValue:(NSData *)value
atPath:(NSString *)path options:(SKNXattrFlags)options error:(NSError **)error;
{
- if((options & kSKNXattrSyncable) && NSFoundationVersionNumber >=
NSFoundationVersionNumber10_10 && [attr
rangeOfString:SYNCABLE_SEPARATOR].location == NSNotFound){
+ if((options & SKNXattrSyncable) && NSFoundationVersionNumber >=
NSFoundationVersionNumber10_10 && [attr
rangeOfString:SYNCABLE_SEPARATOR].location == NSNotFound){
attr = [attr stringByAppendingString:SYNCABLE_FLAG];
}
@@ -348,16 +348,16 @@
// options passed to xattr functions
int xopts = 0;
- if(options & kSKNXattrNoFollow)
+ if(options & SKNXattrNoFollow)
xopts = XATTR_NOFOLLOW;
- if(options & kSKNXattrCreateOnly)
+ if(options & SKNXattrCreateOnly)
xopts |= XATTR_CREATE;
- if(options & kSKNXattrReplaceOnly)
+ if(options & SKNXattrReplaceOnly)
xopts |= XATTR_REPLACE;
BOOL success;
- if ((options & kSKNXattrNoSplitData) == 0 && _namePrefix && [value length]
> MAX_XATTR_LENGTH) {
+ if ((options & SKNXattrNoSplitData) == 0 && _namePrefix && [value length]
> MAX_XATTR_LENGTH) {
// compress to save space, and so we don't identify this as a plist
when reading it (in case it really is plist data)
value = [self bzipData:value];
@@ -425,7 +425,7 @@
success = NO;
} else {
// if we don't split and the data is too long, compress the data using
bzip to save space
- if (((options & kSKNXattrNoSplitData) != 0 || _namePrefix == nil) &&
(options & kSKNXattrNoCompress) == 0 && [data length] > MAX_XATTR_LENGTH)
+ if (((options & SKNXattrNoSplitData) != 0 || _namePrefix == nil) &&
(options & SKNXattrNoCompress) == 0 && [data length] > MAX_XATTR_LENGTH)
data = [self bzipData:data];
success = [self setExtendedAttributeNamed:attr toValue:data
atPath:path options:options error:error];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit