mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
improve build on windows
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37483 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1aeea18a33
commit
263e81a85c
3 changed files with 20 additions and 11 deletions
|
@ -25,25 +25,34 @@
|
|||
#ifndef __NSUUID_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSUUID_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef uint8_t gsuuid_t[16];
|
||||
|
||||
#if defined(uuid_t)
|
||||
#undef uuid_t
|
||||
#endif
|
||||
#define uuid_t gsuuid_t
|
||||
|
||||
|
||||
@class NSString;
|
||||
|
||||
@interface NSUUID : NSObject <NSCopying, NSCoding>
|
||||
{
|
||||
@private
|
||||
uint8_t uuid[16];
|
||||
gsuuid_t uuid;
|
||||
}
|
||||
|
||||
+ (id) UUID;
|
||||
- (id) initWithUUIDString: (NSString *)string;
|
||||
- (id) initWithUUIDBytes: (uint8_t*)bytes;
|
||||
- (NSString *) UUIDString;
|
||||
- (void) getUUIDBytes: (uint8_t*)bytes;
|
||||
+ (id)UUID;
|
||||
- (id)initWithUUIDString:(NSString *)string;
|
||||
- (id)initWithUUIDBytes:(gsuuid_t)bytes;
|
||||
- (NSString *)UUIDString;
|
||||
- (void)getUUIDBytes:(gsuuid_t)bytes;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ static const int kUUIDByteCount = 16;
|
|||
|
||||
- (id) init
|
||||
{
|
||||
uint8_t localUUID[16];
|
||||
gsuuid_t localUUID;
|
||||
int result;
|
||||
|
||||
result = random_uuid(localUUID);
|
||||
|
@ -67,7 +67,7 @@ static const int kUUIDByteCount = 16;
|
|||
|
||||
- (id) initWithUUIDString: (NSString *)string
|
||||
{
|
||||
uint8_t localUUID[16];
|
||||
gsuuid_t localUUID;
|
||||
const char *cString;
|
||||
int parseResult;
|
||||
|
||||
|
@ -81,7 +81,7 @@ static const int kUUIDByteCount = 16;
|
|||
return [self initWithUUIDBytes: localUUID];
|
||||
}
|
||||
|
||||
- (id) initWithUUIDBytes: (uint8_t*)bytes
|
||||
- (id) initWithUUIDBytes: (gsuuid_t)bytes
|
||||
{
|
||||
if (nil != (self = [super init]))
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ static const int kUUIDByteCount = 16;
|
|||
return AUTORELEASE(string);
|
||||
}
|
||||
|
||||
- (void) getUUIDBytes: (uint8_t*)bytes
|
||||
- (void) getUUIDBytes: (gsuuid_t)bytes
|
||||
{
|
||||
memcpy(bytes, uuid, kUUIDByteCount);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ int main(int argc, char **argv)
|
|||
NSUUID *uuid1, *uuid2;
|
||||
NSString *uuidString = @"2139CD2E-15E6-4C37-84DA-1E18EEBFAB4A";
|
||||
|
||||
uuid_t uuidBytes = { 0x80, 0x1f, 0x3a, 0x01, 0x95, 0x7c, 0x45, 0x0f,
|
||||
gsuuid_t uuidBytes = { 0x80, 0x1f, 0x3a, 0x01, 0x95, 0x7c, 0x45, 0x0f,
|
||||
0xaf, 0xf2, 0x1b, 0xe9, 0x59, 0xf5, 0x89, 0x54 };
|
||||
|
||||
TEST_FOR_CLASS(@"NSUUID", [NSUUID alloc],
|
||||
|
|
Loading…
Reference in a new issue