mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
URL fixes and implementation of unimplemented methods
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7584 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
91205d1463
commit
81bb7908f3
90 changed files with 6448 additions and 5922 deletions
|
@ -74,6 +74,7 @@
|
|||
#include <Foundation/NSFileManager.h>
|
||||
#include <Foundation/NSPathUtilities.h>
|
||||
#include <Foundation/NSRange.h>
|
||||
#include <Foundation/NSURL.h>
|
||||
#include <Foundation/NSZone.h>
|
||||
#include <string.h> /* for memset() */
|
||||
#include <unistd.h> /* SEEK_* on SunOS 4 */
|
||||
|
@ -402,6 +403,14 @@ failure:
|
|||
return AUTORELEASE(d);
|
||||
}
|
||||
|
||||
+ (id) dataWithContentsOfURL: (NSURL*)url
|
||||
{
|
||||
NSData *d;
|
||||
|
||||
d = [url resourceDataUsingCache: YES];
|
||||
return d;
|
||||
}
|
||||
|
||||
+ (id) dataWithData: (NSData*)data
|
||||
{
|
||||
NSData *d;
|
||||
|
@ -457,6 +466,13 @@ failure:
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (id) initWithContentsOfURL: (NSURL*)url
|
||||
{
|
||||
NSData *data = [url resourceDataUsingCache: YES];
|
||||
|
||||
return [self initWithBytes: [data bytes] length: [data length]];
|
||||
}
|
||||
|
||||
- (id) initWithData: (NSData*)data
|
||||
{
|
||||
return [self initWithBytes: [data bytes] length: [data length]];
|
||||
|
@ -614,12 +630,12 @@ failure:
|
|||
|
||||
- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)useAuxiliaryFile
|
||||
{
|
||||
char thePath[BUFSIZ*2+8];
|
||||
char theRealPath[BUFSIZ*2];
|
||||
NSString *tmppath;
|
||||
FILE *theFile;
|
||||
int c;
|
||||
char thePath[BUFSIZ*2+8];
|
||||
char theRealPath[BUFSIZ*2];
|
||||
FILE *theFile;
|
||||
int c;
|
||||
#if defined(__MINGW__)
|
||||
NSString *tmppath;
|
||||
HANDLE fh;
|
||||
DWORD wroteBytes;
|
||||
#endif
|
||||
|
@ -1337,7 +1353,7 @@ failure:
|
|||
|
||||
+ (id) dataWithContentsOfFile: (NSString*)path
|
||||
{
|
||||
NSData *d;
|
||||
NSMutableData *d;
|
||||
|
||||
d = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
d = [d initWithContentsOfFile: path];
|
||||
|
@ -1346,16 +1362,27 @@ failure:
|
|||
|
||||
+ (id) dataWithContentsOfMappedFile: (NSString*)path
|
||||
{
|
||||
NSData *d;
|
||||
NSMutableData *d;
|
||||
|
||||
d = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
d = [d initWithContentsOfMappedFile: path];
|
||||
return AUTORELEASE(d);
|
||||
}
|
||||
|
||||
+ (id) dataWithContentsOfURL: (NSURL*)url
|
||||
{
|
||||
NSMutableData *d;
|
||||
NSData *data;
|
||||
|
||||
d = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
data = [url resourceDataUsingCache: YES];
|
||||
d = [d initWithBytes: [data bytes] length: [data length]];
|
||||
return AUTORELEASE(d);
|
||||
}
|
||||
|
||||
+ (id) dataWithData: (NSData*)data
|
||||
{
|
||||
NSData *d;
|
||||
NSMutableData *d;
|
||||
|
||||
d = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
d = [d initWithBytes: [data bytes] length: [data length]];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue