VirtualBox

Changeset 16395 in vbox for trunk/src/libs/xpcom18a4/xpcom


Ignore:
Timestamp:
Jan 29, 2009 11:38:21 PM (16 years ago)
Author:
vboxsync
Message:

XPCOM-darwin/amd64: Use nsLocalFileUnix.cpp instead of nsLocalFileOSX.cpp; nsLocalFile::InitWithFile fix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/xpcom/io/nsLocalFileCommon.cpp

    r1 r16395  
    6262}
    6363
    64 #if !defined(XP_MAC) && !defined(XP_MACOSX)
     64#if (!defined(XP_MAC) && !defined(XP_MACOSX)) || (defined(VBOX) && defined(RT_ARCH_AMD64))
    6565NS_IMETHODIMP
    6666nsLocalFile::InitWithFile(nsILocalFile *aFile)
    6767{
    6868    NS_ENSURE_ARG(aFile);
    69    
     69
    7070    nsCAutoString path;
    7171    aFile->GetNativePath(path);
    7272    if (path.IsEmpty())
    7373        return NS_ERROR_INVALID_ARG;
    74     return InitWithNativePath(path); 
     74    return InitWithNativePath(path);
    7575}
    7676#endif
     
    8080#else
    8181#define kMaxFilenameLength 255
    82 #endif 
     82#endif
    8383
    8484NS_IMETHODIMP
     
    8686{
    8787    nsresult rv = Create(type, attributes);
    88    
     88
    8989    if (NS_SUCCEEDED(rv)) return NS_OK;
    9090    if (rv != NS_ERROR_FILE_ALREADY_EXISTS) return rv;
    9191
    92     nsCAutoString leafName; 
     92    nsCAutoString leafName;
    9393    rv = GetNativeLeafName(leafName);
    9494
     
    117117
    118118        rv = Create(type, attributes);
    119    
    120         if (NS_SUCCEEDED(rv) || rv != NS_ERROR_FILE_ALREADY_EXISTS) 
     119
     120        if (NS_SUCCEEDED(rv) || rv != NS_ERROR_FILE_ALREADY_EXISTS)
    121121        {
    122122            return rv;
    123123        }
    124124    }
    125  
     125
    126126    // The disk is full, sort of
    127127    return NS_ERROR_FILE_TOO_BIG;
     
    150150    PRUnichar **nodePtr = nodeArray;
    151151    if (*path == kPathSeparatorChar)
    152       path++;   
     152      path++;
    153153    *nodePtr++ = path;
    154    
     154
    155155    for (PRUnichar *cp = path; *cp != 0; cp++) {
    156156      if (*cp == kPathSeparatorChar) {
     
    166166}
    167167
    168  
     168
    169169NS_IMETHODIMP
    170170nsLocalFile::GetRelativeDescriptor(nsILocalFile *fromFile, nsACString& _retval)
     
    175175    //
    176176    // _retval will be UTF-8 encoded
    177     // 
    178        
     177    //
     178
    179179    nsresult rv;
    180180    _retval.Truncate(0);
     
    183183    PRUnichar *thisNodes[kMaxNodesInPath], *fromNodes[kMaxNodesInPath];
    184184    PRInt32  thisNodeCnt, fromNodeCnt, nodeIndex;
    185    
     185
    186186    rv = GetPath(thisPath);
    187187    if (NS_FAILED(rv))
     
    194194    PRUnichar *thisPathPtr; thisPath.BeginWriting(thisPathPtr);
    195195    PRUnichar *fromPathPtr; fromPath.BeginWriting(fromPathPtr);
    196    
     196
    197197    thisNodeCnt = SplitPath(thisPathPtr, thisNodes, kMaxNodesInPath);
    198198    fromNodeCnt = SplitPath(fromPathPtr, fromNodes, kMaxNodesInPath);
    199199    if (thisNodeCnt < 0 || fromNodeCnt < 0)
    200200      return NS_ERROR_FAILURE;
    201    
     201
    202202    for (nodeIndex = 0; nodeIndex < thisNodeCnt && nodeIndex < fromNodeCnt; ++nodeIndex) {
    203203#ifdef XP_WIN
     
    209209#endif
    210210    }
    211    
     211
    212212    PRInt32 branchIndex = nodeIndex;
    213     for (nodeIndex = branchIndex; nodeIndex < fromNodeCnt; nodeIndex++) 
     213    for (nodeIndex = branchIndex; nodeIndex < fromNodeCnt; nodeIndex++)
    214214      _retval.AppendLiteral("../");
    215215    for (nodeIndex = branchIndex; nodeIndex < thisNodeCnt; nodeIndex++) {
     
    222222        _retval.Append('/');
    223223    }
    224        
     224
    225225    return NS_OK;
    226226}
     
    230230{
    231231    NS_NAMED_LITERAL_CSTRING(kParentDirStr, "../");
    232  
     232
    233233    nsCOMPtr<nsIFile> targetFile;
    234234    nsresult rv = fromFile->Clone(getter_AddRefs(targetFile));
     
    238238    //
    239239    // relativeDesc is UTF-8 encoded
    240     // 
     240    //
    241241
    242242    nsCString::const_iterator strBegin, strEnd;
    243243    relativeDesc.BeginReading(strBegin);
    244244    relativeDesc.EndReading(strEnd);
    245    
     245
    246246    nsCString::const_iterator nodeBegin(strBegin), nodeEnd(strEnd);
    247247    nsCString::const_iterator pos(strBegin);
    248    
     248
    249249    nsCOMPtr<nsIFile> parentDir;
    250250    while (FindInReadable(kParentDirStr, nodeBegin, nodeEnd)) {
     
    263263      FindCharInReadable('/', nodeEnd, strEnd);
    264264#ifdef XP_MAC
    265       nsCAutoString nodeString(Substring(nodeBegin, nodeEnd));     
     265      nsCAutoString nodeString(Substring(nodeBegin, nodeEnd));
    266266      nodeString.ReplaceSubstring(kESCSlashStr, kSlashStr);
    267267      targetFile->Append(NS_ConvertUTF8toUCS2(nodeString));
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette