Revision: 5162
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5162&view=rev
Author:   hofman
Date:     2009-01-25 16:27:03 +0000 (Sun, 25 Jan 2009)

Log Message:
-----------
Add option to prevent compression of EA data

Modified Paths:
--------------
    trunk/SkimNotes/SKNExtendedAttributeManager.h
    trunk/SkimNotes/SKNExtendedAttributeManager.m

Modified: trunk/SkimNotes/SKNExtendedAttributeManager.h
===================================================================
--- trunk/SkimNotes/SKNExtendedAttributeManager.h       2009-01-24 11:01:56 UTC 
(rev 5161)
+++ trunk/SkimNotes/SKNExtendedAttributeManager.h       2009-01-25 16:27:03 UTC 
(rev 5162)
@@ -51,13 +51,15 @@
     @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.
 */
 enum {
     kSKNXattrDefault     = 0,
     kSKNXattrNoFollow    = 1 << 1,
     kSKNXattrCreateOnly  = 1 << 2,
     kSKNXattrReplaceOnly = 1 << 3,
-    kSKNXattrNoSplitData = 1 << 4
+    kSKNXattrNoSplitData = 1 << 4,
+    kSKNXattrNoCompress  = 1 << 5,
 };
 typedef int SKNXattrFlags;
 

Modified: trunk/SkimNotes/SKNExtendedAttributeManager.m
===================================================================
--- trunk/SkimNotes/SKNExtendedAttributeManager.m       2009-01-24 11:01:56 UTC 
(rev 5161)
+++ trunk/SkimNotes/SKNExtendedAttributeManager.m       2009-01-25 16:27:03 UTC 
(rev 5162)
@@ -315,7 +315,8 @@
     if ((options & kSKNXattrNoSplitData) == 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];
+        if ((options & kSKNXattrNoCompress) == 0)
+            value = [self bzipData:value];
         
         // this will be a unique identifier for the set of keys we're about to 
write (appending a counter to the UUID)
         NSString *uniqueValue = [namePrefix 
stringByAppendingString:UNIQUE_VALUE];
@@ -373,7 +374,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) && 
[data length] > MAX_XATTR_LENGTH)
+        if (((options & kSKNXattrNoSplitData) != 0 || namePrefix == nil) && 
(options & kSKNXattrNoCompress) == 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.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to