Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
2a2fbbec
Kaydet (Commit)
2a2fbbec
authored
Kas 21, 2011
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
ByteString->rtl::OString
üst
d4d79be2
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
169 additions
and
168 deletions
+169
-168
fsys.hxx
tools/inc/tools/fsys.hxx
+10
-10
comdep.hxx
tools/source/fsys/comdep.hxx
+3
-3
dirent.cxx
tools/source/fsys/dirent.cxx
+132
-129
filecopy.cxx
tools/source/fsys/filecopy.cxx
+5
-5
fstat.cxx
tools/source/fsys/fstat.cxx
+8
-9
tdir.cxx
tools/source/fsys/tdir.cxx
+6
-7
wntmsc.cxx
tools/source/fsys/wntmsc.cxx
+4
-4
wntmsc.hxx
tools/source/fsys/wntmsc.hxx
+1
-1
No files found.
tools/inc/tools/fsys.hxx
Dosyayı görüntüle @
2a2fbbec
...
...
@@ -223,13 +223,13 @@ friend class FileCopier;
#ifdef FEAT_FSYS_DOUBLESPEED
FileStat
*
pStat
;
// optional
#endif
ByteString
aName
;
rtl
::
OString
aName
;
DirEntry
*
pParent
;
sal_uIntPtr
nError
;
DirEntryFlag
eFlag
;
private
:
TOOLS_DLLPRIVATE
DirEntry
(
const
Byte
String
&
rInitName
,
TOOLS_DLLPRIVATE
DirEntry
(
const
rtl
::
O
String
&
rInitName
,
DirEntryFlag
aDirFlag
,
FSysPathStyle
eStyle
);
...
...
@@ -237,13 +237,13 @@ private:
friend
class
FileStat
;
friend
const
char
*
ImpCheckDirEntry
(
const
void
*
p
);
TOOLS_DLLPRIVATE
FSysError
ImpParseName
(
const
Byte
String
&
rIntiName
,
TOOLS_DLLPRIVATE
FSysError
ImpParseName
(
const
rtl
::
O
String
&
rIntiName
,
FSysPathStyle
eParser
);
#if defined(WNT)
TOOLS_DLLPRIVATE
FSysError
ImpParseOs2Name
(
const
Byte
String
&
rPfad
,
TOOLS_DLLPRIVATE
FSysError
ImpParseOs2Name
(
const
rtl
::
O
String
&
rPfad
,
FSysPathStyle
eStyle
);
#else
TOOLS_DLLPRIVATE
FSysError
ImpParseUnixName
(
const
Byte
String
&
rPfad
,
TOOLS_DLLPRIVATE
FSysError
ImpParseUnixName
(
const
rtl
::
O
String
&
rPfad
,
FSysPathStyle
eStyle
);
#endif
TOOLS_DLLPRIVATE
const
DirEntry
*
ImpGetTopPtr
()
const
;
...
...
@@ -251,7 +251,7 @@ private:
protected
:
void
ImpTrim
(
FSysPathStyle
eStyle
);
const
ByteString
&
ImpTheName
()
const
;
const
rtl
::
OString
&
ImpTheName
()
const
;
DirEntryFlag
ImpTheFlag
()
const
{
return
eFlag
;
};
DirEntry
*
ImpChangeParent
(
DirEntry
*
pNewParent
,
sal_Bool
bNormalize
=
sal_True
);
DirEntry
*
ImpGetParent
()
{
return
pParent
;
}
...
...
@@ -266,7 +266,7 @@ protected:
public
:
DirEntry
(
DirEntryFlag
aDirFlag
=
FSYS_FLAG_CURRENT
);
DirEntry
(
const
DirEntry
&
rEntry
);
DirEntry
(
const
Byte
String
&
rInitName
,
DirEntry
(
const
rtl
::
O
String
&
rInitName
,
FSysPathStyle
eParser
=
FSYS_STYLE_HOST
);
DirEntry
(
const
String
&
rInitName
,
FSysPathStyle
eParser
=
FSYS_STYLE_HOST
);
...
...
@@ -323,14 +323,14 @@ public:
sal_Bool
operator
!=
(
const
DirEntry
&
rAnotherDir
)
const
{
return
!
(
DirEntry
::
operator
==
(
rAnotherDir
));
}
inline
StringCompare
NameCompareDirect
(
const
DirEntry
&
rWith
)
const
inline
sal_Int32
NameCompareDirect
(
const
DirEntry
&
rWith
)
const
{
#ifdef UNX
return
rWith
.
aName
.
CompareTo
(
aName
);
return
rWith
.
aName
.
compareTo
(
aName
);
#else
rtl
::
OString
aThis
(
rtl
::
OString
(
aName
).
toAsciiLowerCase
());
rtl
::
OString
aWith
(
rtl
::
OString
(
rWith
.
aName
).
toAsciiLowerCase
());
return
static_cast
<
StringCompare
>
(
aWith
.
compareTo
(
aThis
)
);
return
aWith
.
compareTo
(
aThis
);
#endif
}
...
...
tools/source/fsys/comdep.hxx
Dosyayı görüntüle @
2a2fbbec
...
...
@@ -64,7 +64,7 @@ struct DirReader_Impl
dirent
*
pDosEntry
;
DirEntry
*
pParent
;
String
aPath
;
ByteString
aBypass
;
rtl
::
OString
aBypass
;
sal_Bool
bReady
;
sal_Bool
bInUse
;
...
...
@@ -86,8 +86,8 @@ struct DirReader_Impl
#if defined(UNX) //for further eplanation see DirReader_Impl::Read() in unx.cxx
pDosDir
=
NULL
;
#else
aBypass
=
Byte
String
(
aPath
,
osl_getThreadTextEncoding
());
pDosDir
=
opendir
(
(
char
*
)
aBypass
.
GetBuffe
r
()
);
aBypass
=
rtl
::
OUStringToO
String
(
aPath
,
osl_getThreadTextEncoding
());
pDosDir
=
opendir
(
aBypass
.
getSt
r
()
);
#endif
// Parent f"ur die neuen DirEntries ermitteln
...
...
tools/source/fsys/dirent.cxx
Dosyayı görüntüle @
2a2fbbec
...
...
@@ -303,41 +303,41 @@ const char* ImpCheckDirEntry( const void* p )
|*
*************************************************************************/
ByteString
ImplCutPath
(
const
ByteString
&
rStr
,
sal_uInt16
nMax
,
char
cAccDel
)
rtl
::
OString
ImplCutPath
(
const
rtl
::
OString
&
rStr
,
sal_Int32
nMax
,
char
cAccDel
)
{
sal_uInt16
nMaxPathLen
=
nMax
;
ByteString
aCutPath
(
rStr
);
sal_Int32
nMaxPathLen
=
nMax
;
sal_Bool
bInsertPrefix
=
sal_False
;
sal_uInt16
nBegin
=
aCutPath
.
Search
(
cAccDel
);
sal_Int32
nBegin
=
rStr
.
indexOf
(
cAccDel
);
rtl
::
OStringBuffer
aCutPath
(
rStr
);
if
(
nBegin
==
STRING_NOTFOUND
)
if
(
nBegin
==
-
1
)
nBegin
=
0
;
else
nMaxPathLen
+=
2
;
// fuer Prefix <Laufwerk>:
while
(
aCutPath
.
Len
()
>
nMaxPathLen
)
while
(
aCutPath
.
getLength
()
>
nMaxPathLen
)
{
sal_
uInt16
nEnd
=
aCutPath
.
Search
(
cAccDel
,
nBegin
+
1
);
sal_
uInt16
nCount
;
sal_
Int32
nEnd
=
aCutPath
.
toString
().
indexOf
(
cAccDel
,
nBegin
+
1
);
sal_
Int32
nCount
;
if
(
nEnd
!=
STRING_NOTFOUND
)
if
(
nEnd
!=
-
1
)
{
nCount
=
nEnd
-
nBegin
;
aCutPath
.
Erase
(
nBegin
,
nCount
);
aCutPath
.
remove
(
nBegin
,
nCount
);
bInsertPrefix
=
sal_True
;
}
else
break
;
}
if
(
aCutPath
.
Len
()
>
nMaxPathLen
)
if
(
aCutPath
.
getLength
()
>
nMaxPathLen
)
{
for
(
sal_
uInt16
n
=
nMaxPathLen
;
n
>
nMaxPathLen
/
2
;
--
n
)
for
(
sal_
Int32
n
=
nMaxPathLen
;
n
>
nMaxPathLen
/
2
;
--
n
)
{
if
(
!
comphelper
::
string
::
isalnumAscii
(
aCutPath
.
GetChar
(
n
)
))
if
(
!
comphelper
::
string
::
isalnumAscii
(
aCutPath
[
n
]
))
{
aCutPath
.
Erase
(
n
);
aCutPath
+=
"..."
;
comphelper
::
string
::
truncateToLength
(
aCutPath
,
n
);
aCutPath
.
append
(
RTL_CONSTASCII_STRINGPARAM
(
"..."
))
;
break
;
}
}
...
...
@@ -347,10 +347,10 @@ ByteString ImplCutPath( const ByteString& rStr, sal_uInt16 nMax, char cAccDel )
{
rtl
::
OStringBuffer
aIns
;
aIns
.
append
(
cAccDel
).
append
(
RTL_CONSTASCII_STRINGPARAM
(
"..."
));
aCutPath
.
Insert
(
ByteString
(
aIns
.
makeStringAndClear
()),
nBegin
);
aCutPath
.
insert
(
nBegin
,
aIns
.
makeStringAndClear
()
);
}
return
aCutPath
;
return
aCutPath
.
makeStringAndClear
()
;
}
#if defined(WNT)
...
...
@@ -360,7 +360,7 @@ ByteString ImplCutPath( const ByteString& rStr, sal_uInt16 nMax, char cAccDel )
|*
*************************************************************************/
FSysError
DirEntry
::
ImpParseOs2Name
(
const
Byte
String
&
rPfad
,
FSysPathStyle
eStyle
)
FSysError
DirEntry
::
ImpParseOs2Name
(
const
rtl
::
O
String
&
rPfad
,
FSysPathStyle
eStyle
)
{
DBG_CHKTHIS
(
DirEntry
,
ImpCheckDirEntry
);
...
...
@@ -391,7 +391,7 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty
for
(
nPos
=
2
;
aPfad
.
Len
()
>
nPos
;
++
nPos
)
if
(
aPfad
.
GetChar
(
nPos
)
==
'\\'
||
aPfad
.
GetChar
(
nPos
)
==
'/'
)
break
;
aName
=
ByteString
(
aPfad
.
Copy
(
2
,
nPos
-
2
),
osl_getThreadTextEncoding
()
);
aName
=
rtl
::
OUStringToOString
(
aPfad
.
Copy
(
2
,
nPos
-
2
),
osl_getThreadTextEncoding
()
);
aStack
.
Push
(
new
DirEntry
(
aName
,
FSYS_FLAG_ABSROOT
,
eStyle
)
);
}
// ist der Name die Root des aktuellen Drives?
...
...
@@ -406,7 +406,7 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty
// ist der Name ein Drive?
if
(
nPos
<
aPfad
.
Len
()
&&
aPfad
.
GetChar
(
nPos
)
==
':'
)
{
aName
=
ByteString
(
aPfad
.
Copy
(
0
,
nPos
+
1
),
osl_getThreadTextEncoding
()
);
aName
=
rtl
::
OUStringToOString
(
aPfad
.
Copy
(
0
,
nPos
+
1
),
osl_getThreadTextEncoding
()
);
// ist der Name die Root des Drives
if
(
(
nPos
+
1
)
<
aPfad
.
Len
()
&&
...
...
@@ -414,7 +414,7 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty
{
// schon was auf dem Stack?
// oder Novell-Format? (not supported wegen URLs)
if
(
!
aStack
.
Empty
()
||
aName
.
Len
()
>
2
)
if
(
!
aStack
.
Empty
()
||
aName
.
getLength
()
>
2
)
{
aName
=
rPfad
;
return
FSYS_ERR_MISPLACEDCHAR
;
...
...
@@ -445,7 +445,7 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty
else
{
// den Namen ohne Trenner abspalten
aName
=
ByteString
(
aPfad
.
Copy
(
0
,
nPos
),
osl_getThreadTextEncoding
()
);
aName
=
rtl
::
OUStringToOString
(
aPfad
.
Copy
(
0
,
nPos
),
osl_getThreadTextEncoding
()
);
// stellt der Name die aktuelle Directory dar?
if
(
aName
==
"."
)
...
...
@@ -502,7 +502,7 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty
if
(
aStack
.
Empty
()
)
{
eFlag
=
FSYS_FLAG_CURRENT
;
aName
.
Erase
();
aName
=
rtl
::
OString
();
}
else
{
...
...
@@ -523,7 +523,7 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty
}
// wird damit ein Volume beschrieben?
if
(
!
pParent
&&
eFlag
==
FSYS_FLAG_RELROOT
&&
aName
.
Len
()
)
if
(
!
pParent
&&
eFlag
==
FSYS_FLAG_RELROOT
&&
aName
.
getLength
()
)
eFlag
=
FSYS_FLAG_VOLUME
;
// bei gesetztem ErrorCode den Namen komplett "ubernehmen
...
...
@@ -539,7 +539,7 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty
|*
*************************************************************************/
FSysError
DirEntry
::
ImpParseName
(
const
Byte
String
&
rbInitName
,
FSysError
DirEntry
::
ImpParseName
(
const
rtl
::
O
String
&
rbInitName
,
FSysPathStyle
eStyle
)
{
if
(
eStyle
==
FSYS_STYLE_HOST
)
...
...
@@ -580,22 +580,22 @@ static FSysPathStyle GetStyle( FSysPathStyle eStyle )
void
DirEntry
::
ImpTrim
(
FSysPathStyle
/* eStyle */
)
{
// Wildcards werden nicht geclipt
if
(
(
aName
.
Search
(
'*'
)
!=
STRING_NOTFOUND
)
||
(
aName
.
Search
(
'?'
)
!=
STRING_NOTFOUND
)
||
(
aName
.
Search
(
';'
)
!=
STRING_NOTFOUND
)
)
if
(
(
aName
.
indexOf
(
'*'
)
!=
-
1
)
||
(
aName
.
indexOf
(
'?'
)
!=
-
1
)
||
(
aName
.
indexOf
(
';'
)
!=
-
1
)
)
return
;
#if defined(WNT)
if
(
aName
.
Len
()
>
254
)
if
(
aName
.
getLength
()
>
254
)
{
nError
=
ERRCODE_IO_MISPLACEDCHAR
|
ERRCODE_WARNING_MASK
;
aName
.
Erase
(
254
);
aName
=
aName
.
copy
(
254
);
}
#else
if
(
aName
.
Len
()
>
250
)
if
(
aName
.
getLength
()
>
250
)
{
nError
=
ERRCODE_IO_MISPLACEDCHAR
|
ERRCODE_WARNING_MASK
;
aName
.
Erase
(
250
);
aName
=
aName
.
copy
(
250
);
}
#endif
}
...
...
@@ -606,7 +606,7 @@ void DirEntry::ImpTrim( FSysPathStyle /* eStyle */ )
|*
*************************************************************************/
DirEntry
::
DirEntry
(
const
Byte
String
&
rName
,
DirEntryFlag
eDirFlag
,
DirEntry
::
DirEntry
(
const
rtl
::
O
String
&
rName
,
DirEntryFlag
eDirFlag
,
FSysPathStyle
eStyle
)
:
#ifdef FEAT_FSYS_DOUBLESPEED
pStat
(
0
),
...
...
@@ -672,8 +672,8 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle )
return
;
}
Byte
String
aTmpName
(
rtl
::
OUStringToOString
(
rInitName
,
osl_getThreadTextEncoding
()));
if
(
aTmpName
.
CompareIgnoreCaseToAscii
(
"file:"
,
5
)
==
COMPARE_EQUAL
)
rtl
::
O
String
aTmpName
(
rtl
::
OUStringToOString
(
rInitName
,
osl_getThreadTextEncoding
()));
if
(
aTmpName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"file:"
))
)
{
#ifndef BOOTSTRAP
DBG_WARNING
(
"File URLs are not permitted but accepted"
);
...
...
@@ -692,12 +692,11 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle )
}
#ifdef DBG_UTIL
if
(
eStyle
==
FSYS_STYLE_HOST
&&
aTmpName
.
Search
(
"://"
)
!=
STRING_NOTFOUND
)
if
(
eStyle
==
FSYS_STYLE_HOST
&&
aTmpName
.
indexOf
(
"://"
)
!=
STRING_NOTFOUND
)
{
ByteString
aErr
=
"DirEntries akzeptieren nur File URLS: "
;
aErr
+=
aTmpName
;
DBG_WARNING
(
aErr
.
GetBuffer
()
);
rtl
::
OStringBuffer
aErr
(
RTL_CONSTASCII_STRINGPARAM
(
"DirEntries akzeptieren nur File URLS: "
))
;
aErr
.
append
(
aTmpName
)
;
DBG_WARNING
(
aErr
.
getStr
()
);
}
#endif
}
...
...
@@ -710,7 +709,7 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle )
/*************************************************************************/
DirEntry
::
DirEntry
(
const
Byte
String
&
rInitName
,
FSysPathStyle
eStyle
)
DirEntry
::
DirEntry
(
const
rtl
::
O
String
&
rInitName
,
FSysPathStyle
eStyle
)
#ifdef FEAT_FSYS_DOUBLESPEED
:
pStat
(
0
)
#endif
...
...
@@ -720,15 +719,15 @@ DirEntry::DirEntry( const ByteString& rInitName, FSysPathStyle eStyle )
pParent
=
NULL
;
// schnelle Loesung fuer Leerstring
if
(
!
rInitName
.
Len
()
)
if
(
!
rInitName
.
getLength
()
)
{
eFlag
=
FSYS_FLAG_CURRENT
;
nError
=
FSYS_ERR_OK
;
return
;
}
Byte
String
aTmpName
(
rInitName
);
if
(
rInitName
.
CompareIgnoreCaseToAscii
(
"file:"
,
5
)
==
COMPARE_EQUAL
)
rtl
::
O
String
aTmpName
(
rInitName
);
if
(
rInitName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"file:"
))
)
{
#ifndef BOOTSTRAP
DBG_WARNING
(
"File URLs are not permitted but accepted"
);
...
...
@@ -738,12 +737,13 @@ DirEntry::DirEntry( const ByteString& rInitName, FSysPathStyle eStyle )
}
#ifdef DBG_UTIL
else
if
(
eStyle
==
FSYS_STYLE_HOST
&&
rInitName
.
Search
(
"://"
)
!=
STRING_NOTFOUND
)
{
ByteString
aErr
=
"DirEntries akzeptieren nur File URLS: "
;
aErr
+=
rInitName
;
DBG_WARNING
(
aErr
.
GetBuffer
()
);
if
(
eStyle
==
FSYS_STYLE_HOST
&&
rInitName
.
indexOf
(
"://"
)
!=
-
1
)
{
rtl
::
OStringBuffer
aErr
(
RTL_CONSTASCII_STRINGPARAM
(
"DirEntries akzeptieren nur File URLS: "
));
aErr
.
append
(
rInitName
);
DBG_WARNING
(
aErr
.
getStr
());
}
}
#endif
...
...
@@ -834,7 +834,7 @@ DirEntry* DirEntry::ImpChangeParent( DirEntry* pNewParent, sal_Bool bNormalize )
DirEntry
*
pTemp
=
pParent
;
if
(
bNormalize
&&
pNewParent
&&
pNewParent
->
eFlag
==
FSYS_FLAG_RELROOT
&&
!
pNewParent
->
aName
.
Len
()
)
pNewParent
->
eFlag
==
FSYS_FLAG_RELROOT
&&
!
pNewParent
->
aName
.
getLength
()
)
{
pParent
=
0
;
delete
pNewParent
;
...
...
@@ -862,18 +862,18 @@ sal_Bool DirEntry::Exists( FSysAccess nAccess ) const
#if defined WNT
// spezielle Filenamen sind vom System da
if
(
(
aName
.
CompareIgnoreCaseToAscii
(
"CLOCK$"
)
==
COMPARE_EQUAL
||
aName
.
CompareIgnoreCaseToAscii
(
"CON"
)
==
COMPARE_EQUAL
||
aName
.
CompareIgnoreCaseToAscii
(
"AUX"
)
==
COMPARE_EQUAL
||
aName
.
CompareIgnoreCaseToAscii
(
"COM1"
)
==
COMPARE_EQUAL
||
aName
.
CompareIgnoreCaseToAscii
(
"COM2"
)
==
COMPARE_EQUAL
||
aName
.
CompareIgnoreCaseToAscii
(
"COM3"
)
==
COMPARE_EQUAL
||
aName
.
CompareIgnoreCaseToAscii
(
"COM4"
)
==
COMPARE_EQUAL
||
aName
.
CompareIgnoreCaseToAscii
(
"LPT1"
)
==
COMPARE_EQUAL
||
aName
.
CompareIgnoreCaseToAscii
(
"LPT2"
)
==
COMPARE_EQUAL
||
aName
.
CompareIgnoreCaseToAscii
(
"LPT3"
)
==
COMPARE_EQUAL
||
aName
.
CompareIgnoreCaseToAscii
(
"NUL"
)
==
COMPARE_EQUAL
||
aName
.
CompareIgnoreCaseToAscii
(
"PRN"
)
==
COMPARE_EQUAL
)
)
if
(
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"CLOCK$"
))
||
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"CON"
))
||
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"AUX"
))
||
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"COM1"
))
||
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"COM2"
))
||
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"COM3"
))
||
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"COM4"
))
||
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"LPT1"
))
||
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"LPT2"
))
||
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"LPT3"
))
||
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"NUL"
))
||
aName
.
equalsIgnoreAsciiCaseL
(
RTL_CONSTASCII_STRINGPARAM
(
"PRN"
)
)
)
return
sal_True
;
#endif
...
...
@@ -887,7 +887,7 @@ sal_Bool DirEntry::Exists( FSysAccess nAccess ) const
#if defined WNT
if
(
0
!=
(
eKind
&
FSYS_KIND_DEV
)
)
{
return
DRIVE_EXISTS
(
ImpGetTopPtr
()
->
aName
.
GetChar
(
0
)
);
return
DRIVE_EXISTS
(
ImpGetTopPtr
()
->
aName
[
0
]
);
}
#endif
...
...
@@ -918,7 +918,7 @@ sal_Bool DirEntry::First()
pEntry
;
pEntry
=
readdir
(
pDir
)
)
{
Byte
String
aFound
(
pEntry
->
d_name
);
rtl
::
O
String
aFound
(
pEntry
->
d_name
);
if
(
aWildeKarte
.
Matches
(
String
(
CMP_LOWER
(
aFound
),
osl_getThreadTextEncoding
())))
{
aName
=
aFound
;
...
...
@@ -1005,16 +1005,18 @@ String DirEntry::GetExtension( char cSep ) const
{
DBG_CHKTHIS
(
DirEntry
,
ImpCheckDirEntry
);
const
char
*
p0
=
(
aName
.
GetBuffer
()
);
const
char
*
p1
=
p0
+
aName
.
Len
()
-
1
;
const
char
*
p0
=
aName
.
getStr
(
);
const
char
*
p1
=
p0
+
aName
.
getLength
()
-
1
;
while
(
p1
>=
p0
&&
*
p1
!=
cSep
)
p1
--
;
if
(
p1
>=
p0
)
{
// es wurde ein cSep an der Position p1 gefunden
return
String
(
aName
.
Copy
(
static_cast
<
xub_StrLen
>
(
p1
-
p0
+
1
)
),
return
rtl
::
OStringToOUString
(
aName
.
copy
(
p1
-
p0
+
1
),
osl_getThreadTextEncoding
());
}
return
String
();
}
...
...
@@ -1028,20 +1030,20 @@ String DirEntry::GetBase( char cSep ) const
{
DBG_CHKTHIS
(
DirEntry
,
ImpCheckDirEntry
);
const
char
*
p0
=
(
aName
.
GetBuffer
()
);
const
char
*
p1
=
p0
+
aName
.
Len
()
-
1
;
const
char
*
p0
=
aName
.
getStr
(
);
const
char
*
p1
=
p0
+
aName
.
getLength
()
-
1
;
while
(
p1
>=
p0
&&
*
p1
!=
cSep
)
p1
--
;
if
(
p1
>=
p0
)
{
// es wurde ein cSep an der Position p1 gefunden
return
String
(
aName
.
Copy
(
0
,
static_cast
<
xub_StrLen
>
(
p1
-
p0
)
),
return
rtl
::
OStringToOUString
(
aName
.
copy
(
0
,
p1
-
p0
),
osl_getThreadTextEncoding
());
else
}
// es wurde kein cSep gefunden
return
String
(
aName
,
osl_getThreadTextEncoding
());
return
rtl
::
OStringToOU
String
(
aName
,
osl_getThreadTextEncoding
());
}
/*************************************************************************
...
...
@@ -1078,7 +1080,7 @@ String DirEntry::GetName( FSysPathStyle eStyle ) const
}
case
FSYS_FLAG_RELROOT
:
if
(
!
aName
.
Len
()
)
if
(
!
aName
.
getLength
()
)
{
aRet
.
append
(
ACTCURRENT
(
eStyle
));
break
;
...
...
@@ -1106,7 +1108,7 @@ bool DirEntry::IsAbs() const
#ifdef UNX
return
(
pParent
?
pParent
->
IsAbs
()
:
eFlag
==
FSYS_FLAG_ABSROOT
);
#else
return
(
pParent
?
pParent
->
IsAbs
()
:
eFlag
==
FSYS_FLAG_ABSROOT
&&
aName
.
Len
()
>
0
);
return
(
pParent
?
pParent
->
IsAbs
()
:
eFlag
==
FSYS_FLAG_ABSROOT
&&
aName
.
getLength
()
>
0
);
#endif
}
...
...
@@ -1138,13 +1140,13 @@ String DirEntry::CutName( FSysPathStyle eStyle )
else
{
eFlag
=
FSYS_FLAG_CURRENT
;
aName
.
Erase
();
aName
=
rtl
::
OString
();
}
}
else
{
eFlag
=
FSYS_FLAG_CURRENT
;
aName
.
Erase
();
aName
=
rtl
::
OString
();
delete
pParent
;
pParent
=
NULL
;
}
...
...
@@ -1250,10 +1252,10 @@ DirEntry DirEntry::operator+( const DirEntry& rEntry ) const
*/
if
(
(
eFlag
==
FSYS_FLAG_RELROOT
&&
!
aName
.
Len
())
||
(
eFlag
==
FSYS_FLAG_RELROOT
&&
!
aName
.
getLength
())
||
(
(
pEntryTop
->
aName
.
Len
()
||
((
rEntry
.
Level
()
>
1
)
?
(
rEntry
[
rEntry
.
Level
()
-
2
].
aName
.
CompareIgnoreCaseToAscii
(
RFS_IDENTIFIER
)
==
COMPARE_EQUAL
)
:
sal_False
))
(
pEntryTop
->
aName
.
getLength
()
||
((
rEntry
.
Level
()
>
1
)
?
(
rEntry
[
rEntry
.
Level
()
-
2
].
aName
.
equalsIgnoreAsciiCase
(
RFS_IDENTIFIER
)
)
:
sal_False
))
&&
(
pEntryTop
->
eFlag
==
FSYS_FLAG_ABSROOT
||
pEntryTop
->
eFlag
==
FSYS_FLAG_RELROOT
||
...
...
@@ -1265,7 +1267,7 @@ DirEntry DirEntry::operator+( const DirEntry& rEntry ) const
}
// irgendwas + "." (=> pEntryTop == &rEntry)
if
(
pEntryTop
->
eFlag
==
FSYS_FLAG_RELROOT
&&
!
pEntryTop
->
aName
.
Len
()
)
if
(
pEntryTop
->
eFlag
==
FSYS_FLAG_RELROOT
&&
!
pEntryTop
->
aName
.
getLength
()
)
{
DBG_ASSERT
(
pEntryTop
==
&
rEntry
,
"DirEntry::op+ buggy"
);
return
*
this
;
...
...
@@ -1279,11 +1281,11 @@ DirEntry DirEntry::operator+( const DirEntry& rEntry ) const
// irgendwas += abs (=> nur Device uebernehmen falls vorhanden)
if
(
pEntryTop
->
eFlag
==
FSYS_FLAG_ABSROOT
)
{
Byte
String
aDevice
;
rtl
::
O
String
aDevice
;
if
(
pThisTop
->
eFlag
==
FSYS_FLAG_ABSROOT
)
aDevice
=
pThisTop
->
aName
;
DirEntry
aRet
=
rEntry
;
if
(
aDevice
.
Len
()
)
if
(
aDevice
.
getLength
()
)
aRet
.
ImpGetTopPtr
()
->
aName
=
aDevice
;
return
aRet
;
}
...
...
@@ -1389,8 +1391,8 @@ void DirEntry::SetName( const String& rName, FSysPathStyle eFormatter )
sal_Char
cAccDelim
(
ACCESSDELIM_C
(
eFormatter
));
if
(
(
eFlag
!=
FSYS_FLAG_NORMAL
)
||
(
aName
.
Search
(
':'
)
!=
STRING_NOTFOUND
)
||
(
aName
.
Search
(
cAccDelim
)
!=
STRING_NOTFOUND
)
)
(
aName
.
indexOf
(
':'
)
!=
-
1
)
||
(
aName
.
indexOf
(
cAccDelim
)
!=
-
1
)
)
{
eFlag
=
FSYS_FLAG_INVALID
;
}
...
...
@@ -1412,8 +1414,9 @@ sal_Bool DirEntry::Find( const String& rPfad, char cDelim )
if
(
ImpGetTopPtr
()
->
eFlag
==
FSYS_FLAG_ABSROOT
)
return
sal_True
;
sal_Bool
bWild
=
aName
.
Search
(
'*'
)
!=
STRING_NOTFOUND
||
aName
.
Search
(
'?'
)
!=
STRING_NOTFOUND
;
sal_Bool
bWild
=
aName
.
indexOf
(
'*'
)
!=
-
1
||
aName
.
indexOf
(
'?'
)
!=
-
1
;
if
(
!
cDelim
)
cDelim
=
SEARCHDELIM
(
DEFSTYLE
)[
0
];
...
...
@@ -1462,10 +1465,10 @@ DirEntry DirEntry::GetDevice() const
const
DirEntry
*
pTop
=
ImpGetTopPtr
();
if
(
(
pTop
->
eFlag
==
FSYS_FLAG_ABSROOT
||
pTop
->
eFlag
==
FSYS_FLAG_RELROOT
)
&&
pTop
->
aName
.
Len
()
)
pTop
->
aName
.
getLength
()
)
return
DirEntry
(
pTop
->
aName
,
FSYS_FLAG_VOLUME
,
FSYS_STYLE_HOST
);
else
return
DirEntry
(
Byte
String
(),
FSYS_FLAG_INVALID
,
FSYS_STYLE_HOST
);
return
DirEntry
(
rtl
::
O
String
(),
FSYS_FLAG_INVALID
,
FSYS_STYLE_HOST
);
}
#endif
...
...
@@ -1480,16 +1483,16 @@ void DirEntry::SetBase( const String& rBase, char cSep )
{
DBG_CHKTHIS
(
DirEntry
,
ImpCheckDirEntry
);
const
char
*
p0
=
(
aName
.
GetBuffer
()
);
const
char
*
p1
=
p0
+
aName
.
Len
()
-
1
;
const
char
*
p0
=
aName
.
getStr
(
);
const
char
*
p1
=
p0
+
aName
.
getLength
()
-
1
;
while
(
p1
>=
p0
&&
*
p1
!=
cSep
)
p1
--
;
if
(
p1
>=
p0
)
{
// es wurde ein cSep an der Position p1 gefunden
aName
.
Erase
(
0
,
static_cast
<
xub_StrLen
>
(
p1
-
p0
)
);
aName
.
Insert
(
ByteString
(
rBase
,
osl_getThreadTextEncoding
()),
0
);
aName
=
rtl
::
OUStringToOString
(
rBase
,
osl_getThreadTextEncoding
())
+
aName
.
copy
(
p1
-
p0
);
}
else
aName
=
rtl
::
OUStringToOString
(
rBase
,
osl_getThreadTextEncoding
());
...
...
@@ -1503,7 +1506,7 @@ void DirEntry::SetBase( const String& rBase, char cSep )
String
DirEntry
::
GetSearchDelimiter
(
FSysPathStyle
eFormatter
)
{
return
String
(
ByteString
(
SEARCHDELIM
(
GetStyle
(
eFormatter
)
)
),
osl_getThreadTextEncoding
());
return
rtl
::
OStringToOUString
(
rtl
::
OString
(
SEARCHDELIM
(
GetStyle
(
eFormatter
))
),
osl_getThreadTextEncoding
());
}
/*************************************************************************
...
...
@@ -1520,15 +1523,15 @@ const DirEntry& DirEntry::SetTempNameBase( const String &rBase )
DirEntry
aTempDir
=
DirEntry
().
TempName
().
GetPath
();
aTempDir
+=
DirEntry
(
rBase
);
#ifdef UNX
Byte
String
aName
(
rtl
::
OUStringToOString
(
aTempDir
.
GetFull
(),
osl_getThreadTextEncoding
()));
if
(
access
(
aName
.
GetBuffe
r
(),
W_OK
|
X_OK
|
R_OK
)
)
rtl
::
O
String
aName
(
rtl
::
OUStringToOString
(
aTempDir
.
GetFull
(),
osl_getThreadTextEncoding
()));
if
(
access
(
aName
.
getSt
r
(),
W_OK
|
X_OK
|
R_OK
)
)
{
// Create the directory and only on success give all rights to
// everyone. Use mkdir instead of DirEntry::MakeDir because
// this returns sal_True even if directory already exists.
if
(
!
mkdir
(
aName
.
GetBuffe
r
(),
S_IRWXU
|
S_IRWXG
|
S_IRWXO
)
)
chmod
(
aName
.
GetBuffe
r
(),
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
if
(
!
mkdir
(
aName
.
getSt
r
(),
S_IRWXU
|
S_IRWXG
|
S_IRWXO
)
)
chmod
(
aName
.
getSt
r
(),
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
// This will not create a directory but perhaps FileStat called
// there modifies the DirEntry
...
...
@@ -1554,7 +1557,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const
return
aFactory
.
TempName
();
}
Byte
String
aDirName
;
rtl
::
O
String
aDirName
;
char
*
ret_val
;
size_t
i
;
...
...
@@ -1562,16 +1565,16 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const
char
pfx
[
6
];
char
ext
[
5
];
const
char
*
dir
;
const
char
*
pWild
=
strchr
(
aName
.
GetBuffe
r
(),
'*'
);
const
char
*
pWild
=
strchr
(
aName
.
getSt
r
(),
'*'
);
if
(
!
pWild
)
pWild
=
strchr
(
aName
.
GetBuffe
r
(),
'?'
);
pWild
=
strchr
(
aName
.
getSt
r
(),
'?'
);
if
(
pWild
)
{
if
(
pParent
)
aDirName
=
rtl
::
OUStringToOString
(
pParent
->
GetFull
(),
osl_getThreadTextEncoding
());
strncpy
(
pfx
,
aName
.
GetBuffer
(),
Min
(
(
int
)
5
,
(
int
)(
pWild
-
aName
.
GetBuffe
r
())
)
);
pfx
[
pWild
-
aName
.
GetBuffe
r
()
]
=
0
;
strncpy
(
pfx
,
aName
.
getStr
(),
Min
(
(
int
)
5
,
(
int
)(
pWild
-
aName
.
getSt
r
())
)
);
pfx
[
pWild
-
aName
.
getSt
r
()
]
=
0
;
const
char
*
pExt
=
strchr
(
pWild
,
'.'
);
if
(
pExt
)
{
...
...
@@ -1587,7 +1590,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const
strcpy
(
pfx
,
"lo"
);
strcpy
(
ext
,
".tmp"
);
}
dir
=
aDirName
.
GetBuffe
r
();
dir
=
aDirName
.
getSt
r
();
char
sBuf
[
_MAX_PATH
];
if
(
eFlag
==
FSYS_FLAG_CURRENT
||
(
!
pParent
&&
pWild
)
)
...
...
@@ -1679,7 +1682,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const
}
#else
struct
stat
aStat
;
if
(
stat
(
ByteString
(
aRedirected
,
osl_getThreadTextEncoding
()).
GetBuffer
(),
&
aStat
)
)
if
(
stat
(
rtl
::
OUStringToOString
(
aRedirected
,
osl_getThreadTextEncoding
()).
getStr
(),
&
aStat
)
)
{
aRet
=
DirEntry
(
aRetVal
);
break
;
...
...
@@ -1722,13 +1725,13 @@ const DirEntry &DirEntry::operator[]( sal_uInt16 nParentLevel ) const
|*
*************************************************************************/
FSysError
DirEntry
::
ImpParseUnixName
(
const
Byte
String
&
rPfad
,
FSysPathStyle
eStyle
)
FSysError
DirEntry
::
ImpParseUnixName
(
const
rtl
::
O
String
&
rPfad
,
FSysPathStyle
eStyle
)
{
DBG_CHKTHIS
(
DirEntry
,
ImpCheckDirEntry
);
// die einzelnen Namen auf einen Stack packen
DirEntryStack
aStack
;
ByteString
aPfad
(
rPfad
);
rtl
::
OString
aPfad
(
rPfad
);
do
{
// den Namen vor dem ersten "/" abspalten,
...
...
@@ -1737,12 +1740,12 @@ FSysError DirEntry::ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eSt
// den ersten '/' suchen
sal_uInt16
nPos
;
for
(
nPos
=
0
;
nPos
<
aPfad
.
Len
()
&&
aPfad
.
GetChar
(
nPos
)
!=
'/'
;
nPos
<
aPfad
.
getLength
()
&&
aPfad
[
nPos
]
!=
'/'
;
nPos
++
)
/* do nothing */
;
// ist der Name die Root des aktuellen Drives?
if
(
nPos
==
0
&&
aPfad
.
Len
()
>
0
&&
(
aPfad
.
GetChar
(
0
)
==
'/'
)
)
if
(
nPos
==
0
&&
aPfad
.
getLength
()
>
0
&&
(
aPfad
[
0
]
==
'/'
)
)
{
// Root-Directory des aktuellen Drives
aStack
.
Push
(
new
DirEntry
(
FSYS_FLAG_ABSROOT
)
);
...
...
@@ -1750,7 +1753,7 @@ FSysError DirEntry::ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eSt
else
{
// den Namen ohne Trenner abspalten
aName
=
aPfad
.
Copy
(
0
,
nPos
);
aName
=
aPfad
.
copy
(
0
,
nPos
);
// stellt der Name die aktuelle Directory dar?
if
(
aName
==
"."
)
...
...
@@ -1774,7 +1777,7 @@ FSysError DirEntry::ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eSt
if
(
(
aStack
.
Empty
()
)
||
(
aStack
.
Top
()
->
eFlag
==
FSYS_FLAG_PARENT
)
)
// fuehrende Parents kommen auf den Stack
aStack
.
Push
(
new
DirEntry
(
ByteString
(),
FSYS_FLAG_PARENT
,
eStyle
)
);
aStack
.
Push
(
new
DirEntry
(
rtl
::
OString
(),
FSYS_FLAG_PARENT
,
eStyle
)
);
// ist es eine absolute Root
else
if
(
aStack
.
Top
()
->
eFlag
==
FSYS_FLAG_ABSROOT
)
{
...
...
@@ -1802,17 +1805,17 @@ FSysError DirEntry::ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eSt
}
// den Restpfad bestimmen
aPfad
.
Erase
(
0
,
nPos
+
1
);
while
(
aPfad
.
Len
()
&&
(
aPfad
.
GetChar
(
0
)
==
'/'
)
)
aPfad
.
Erase
(
0
,
1
);
aPfad
=
aPfad
.
copy
(
nPos
+
1
);
while
(
aPfad
.
getLength
()
&&
(
aPfad
[
0
]
==
'/'
)
)
aPfad
=
aPfad
.
copy
(
1
);
}
while
(
aPfad
.
Len
()
);
while
(
aPfad
.
getLength
()
);
// Haupt-Entry (selbst) zuweisen
if
(
aStack
.
Empty
()
)
{
eFlag
=
FSYS_FLAG_CURRENT
;
aName
.
Erase
();
aName
=
rtl
::
OString
();
}
else
{
...
...
@@ -1973,8 +1976,8 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const
FSysRedirector
::
DoRedirect
(
aTo
);
#endif
Byte
String
bFrom
(
rtl
::
OUStringToOString
(
aFrom
,
osl_getThreadTextEncoding
()));
Byte
String
bTo
(
rtl
::
OUStringToOString
(
aTo
,
osl_getThreadTextEncoding
()));
rtl
::
O
String
bFrom
(
rtl
::
OUStringToOString
(
aFrom
,
osl_getThreadTextEncoding
()));
rtl
::
O
String
bTo
(
rtl
::
OUStringToOString
(
aTo
,
osl_getThreadTextEncoding
()));
#ifdef WNT
// MoveTo nun atomar
...
...
@@ -1991,7 +1994,7 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const
if
(
aFromDevice
==
aToDevice
)
{
// ja, also intra-device-move mit MoveFile
MoveFile
(
bFrom
.
GetBuffer
(),
bTo
.
GetBuffe
r
()
);
MoveFile
(
bFrom
.
getStr
(),
bTo
.
getSt
r
()
);
// MoveFile ist buggy bei cross-device operationen.
// Der R?ckgabewert ist auch dann sal_True, wenn nur ein Teil der Operation geklappt hat.
// Zudem zeigt MoveFile unterschiedliches Verhalten bei unterschiedlichen NT-Versionen.
...
...
@@ -2031,7 +2034,7 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const
// #68639#
// on some nfs connections rename with from == to
// leads to destruction of file
if
(
(
aFrom
!=
aTo
)
&&
(
0
!=
rename
(
bFrom
.
GetBuffer
(),
bTo
.
GetBuffe
r
()
)
)
)
if
(
(
aFrom
!=
aTo
)
&&
(
0
!=
rename
(
bFrom
.
getStr
(),
bTo
.
getSt
r
()
)
)
)
#if !defined(UNX)
return
Sys2SolarError_Impl
(
GetLastError
()
);
#else
...
...
@@ -2039,8 +2042,8 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const
if
(
errno
==
EXDEV
)
// cross device geht latuernich nicht mit rename
{
FILE
*
fpIN
=
fopen
(
bFrom
.
GetBuffe
r
(),
"r"
);
FILE
*
fpOUT
=
fopen
(
bTo
.
GetBuffe
r
(),
"w"
);
FILE
*
fpIN
=
fopen
(
bFrom
.
getSt
r
(),
"r"
);
FILE
*
fpOUT
=
fopen
(
bTo
.
getSt
r
(),
"w"
);
if
(
fpIN
&&
fpOUT
)
{
char
pBuf
[
16384
];
...
...
@@ -2060,12 +2063,12 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const
fclose
(
fpOUT
);
if
(
nErr
)
{
unlink
(
bTo
.
GetBuffe
r
()
);
unlink
(
bTo
.
getSt
r
()
);
return
Sys2SolarError_Impl
(
nErr
);
}
else
{
unlink
(
bFrom
.
GetBuffe
r
()
);
unlink
(
bFrom
.
getSt
r
()
);
}
}
else
...
...
@@ -2113,11 +2116,11 @@ FSysError DirEntry::Kill( FSysAction nActions ) const
#ifndef BOOTSTRAP
FSysRedirector
::
DoRedirect
(
aTmpName
);
#endif
Byte
String
bTmpName
(
rtl
::
OUStringToOString
(
aTmpName
,
osl_getThreadTextEncoding
()));
rtl
::
O
String
bTmpName
(
rtl
::
OUStringToOString
(
aTmpName
,
osl_getThreadTextEncoding
()));
char
*
pName
=
new
char
[
bTmpName
.
Len
()
+
2
];
strcpy
(
pName
,
bTmpName
.
GetBuffe
r
()
);
pName
[
bTmpName
.
Len
()
+
1
]
=
(
char
)
0
;
char
*
pName
=
new
char
[
bTmpName
.
getLength
()
+
2
];
strcpy
(
pName
,
bTmpName
.
getSt
r
()
);
pName
[
bTmpName
.
getLength
()
+
1
]
=
(
char
)
0
;
//read-only files sollen auch geloescht werden koennen
sal_Bool
isReadOnly
=
FileStat
::
GetReadOnlyFlag
(
*
this
);
...
...
tools/source/fsys/filecopy.cxx
Dosyayı görüntüle @
2a2fbbec
...
...
@@ -270,14 +270,14 @@ FSysError FileCopier::DoCopy_Impl(
if
(
FSYS_ERR_OK
==
ERRCODE_TOERROR
(
eRet
)
)
{
WIN32_FIND_DATA
fdSource
;
ByteString
aFullSource
(
aSource
.
GetFull
(),
osl_getThreadTextEncoding
(
));
ByteString
aFullTarget
(
aTgt
.
GetFull
(),
osl_getThreadTextEncoding
(
));
HANDLE
hFind
=
FindFirstFile
(
aFullSource
.
GetBuffe
r
()
,
&
fdSource
);
rtl
::
OString
aFullSource
(
rtl
::
OUStringToOString
(
aSource
.
GetFull
(),
osl_getThreadTextEncoding
()
));
rtl
::
OString
aFullTarget
(
rtl
::
OUStringToOString
(
aTgt
.
GetFull
(),
osl_getThreadTextEncoding
()
));
HANDLE
hFind
=
FindFirstFile
(
aFullSource
.
getSt
r
()
,
&
fdSource
);
if
(
hFind
!=
INVALID_HANDLE_VALUE
)
{
FindClose
(
hFind
);
HANDLE
hFile
=
CreateFile
(
aFullTarget
.
GetBuffe
r
(),
GENERIC_WRITE
,
HANDLE
hFile
=
CreateFile
(
aFullTarget
.
getSt
r
(),
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
...
...
@@ -287,7 +287,7 @@ FSysError FileCopier::DoCopy_Impl(
CloseHandle
(
hFile
);
}
SetFileAttributes
(
aFullTarget
.
GetBuffe
r
(),
fdSource
.
dwFileAttributes
);
SetFileAttributes
(
aFullTarget
.
getSt
r
(),
fdSource
.
dwFileAttributes
);
}
}
#endif
...
...
tools/source/fsys/fstat.cxx
Dosyayı görüntüle @
2a2fbbec
...
...
@@ -140,16 +140,15 @@ sal_Bool FileStat::IsKind( DirEntryKind nKind ) const
sal_Bool
FileStat
::
GetReadOnlyFlag
(
const
DirEntry
&
rEntry
)
{
ByteString
aFPath
(
rEntry
.
GetFull
(),
osl_getThreadTextEncoding
());
rtl
::
OString
aFPath
(
rtl
::
OUStringToOString
(
rEntry
.
GetFull
(),
osl_getThreadTextEncoding
()));
#if defined WNT
DWORD
nRes
=
GetFileAttributes
(
(
LPCTSTR
)
aFPath
.
GetBuffe
r
()
);
DWORD
nRes
=
GetFileAttributes
(
(
LPCTSTR
)
aFPath
.
getSt
r
()
);
return
ULONG_MAX
!=
nRes
&&
(
FILE_ATTRIBUTE_READONLY
&
nRes
)
==
FILE_ATTRIBUTE_READONLY
;
#elif defined UNX
/* could we stat the object? */
struct
stat
aBuf
;
if
(
stat
(
aFPath
.
GetBuffe
r
(),
&
aBuf
))
if
(
stat
(
aFPath
.
getSt
r
(),
&
aBuf
))
return
sal_False
;
/* jupp, is writable for user? */
return
((
aBuf
.
st_mode
&
S_IWUSR
)
!=
S_IWUSR
);
...
...
@@ -167,19 +166,19 @@ sal_Bool FileStat::GetReadOnlyFlag( const DirEntry &rEntry )
sal_uIntPtr
FileStat
::
SetReadOnlyFlag
(
const
DirEntry
&
rEntry
,
sal_Bool
bRO
)
{
ByteString
aFPath
(
rEntry
.
GetFull
(),
osl_getThreadTextEncoding
(
));
rtl
::
OString
aFPath
(
rtl
::
OUStringToOString
(
rEntry
.
GetFull
(),
osl_getThreadTextEncoding
()
));
#if defined WNT
DWORD
nRes
=
GetFileAttributes
(
(
LPCTSTR
)
aFPath
.
GetBuffe
r
()
);
DWORD
nRes
=
GetFileAttributes
(
(
LPCTSTR
)
aFPath
.
getSt
r
()
);
if
(
ULONG_MAX
!=
nRes
)
nRes
=
SetFileAttributes
(
(
LPCTSTR
)
aFPath
.
GetBuffe
r
(),
nRes
=
SetFileAttributes
(
(
LPCTSTR
)
aFPath
.
getSt
r
(),
(
nRes
&
~
FILE_ATTRIBUTE_READONLY
)
|
(
bRO
?
FILE_ATTRIBUTE_READONLY
:
0
)
);
return
(
ULONG_MAX
==
nRes
)
?
ERRCODE_IO_UNKNOWN
:
0
;
#elif defined UNX
/* first, stat the object to get permissions */
struct
stat
aBuf
;
if
(
stat
(
aFPath
.
GetBuffe
r
(),
&
aBuf
))
if
(
stat
(
aFPath
.
getSt
r
(),
&
aBuf
))
return
ERRCODE_IO_NOTEXISTS
;
/* set or clear write bit for user */
mode_t
nMode
;
...
...
@@ -192,7 +191,7 @@ sal_uIntPtr FileStat::SetReadOnlyFlag( const DirEntry &rEntry, sal_Bool bRO )
else
nMode
=
aBuf
.
st_mode
|
S_IWUSR
;
/* change it on fs */
if
(
chmod
(
aFPath
.
GetBuffe
r
(),
nMode
))
if
(
chmod
(
aFPath
.
getSt
r
(),
nMode
))
{
switch
(
errno
)
{
...
...
tools/source/fsys/tdir.cxx
Dosyayı görüntüle @
2a2fbbec
...
...
@@ -247,15 +247,14 @@ void Dir::Construct( DirEntryKind nKindFlags )
pSortLst
=
NULL
;
pStatLst
=
NULL
;
eAttrMask
=
nKindFlags
;
ByteString
aTempName
(
GetName
(),
osl_getThreadTextEncoding
()
);
if
(
aTempName
.
Search
(
"*"
)
!=
STRING_NOTFOUND
||
aTempName
.
Search
(
"?"
)
!=
STRING_NOTFOUND
)
rtl
::
OString
aTempName
(
rtl
::
OUStringToOString
(
GetName
(),
osl_getThreadTextEncoding
()));
if
(
aTempName
.
indexOf
(
'*'
)
!=
-
1
||
aTempName
.
indexOf
(
'?'
)
!=
-
1
)
{
#if defined( WNT )
ByteString
aTStr
(
CutName
(),
osl_getThreadTextEncoding
(
));
char
*
pBuffer
=
new
char
[
aTStr
.
Len
()
+
1
];
strcpy
(
pBuffer
,
aTStr
.
GetBuffe
r
()
);
CharLowerBuff
(
pBuffer
,
aTStr
.
Len
()
);
rtl
::
OString
aTStr
(
rtl
::
OUStringToOString
(
CutName
(),
osl_getThreadTextEncoding
()
));
char
*
pBuffer
=
new
char
[
aTStr
.
getLength
()
+
1
];
strcpy
(
pBuffer
,
aTStr
.
getSt
r
()
);
CharLowerBuff
(
pBuffer
,
aTStr
.
getLength
()
);
aNameMask
=
WildCard
(
String
(
pBuffer
,
osl_getThreadTextEncoding
()),
';'
);
delete
[]
pBuffer
;
#else
...
...
tools/source/fsys/wntmsc.cxx
Dosyayı görüntüle @
2a2fbbec
...
...
@@ -206,7 +206,7 @@ sal_Bool DirEntry::SetCWD( sal_Bool bSloppy ) const
FSysFailOnErrorImpl
();
if
(
eFlag
==
FSYS_FLAG_CURRENT
&&
!
aName
.
Len
()
)
if
(
eFlag
==
FSYS_FLAG_CURRENT
&&
!
aName
.
getLength
()
)
return
sal_True
;
if
(
SetCurrentDirectory
(
rtl
::
OUStringToOString
(
GetFull
(),
osl_getThreadTextEncoding
()).
getStr
())
)
...
...
@@ -659,7 +659,7 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool bForceAccess )
// Sonderbehandlung falls es sich um eine Root ohne Laufwerk handelt
if
(
!
rDirEntry
.
aName
.
Len
()
&&
rDirEntry
.
eFlag
==
FSYS_FLAG_ABSROOT
)
if
(
!
rDirEntry
.
aName
.
getLength
()
&&
rDirEntry
.
eFlag
==
FSYS_FLAG_ABSROOT
)
{
nKindFlags
=
FSYS_KIND_DIR
;
nError
=
FSYS_ERR_OK
;
...
...
@@ -701,7 +701,7 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool bForceAccess )
aDirEntry
.
eFlag
==
FSYS_FLAG_ABSROOT
)
{
if
(
aDirEntry
.
eFlag
==
FSYS_FLAG_VOLUME
)
nKindFlags
=
FSYS_KIND_DEV
|
(
aDirEntry
.
aName
.
Len
()
==
2
nKindFlags
=
FSYS_KIND_DEV
|
(
aDirEntry
.
aName
.
getLength
()
==
2
?
FSYS_KIND_BLOCK
:
FSYS_KIND_CHAR
);
else
...
...
@@ -781,7 +781,7 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool bForceAccess )
// UNC-Volume?
DirEntry
*
pTop
=
aAbsEntry
.
ImpGetTopPtr
();
if
(
pTop
->
GetFlag
()
==
FSYS_FLAG_ABSROOT
&&
(
pTop
->
aName
.
Len
()
>
1
&&
(
pTop
->
aName
.
GetBuffer
()
[
1
]
!=
':'
))
)
(
pTop
->
aName
.
getLength
()
>
1
&&
(
pTop
->
aName
[
1
]
!=
':'
))
)
{
if
(
bForceAccess
)
{
...
...
tools/source/fsys/wntmsc.hxx
Dosyayı görüntüle @
2a2fbbec
...
...
@@ -70,7 +70,7 @@ typedef struct
#define PATHDELIMITER ";"
#define DEFSTYLE FSYS_STYLE_NTFS
#define MKDIR( p ) mkdir( p )
#define CMP_LOWER(s) (
ByteString(s).ToLowerAscii
() )
#define CMP_LOWER(s) (
s.toAsciiLowerCase
() )
#define START_DRV 'a'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment