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
4a086fca
Kaydet (Commit)
4a086fca
authored
Ock 19, 2012
tarafından
Michael Meeks
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix SvStream to not require a custom open or lstat method.
üst
755f299e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
66 deletions
+38
-66
file.h
sal/inc/osl/detail/file.h
+0
-12
file.h
sal/inc/osl/file.h
+1
-0
file.cxx
sal/osl/unx/file.cxx
+1
-1
file_stat.cxx
sal/osl/unx/file_stat.cxx
+0
-12
sal.map
sal/util/sal.map
+0
-2
stream.hxx
tools/inc/tools/stream.hxx
+2
-2
strmunx.cxx
tools/source/stream/strmunx.cxx
+34
-37
No files found.
sal/inc/osl/detail/file.h
Dosyayı görüntüle @
4a086fca
...
...
@@ -49,25 +49,13 @@ extern "C" {
#define osl_File_OpenFlag_Trunc 0x00000010L
#define osl_File_OpenFlag_NoExcl 0x00000020L
/* Variant of osl_openFile that takes the file pathname directly as a
char*
*/
SAL_DLLPUBLIC
oslFileError
SAL_CALL
osl_openFilePath
(
const
char
*
cpFilePath
,
oslFileHandle
*
pHandle
,
sal_uInt32
uFlags
);
/* Compare directory items for being the same underlying file
* this unwinds unix hard-links and symlinks etc.
*/
SAL_DLLPUBLIC
sal_Bool
SAL_CALL
osl_identicalDirectoryItem
(
oslDirectory
a
,
oslDirectory
b
);
SAL_DLLPUBLIC
oslFileError
SAL_CALL
osl_lstatFilePath
(
const
char
*
cpFilePath
,
struct
stat
*
statb
);
/* Get the OS specific "handle" of an open file. */
SAL_DLLPUBLIC
oslFileError
SAL_CALL
osl_getFileOSHandle
(
oslFileHandle
Handle
,
sal_IntPtr
*
piFileHandle
);
...
...
sal/inc/osl/file.h
Dosyayı görüntüle @
4a086fca
...
...
@@ -664,6 +664,7 @@ typedef void *oslFileHandle;
#define osl_File_OpenFlag_Write 0x00000002L
#define osl_File_OpenFlag_Create 0x00000004L
#define osl_File_OpenFlag_NoLock 0x00000008L
/* larger bit-fields reserved for internal use cf. detail/file.h */
/** Open a regular file.
...
...
sal/osl/unx/file.cxx
Dosyayı görüntüle @
4a086fca
...
...
@@ -892,7 +892,7 @@ SAL_CALL osl_openMemoryAsFile( void *address, size_t size, oslFileHandle *pHandl
#define OPEN_CREATE_FLAGS ( O_CREAT | O_RDWR )
#endif
oslFileError
static
oslFileError
SAL_CALL
osl_openFilePath
(
const
char
*
cpFilePath
,
oslFileHandle
*
pHandle
,
sal_uInt32
uFlags
)
{
oslFileError
eRet
;
...
...
sal/osl/unx/file_stat.cxx
Dosyayı görüntüle @
4a086fca
...
...
@@ -462,7 +462,6 @@ SAL_CALL osl_identicalDirectoryItem( oslDirectoryItem a, oslDirectoryItem b)
return
sal_True
;
fprintf
(
stderr
,
"We have to do an inode compare !
\n
"
);
/*
int rc = stat_c( cpFilePath, statb );
...
...
@@ -475,15 +474,4 @@ SAL_CALL osl_identicalDirectoryItem( oslDirectoryItem a, oslDirectoryItem b)
return
sal_False
;
}
oslFileError
SAL_CALL
osl_lstatFilePath
(
const
char
*
cpFilePath
,
struct
stat
*
statb
)
{
int
rc
=
lstat_c
(
cpFilePath
,
statb
);
if
(
rc
==
-
1
)
return
oslTranslateFileError
(
OSL_FET_ERROR
,
errno
);
else
return
osl_File_E_None
;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal/util/sal.map
Dosyayı görüntüle @
4a086fca
...
...
@@ -647,9 +647,7 @@ PRIVATE_textenc.1 { # LibreOffice 3.6
PRIVATE_file.1 { # LibreOffice 3.6
global:
osl_openFilePath;
osl_identicalDirectoryItem;
osl_lstatFilePath;
osl_getFileOSHandle;
};
...
...
tools/inc/tools/stream.hxx
Dosyayı görüntüle @
4a086fca
...
...
@@ -576,10 +576,10 @@ class TOOLS_DLLPUBLIC SvFileStream : public SvStream
friend
class
FileCopier
;
private
:
StreamData
*
pInstanceData
;
StreamData
*
pInstanceData
;
String
aFilename
;
sal_uInt16
nLockCounter
;
sal_Bool
bIsOpen
;
sal_Bool
bIsOpen
;
sal_uInt32
GetFileHandle
()
const
;
// Forbidden and not implemented.
...
...
tools/source/stream/strmunx.cxx
Dosyayı görüntüle @
4a086fca
...
...
@@ -223,7 +223,7 @@ class StreamData
public
:
oslFileHandle
rHandle
;
StreamData
(
)
{
}
StreamData
()
:
rHandle
(
0
)
{
}
};
// -----------------------------------------------------------------------
...
...
@@ -683,8 +683,6 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode )
{
sal_uInt32
uFlags
;
oslFileHandle
nHandleTmp
;
struct
stat
buf
;
sal_Bool
bStatValid
=
sal_False
;
Close
();
errno
=
0
;
...
...
@@ -707,16 +705,22 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode )
OSL_TRACE
(
"%s"
,
aTraceStr
.
getStr
()
);
#endif
if
(
osl_lstatFilePath
(
aLocalFilename
.
getStr
(),
&
buf
)
==
osl_File_E_None
)
{
bStatValid
=
sal_True
;
// SvFileStream soll kein Directory oeffnen
if
(
S_ISDIR
(
buf
.
st_mode
)
)
{
SetError
(
::
GetSvError
(
EISDIR
)
);
return
;
}
}
rtl
::
OUString
aFileURL
;
osl
::
DirectoryItem
aItem
;
osl
::
FileStatus
aStatus
(
osl_FileStatus_Mask_Type
|
osl_FileStatus_Mask_LinkTargetURL
);
// FIXME: we really need to switch to a pure URL model ...
if
(
osl
::
File
::
getFileURLFromSystemPath
(
aFilename
,
aFileURL
)
!=
osl
::
FileBase
::
RC
::
E_None
)
aFileURL
=
aFilename
;
bool
bStatValid
=
(
osl
::
DirectoryItem
::
get
(
aFileURL
,
aItem
)
!=
osl
::
FileBase
::
RC
::
E_None
&&
aItem
.
getFileStatus
(
aStatus
)
!=
osl
::
FileBase
::
RC
::
E_None
);
// SvFileStream can't open a directory
if
(
bStatValid
&&
aStatus
.
getFileType
()
==
osl
::
FileStatus
::
Type
::
Directory
)
{
SetError
(
::
GetSvError
(
EISDIR
)
);
return
;
}
if
(
!
(
nOpenMode
&
STREAM_WRITE
)
)
uFlags
=
osl_File_OpenFlag_Read
;
...
...
@@ -736,44 +740,37 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode )
if
(
nOpenMode
&
STREAM_WRITE
)
{
if
(
nOpenMode
&
STREAM_COPY_ON_SYMLINK
)
{
if
(
bStatValid
&&
S_ISLNK
(
buf
.
st_mode
)
<
0
)
if
(
nOpenMode
&
STREAM_COPY_ON_SYMLINK
)
{
if
(
bStatValid
&&
aStatus
.
getFileType
()
==
osl
::
FileStatus
::
Type
::
Link
&&
aStatus
.
getLinkTargetURL
().
getLength
()
>
0
)
{
char
*
pBuf
=
new
char
[
1024
+
1
];
if
(
readlink
(
aLocalFilename
.
getStr
(),
pBuf
,
1024
)
>
0
)
// delete the symbolic link, and replace it with the contents of the link
if
(
osl
::
File
::
remove
(
aFileURL
)
==
osl
::
FileBase
::
RC
::
E_None
)
{
if
(
unlink
(
aLocalFilename
.
getStr
())
==
0
)
{
#ifdef DBG_UTIL
fprintf
(
stderr
,
"Copying file on symbolic link (%s).
\n
"
,
aLocalFilename
.
getStr
()
);
File
::
copy
(
aStatus
.
getLinkTargetURL
(),
aFileURL
);
#if OSL_DEBUG_LEVEL > 0
fprintf
(
stderr
,
"Removing link and replacing with file contents (%s) -> (%s).
\n
"
,
rtl
::
OUStringToOString
(
aStatus
.
getLinkTargetURL
(),
RTL_TEXTENCODING_UTF8
).
getStr
(),
rtl
::
OUStringToOString
(
aFileURL
,
RTL_TEXTENCODING_UTF8
).
getStr
()
);
#endif
String
aTmpString
(
pBuf
,
osl_getThreadTextEncoding
()
);
const
DirEntry
aSourceEntry
(
aTmpString
);
const
DirEntry
aTargetEntry
(
aFilename
);
FileCopier
aFileCopier
(
aSourceEntry
,
aTargetEntry
);
aFileCopier
.
Execute
();
}
}
delete
[]
pBuf
;
}
}
}
oslFileError
rc
=
osl_openFilePath
(
aLocalFilename
.
getStr
(),
&
nHandleTmp
,
uFlags
);
oslFileError
rc
=
osl_openFile
(
aFileURL
.
pData
,
&
nHandleTmp
,
uFlags
);
if
(
rc
!=
osl_File_E_None
)
{
if
(
uFlags
&
osl_File_OpenFlag_Write
)
{
// auf Lesen runterschalten
uFlags
&=
~
osl_File_OpenFlag_Write
;
rc
=
osl_openFilePath
(
aLocalFilename
.
getStr
(),
&
nHandleTmp
,
uFlags
);
}
rc
=
osl_openFile
(
aFileURL
.
pData
,
&
nHandleTmp
,
uFlags
);
}
}
if
(
rc
==
osl_File_E_None
)
{
...
...
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