X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/1c79356b52d46aa6b508fb032f5ae709b1f2897b..b36670cedae0009469e8ee117453de831de64a6b:/bsd/hfs/hfscommon/Unicode/UnicodeWrappers.c?ds=inline diff --git a/bsd/hfs/hfscommon/Unicode/UnicodeWrappers.c b/bsd/hfs/hfscommon/Unicode/UnicodeWrappers.c index 90c08d466..91b3e7a98 100644 --- a/bsd/hfs/hfscommon/Unicode/UnicodeWrappers.c +++ b/bsd/hfs/hfscommon/Unicode/UnicodeWrappers.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -51,36 +51,10 @@ enum { static void GetFilenameExtension( ItemCount length, ConstUniCharArrayPtr unicodeStr, char* extStr ); -static void GetFileIDString( HFSCatalogNodeID fileID, char* fileIDStr ); static UInt32 HexStringToInteger( UInt32 length, const UInt8 *hexStr ); - -/* - * Convert file ID into a hexidecimal string with no leading zeros - */ -static void -GetFileIDString( HFSCatalogNodeID fileID, char * fileIDStr ) -{ - SInt32 i, b; - UInt8 *translate = (UInt8 *) "0123456789ABCDEF"; - UInt8 c; - - fileIDStr[0] = '#'; - - for ( i = 0, b = 28; b >= 0; b -= 4 ) { - c = *(translate + ((fileID >> b) & 0x0000000F)); - - /* if its not a leading zero add it to our string */ - if ( (c != (UInt8) '0') || (i > 1) || (b == 0) ) - fileIDStr[++i] = c; - } - - fileIDStr[++i] = '\0'; -} - - /* * Get filename extension (if any) as a C string */ @@ -148,9 +122,6 @@ CountFilenameExtensionChars( const unsigned char * filename, UInt32 length ) UInt16 maxExtChars; Boolean foundExtension; - if (length == kUndefinedStrLen) - length = strlen(filename); - if ( length < 3 ) return 0; /* "x.y" is smallest possible extension */ @@ -199,9 +170,6 @@ GetEmbeddedFileID(const unsigned char * filename, UInt32 length, UInt32 *prefixL if ( filename == NULL ) return 0; - if (length == kUndefinedStrLen) - length = strlen(filename); - if ( length < 28 ) return 0; /* too small to have been mangled */ @@ -241,7 +209,7 @@ static UInt32 HexStringToInteger(UInt32 length, const UInt8 *hexStr) { UInt32 value; - short i; + UInt32 i; UInt8 c; const UInt8 *p; @@ -274,8 +242,6 @@ HexStringToInteger(UInt32 length, const UInt8 *hexStr) * return 0 if equal * */ -extern unsigned short gCompareTable[]; - SInt32 FastRelString( ConstStr255Param str1, ConstStr255Param str2 ) { UInt16* compareTable; @@ -390,9 +356,6 @@ SInt32 FastRelString( ConstStr255Param str1, ConstStr255Param str2 ) // return 1; // -extern UInt16 gLowerCaseTable[]; -extern UInt16 gLatinCaseFold[]; - SInt32 FastUnicodeCompare ( register ConstUniCharArrayPtr str1, register ItemCount length1, register ConstUniCharArrayPtr str2, register ItemCount length2) { @@ -459,7 +422,7 @@ ConvertUnicodeToUTF8Mangled(ByteCount srcLen, ConstUniCharArrayPtr srcStr, ByteC char fileIDStr[15]; char extStr[15]; - GetFileIDString(cnid, fileIDStr); + sprintf(fileIDStr, "#%X", cnid); GetFilenameExtension(srcLen/sizeof(UniChar), srcStr, extStr); /* remove extension chars from source */