--- np2/macosx/macossub.cpp 2003/11/03 10:19:43 1.2 +++ np2/macosx/macossub.cpp 2003/11/21 16:01:41 1.4 @@ -20,7 +20,7 @@ UINT32 macos_gettick(void) { UnsignedWide current; Microseconds(¤t); - return((UINT32)(current.lo / 1000)); + return((UINT32)((current.hi * 4294967) + (current.lo / 1000))); } @@ -69,8 +69,10 @@ static void char2str(char *dst, int size CFStringRef cfsr; cfsr = CFStringCreateWithCharacters(NULL, uni, unicnt); - CFStringGetCString(cfsr, dst, size, CFStringGetSystemEncoding()); - CFRelease(cfsr); + if (cfsr) { + CFStringGetCString(cfsr, dst, size, CFStringGetSystemEncoding()); + CFRelease(cfsr); + } } void *file_list1st(const char *dir, FLDATA *fl) { @@ -156,30 +158,21 @@ bool getLongFileName(char* dst, const ch FSSpec fss; Str255 fname; FSRef fref; - char buffer[1024]; - char *ret, *val; + HFSUniStr255 name; if (*path == '\0') { return(false); } mkstr255(fname, path); - if (FSMakeFSSpec(0, 0, fname, &fss) != noErr) { - return(false); - } - if (FSpMakeFSRef(&fss, &fref) != noErr) { + FSMakeFSSpec(0, 0, fname, &fss); + FSpMakeFSRef(&fss, &fref); + if (FSGetCatalogInfo(&fref, kFSCatInfoNone, NULL, &name, NULL, NULL) != noErr) { return(false); } - if (FSRefMakePath(&fref, (UInt8*)buffer, 1024) != noErr) { + char2str(dst, 512, name.unicode, name.length); + if (!dst) { return(false); } - val = buffer; - ret = val; - while(*val != '\0') { - if (*val++ == '/') { - ret = val; - } - } - strcpy(dst, ret); return(true); }