ObjFW  Check-in [09d0cd7ac5]

Overview
Comment:OFFile: Code cleanup.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 09d0cd7ac5f0c263e81403eab96cf08db1cfbf627e39ff7dd4249136911907ad
User & Date: js on 2013-12-15 17:57:14
Other Links: manifest | tags
Context
2013-12-15
18:11
Fix a few minor bugs found by the Clang Analyzer. check-in: ffe7645e3a user: js tags: trunk
17:57
OFFile: Code cleanup. check-in: 09d0cd7ac5 user: js tags: trunk
17:56
OFFile: Require a full path for (sym)links. check-in: feaf3faad5 user: js tags: trunk
Changes

Modified src/OFFile.m from [e46a299ae7] to [2af7091a44].

563
564
565
566
567
568
569
570
571
572
573
574
575
576


577
578
579
580


581
582
583
584
585
586
587
563
564
565
566
567
568
569

570
571




572
573




574
575
576
577
578
579
580
581
582







-


-
-
-
-
+
+
-
-
-
-
+
+







			    exceptionWithSourcePath: source
				    destinationPath: destination];
		}

		enumerator = [contents objectEnumerator];
		while ((item = [enumerator nextObject]) != nil) {
			void *pool2 = objc_autoreleasePoolPush();
			OFArray *components;
			OFString *sourcePath, *destinationPath;

			components = [OFArray arrayWithObjects:
			    source, item, nil];
			sourcePath = [OFString pathWithComponents: components];

			sourcePath =
			    [source stringByAppendingPathComponent: item];
			components = [OFArray arrayWithObjects:
			    destination, item, nil];
			destinationPath = [OFString
			    pathWithComponents: components];
			destinationPath =
			    [destination stringByAppendingPathComponent: item];

			[OFFile copyItemAtPath: sourcePath
					toPath: destinationPath];

			objc_autoreleasePoolPop(pool2);
		}
	} else if (S_ISREG(s.st_mode)) {
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733


734
735
736
737
738
739
740
714
715
716
717
718
719
720


721





722
723
724
725
726
727
728
729
730







-
-

-
-
-
-
-
+
+







			@throw [OFRemoveItemFailedException
			    exceptionWithPath: path];
		}

		enumerator = [contents objectEnumerator];
		while ((item = [enumerator nextObject]) != nil) {
			void *pool2 = objc_autoreleasePoolPush();
			OFArray *components;
			OFString *itemPath;

			components = [OFArray arrayWithObjects:
			    path, item, nil];
			itemPath = [OFString pathWithComponents: components];

			[OFFile removeItemAtPath: itemPath];
			[OFFile removeItemAtPath:
			    [path stringByAppendingPathComponent: item]];

			objc_autoreleasePoolPop(pool2);
		}
	}

#ifndef _WIN32
	if (remove([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE]))