On Tue, May 03, 2011 at 10:21:18AM +0200, Francois Tigeot wrote:
> On Tue, May 03, 2011 at 02:06:24AM -0600, Tor Lillqvist wrote:
>
> > I mean, if we have code in there that assumes NTFS (and SMB) volumes are
> > case insensitive (at least when accessed from Windows), we should
> > definitely keep it that way, even if somebody might have toggled a registry
> > value to change it. If somebody does that, they deserve what they get.
>
> The code is overly complex and wrong in some cases. I was thinking of
> simplifying it by doing a simple compile-time check for WNT but this may not
> be
> the best way.
Following a short discussion on IRC, I've decided to remove the bulk of the
code and use a single #if defined(WNT) check instead.
The attached patch is relative to libs-gui.
--
Francois Tigeot
diff --git a/tools/inc/tools/fsys.hxx b/tools/inc/tools/fsys.hxx
index 47ce264..e4ab76b 100644
--- a/tools/inc/tools/fsys.hxx
+++ b/tools/inc/tools/fsys.hxx
@@ -296,8 +296,6 @@ public:
FSysPathStyle eParser = FSYS_STYLE_HOST );
~DirEntry();
- sal_Bool IsCaseSensitive (FSysPathStyle
eFormatter = FSYS_STYLE_HOST) const;
-
sal_uIntPtr GetError() const { return
nError; }
sal_Bool IsValid() const;
DirEntryFlag GetFlag() const { return eFlag; };
diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx
index a557edb..625fc48 100644
--- a/tools/source/fsys/dirent.cxx
+++ b/tools/source/fsys/dirent.cxx
@@ -1662,13 +1662,12 @@ sal_Bool DirEntry::ImpToRel( String aCurStr )
aThis.ToAbs();
String aThisStr( aThis.GetFull( FSYS_STYLE_HPFS ) );
- // #109512 preserve case of path even if caseinsensitive
+ // preserve case of path even if caseinsensitive
String aThisCompareStr( aThisStr ), aCurCompareStr( aCurStr );
- if ( ! IsCaseSensitive() )
- {
+ #if defined(WNT)
aThisCompareStr.ToLowerAscii();
aCurCompareStr.ToLowerAscii();
- }
+ #endif
// "Ubereinstimmung pr"ufen
sal_uInt16 nPos = aThisCompareStr.Match( aCurCompareStr );
diff --git a/tools/source/fsys/unx.cxx b/tools/source/fsys/unx.cxx
index a2eba54..90c7a94 100644
--- a/tools/source/fsys/unx.cxx
+++ b/tools/source/fsys/unx.cxx
@@ -191,81 +191,6 @@ static sal_Bool GetMountEntry(dev_t dev, struct mymnttab
*mytab)
#endif
-/************************************************************************
-|*
-|* DirEntry::IsCaseSensitive()
-|*
-*************************************************************************/
-
-sal_Bool DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const
-{
-
- if (eFormatter==FSYS_STYLE_HOST)
- {
-#if defined(NETBSD) || defined(DRAGONFLY)
- return sal_True;
-#else
- struct stat buf;
- DirEntry aPath(*this);
- aPath.ToAbs();
-
- while (stat (ByteString(aPath.GetFull(),
osl_getThreadTextEncoding()).GetBuffer(), &buf))
- {
- if (aPath.Level() == 1)
- {
- return sal_True; // ich bin unter UNIX, also ist der
default im Zweifelsfall case sensitiv
- }
- aPath = aPath [1];
- }
-
- struct mymnttab fsmnt;
- GetMountEntry(buf.st_dev, &fsmnt);
- if ((fsmnt.mymnttab_filesystem.CompareTo("msdos")==COMPARE_EQUAL) ||
- (fsmnt.mymnttab_filesystem.CompareTo("umsdos")==COMPARE_EQUAL) ||
- (fsmnt.mymnttab_filesystem.CompareTo("vfat")==COMPARE_EQUAL) ||
- (fsmnt.mymnttab_filesystem.CompareTo("hpfs")==COMPARE_EQUAL) ||
- (fsmnt.mymnttab_filesystem.CompareTo("smb")
==COMPARE_EQUAL) ||
- (fsmnt.mymnttab_filesystem.CompareTo("ncpfs")==COMPARE_EQUAL))
- {
- return sal_False;
- }
- else
- {
- return sal_True;
- }
-#endif
- }
- else
- {
- sal_Bool isCaseSensitive = sal_True; // ich bin unter UNIX, also ist
der default im Zweifelsfall case sensitiv
- switch ( eFormatter )
- {
- case FSYS_STYLE_MAC:
- case FSYS_STYLE_FAT:
- case FSYS_STYLE_VFAT:
- case FSYS_STYLE_NTFS:
- case FSYS_STYLE_NWFS:
- case FSYS_STYLE_HPFS:
- {
- isCaseSensitive = sal_False;
- break;
- }
- case FSYS_STYLE_SYSV:
- case FSYS_STYLE_BSD:
- case FSYS_STYLE_DETECT:
- {
- isCaseSensitive = sal_True;
- break;
- }
- default:
- {
- isCaseSensitive = sal_True; // ich bin unter UNIX,
also ist der default im Zweifelsfall case sensitiv
- break;
- }
- }
- return isCaseSensitive;
- }
-}
/************************************************************************
|*
diff --git a/tools/source/fsys/wntmsc.cxx b/tools/source/fsys/wntmsc.cxx
index cfe64bea..bfe7a3c 100644
--- a/tools/source/fsys/wntmsc.cxx
+++ b/tools/source/fsys/wntmsc.cxx
@@ -169,91 +169,6 @@ FSysPathStyle DirEntry::GetPathStyle( const String
&rDevice )
/*************************************************************************
|*
-|* DirEntry::IsCaseSensitive()
-|*
-*************************************************************************/
-
-sal_Bool DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const
-{
-
- if (eFormatter==FSYS_STYLE_HOST)
- {
-/*
- DirEntry aRoot(*this);
- aRoot.ToAbs();
- aRoot = aRoot[Level()-1];
- String aRootDir = aRoot.GetFull(FSYS_STYLE_HOST, sal_True);
-
- char sVolumeName[256];
- DWORD nVolumeSerial;
- DWORD nMaxCompLen;
- DWORD nFlags;
- char sFileSysName[16];
-
- if ( GetVolumeInformation( (char*) aRootDir.GetStr(),
- sVolumeName,
- 256,
- (LPDWORD) &nVolumeSerial,
- (LPDWORD) &nMaxCompLen,
- (LPDWORD) &nFlags,
- sFileSysName,
- 16 ))
- {
- return (nFlags & FS_CASE_SENSITIVE) ? sal_True : sal_False;
- }
- else
- {
- return sal_False;
- }
-*/
- //
- // guter versuch, aber FS_CASE_SENSITIVE ist D?nnsinn in T?ten:
- //
- // sFileSysName FS_CASE_SENSITIVE
- // FAT sal_False
- // NTFS sal_True !!!
- // NWCompat sal_False
- // Samba sal_False
- //
- // NT spricht auch NTFS lediglich case preserving an, also ist unter
NT alles case insensitiv
- //
-
- return sal_False;
- }
- else
- {
- sal_Bool isCaseSensitive = sal_False; // ich bin unter win32, also
ist der default case insensitiv
- switch ( eFormatter )
- {
- case FSYS_STYLE_MAC:
- case FSYS_STYLE_FAT:
- case FSYS_STYLE_VFAT:
- case FSYS_STYLE_NTFS:
- case FSYS_STYLE_NWFS:
- case FSYS_STYLE_HPFS:
- case FSYS_STYLE_DETECT:
- {
- isCaseSensitive = sal_False;
- break;
- }
- case FSYS_STYLE_SYSV:
- case FSYS_STYLE_BSD:
- {
- isCaseSensitive = sal_True;
- break;
- }
- default:
- {
- isCaseSensitive = sal_False; // ich bin unter win32,
also ist der default case insensitiv
- break;
- }
- }
- return isCaseSensitive;
- }
-}
-
-/*************************************************************************
-|*
|* DirEntry::ToAbs()
|*
*************************************************************************/
_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice