summaryrefslogtreecommitdiff
path: root/sal/osl
diff options
context:
space:
mode:
authorDirk Voelzke <dv@openoffice.org>2010-04-22 09:14:14 +0200
committerDirk Voelzke <dv@openoffice.org>2010-04-22 09:14:14 +0200
commita5763b54acc6c28acf17e24cbbd3bbd5ba356ad8 (patch)
treea03877bd25c799222635ae0ed7c3eb271fdbf8bb /sal/osl
parent9468be6f6fe2d0cd1d72df87537d68e5cf76e946 (diff)
parent9734c73c9a61fc5ef4e263617add17914a9b5f15 (diff)
dv12: merge with DEV300_m76
Diffstat (limited to 'sal/osl')
-rw-r--r--sal/osl/all/debugbase.cxx5
-rw-r--r--sal/osl/all/filepath.c5
-rw-r--r--sal/osl/all/loadmodulerelative.cxx5
-rw-r--r--sal/osl/all/makefile.mk6
-rwxr-xr-xsal/osl/all/utility.cxx5
-rw-r--r--sal/osl/os2/conditn.c5
-rw-r--r--sal/osl/os2/debug.c5
-rw-r--r--sal/osl/os2/diagnose.c5
-rw-r--r--sal/osl/os2/dllentry.c5
-rw-r--r--sal/osl/os2/except.c5
-rw-r--r--sal/osl/os2/file.cxx9
-rw-r--r--sal/osl/os2/file_error_transl.cxx5
-rw-r--r--sal/osl/os2/file_error_transl.h5
-rw-r--r--sal/osl/os2/file_path_helper.cxx5
-rw-r--r--sal/osl/os2/file_path_helper.h5
-rw-r--r--sal/osl/os2/file_path_helper.hxx5
-rw-r--r--sal/osl/os2/file_url.cxx5
-rw-r--r--sal/osl/os2/file_url.h5
-rw-r--r--sal/osl/os2/helpers/debug.h5
-rw-r--r--sal/osl/os2/helpers/dosh.h5
-rw-r--r--sal/osl/os2/helpers/except.h5
-rw-r--r--sal/osl/os2/helpers/setup.h8
-rw-r--r--sal/osl/os2/interlck.c5
-rw-r--r--sal/osl/os2/libutil.c5
-rw-r--r--sal/osl/os2/makefile.mk6
-rw-r--r--sal/osl/os2/module.c5
-rw-r--r--sal/osl/os2/mutex.c5
-rw-r--r--sal/osl/os2/nlsupport.c26
-rw-r--r--sal/osl/os2/path_helper.cxx5
-rw-r--r--sal/osl/os2/path_helper.h5
-rw-r--r--sal/osl/os2/path_helper.hxx5
-rw-r--r--sal/osl/os2/pipe.cxx5
-rw-r--r--sal/osl/os2/process.c5
-rw-r--r--sal/osl/os2/process_impl.cxx5
-rw-r--r--sal/osl/os2/procimpl.h5
-rw-r--r--sal/osl/os2/profile.c5
-rw-r--r--sal/osl/os2/salinit.cxx5
-rw-r--r--sal/osl/os2/secimpl.h5
-rw-r--r--sal/osl/os2/security.c5
-rw-r--r--sal/osl/os2/semaphor.c5
-rw-r--r--sal/osl/os2/signal.c5
-rw-r--r--sal/osl/os2/socket.c7
-rw-r--r--sal/osl/os2/sockimpl.h5
-rw-r--r--sal/osl/os2/system.h37
-rw-r--r--sal/osl/os2/tempfile.c5
-rw-r--r--sal/osl/os2/thread.c5
-rw-r--r--sal/osl/os2/time.c5
-rw-r--r--sal/osl/os2/util.c5
-rw-r--r--sal/osl/os2/uunxapi.cxx5
-rw-r--r--sal/osl/os2/uunxapi.h5
-rw-r--r--sal/osl/os2/uunxapi.hxx5
-rw-r--r--sal/osl/unx/asm/interlck_sparc.s5
-rw-r--r--sal/osl/unx/asm/interlck_x86.s5
-rwxr-xr-xsal/osl/unx/backtrace.c53
-rwxr-xr-xsal/osl/unx/backtrace.h5
-rw-r--r--sal/osl/unx/conditn.c5
-rw-r--r--sal/osl/unx/diagnose.c5
-rw-r--r--sal/osl/unx/file.cxx32
-rw-r--r--sal/osl/unx/file_error_transl.cxx5
-rw-r--r--sal/osl/unx/file_error_transl.h5
-rw-r--r--sal/osl/unx/file_impl.hxx5
-rw-r--r--sal/osl/unx/file_misc.cxx97
-rw-r--r--sal/osl/unx/file_path_helper.cxx5
-rw-r--r--sal/osl/unx/file_path_helper.h5
-rw-r--r--sal/osl/unx/file_path_helper.hxx5
-rw-r--r--sal/osl/unx/file_stat.cxx5
-rw-r--r--sal/osl/unx/file_url.cxx5
-rw-r--r--sal/osl/unx/file_url.h5
-rw-r--r--sal/osl/unx/file_volume.cxx427
-rw-r--r--sal/osl/unx/interlck.c5
-rw-r--r--sal/osl/unx/makefile.mk14
-rw-r--r--sal/osl/unx/module.c31
-rw-r--r--sal/osl/unx/mutex.c5
-rw-r--r--sal/osl/unx/nlsupport.c55
-rw-r--r--sal/osl/unx/osxlocale.cxx5
-rw-r--r--sal/osl/unx/pipe.c5
-rw-r--r--sal/osl/unx/process.c113
-rw-r--r--sal/osl/unx/process_impl.cxx5
-rw-r--r--sal/osl/unx/procimpl.h5
-rw-r--r--sal/osl/unx/profile.c17
-rw-r--r--sal/osl/unx/salinit.cxx5
-rw-r--r--sal/osl/unx/secimpl.h5
-rw-r--r--sal/osl/unx/security.c5
-rw-r--r--sal/osl/unx/semaphor.c5
-rw-r--r--sal/osl/unx/signal.c16
-rw-r--r--sal/osl/unx/socket.c30
-rw-r--r--sal/osl/unx/sockimpl.h5
-rw-r--r--sal/osl/unx/system.c5
-rw-r--r--sal/osl/unx/system.h36
-rw-r--r--sal/osl/unx/tempfile.c5
-rw-r--r--sal/osl/unx/thread.c5
-rw-r--r--sal/osl/unx/time.c5
-rw-r--r--sal/osl/unx/util.c5
-rw-r--r--sal/osl/unx/uunxapi.cxx5
-rw-r--r--sal/osl/unx/uunxapi.h5
-rw-r--r--sal/osl/unx/uunxapi.hxx5
-rw-r--r--sal/osl/w32/MAKEFILE.MK6
-rw-r--r--sal/osl/w32/conditn.c5
-rw-r--r--sal/osl/w32/diagnose.c5
-rw-r--r--sal/osl/w32/dllentry.c9
-rw-r--r--sal/osl/w32/file.cxx7
-rw-r--r--sal/osl/w32/file_dirvol.cxx222
-rw-r--r--sal/osl/w32/file_error.c5
-rw-r--r--sal/osl/w32/file_error.h5
-rw-r--r--sal/osl/w32/file_url.cxx330
-rw-r--r--sal/osl/w32/file_url.h11
-rw-r--r--sal/osl/w32/interlck.c5
-rw-r--r--sal/osl/w32/libutil.c5
-rw-r--r--sal/osl/w32/module.cxx (renamed from sal/osl/w32/module.c)80
-rw-r--r--sal/osl/w32/mutex.c5
-rw-r--r--sal/osl/w32/nlsupport.c5
-rw-r--r--sal/osl/w32/path_helper.cxx5
-rw-r--r--sal/osl/w32/path_helper.h5
-rw-r--r--sal/osl/w32/path_helper.hxx48
-rw-r--r--sal/osl/w32/pipe.c5
-rw-r--r--sal/osl/w32/pipeimpl.cxx5
-rw-r--r--sal/osl/w32/process.cxx (renamed from sal/osl/w32/process.c)97
-rw-r--r--sal/osl/w32/procimpl.cxx5
-rw-r--r--sal/osl/w32/procimpl.h5
-rw-r--r--sal/osl/w32/profile.cxx (renamed from sal/osl/w32/profile.c)326
-rw-r--r--sal/osl/w32/salinit.cxx5
-rw-r--r--sal/osl/w32/secimpl.h5
-rw-r--r--sal/osl/w32/security.c5
-rw-r--r--sal/osl/w32/semaphor.c5
-rw-r--r--sal/osl/w32/signal.cxx (renamed from sal/osl/w32/signal.c)70
-rw-r--r--sal/osl/w32/socket.cxx5
-rw-r--r--sal/osl/w32/sockimpl.h5
-rw-r--r--sal/osl/w32/system.h17
-rw-r--r--sal/osl/w32/tempfile.cxx33
-rw-r--r--sal/osl/w32/thread.c5
-rw-r--r--sal/osl/w32/time.c5
-rw-r--r--sal/osl/w32/util.c5
132 files changed, 1033 insertions, 1743 deletions
diff --git a/sal/osl/all/debugbase.cxx b/sal/osl/all/debugbase.cxx
index 09fe92b9fdd2..10679cb45ccb 100644
--- a/sal/osl/all/debugbase.cxx
+++ b/sal/osl/all/debugbase.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: debugbase.cxx,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/all/filepath.c b/sal/osl/all/filepath.c
index bf24f32348e9..e9461a538840 100644
--- a/sal/osl/all/filepath.c
+++ b/sal/osl/all/filepath.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: filepath.c,v $
- * $Revision: 1.8 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/all/loadmodulerelative.cxx b/sal/osl/all/loadmodulerelative.cxx
index 83f2a90a8e0f..39bea770e8a1 100644
--- a/sal/osl/all/loadmodulerelative.cxx
+++ b/sal/osl/all/loadmodulerelative.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: loadmodulerelative.cxx,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/all/makefile.mk b/sal/osl/all/makefile.mk
index bbb46b89d44e..0d105906effb 100644
--- a/sal/osl/all/makefile.mk
+++ b/sal/osl/all/makefile.mk
@@ -2,14 +2,10 @@
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
-# Copyright 2008 by Sun Microsystems, Inc.
+# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.17 $
-#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/all/utility.cxx b/sal/osl/all/utility.cxx
index 00a6839a9189..21c392ba1793 100755
--- a/sal/osl/all/utility.cxx
+++ b/sal/osl/all/utility.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: utility.cxx,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/conditn.c b/sal/osl/os2/conditn.c
index 3497bbd37237..9ad2459fd851 100644
--- a/sal/osl/os2/conditn.c
+++ b/sal/osl/os2/conditn.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: conditn.c,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/debug.c b/sal/osl/os2/debug.c
index 78a2df07056e..f2d0f915f375 100644
--- a/sal/osl/os2/debug.c
+++ b/sal/osl/os2/debug.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile:$
- * $Revision:$
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/diagnose.c b/sal/osl/os2/diagnose.c
index b33c1491f77d..4921e20fd5af 100644
--- a/sal/osl/os2/diagnose.c
+++ b/sal/osl/os2/diagnose.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: diagnose.c,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/dllentry.c b/sal/osl/os2/dllentry.c
index d0ea57e00127..494119599f8b 100644
--- a/sal/osl/os2/dllentry.c
+++ b/sal/osl/os2/dllentry.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: dllentry.c,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/except.c b/sal/osl/os2/except.c
index 0dd2a35d1fcd..29962889fb01 100644
--- a/sal/osl/os2/except.c
+++ b/sal/osl/os2/except.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile:$
- * $Revision:$
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/file.cxx b/sal/osl/os2/file.cxx
index e89ce6450bee..2e668d23d638 100644
--- a/sal/osl/os2/file.cxx
+++ b/sal/osl/os2/file.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file.cxx,v $
- * $Revision: 1.7 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -2343,7 +2340,7 @@ oslFileError SAL_CALL osl_syncFile(oslFileHandle Handle)
# define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) ((__OSL_MSDOS_SUPER_MAGIC != (a).f_type))
#endif /* LINUX */
-#if defined(SOLARIS) || defined(IRIX)
+#if defined(SOLARIS)
# define __OSL_STATFS_STRUCT struct statvfs
# define __OSL_STATFS(dir, sfs) statvfs((dir), (sfs))
# define __OSL_STATFS_BLKSIZ(a) ((sal_uInt64)((a).f_frsize))
@@ -2355,7 +2352,7 @@ oslFileError SAL_CALL osl_syncFile(oslFileHandle Handle)
of the target platforms fix it!!!! */
# define __OSL_STATFS_IS_CASE_SENSITIVE_FS(a) (1)
# define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) (1)
-#endif /* SOLARIS || IRIX*/
+#endif /* SOLARIS */
# define __OSL_STATFS_INIT(a) (memset(&(a), 0, sizeof(__OSL_STATFS_STRUCT)))
diff --git a/sal/osl/os2/file_error_transl.cxx b/sal/osl/os2/file_error_transl.cxx
index 53867a32fcf9..fd296d9dd3d2 100644
--- a/sal/osl/os2/file_error_transl.cxx
+++ b/sal/osl/os2/file_error_transl.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_error_transl.cxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/file_error_transl.h b/sal/osl/os2/file_error_transl.h
index 6e461f4019bd..59d7b1d9faec 100644
--- a/sal/osl/os2/file_error_transl.h
+++ b/sal/osl/os2/file_error_transl.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_error_transl.h,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/file_path_helper.cxx b/sal/osl/os2/file_path_helper.cxx
index 872239043981..1aa5840deca4 100644
--- a/sal/osl/os2/file_path_helper.cxx
+++ b/sal/osl/os2/file_path_helper.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_path_helper.cxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/file_path_helper.h b/sal/osl/os2/file_path_helper.h
index 8e6deee5760c..88b8ccbe9b6a 100644
--- a/sal/osl/os2/file_path_helper.h
+++ b/sal/osl/os2/file_path_helper.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_path_helper.h,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/file_path_helper.hxx b/sal/osl/os2/file_path_helper.hxx
index 4eda01c9f402..5310f462efc0 100644
--- a/sal/osl/os2/file_path_helper.hxx
+++ b/sal/osl/os2/file_path_helper.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_path_helper.hxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/file_url.cxx b/sal/osl/os2/file_url.cxx
index fbec9daaca1d..e3b5fbf00c48 100644
--- a/sal/osl/os2/file_url.cxx
+++ b/sal/osl/os2/file_url.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_url.cxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/file_url.h b/sal/osl/os2/file_url.h
index 8884932c5a8a..052858503b24 100644
--- a/sal/osl/os2/file_url.h
+++ b/sal/osl/os2/file_url.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_url.h,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/helpers/debug.h b/sal/osl/os2/helpers/debug.h
index b03508b70379..83edca5db676 100644
--- a/sal/osl/os2/helpers/debug.h
+++ b/sal/osl/os2/helpers/debug.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile:$
- * $Revision:$
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/helpers/dosh.h b/sal/osl/os2/helpers/dosh.h
index 518f979fd4de..fe51ee9bc488 100644
--- a/sal/osl/os2/helpers/dosh.h
+++ b/sal/osl/os2/helpers/dosh.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile:$
- * $Revision:$
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/helpers/except.h b/sal/osl/os2/helpers/except.h
index b2d6b17ca702..af303a9827e3 100644
--- a/sal/osl/os2/helpers/except.h
+++ b/sal/osl/os2/helpers/except.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile:$
- * $Revision:$
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/helpers/setup.h b/sal/osl/os2/helpers/setup.h
index 6c02d8b655fb..b9c6e50f0111 100644
--- a/sal/osl/os2/helpers/setup.h
+++ b/sal/osl/os2/helpers/setup.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile:$
- * $Revision:$
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -26,9 +23,6 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- * 2009-06-15 published under LGPL3 with Ulrich M�ller permission.
- *
- *
************************************************************************/
/*
diff --git a/sal/osl/os2/interlck.c b/sal/osl/os2/interlck.c
index 003398880cfc..589005f215b9 100644
--- a/sal/osl/os2/interlck.c
+++ b/sal/osl/os2/interlck.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: interlck.c,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/libutil.c b/sal/osl/os2/libutil.c
index 1cf8680ddc7b..e0f94a8b3235 100644
--- a/sal/osl/os2/libutil.c
+++ b/sal/osl/os2/libutil.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: libutil.c,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/makefile.mk b/sal/osl/os2/makefile.mk
index 94a47b2bb02b..c9bfd3f96771 100644
--- a/sal/osl/os2/makefile.mk
+++ b/sal/osl/os2/makefile.mk
@@ -2,14 +2,10 @@
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
-# Copyright 2008 by Sun Microsystems, Inc.
+# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.7 $
-#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/module.c b/sal/osl/os2/module.c
index 901c029429c4..421b78195d83 100644
--- a/sal/osl/os2/module.c
+++ b/sal/osl/os2/module.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: module.c,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/mutex.c b/sal/osl/os2/mutex.c
index 94253e48a89d..e86b3f965608 100644
--- a/sal/osl/os2/mutex.c
+++ b/sal/osl/os2/mutex.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: mutex.c,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/nlsupport.c b/sal/osl/os2/nlsupport.c
index 0efccaa787e6..ab00443e57d7 100644
--- a/sal/osl/os2/nlsupport.c
+++ b/sal/osl/os2/nlsupport.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: nlsupport.c,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -411,9 +408,6 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale )
int _imp_setProcessLocale( rtl_Locale * pLocale )
{
-#ifdef IRIX
- char env_buf[80];
-#endif
char locale_buf[64];
/* convert rtl_Locale to locale string */
@@ -421,11 +415,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale )
{
/* only change env vars that exist already */
if( getenv( "LC_ALL" ) ) {
-#if defined( IRIX )
- snprintf(env_buf, sizeof(env_buf), "LC_ALL=%s", locale_buf);
- env_buf[sizeof(env_buf)] = '\0';
- putenv(env_buf);
-#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ )
+#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ )
setenv( "LC_ALL", locale_buf, 1);
#else
setenv( "LC_ALL", locale_buf );
@@ -433,11 +423,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale )
}
if( getenv( "LC_CTYPE" ) ) {
-#if defined( IRIX )
- snprintf(env_buf, sizeof(env_buf), "LC_CTYPE=%s", locale_buf);
- env_buf[sizeof(env_buf)] = '\0';
- putenv(env_buf);
-#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ )
+#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ )
setenv("LC_CTYPE", locale_buf, 1 );
#else
setenv( "LC_CTYPE", locale_buf );
@@ -445,11 +431,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale )
}
if( getenv( "LANG" ) ) {
-#if defined( IRIX )
- snprintf(env_buf, sizeof(env_buf), "LANG=%s", locale_buf);
- env_buf[sizeof(env_buf)] = '\0';
- putenv(env_buf);
-#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ )
+#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ )
setenv("LC_CTYPE", locale_buf, 1 );
#else
setenv( "LANG", locale_buf );
diff --git a/sal/osl/os2/path_helper.cxx b/sal/osl/os2/path_helper.cxx
index fbf249fc1ece..6425927a0021 100644
--- a/sal/osl/os2/path_helper.cxx
+++ b/sal/osl/os2/path_helper.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: path_helper.cxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/path_helper.h b/sal/osl/os2/path_helper.h
index de833df30ef8..79341f538667 100644
--- a/sal/osl/os2/path_helper.h
+++ b/sal/osl/os2/path_helper.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: path_helper.h,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/path_helper.hxx b/sal/osl/os2/path_helper.hxx
index 6ba7d09f5af1..8a301431f610 100644
--- a/sal/osl/os2/path_helper.hxx
+++ b/sal/osl/os2/path_helper.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: path_helper.hxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/pipe.cxx b/sal/osl/os2/pipe.cxx
index 0d72855df272..20db94bda9eb 100644
--- a/sal/osl/os2/pipe.cxx
+++ b/sal/osl/os2/pipe.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: pipe.cxx,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/process.c b/sal/osl/os2/process.c
index a3408ddbf7d0..e83552192bfb 100644
--- a/sal/osl/os2/process.c
+++ b/sal/osl/os2/process.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: process.c,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/process_impl.cxx b/sal/osl/os2/process_impl.cxx
index 97b137043444..d27bd72190e5 100644
--- a/sal/osl/os2/process_impl.cxx
+++ b/sal/osl/os2/process_impl.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: process_impl.cxx,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/procimpl.h b/sal/osl/os2/procimpl.h
index b1deaa006cb1..5ff7a9f36b91 100644
--- a/sal/osl/os2/procimpl.h
+++ b/sal/osl/os2/procimpl.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: procimpl.h,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/profile.c b/sal/osl/os2/profile.c
index f5334f88ddf9..d9d166d0e091 100644
--- a/sal/osl/os2/profile.c
+++ b/sal/osl/os2/profile.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: profile.c,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/salinit.cxx b/sal/osl/os2/salinit.cxx
index 43130c18e6f4..f932f2ea1b50 100644
--- a/sal/osl/os2/salinit.cxx
+++ b/sal/osl/os2/salinit.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: salinit.cxx,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/secimpl.h b/sal/osl/os2/secimpl.h
index 3c9d07e1a606..6922a6d3c0ce 100644
--- a/sal/osl/os2/secimpl.h
+++ b/sal/osl/os2/secimpl.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: secimpl.h,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/security.c b/sal/osl/os2/security.c
index a5a37e625b89..f03be57acc85 100644
--- a/sal/osl/os2/security.c
+++ b/sal/osl/os2/security.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: security.c,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/semaphor.c b/sal/osl/os2/semaphor.c
index dbb8ff472b73..8613e3ecd352 100644
--- a/sal/osl/os2/semaphor.c
+++ b/sal/osl/os2/semaphor.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: semaphor.c,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/signal.c b/sal/osl/os2/signal.c
index a79e50b3a1e1..881db13fe1e1 100644
--- a/sal/osl/os2/signal.c
+++ b/sal/osl/os2/signal.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: signal.c,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/socket.c b/sal/osl/os2/socket.c
index de70e5b8885a..6c171016f798 100644
--- a/sal/osl/os2/socket.c
+++ b/sal/osl/os2/socket.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: socket.c,v $
- * $Revision: 1.5.60.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -48,7 +45,7 @@
#undef HAVE_POLL_H
#endif
-#if defined(LINUX) || defined (IRIX) || defined(NETBSD) || defined ( FREEBSD ) || defined (MACOSX)
+#if defined(LINUX) || defined(NETBSD) || defined ( FREEBSD ) || defined (MACOSX)
#include <sys/poll.h>
#define HAVE_POLL_H
#endif /* HAVE_POLL_H */
diff --git a/sal/osl/os2/sockimpl.h b/sal/osl/os2/sockimpl.h
index 3ce16e425fde..38fc26bf0d22 100644
--- a/sal/osl/os2/sockimpl.h
+++ b/sal/osl/os2/sockimpl.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: sockimpl.h,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/system.h b/sal/osl/os2/system.h
index 565dfe3ea9c6..ac7e410c5a34 100644
--- a/sal/osl/os2/system.h
+++ b/sal/osl/os2/system.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: system.h,v $
- * $Revision: 1.5.60.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -306,36 +303,6 @@ extern unsigned int nanosleep(unsigned int);
# define PTHREAD_SIGACTION cma_sigaction
#endif
-#ifdef IRIX
-# define AF_IPX -1
-# include <pthread.h>
-# include <semaphore.h>
-# include <sched.h>
-# include <sys/socket.h>
-# include <sys/un.h>
-# include <sys/stropts.h>
-# include <netinet/tcp.h>
-# include <procfs/procfs.h>
-# include <sys/endian.h>
-# if BYTE_ORDER == LITTLE_ENDIAN
-# undef _BIG_ENDIAN
-# undef _PDP_ENDIAN
-# elif BYTE_ORDER == BIG_ENDIAN
-# undef _LITTLE_ENDIAN
-# undef _PDP_ENDIAN
-# elif BYTE_ORDER == PDP_ENDIAN
-# undef _LITTLE_ENDIAN
-# undef _BIG_ENDIAN
-# endif
-# define SA_FAMILY_DECL \
- union { struct { short sa_family2; } sa_generic; } sa_union
-# define PTR_SIZE_T(s) ((int *)&(s))
-# define NO_PTHREAD_PRIORITY
-# include <dlfcn.h>
-# define IOCHANNEL_TRANSFER_BSD
-extern char *strdup(const char *);
-#endif
-
#ifdef SOLARIS
# include <shadow.h>
# include <sys/procfs.h>
@@ -389,7 +356,7 @@ char *macxp_tempnam( const char *tmpdir, const char *prefix );
#if !defined(_WIN32) && !defined(_WIN16) && !defined(OS2) && \
!defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) && !defined(SCO) && \
!defined(AIX) && !defined(HPUX) && \
- !defined(SOLARIS) && !defined(IRIX) && !defined(MAC) && \
+ !defined(SOLARIS) && !defined(MAC) && \
!defined(MACOSX)
# error "Target plattform not specified !"
#endif
diff --git a/sal/osl/os2/tempfile.c b/sal/osl/os2/tempfile.c
index f6f80f79e69a..672995563c88 100644
--- a/sal/osl/os2/tempfile.c
+++ b/sal/osl/os2/tempfile.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: tempfile.c,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/thread.c b/sal/osl/os2/thread.c
index d84c09326d9b..313e67c0f925 100644
--- a/sal/osl/os2/thread.c
+++ b/sal/osl/os2/thread.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: thread.c,v $
- * $Revision: 1.7 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/time.c b/sal/osl/os2/time.c
index 5c0833ce23e8..c1a98a6b87a9 100644
--- a/sal/osl/os2/time.c
+++ b/sal/osl/os2/time.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: time.c,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/util.c b/sal/osl/os2/util.c
index 217c71878838..cfe3eb76c622 100644
--- a/sal/osl/os2/util.c
+++ b/sal/osl/os2/util.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: util.c,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/uunxapi.cxx b/sal/osl/os2/uunxapi.cxx
index a0a3fe952f11..e86ad31264e0 100644
--- a/sal/osl/os2/uunxapi.cxx
+++ b/sal/osl/os2/uunxapi.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: uunxapi.cxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/uunxapi.h b/sal/osl/os2/uunxapi.h
index 7eb224f6309f..9eddc5fe4753 100644
--- a/sal/osl/os2/uunxapi.h
+++ b/sal/osl/os2/uunxapi.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: uunxapi.h,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/os2/uunxapi.hxx b/sal/osl/os2/uunxapi.hxx
index 3b99ec98e808..ab7e5cce890d 100644
--- a/sal/osl/os2/uunxapi.hxx
+++ b/sal/osl/os2/uunxapi.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: uunxapi.hxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/asm/interlck_sparc.s b/sal/osl/unx/asm/interlck_sparc.s
index 51604d3ea1a8..a33e3539398e 100644
--- a/sal/osl/unx/asm/interlck_sparc.s
+++ b/sal/osl/unx/asm/interlck_sparc.s
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: interlck_sparc.s,v $
- * $Revision: 1.7 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/asm/interlck_x86.s b/sal/osl/unx/asm/interlck_x86.s
index 3f9607f530f8..c1f99008d406 100644
--- a/sal/osl/unx/asm/interlck_x86.s
+++ b/sal/osl/unx/asm/interlck_x86.s
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: interlck_x86.s,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c
index 437d31157049..00156b80f1d6 100755
--- a/sal/osl/unx/backtrace.c
+++ b/sal/osl/unx/backtrace.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: backtrace.c,v $
- * $Revision: 1.15 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -207,54 +204,6 @@ void backtrace_symbols_fd( void **buffer, int size, int fd )
}
#endif /* defined FREEBSD */
-#if defined(IRIX)
-#include <stdio.h>
-#include <rld_interface.h>
-#include <exception.h>
-#include <sys/signal.h>
-#include <unistd.h>
-
-/* Need extra libs -lexc -ldwarf -lelf */
-
-int backtrace( void **buffer, int max_frames )
-{
- struct sigcontext context;
- int i = 0;
-
- memset(&context, 0, sizeof(struct sigcontext));
-
- exc_setjmp(&context);
- while(context.sc_pc != 1 && i < max_frames) {
- exc_unwind(&context, 0);
- if(context.sc_pc != 1) {
- *(buffer++) = (void *)context.sc_pc;
- i++;
- }
- }
- return(i);
-}
-
-void backtrace_symbols_fd( void **buffer, int size, int fd )
-{
- FILE *fp = fdopen( fd, "w" );
- struct sigcontext context;
- char *name;
-
- if ( fp ) {
- while(context.sc_pc!=1) {
- if(context.sc_pc != 1) {
- exc_unwind_name(&context, 0, &name);
- fprintf(fp, " 0x%012lx %.100s\n", context.sc_pc, name ? name : "<unknown function>");
- free(name);
- }
- }
-
- fflush( fp );
- fclose( fp );
- }
-}
-#endif /* defined IRIX */
-
#ifdef LINUX
#ifndef _GNU_SOURCE
diff --git a/sal/osl/unx/backtrace.h b/sal/osl/unx/backtrace.h
index a641ccea603a..1ca2ae84c4a0 100755
--- a/sal/osl/unx/backtrace.h
+++ b/sal/osl/unx/backtrace.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: backtrace.h,v $
- * $Revision: 1.9 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/conditn.c b/sal/osl/unx/conditn.c
index 724f661cbece..ea701d221e55 100644
--- a/sal/osl/unx/conditn.c
+++ b/sal/osl/unx/conditn.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: conditn.c,v $
- * $Revision: 1.8 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/diagnose.c b/sal/osl/unx/diagnose.c
index 829c082b6eba..bb8cbca406bd 100644
--- a/sal/osl/unx/diagnose.c
+++ b/sal/osl/unx/diagnose.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: diagnose.c,v $
- * $Revision: 1.26 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 8e7d76cda614..cc0c041bc328 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file.cxx,v $
- * $Revision: 1.21 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -466,6 +463,7 @@ oslFileError FileHandle_Impl::readFileAt (
oslFileError result = syncFile();
if (result != osl_File_E_None)
return (result);
+ m_bufptr = -1, m_buflen = 0;
if (nBytesRequested >= m_bufsiz)
{
@@ -535,6 +533,7 @@ oslFileError FileHandle_Impl::writeFileAt (
oslFileError result = syncFile();
if (result != osl_File_E_None)
return (result);
+ m_bufptr = -1, m_buflen = 0;
if (nBytesToWrite >= m_bufsiz)
{
@@ -1009,7 +1008,7 @@ SAL_CALL osl_syncFile(oslFileHandle Handle)
FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
- OSL_FILE_TRACE("osl_syncFile(%d)", pImpl->m_fd);
+ OSL_TRACE("osl_syncFile(%d)", pImpl->m_fd);
oslFileError result = pImpl->syncFile();
if (result != osl_File_E_None)
return (result);
@@ -1080,6 +1079,29 @@ SAL_CALL osl_mapFile (
}
}
}
+ if (uFlags & osl_File_MapFlag_WillNeed)
+ {
+ // On Linux, madvise(..., MADV_WILLNEED) appears to have the undesirable
+ // effect of not returning until the data has actually been paged in, so
+ // that its net effect would typically be to slow down the process
+ // (which could start processing at the beginning of the data while the
+ // OS simultaneously pages in the rest); on other platforms, it remains
+ // to be evaluated whether madvise or equivalent is available and
+ // actually useful:
+#if defined MACOSX
+ int e = posix_madvise(p, nLength, POSIX_MADV_WILLNEED);
+ if (e != 0)
+ {
+ OSL_TRACE(
+ "posix_madvise(..., POSIX_MADV_WILLNEED) failed with %d", e);
+ }
+#elif defined SOLARIS
+ if (madvise(static_cast< caddr_t >(p), nLength, MADV_WILLNEED) != 0)
+ {
+ OSL_TRACE("madvise(..., MADV_WILLNEED) failed with %d", errno);
+ }
+#endif
+ }
return osl_File_E_None;
}
diff --git a/sal/osl/unx/file_error_transl.cxx b/sal/osl/unx/file_error_transl.cxx
index d565779cacae..3de829afc391 100644
--- a/sal/osl/unx/file_error_transl.cxx
+++ b/sal/osl/unx/file_error_transl.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_error_transl.cxx,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/file_error_transl.h b/sal/osl/unx/file_error_transl.h
index 059a9f5a6b17..59d7b1d9faec 100644
--- a/sal/osl/unx/file_error_transl.h
+++ b/sal/osl/unx/file_error_transl.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_error_transl.h,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/file_impl.hxx b/sal/osl/unx/file_impl.hxx
index db85b00cbfef..5dee69f29b2e 100644
--- a/sal/osl/unx/file_impl.hxx
+++ b/sal/osl/unx/file_impl.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: $
- * $Revision: $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index 3f3cf02fb010..331b91cb1626 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -2,7 +2,7 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -29,6 +29,7 @@
#include "osl/diagnose.h"
#include "osl/thread.h"
+#include <osl/signal.h>
#include "rtl/alloc.h"
#include "system.h"
@@ -48,6 +49,8 @@
#include <sys/stat.h>
#include <sys/mman.h>
+#include <algorithm>
+
/************************************************************************
* ToDo
*
@@ -1002,7 +1005,6 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD
int SourceFileFD=0;
int DestFileFD=0;
int nRet=0;
- void* pSourceFile=0;
SourceFileFD=open(pszSourceFileName,O_RDONLY);
if ( SourceFileFD < 0 )
@@ -1029,56 +1031,71 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD
return 0;
}
- /* FIXME doCopy: fall back code for systems not having mmap */
- /* mmap file -- open dest file -- write once -- fsync it */
- pSourceFile=mmap(0,nSourceSize,PROT_READ,MAP_PRIVATE,SourceFileFD,0);
-
- if ( pSourceFile == MAP_FAILED )
+ // read and lseek are used to check the possibility to access the data
+ // not a nice solution, but it allows to avoid a crash in case it is an opened samba file
+ // generally, reading of one byte should not affect the performance
+ char nCh;
+ if ( 1 != read( SourceFileFD, &nCh, 1 )
+ || -1 == lseek( SourceFileFD, 0, SEEK_SET ) )
{
- /* it's important to set nRet before the hack
- otherwise errno may be changed by lstat */
nRet = errno;
- close(SourceFileFD);
- close(DestFileFD);
-
+ close( SourceFileFD );
+ close( DestFileFD );
return nRet;
}
- nRet = write(DestFileFD,pSourceFile,nSourceSize);
+ size_t nWritten = 0;
+ size_t nRemains = nSourceSize;
- /* #112584# if 'write' could not write the requested number of bytes
- we have to fail of course; because it's not exactly specified if 'write'
- sets errno if less than requested byte could be written we set nRet
- explicitly to ENOSPC */
- if ((nRet < 0) || (nRet != sal::static_int_cast< int >(nSourceSize)))
+ /* mmap file -- open dest file -- write -- fsync it at the end */
+ void* pSourceFile = mmap( 0, nSourceSize, PROT_READ, MAP_SHARED, SourceFileFD, 0 );
+ if ( pSourceFile != MAP_FAILED )
{
- if (nRet < 0)
- nRet = errno;
- else
- nRet = ENOSPC;
+ nWritten = write( DestFileFD, pSourceFile, nSourceSize );
+ nRemains -= nWritten;
+ munmap( (char*)pSourceFile, nSourceSize );
+ }
- close(SourceFileFD);
- close(DestFileFD);
- munmap((char*)pSourceFile,nSourceSize);
- return nRet;
+ if ( nRemains )
+ {
+ /* mmap has problems, try the direct streaming */
+ char pBuffer[32000];
+ size_t nRead = 0;
+
+ nRemains = nSourceSize;
+
+ if ( -1 != lseek( SourceFileFD, 0, SEEK_SET )
+ && -1 != lseek( DestFileFD, 0, SEEK_SET ) )
+ {
+ do
+ {
+ nRead = 0;
+ nWritten = 0;
+
+ size_t nToRead = std::min( (size_t)32000, nRemains );
+ nRead = read( SourceFileFD, pBuffer, nToRead );
+ if ( (size_t)-1 != nRead )
+ nWritten = write( DestFileFD, pBuffer, nRead );
+
+ if ( (size_t)-1 != nWritten )
+ nRemains -= nWritten;
+ }
+ while( nRemains && (size_t)-1 != nRead && nRead == nWritten );
+ }
}
- nRet = munmap((char*)pSourceFile,nSourceSize);
- if ( nRet < 0 )
+ if ( nRemains )
{
- nRet=errno;
- close(SourceFileFD);
- close(DestFileFD);
- return nRet;
+ if ( errno )
+ nRet = errno;
+ else
+ nRet = ENOSPC;
}
- close(SourceFileFD);
+ close( SourceFileFD );
+ if ( close( DestFileFD ) == -1 && nRet == 0 )
+ nRet = errno;
- // Removed call to 'fsync' again (#112584#) and instead
- // evaluate the return value of 'close' in order to detect
- // and report ENOSPC and other erronous conditions on close
- if (close(DestFileFD) == -1)
- return errno;
- else
- return 0;
+ return nRet;
}
+
diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx
index 434a5a516e5c..04fdd13e7c15 100644
--- a/sal/osl/unx/file_path_helper.cxx
+++ b/sal/osl/unx/file_path_helper.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_path_helper.cxx,v $
- * $Revision: 1.8 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/file_path_helper.h b/sal/osl/unx/file_path_helper.h
index 3a89077e5633..c1e3908fa9f2 100644
--- a/sal/osl/unx/file_path_helper.h
+++ b/sal/osl/unx/file_path_helper.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_path_helper.h,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/file_path_helper.hxx b/sal/osl/unx/file_path_helper.hxx
index 2a1d74687493..4b429b111799 100644
--- a/sal/osl/unx/file_path_helper.hxx
+++ b/sal/osl/unx/file_path_helper.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_path_helper.hxx,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/file_stat.cxx b/sal/osl/unx/file_stat.cxx
index d56c2a1fad6a..df32fa105a50 100644
--- a/sal/osl/unx/file_stat.cxx
+++ b/sal/osl/unx/file_stat.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_stat.cxx,v $
- * $Revision: 1.8 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 1bcd2afb4505..26290957f802 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_url.cxx,v $
- * $Revision: 1.13 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/file_url.h b/sal/osl/unx/file_url.h
index 721bc9d3d698..0a0d07823bba 100644
--- a/sal/osl/unx/file_url.h
+++ b/sal/osl/unx/file_url.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_url.h,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx
index a3b7109123b7..543acc5f71c5 100644
--- a/sal/osl/unx/file_volume.cxx
+++ b/sal/osl/unx/file_volume.cxx
@@ -2,7 +2,7 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -76,16 +76,6 @@ static const sal_Char* MOUNTTAB="/etc/mtab";
* This information is stored only in the kernel. */
/* static const sal_Char* MOUNTTAB="/etc/mtab"; */
-#elif defined(IRIX)
-
-#include <mntent.h>
-#include <sys/mount.h>
-#include <sys/statvfs.h>
-#define HAVE_STATFS_H
-#include <sys/quota.h>
-//#include <ctype.h>
-static const sal_Char* MOUNTTAB="/etc/mtab";
-
#elif defined(MACOSX)
#include <ufs/ufs/quota.h>
@@ -140,12 +130,6 @@ static sal_Bool osl_isFloppyMounted(oslVolumeDeviceHandleImpl* pDevice);
static sal_Bool osl_getFloppyMountEntry(const sal_Char* pszPath, oslVolumeDeviceHandleImpl* pItem);
#endif /* LINUX */
-
-#if defined(IRIX)
-static sal_Bool osl_isFloppyMounted(oslVolumeDeviceHandleImpl* pDevice);
-static sal_Bool osl_getFloppyMountEntry(const sal_Char* pszPath, oslVolumeDeviceHandleImpl* pItem);
-#endif /* IRIX */
-
#ifdef DEBUG_OSL_FILE
static void osl_printFloppyHandle(oslVolumeDeviceHandleImpl* hFloppy);
#endif /* DEBUG_OSL_FILE */
@@ -220,7 +204,7 @@ oslFileError osl_getVolumeInformation( rtl_uString* ustrDirectoryURL, oslVolumeI
# define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) ((__OSL_MSDOS_SUPER_MAGIC != (a).f_type))
#endif /* LINUX */
-#if defined(SOLARIS) || defined(IRIX)
+#if defined(SOLARIS)
# define __OSL_STATFS_STRUCT struct statvfs
# define __OSL_STATFS(dir, sfs) statvfs((dir), (sfs))
# define __OSL_STATFS_BLKSIZ(a) ((sal_uInt64)((a).f_frsize))
@@ -232,7 +216,7 @@ oslFileError osl_getVolumeInformation( rtl_uString* ustrDirectoryURL, oslVolumeI
of the target platforms fix it!!!! */
# define __OSL_STATFS_IS_CASE_SENSITIVE_FS(a) (1)
# define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) (1)
-#endif /* SOLARIS || IRIX*/
+#endif /* SOLARIS */
# define __OSL_STATFS_INIT(a) (memset(&(a), 0, sizeof(__OSL_STATFS_STRUCT)))
@@ -1093,411 +1077,6 @@ osl_isFloppyMounted (oslVolumeDeviceHandleImpl* pDevice)
}
#endif /* LINUX */
-/******************************************************************************
- *
- * IRIX FLOPPY FUNCTIONS
- *
- *****************************************************************************/
-
-#if defined(IRIX)
-static oslVolumeDeviceHandle osl_isFloppyDrive(const sal_Char* pszPath)
-{
- oslVolumeDeviceHandleImpl* pItem = osl_newVolumeDeviceHandleImpl ();
- sal_Bool bRet = sal_False;
-
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"In osl_isFloppyDrive\n");
-#endif
-
- bRet=osl_getFloppyMountEntry(pszPath,pItem);
-
- if ( bRet == sal_False )
- {
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_isFloppyDrive [not a floppy]\n");
-#endif
- rtl_freeMemory(pItem);
- return 0;
- }
-
-
-#ifdef DEBUG_OSL_FILE
- osl_printFloppyHandle(pItem);
-#endif
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_isFloppyDrive [ok]\n");
-#endif
-
- return (oslVolumeDeviceHandle) pItem;
-}
-
-
-static oslFileError osl_mountFloppy(oslVolumeDeviceHandle hFloppy)
-{
- sal_Bool bRet = sal_False;
- oslVolumeDeviceHandleImpl* pItem=0;
- int nRet;
- sal_Char pszCmd[PATH_MAX];
- sal_Char* pszMountProg = "mount";
- sal_Char* pszSuDo = 0;
- sal_Char* pszTmp = 0;
-
- pszCmd[0] = '\0';
-
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"In osl_mountFloppy\n");
-#endif
-
- pItem = (oslVolumeDeviceHandleImpl*) hFloppy;
-
- if ( pItem == 0 )
- {
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_mountFloppy [pItem == 0]\n");
-#endif
-
- return osl_File_E_INVAL;
- }
-
- if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' )
- {
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_mountFloppy [invalid handle]\n");
-#endif
- return osl_File_E_INVAL;
- }
-
- bRet = osl_isFloppyMounted(pItem);
- if ( bRet == sal_True )
- {
-#ifdef DEBUG_OSL_FILE
- fprintf(stderr,"detected mounted floppy at '%s'\n",pItem->pszMountPoint);
-#endif
- return osl_File_E_BUSY;
- }
-
- /* mfe: we can't use the mount(2) system call!!! */
- /* even if we are root */
- /* since mtab is not updated!!! */
- /* but we need it to be updated */
- /* some "magic" must be done */
-
-/* nRet = mount(pItem->pszDevice,pItem->pszMountPoint,0,0,0); */
-/* if ( nRet != 0 ) */
-/* { */
-/* nRet=errno; */
-/* #ifdef DEBUG_OSL_FILE */
-/* perror("mount"); */
-/* #endif */
-/* } */
-
- pszTmp = getenv("SAL_MOUNT_MOUNTPROG");
- if ( pszTmp != 0 )
- {
- pszMountProg=pszTmp;
- }
-
- pszTmp=getenv("SAL_MOUNT_SU_DO");
- if ( pszTmp != 0 )
- {
- pszSuDo=pszTmp;
- }
-
- if ( pszSuDo != 0 )
- {
- snprintf(pszCmd, sizeof(pszCmd), "%s %s %s %s",pszSuDo,pszMountProg,pItem->pszDevice,pItem->pszMountPoint);
- }
- else
- {
- snprintf(pszCmd, sizeof(pszCmd), "%s %s",pszMountProg,pItem->pszMountPoint);
- }
-
-
-#ifdef DEBUG_OSL_FILE
- fprintf(stderr,"executing '%s'\n",pszCmd);
-#endif
-
- nRet = system(pszCmd);
-
-#ifdef DEBUG_OSL_FILE
- fprintf(stderr,"call returned '%i'\n",nRet);
- fprintf(stderr,"exit status is '%i'\n", WEXITSTATUS(nRet));
-#endif
-
-
- switch ( WEXITSTATUS(nRet) )
- {
- case 0:
- nRet=0;
- break;
-
- case 2:
- nRet=EPERM;
- break;
-
- case 4:
- nRet=ENOENT;
- break;
-
- case 8:
- nRet=EINTR;
- break;
-
- case 16:
- nRet=EPERM;
- break;
-
- case 32:
- nRet=EBUSY;
- break;
-
- case 64:
- nRet=EAGAIN;
- break;
-
- default:
- nRet=EBUSY;
- break;
- }
-
- return ((0 == nRet) ? oslTranslateFileError(OSL_FET_SUCCESS, nRet) : oslTranslateFileError(OSL_FET_ERROR, nRet));
-}
-
-static oslFileError osl_unmountFloppy(oslVolumeDeviceHandle hFloppy)
-{
- oslVolumeDeviceHandleImpl* pItem=0;
- int nRet=0;
- sal_Char pszCmd[PATH_MAX];
- sal_Char* pszTmp = 0;
- sal_Char* pszSuDo = 0;
- sal_Char* pszUmountProg = "umount";
-
- pszCmd[0] = '\0';
-
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"In osl_unmountFloppy\n");
-#endif
-
- pItem = (oslVolumeDeviceHandleImpl*) hFloppy;
-
- if ( pItem == 0 )
- {
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_unmountFloppy [pItem==0]\n");
-#endif
- return osl_File_E_INVAL;
- }
-
- if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' )
- {
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_unmountFloppy [invalid handle]\n");
-#endif
- return osl_File_E_INVAL;
- }
-
- /* mfe: we can't use the umount(2) system call!!! */
- /* even if we are root */
- /* since mtab is not updated!!! */
- /* but we need it to be updated */
- /* some "magic" must be done */
-
-/* nRet=umount(pItem->pszDevice); */
-/* if ( nRet != 0 ) */
-/* { */
-/* nRet = errno; */
-
-/* #ifdef DEBUG_OSL_FILE */
-/* perror("mount"); */
-/* #endif */
-/* } */
-
-
- pszTmp = getenv("SAL_MOUNT_UMOUNTPROG");
- if ( pszTmp != 0 )
- {
- pszUmountProg=pszTmp;
- }
-
- pszTmp = getenv("SAL_MOUNT_SU_DO");
- if ( pszTmp != 0 )
- {
- pszSuDo=pszTmp;
- }
-
- if ( pszSuDo != 0 )
- {
- snprintf(pszCmd, sizeof(pszCmd), "%s %s %s",pszSuDo,pszUmountProg,pItem->pszMountPoint);
- }
- else
- {
- snprintf(pszCmd, sizeof(pszCmd), "%s %s",pszUmountProg,pItem->pszMountPoint);
- }
-
-
-#ifdef DEBUG_OSL_FILE
- fprintf(stderr,"executing '%s'\n",pszCmd);
-#endif
-
- nRet = system(pszCmd);
-
-#ifdef DEBUG_OSL_FILE
- fprintf(stderr,"call returned '%i'\n",nRet);
- fprintf(stderr,"exit status is '%i'\n", WEXITSTATUS(nRet));
-#endif
-
- switch ( WEXITSTATUS(nRet) )
- {
- case 0:
- nRet=0;
- break;
-
- default:
- nRet=EBUSY;
- break;
- }
-
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_unmountFloppy [ok]\n");
-#endif
-
- return ((0 == nRet) ? oslTranslateFileError(OSL_FET_SUCCESS, nRet) : oslTranslateFileError(OSL_FET_ERROR, nRet));
-
-/* return osl_File_E_None;*/
-}
-
-static sal_Bool osl_getFloppyMountEntry(const sal_Char* pszPath, oslVolumeDeviceHandleImpl* pItem)
-{
- struct mntent* pMountEnt=0;
- sal_Char buffer[PATH_MAX];
- FILE* mntfile=0;
- int nRet=0;
-
- buffer[0] = '\0';
-
- mntfile = setmntent(MOUNTTAB,"r");
-
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"In osl_getFloppyMountEntry\n");
-#endif
-
- memset(buffer, 0, sizeof(buffer));
- strncpy(buffer, pszPath, sizeof(buffer) - 1);
-
-#ifdef DEBUG_OSL_FILE
- fprintf(stderr,"Checking mount of %s\n",buffer);
-#endif
-
-
- if ( mntfile == 0 )
- {
- nRet=errno;
-#ifdef DEBUG_OSL_FILE
- perror("mounttab");
-#endif
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_getFloppyMountEntry [mntfile]\n");
-#endif
- return sal_False;
- }
-
- pMountEnt=getmntent(mntfile);
- while ( pMountEnt != 0 )
- {
-#ifdef DEBUG_OSL_FILE
-/* fprintf(stderr,"mnt_fsname : %s\n",pMountEnt->mnt_fsname); */
-/* fprintf(stderr,"mnt_dir : %s\n",pMountEnt->mnt_dir); */
-/* fprintf(stderr,"mnt_type : %s\n",pMountEnt->mnt_type);*/
-#endif
- if ( strcmp(pMountEnt->mnt_dir,buffer) == 0 &&
- strncmp(pMountEnt->mnt_fsname,"/dev/fd",strlen("/dev/fd")) == 0 )
- {
-
- memset(pItem->pszMountPoint, 0, sizeof(pItem->pszMountPoint));
- strncpy(pItem->pszMountPoint, pMountEnt->mnt_dir, sizeof(pItem->pszMountPoint) - 1);
-
- memset(pItem->pszFilePath, 0, sizeof(pItem->pszFilePath));
- strncpy(pItem->pszFilePath, pMountEnt->mnt_dir, sizeof(pItem->pszFilePath) - 1);
-
- memset(pItem->pszDevice, 0, sizeof(pItem->pszDevice));
- strncpy(pItem->pszDevice, pMountEnt->mnt_fsname, sizeof(pItem->pszDevice) - 1);
-
- fclose(mntfile);
-#ifdef DEBUG_OSL_FILE
- fprintf(stderr,"Mount Point found '%s'\n",pItem->pszMountPoint);
-#endif
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_getFloppyMountEntry [found]\n");
-#endif
- return sal_True;
- }
-#ifdef DEBUG_OSL_FILE
-/* fprintf(stderr,"=================\n");*/
-#endif
- pMountEnt=getmntent(mntfile);
- }
-
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_getFloppyMountEntry [not found]\n");
-#endif
-
- fclose(mntfile);
- return sal_False;
-}
-
-static sal_Bool osl_isFloppyMounted(oslVolumeDeviceHandleImpl* pDevice)
-{
- sal_Char buffer[PATH_MAX];
- oslVolumeDeviceHandleImpl* pItem=0;
- sal_Bool bRet=0;
-
- buffer[0] = '\0';
-
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"In osl_isFloppyMounted\n");
-#endif
-
- pItem = osl_newVolumeDeviceHandleImpl ();
- if ( pItem == 0 )
- return osl_File_E_NOMEM;
-
- memset(buffer, 0, sizeof(buffer));
- strncpy(buffer, pDevice->pszMountPoint, sizeof(buffer) - 1);
-
-#ifdef DEBUG_OSL_FILE
- fprintf(stderr,"Checking mount of %s\n",buffer);
-#endif
-
- bRet = osl_getFloppyMountEntry(buffer,pItem);
-
- if ( bRet == sal_False )
- {
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_isFloppyMounted [not mounted]\n");
-#endif
- return sal_False;
- }
-
- if (strcmp(pItem->pszMountPoint, pDevice->pszMountPoint) == 0 &&
- strcmp(pItem->pszDevice,pDevice->pszDevice) == 0)
- {
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_isFloppyMounted [is mounted]\n");
-#endif
- rtl_freeMemory(pItem);
- return sal_True;
- }
-
-#ifdef TRACE_OSL_FILE
- fprintf(stderr,"Out osl_isFloppyMounted [may be EBUSY]\n");
-#endif
-
- rtl_freeMemory(pItem);
- return sal_False;
-}
-#endif /* IRIX */
-
-
/* NetBSD floppy functions have to be added here. Until we have done that,
* we use the MACOSX definitions for nonexistent floppy.
* */
diff --git a/sal/osl/unx/interlck.c b/sal/osl/unx/interlck.c
index ee4d61bdc2b6..0342cdd983b4 100644
--- a/sal/osl/unx/interlck.c
+++ b/sal/osl/unx/interlck.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: interlck.c,v $
- * $Revision: 1.14 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/makefile.mk b/sal/osl/unx/makefile.mk
index 0e728c29dbcd..1dd47fb4d19b 100644
--- a/sal/osl/unx/makefile.mk
+++ b/sal/osl/unx/makefile.mk
@@ -2,14 +2,10 @@
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
-# Copyright 2008 by Sun Microsystems, Inc.
+# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.36 $
-#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
@@ -55,7 +51,8 @@ CXXFLAGS+= $(LFS_CFLAGS)
# --- Files --------------------------------------------------------
-SLOFILES= $(SLO)$/conditn.obj \
+SLOFILES= \
+ $(SLO)$/conditn.obj \
$(SLO)$/diagnose.obj \
$(SLO)$/semaphor.obj \
$(SLO)$/socket.obj \
@@ -74,7 +71,7 @@ SLOFILES= $(SLO)$/conditn.obj \
$(SLO)$/util.obj \
$(SLO)$/tempfile.obj\
$(SLO)$/file.obj \
- $(SLO)$/file_misc.obj \
+ $(SLO)$/file_misc.obj\
$(SLO)$/file_url.obj\
$(SLO)$/file_error_transl.obj\
$(SLO)$/file_path_helper.obj\
@@ -84,6 +81,7 @@ SLOFILES= $(SLO)$/conditn.obj \
$(SLO)$/process_impl.obj\
$(SLO)$/salinit.obj
+
#.IF "$(UPDATER)"=="YES"
OBJFILES= $(OBJ)$/conditn.obj \
$(OBJ)$/diagnose.obj \
@@ -104,7 +102,7 @@ OBJFILES= $(OBJ)$/conditn.obj \
$(OBJ)$/util.obj \
$(OBJ)$/tempfile.obj\
$(OBJ)$/file.obj \
- $(OBJ)$/file_misc.obj \
+ $(OBJ)$/file_misc.obj\
$(OBJ)$/file_url.obj\
$(OBJ)$/file_error_transl.obj\
$(OBJ)$/file_path_helper.obj\
diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c
index d486aad00e01..8f8f76a8656c 100644
--- a/sal/osl/unx/module.c
+++ b/sal/osl/unx/module.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: module.c,v $
- * $Revision: 1.39 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -35,32 +32,6 @@
#include <osl/process.h>
#include <osl/file.h>
-#ifdef IRIX
-#ifndef _RLD_INTERFACE_DLFCN_H_DLADDR
-#define _RLD_INTERFACE_DLFCN_H_DLADDR
-typedef struct DL_INFO {
- const char * dli_fname;
- void * dli_fbase;
- const char * dli_sname;
- void * dli_saddr;
- int dli_version;
- int dli_reserved1;
- long dli_reserved[4];
-} Dl_info;
-#endif
-#include <rld_interface.h>
-#define _RLD_DLADDR 14
-int dladdr(void *address, Dl_info *dl);
-
-int dladdr(void *address, Dl_info *dl)
-{
- void *v;
- v = _rld_new_interface(_RLD_DLADDR,address,dl);
-
- return (int)v;
-}
-#endif
-
#include "system.h"
#if OSL_DEBUG_LEVEL > 1
diff --git a/sal/osl/unx/mutex.c b/sal/osl/unx/mutex.c
index 4504891339e1..2f47ba8791ad 100644
--- a/sal/osl/unx/mutex.c
+++ b/sal/osl/unx/mutex.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: mutex.c,v $
- * $Revision: 1.15 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c
index e5390089e6d7..0b09cf1ac2a4 100644
--- a/sal/osl/unx/nlsupport.c
+++ b/sal/osl/unx/nlsupport.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: nlsupport.c,v $
- * $Revision: 1.36 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -33,7 +30,7 @@
#include <osl/process.h>
#include <rtl/memory.h>
-#if defined(LINUX) || defined(SOLARIS) || defined(IRIX) || defined(NETBSD) || defined(FREEBSD) || defined(MACOSX)
+#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(MACOSX)
#include <pthread.h>
#ifndef MACOSX
#include <locale.h>
@@ -42,7 +39,7 @@
#include <osl/module.h>
#include <osl/thread.h>
#endif /* !MACOSX */
-#endif /* LINUX || SOLARIS || IRIX || NETBSD || MACOSX */
+#endif /* LINUX || SOLARIS || NETBSD || MACOSX */
#include <string.h>
@@ -229,13 +226,12 @@ static rtl_Locale * _parse_locale( const char * locale )
return NULL;
}
-#if defined(LINUX) || defined(SOLARIS) || defined(IRIX) || defined(NETBSD) || defined(FREEBSD)
+#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD)
/*
* This implementation of osl_getTextEncodingFromLocale maps
* from nl_langinfo(CODESET) to rtl_textencoding defines.
- * nl_langinfo() is supported only on Linux and Solaris.
- * nl_langinfo() is supported only on Linux, Solaris and IRIX,
+ * nl_langinfo() is supported only on Linux, Solaris,
* >= NetBSD 1.6 and >= FreeBSD 4.4
*
* This routine is SLOW because of the setlocale call, so
@@ -299,24 +295,6 @@ const _pair _nl_language_list[] = {
/* XXX MS-874 is an extension to tis620, so this is not
* really equivalent */
-#elif defined(IRIX)
-
-const _pair _nl_language_list[] = {
- { "big5", RTL_TEXTENCODING_BIG5 }, /* China - Traditional Chinese */
- { "eucCN", RTL_TEXTENCODING_EUC_CN }, /* China */
- { "eucgbk", RTL_TEXTENCODING_DONTKNOW }, /* China - Simplified Chinese */
- { "eucJP", RTL_TEXTENCODING_EUC_JP }, /* Japan */
- { "eucKR", RTL_TEXTENCODING_EUC_KR }, /* Korea */
- { "eucTW", RTL_TEXTENCODING_EUC_TW }, /* Taiwan - Traditional Chinese */
- { "gbk", RTL_TEXTENCODING_GBK }, /* China - Simplified Chinese */
- { "ISO8859-1", RTL_TEXTENCODING_ISO_8859_1 }, /* Western */
- { "ISO8859-2", RTL_TEXTENCODING_ISO_8859_2 }, /* Central European */
- { "ISO8859-5", RTL_TEXTENCODING_ISO_8859_5 }, /* Cyrillic */
- { "ISO8859-7", RTL_TEXTENCODING_ISO_8859_7 }, /* Greek */
- { "ISO8859-9", RTL_TEXTENCODING_ISO_8859_9 }, /* Turkish */
- { "ISO8859-15", RTL_TEXTENCODING_ISO_8859_15 }, /* Western Updated (w/Euro sign) */
- { "sjis", RTL_TEXTENCODING_SHIFT_JIS } /* Japan */
-};
#elif defined(LINUX) || defined(NETBSD)
@@ -552,7 +530,7 @@ const _pair _nl_language_list[] = {
{ "UTF-8", RTL_TEXTENCODING_UTF8 } /* ISO-10646/UTF-8 */
};
-#endif /* ifdef SOLARIS IRIX LINUX FREEBSD NETBSD */
+#endif /* ifdef SOLARIS LINUX FREEBSD NETBSD */
static pthread_mutex_t aLocalMutex = PTHREAD_MUTEX_INITIALIZER;
@@ -927,9 +905,6 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale )
int _imp_setProcessLocale( rtl_Locale * pLocale )
{
-#ifdef IRIX
- char env_buf[80];
-#endif
char locale_buf[64];
/* convert rtl_Locale to locale string */
@@ -937,11 +912,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale )
{
/* only change env vars that exist already */
if( getenv( "LC_ALL" ) ) {
-#if defined( IRIX )
- snprintf(env_buf, sizeof(env_buf), "LC_ALL=%s", locale_buf);
- env_buf[sizeof(env_buf)] = '\0';
- putenv(env_buf);
-#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX )
+#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX )
setenv( "LC_ALL", locale_buf, 1);
#else
setenv( "LC_ALL", locale_buf );
@@ -949,11 +920,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale )
}
if( getenv( "LC_CTYPE" ) ) {
-#if defined( IRIX )
- snprintf(env_buf, sizeof(env_buf), "LC_CTYPE=%s", locale_buf);
- env_buf[sizeof(env_buf)] = '\0';
- putenv(env_buf);
-#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX )
+#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX )
setenv("LC_CTYPE", locale_buf, 1 );
#else
setenv( "LC_CTYPE", locale_buf );
@@ -961,11 +928,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale )
}
if( getenv( "LANG" ) ) {
-#if defined( IRIX )
- snprintf(env_buf, sizeof(env_buf), "LANG=%s", locale_buf);
- env_buf[sizeof(env_buf)] = '\0';
- putenv(env_buf);
-#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX )
+#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX )
setenv("LC_CTYPE", locale_buf, 1 );
#else
setenv( "LANG", locale_buf );
diff --git a/sal/osl/unx/osxlocale.cxx b/sal/osl/unx/osxlocale.cxx
index 4b877a6acb6f..9a20fd9ceb12 100644
--- a/sal/osl/unx/osxlocale.cxx
+++ b/sal/osl/unx/osxlocale.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: osxlocale.cxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c
index 43f564d0322a..ede4cd7e074f 100644
--- a/sal/osl/unx/pipe.c
+++ b/sal/osl/unx/pipe.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: pipe.c,v $
- * $Revision: 1.20 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c
index a1f47cdf76a5..5262fef5cd38 100644
--- a/sal/osl/unx/process.c
+++ b/sal/osl/unx/process.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: process.c,v $
- * $Revision: 1.44 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -49,7 +46,7 @@
#endif
#include "system.h"
-#if defined(SOLARIS) || defined(IRIX)
+#if defined(SOLARIS)
# include <sys/procfs.h>
#endif
#include <osl/diagnose.h>
@@ -269,7 +266,7 @@ static sal_Bool sendFdPipe(int PipeFD, int SocketFD)
cmptr->cmsg_level = SOL_SOCKET;
cmptr->cmsg_type = SCM_RIGHTS;
cmptr->cmsg_len = CONTROLLEN;
- *(int*)CMSG_DATA(cmptr) = SocketFD;
+ memcpy(CMSG_DATA(cmptr), &SocketFD, sizeof(int));
#endif
@@ -360,7 +357,7 @@ static oslSocket receiveFdPipe(int PipeFD)
( msghdr.msg_controllen == CONTROLLEN ) )
{
OSL_TRACE("receiveFdPipe : received '%i' bytes\n",nRead);
- newfd = *(int*)CMSG_DATA(cmptr);
+ memcpy(&newfd, CMSG_DATA(cmptr), sizeof(int));
}
#endif
else
@@ -431,10 +428,8 @@ oslSocket osl_receiveResourcePipe(oslPipe pPipe)
static void ChildStatusProc(void *pData)
{
- int i;
-/* int first = 0;*/
- pid_t pid;
-/* int status;*/
+ pid_t pid = -1;
+ int status = 0;
int channel[2];
ProcessData data;
ProcessData *pdata;
@@ -447,25 +442,31 @@ static void ChildStatusProc(void *pData)
in our child process */
memcpy(&data, pData, sizeof(data));
- socketpair(AF_UNIX, SOCK_STREAM, 0, channel);
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, channel) == -1)
+ status = errno;
fcntl(channel[0], F_SETFD, FD_CLOEXEC);
fcntl(channel[1], F_SETFD, FD_CLOEXEC);
/* Create redirected IO pipes */
+ if ( status == 0 && data.m_pInputWrite )
+ if (pipe( stdInput ) == -1)
+ status = errno;
- if ( data.m_pInputWrite )
- pipe( stdInput );
-
- if ( data.m_pOutputRead )
- pipe( stdOutput );
+ if ( status == 0 && data.m_pOutputRead )
+ if (pipe( stdOutput ) == -1)
+ status = errno;
- if ( data.m_pErrorRead )
- pipe( stdError );
+ if ( status == 0 && data.m_pErrorRead )
+ if (pipe( stdError ) == -1)
+ status = errno;
- if ((pid = fork()) == 0)
+ if ( (status == 0) && ((pid = fork()) == 0) )
{
/* Child */
+ int chstatus = 0;
+ sal_Int32 nWrote;
+
if (channel[0] != -1) close(channel[0]);
if ((data.m_uid != (uid_t)-1) && ((data.m_uid != getuid()) || (data.m_gid != getgid())))
@@ -481,20 +482,15 @@ static void ChildStatusProc(void *pData)
#endif
}
- if ((data.m_uid == (uid_t)-1) || ((data.m_uid == getuid()) && (data.m_gid == getgid())))
+ if (data.m_pszDir)
+ chstatus = chdir(data.m_pszDir);
+ if (chstatus == 0 && ((data.m_uid == (uid_t)-1) || ((data.m_uid == getuid()) && (data.m_gid == getgid()))))
{
- if (data.m_pszDir)
- chdir(data.m_pszDir);
-
+ int i;
for (i = 0; data.m_pszEnv[i] != NULL; i++)
putenv(data.m_pszEnv[i]);
-#if defined(LINUX) && !defined(NPTL)
- /* mfe: linux likes to have just one thread when the exec family is called */
- /* this np function has this purpose ... */
- pthread_kill_other_threads_np();
-#endif
OSL_TRACE("ChildStatusProc : starting '%s'",data.m_pszArgs[0]);
/* Connect std IO to pipe ends */
@@ -537,7 +533,9 @@ static void ChildStatusProc(void *pData)
OSL_TRACE("ChildStatusProc : starting '%s' failed",data.m_pszArgs[0]);
/* if we reach here, something went wrong */
- write(channel[1], &errno, sizeof(errno));
+ nWrote = write(channel[1], &errno, sizeof(errno));
+ if (nWrote != sizeof(errno))
+ OSL_TRACE("sendFdPipe : sending failed (%s)",strerror(errno));
if (channel[1] != -1) close(channel[1]);
@@ -545,8 +543,7 @@ static void ChildStatusProc(void *pData)
}
else
{ /* Parent */
- int status;
-
+ int i = -1;
if (channel[1] != -1) close(channel[1]);
/* Close unused pipe ends */
@@ -554,15 +551,17 @@ static void ChildStatusProc(void *pData)
if (stdOutput[1] != -1) close( stdOutput[1] );
if (stdError[1] != -1) close( stdError[1] );
- while (((i = read(channel[0], &status, sizeof(status))) < 0))
+ if (pid > 0)
{
- if (errno != EINTR)
- break;
+ while (((i = read(channel[0], &status, sizeof(status))) < 0))
+ {
+ if (errno != EINTR)
+ break;
+ }
}
if (channel[0] != -1) close(channel[0]);
-
if ((pid > 0) && (i == 0))
{
pid_t child_pid;
@@ -1368,48 +1367,6 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F
return (pInfo->Fields == Fields) ? osl_Process_E_None : osl_Process_E_Unknown;
}
-#elif defined(IRIX)
-
- int fd;
- sal_Char name[PATH_MAX + 1];
-
- snprintf(name, sizeof(name), "/proc/%u", pid);
-
- if ((fd = open(name, O_RDONLY)) >= 0)
- {
- prstatus_t prstatus;
- prpsinfo_t prpsinfo;
-
- if (ioctl(fd, PIOCSTATUS, &prstatus) >= 0 &&
- ioctl(fd, PIOCPSINFO, &prpsinfo) >= 0)
- {
- if (Fields & osl_Process_CPUTIMES)
- {
- pInfo->UserTime.Seconds = prstatus.pr_utime.tv_sec;
- pInfo->UserTime.Nanosec = prstatus.pr_utime.tv_nsec;
- pInfo->SystemTime.Seconds = prstatus.pr_stime.tv_sec;
- pInfo->SystemTime.Nanosec = prstatus.pr_stime.tv_nsec;
-
- pInfo->Fields |= osl_Process_CPUTIMES;
- }
-
- if (Fields & osl_Process_HEAPUSAGE)
- {
- int pagesize = getpagesize();
-
- pInfo->HeapUsage = prpsinfo.pr_size*pagesize;
-
- pInfo->Fields |= osl_Process_HEAPUSAGE;
- }
-
- close(fd);
-
- return (pInfo->Fields == Fields) ? osl_Process_E_None : osl_Process_E_Unknown;
- }
- else
- close(fd);
- }
-
#elif defined(LINUX)
if ( (Fields & osl_Process_CPUTIMES) || (Fields & osl_Process_HEAPUSAGE) )
diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx
index 5851decc3945..adfc59e9c8af 100644
--- a/sal/osl/unx/process_impl.cxx
+++ b/sal/osl/unx/process_impl.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: process_impl.cxx,v $
- * $Revision: 1.12 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/procimpl.h b/sal/osl/unx/procimpl.h
index 7b414ee4ead5..1a08d72ffe5a 100644
--- a/sal/osl/unx/procimpl.h
+++ b/sal/osl/unx/procimpl.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: procimpl.h,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c
index a01d292e23b6..c77a27543261 100644
--- a/sal/osl/unx/profile.c
+++ b/sal/osl/unx/profile.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: profile.c,v $
- * $Revision: 1.19 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -263,12 +260,9 @@ static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, o
pProfile->m_Stamp = OslProfile_getFileStamp(pFile);
bRet=loadProfile(pFile, pProfile);
+ bRet &= realpath(pszProfileName, pProfile->m_FileName) != NULL;
OSL_ASSERT(bRet);
- /* #109261# using osl profiles is deprecated */
- /* OSL_VERIFY(NULL != realpath(pszProfileName, pProfile->m_FileName)); */
- realpath(pszProfileName, pProfile->m_FileName);
-
if (pProfile->m_pFile == NULL)
closeFileImpl(pFile,pProfile->m_Flags);
@@ -1338,6 +1332,7 @@ static osl_TStamp closeFileImpl(osl_TFile* pFile, oslProfileOption Flags)
static sal_Bool OslProfile_rewindFile(osl_TFile* pFile, sal_Bool bTruncate)
{
+ sal_Bool bRet = sal_True;
#ifdef TRACE_OSL_PROFILE
OSL_TRACE("In osl_OslProfile_rewindFile\n");
#endif
@@ -1349,14 +1344,14 @@ static sal_Bool OslProfile_rewindFile(osl_TFile* pFile, sal_Bool bTruncate)
#ifdef DEBUG_OSL_PROFILE
OSL_TRACE("rewinding\n");
#endif
- lseek(pFile->m_Handle, SEEK_SET, 0L);
+ bRet = (lseek(pFile->m_Handle, SEEK_SET, 0L) == 0L);
if (bTruncate)
{
#ifdef DEBUG_OSL_PROFILE
OSL_TRACE("truncating\n");
#endif
- ftruncate(pFile->m_Handle, 0L);
+ bRet &= (ftruncate(pFile->m_Handle, 0L) == 0);
}
}
@@ -1364,7 +1359,7 @@ static sal_Bool OslProfile_rewindFile(osl_TFile* pFile, sal_Bool bTruncate)
#ifdef TRACE_OSL_PROFILE
OSL_TRACE("Out osl_OslProfile_rewindFile [ok]\n");
#endif
- return (sal_True);
+ return bRet;
}
diff --git a/sal/osl/unx/salinit.cxx b/sal/osl/unx/salinit.cxx
index 8f4730ffdf29..7090a381235c 100644
--- a/sal/osl/unx/salinit.cxx
+++ b/sal/osl/unx/salinit.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: salinit.cxx,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/secimpl.h b/sal/osl/unx/secimpl.h
index 09f076613d1d..1d8f2aaa9419 100644
--- a/sal/osl/unx/secimpl.h
+++ b/sal/osl/unx/secimpl.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: secimpl.h,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c
index 5b601ee138a9..d08326e65ebe 100644
--- a/sal/osl/unx/security.c
+++ b/sal/osl/unx/security.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: security.c,v $
- * $Revision: 1.29 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/semaphor.c b/sal/osl/unx/semaphor.c
index 5b1026ba2e02..c514b2dacff6 100644
--- a/sal/osl/unx/semaphor.c
+++ b/sal/osl/unx/semaphor.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: semaphor.c,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/signal.c b/sal/osl/unx/signal.c
index 35884e11c9ba..c5141fa02260 100644
--- a/sal/osl/unx/signal.c
+++ b/sal/osl/unx/signal.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: signal.c,v $
- * $Revision: 1.37 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -202,6 +199,7 @@ static sal_Bool InitSignal()
int i;
struct sigaction act;
struct sigaction oact;
+ sigset_t unset;
if (is_soffice_Impl())
{
@@ -283,6 +281,16 @@ static sal_Bool InitSignal()
}
}
+ /* Clear signal mask inherited from parent process (on Mac OS X, upon a
+ crash soffice re-execs itself from within the signal handler, so the
+ second soffice would have the guilty signal blocked and would freeze upon
+ encountering a similar crash again): */
+ if (sigemptyset(&unset) < 0 ||
+ pthread_sigmask(SIG_SETMASK, &unset, NULL) < 0)
+ {
+ OSL_TRACE("sigemptyset or pthread_sigmask failed");
+ }
+
return sal_True;
}
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index 310dd57592f5..c8faf6c028f5 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: socket.c,v $
- * $Revision: 1.29.60.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -48,7 +45,7 @@
#undef HAVE_POLL_H
#endif
-#if defined(LINUX) || defined (IRIX) || defined(NETBSD) || defined ( FREEBSD ) || defined (MACOSX)
+#if defined(LINUX) || defined(NETBSD) || defined ( FREEBSD ) || defined (MACOSX)
#include <sys/poll.h>
#define HAVE_POLL_H
#endif /* HAVE_POLL_H */
@@ -1861,6 +1858,9 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
pSocket->m_nLastError=0;
nFD = pSocket->m_Socket;
+ if (nFD == OSL_INVALID_SOCKET)
+ return;
+
pSocket->m_Socket = OSL_INVALID_SOCKET;
#if defined(LINUX)
@@ -1869,10 +1869,13 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
if ( pSocket->m_bIsAccepting == sal_True )
{
int nConnFD;
- struct sockaddr aSockAddr;
- socklen_t nSockLen = sizeof(aSockAddr);
+ union {
+ struct sockaddr aSockAddr;
+ struct sockaddr_in aSockAddrIn;
+ } s;
+ socklen_t nSockLen = sizeof(s.aSockAddr);
- nRet = getsockname(nFD, &aSockAddr, &nSockLen);
+ nRet = getsockname(nFD, &s.aSockAddr, &nSockLen);
#if OSL_DEBUG_LEVEL > 1
if ( nRet < 0 )
{
@@ -1880,13 +1883,11 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
}
#endif /* OSL_DEBUG_LEVEL */
- if ( aSockAddr.sa_family == AF_INET )
+ if ( s.aSockAddr.sa_family == AF_INET )
{
- struct sockaddr_in* pSockAddrIn = (struct sockaddr_in*) &aSockAddr;
-
- if ( pSockAddrIn->sin_addr.s_addr == htonl(INADDR_ANY) )
+ if ( s.aSockAddrIn.sin_addr.s_addr == htonl(INADDR_ANY) )
{
- pSockAddrIn->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ s.aSockAddrIn.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
}
nConnFD = socket(AF_INET, SOCK_STREAM, 0);
@@ -1897,7 +1898,7 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
}
#endif /* OSL_DEBUG_LEVEL */
- nRet = connect(nConnFD, &aSockAddr, sizeof(aSockAddr));
+ nRet = connect(nConnFD, &s.aSockAddr, sizeof(s.aSockAddr));
#if OSL_DEBUG_LEVEL > 1
if ( nRet < 0 )
{
@@ -1906,6 +1907,7 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
#endif /* OSL_DEBUG_LEVEL */
close(nConnFD);
}
+ pSocket->m_bIsAccepting = sal_False;
}
#endif /* LINUX */
diff --git a/sal/osl/unx/sockimpl.h b/sal/osl/unx/sockimpl.h
index 9affae49c6d2..86122e850875 100644
--- a/sal/osl/unx/sockimpl.h
+++ b/sal/osl/unx/sockimpl.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: sockimpl.h,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c
index 3810e86b4efb..0ea3b819438c 100644
--- a/sal/osl/unx/system.c
+++ b/sal/osl/unx/system.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: system.c,v $
- * $Revision: 1.16.60.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h
index c2e01126fb58..8cb77c9b7fc8 100644
--- a/sal/osl/unx/system.h
+++ b/sal/osl/unx/system.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: system.h,v $
- * $Revision: 1.42.60.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -270,34 +267,6 @@ extern unsigned int nanosleep(unsigned int);
# define PTHREAD_SIGACTION cma_sigaction
#endif
-#ifdef IRIX
-# define AF_IPX -1
-# include <pthread.h>
-# include <semaphore.h>
-# include <sched.h>
-# include <sys/socket.h>
-# include <sys/un.h>
-# include <sys/stropts.h>
-# include <netinet/tcp.h>
-# include <sys/endian.h>
-# if BYTE_ORDER == LITTLE_ENDIAN
-# undef _BIG_ENDIAN
-# undef _PDP_ENDIAN
-# elif BYTE_ORDER == BIG_ENDIAN
-# undef _LITTLE_ENDIAN
-# undef _PDP_ENDIAN
-# elif BYTE_ORDER == PDP_ENDIAN
-# undef _LITTLE_ENDIAN
-# undef _BIG_ENDIAN
-# endif
-# define SA_FAMILY_DECL \
- union { struct { short sa_family2; } sa_generic; } sa_union
-# define NO_PTHREAD_PRIORITY
-# include <dlfcn.h>
-# define IOCHANNEL_TRANSFER_BSD
-extern char *strdup(const char *);
-#endif
-
#ifdef SOLARIS
# include <shadow.h>
# include <sys/un.h>
@@ -364,8 +333,7 @@ int macxp_resolveAlias(char *path, int buflen);
#if !defined(_WIN32) && !defined(_WIN16) && !defined(OS2) && \
!defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) && !defined(SCO) && \
!defined(AIX) && !defined(HPUX) && \
- !defined(SOLARIS) && !defined(IRIX) && \
- !defined(MACOSX)
+ !defined(SOLARIS) && !defined(MACOSX)
# error "Target platform not specified!"
#endif
diff --git a/sal/osl/unx/tempfile.c b/sal/osl/unx/tempfile.c
index c60d9cb3ba61..e10fffaa5ce2 100644
--- a/sal/osl/unx/tempfile.c
+++ b/sal/osl/unx/tempfile.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: tempfile.c,v $
- * $Revision: 1.11 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c
index 20272c5f4a28..fe53915b792f 100644
--- a/sal/osl/unx/thread.c
+++ b/sal/osl/unx/thread.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: thread.c,v $
- * $Revision: 1.31.48.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/time.c b/sal/osl/unx/time.c
index 8ed7a5806b42..c1a98a6b87a9 100644
--- a/sal/osl/unx/time.c
+++ b/sal/osl/unx/time.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: time.c,v $
- * $Revision: 1.12 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/util.c b/sal/osl/unx/util.c
index 66746fd3ff44..f969bfe566ec 100644
--- a/sal/osl/unx/util.c
+++ b/sal/osl/unx/util.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: util.c,v $
- * $Revision: 1.13 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx
index 1eae6279b26f..299ea4198fdc 100644
--- a/sal/osl/unx/uunxapi.cxx
+++ b/sal/osl/unx/uunxapi.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: uunxapi.cxx,v $
- * $Revision: 1.7 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/uunxapi.h b/sal/osl/unx/uunxapi.h
index 26bf9b238320..9eddc5fe4753 100644
--- a/sal/osl/unx/uunxapi.h
+++ b/sal/osl/unx/uunxapi.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: uunxapi.h,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/unx/uunxapi.hxx b/sal/osl/unx/uunxapi.hxx
index d1ab8600027e..7f1a9072e8cc 100644
--- a/sal/osl/unx/uunxapi.hxx
+++ b/sal/osl/unx/uunxapi.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: uunxapi.hxx,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/MAKEFILE.MK b/sal/osl/w32/MAKEFILE.MK
index cd52ef549c8d..4749048847b5 100644
--- a/sal/osl/w32/MAKEFILE.MK
+++ b/sal/osl/w32/MAKEFILE.MK
@@ -2,14 +2,10 @@
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
-# Copyright 2008 by Sun Microsystems, Inc.
+# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
-# $RCSfile: MAKEFILE.MK,v $
-#
-# $Revision: 1.16 $
-#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/conditn.c b/sal/osl/w32/conditn.c
index 7af4398284be..1a382af89fcf 100644
--- a/sal/osl/w32/conditn.c
+++ b/sal/osl/w32/conditn.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: conditn.c,v $
- * $Revision: 1.8 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/diagnose.c b/sal/osl/w32/diagnose.c
index 92560a35cfa0..b46bff44b73c 100644
--- a/sal/osl/w32/diagnose.c
+++ b/sal/osl/w32/diagnose.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: diagnose.c,v $
- * $Revision: 1.14 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/dllentry.c b/sal/osl/w32/dllentry.c
index 11928a3b6458..b6a21d6c2724 100644
--- a/sal/osl/w32/dllentry.c
+++ b/sal/osl/w32/dllentry.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: dllentry.c,v $
- * $Revision: 1.34 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -255,7 +252,7 @@ void do_cleanup( void )
*/
-#ifdef PRODUCT
+#ifndef DBG_UTIL
__try
#endif
{
@@ -267,7 +264,7 @@ void do_cleanup( void )
rtl_cache_fini();
rtl_arena_fini();
}
-#ifdef PRODUCT
+#ifndef DBG_UTIL
__except( EXCEPTION_EXECUTE_HANDLER )
{
}
diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx
index 34deba2293da..7728189387cd 100644
--- a/sal/osl/w32/file.cxx
+++ b/sal/osl/w32/file.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file.cxx,v $
- * $Revision: 1.0 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -400,6 +397,7 @@ oslFileError FileHandle_Impl::readFileAt (
oslFileError result = syncFile();
if (result != osl_File_E_None)
return (result);
+ m_bufptr = -1, m_buflen = 0;
if (nBytesRequested >= m_bufsiz)
{
@@ -472,6 +470,7 @@ oslFileError FileHandle_Impl::writeFileAt (
oslFileError result = syncFile();
if (result != osl_File_E_None)
return (result);
+ m_bufptr = -1, m_buflen = 0;
if (nBytesToWrite >= m_bufsiz)
{
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 5ea839ae215d..09bdec7988c3 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file.cxx,v $
- * $Revision: 1.19 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -37,6 +34,7 @@
#include "file_url.h"
#include "file_error.h"
+
#include "path_helper.hxx"
#include "osl/diagnose.h"
@@ -294,7 +292,7 @@ struct DirectoryItem_Impl
WIN32_FIND_DATA FindData;
TCHAR cDriveString[MAX_PATH];
};
- TCHAR szFullPath[MAX_PATH];
+ rtl_uString* m_pFullPath;
BOOL bFullPathNormalized;
int nRefCount;
};
@@ -313,7 +311,7 @@ struct Directory_Impl
HANDLE hDirectory;
HANDLE hEnumDrives;
};
- TCHAR szDirectoryPath[MAX_PATH];
+ rtl_uString* m_pDirectoryPath;
};
//#####################################################
@@ -398,34 +396,48 @@ typedef struct tagDIRECTORY
} DIRECTORY, *PDIRECTORY, FAR *LPDIRECTORY;
//#####################################################
-static HANDLE WINAPI OpenDirectory(LPCTSTR lpszPath)
+static HANDLE WINAPI OpenDirectory( rtl_uString* pPath)
{
- LPDIRECTORY pDirectory = (LPDIRECTORY)HeapAlloc(GetProcessHeap(), 0, sizeof(DIRECTORY));
+ LPDIRECTORY pDirectory = NULL;
- if (pDirectory)
+ if ( pPath )
{
- TCHAR szFileMask[MAX_PATH];
- int nLen;
+ sal_uInt32 nLen = rtl_uString_getLength( pPath );
+ if ( nLen )
+ {
+ TCHAR* pSuffix = 0;
+ sal_uInt32 nSuffLen = 0;
- _tcscpy( szFileMask, lpszPath );
- nLen = _tcslen( szFileMask );
+ if ( pPath->buffer[nLen - 1] != L'\\' )
+ {
+ pSuffix = L"\\*.*";
+ nSuffLen = 4;
+ }
+ else
+ {
+ pSuffix = L"*.*";
+ nSuffLen = 3;
+ }
- if (nLen && szFileMask[nLen-1] != '\\')
- _tcscat(szFileMask, TEXT("\\*.*"));
- else
- _tcscat(szFileMask, TEXT("*.*"));
+ TCHAR* szFileMask = reinterpret_cast< TCHAR* >( rtl_allocateMemory( sizeof( TCHAR ) * ( nLen + nSuffLen + 1 ) ) );
- pDirectory->hFind = FindFirstFile(szFileMask, &pDirectory->aFirstData);
+ _tcscpy( szFileMask, reinterpret_cast<LPCTSTR>( rtl_uString_getStr( pPath ) ) );
+ _tcscat( szFileMask, pSuffix );
- if (!IsValidHandle(pDirectory->hFind))
- {
- if ( GetLastError() != ERROR_NO_MORE_FILES )
+ pDirectory = (LPDIRECTORY)HeapAlloc(GetProcessHeap(), 0, sizeof(DIRECTORY));
+ pDirectory->hFind = FindFirstFile(szFileMask, &pDirectory->aFirstData);
+
+ if (!IsValidHandle(pDirectory->hFind))
{
- HeapFree(GetProcessHeap(), 0, pDirectory);
- pDirectory = NULL;
+ if ( GetLastError() != ERROR_NO_MORE_FILES )
+ {
+ HeapFree(GetProcessHeap(), 0, pDirectory);
+ pDirectory = NULL;
+ }
}
}
}
+
return (HANDLE)pDirectory;
}
@@ -502,15 +514,26 @@ static oslFileError osl_openLocalRoot(
Directory_Impl *pDirImpl;
pDirImpl = reinterpret_cast<Directory_Impl*>(rtl_allocateMemory( sizeof(Directory_Impl)));
- _tcscpy( pDirImpl->szDirectoryPath, reinterpret_cast<LPCTSTR>(rtl_uString_getStr(strSysPath)) );
+ ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
+ rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strSysPath );
/* Append backslash if neccessary */
/* @@@ToDo
use function ensure backslash
*/
- if ( pDirImpl->szDirectoryPath[_tcslen(pDirImpl->szDirectoryPath) - 1] != L'\\' )
- _tcscat( pDirImpl->szDirectoryPath, L"\\" );
+ sal_uInt32 nLen = rtl_uString_getLength( pDirImpl->m_pDirectoryPath );
+ if ( nLen && pDirImpl->m_pDirectoryPath->buffer[nLen - 1] != L'\\' )
+ {
+ rtl_uString* pCurDir = 0;
+ rtl_uString* pBackSlash = 0;
+
+ rtl_uString_assign( &pCurDir, pDirImpl->m_pDirectoryPath );
+ rtl_uString_newFromAscii( &pBackSlash, "\\" );
+ rtl_uString_newConcat( &pDirImpl->m_pDirectoryPath, pCurDir, pBackSlash );
+ rtl_uString_release( pBackSlash );
+ rtl_uString_release( pCurDir );
+ }
pDirImpl->uType = DIRECTORYTYPE_LOCALROOT;
pDirImpl->hEnumDrives = OpenLogicalDrivesEnum();
@@ -526,7 +549,16 @@ static oslFileError osl_openLocalRoot(
else
{
if ( pDirImpl )
+ {
+ if ( pDirImpl->m_pDirectoryPath )
+ {
+ rtl_uString_release( pDirImpl->m_pDirectoryPath );
+ pDirImpl->m_pDirectoryPath = 0;
+ }
+
rtl_freeMemory(pDirImpl);
+ pDirImpl = 0;
+ }
error = oslTranslateFileError( GetLastError() );
}
@@ -547,23 +579,41 @@ static oslFileError SAL_CALL osl_openFileDirectory(
*pDirectory = NULL;
Directory_Impl *pDirImpl = reinterpret_cast<Directory_Impl*>(rtl_allocateMemory(sizeof(Directory_Impl)));
- _tcscpy( pDirImpl->szDirectoryPath, reinterpret_cast<LPCTSTR>(rtl_uString_getStr(strDirectoryPath)) );
+ ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
+ rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strDirectoryPath );
/* Append backslash if neccessary */
/* @@@ToDo
use function ensure backslash
*/
- if ( pDirImpl->szDirectoryPath[_tcslen(pDirImpl->szDirectoryPath) - 1] != L'\\' )
- _tcscat( pDirImpl->szDirectoryPath, L"\\" );
+ sal_uInt32 nLen = rtl_uString_getLength( pDirImpl->m_pDirectoryPath );
+ if ( nLen && pDirImpl->m_pDirectoryPath->buffer[nLen - 1] != L'\\' )
+ {
+ rtl_uString* pCurDir = 0;
+ rtl_uString* pBackSlash = 0;
+
+ rtl_uString_assign( &pCurDir, pDirImpl->m_pDirectoryPath );
+ rtl_uString_newFromAscii( &pBackSlash, "\\" );
+ rtl_uString_newConcat( &pDirImpl->m_pDirectoryPath, pCurDir, pBackSlash );
+ rtl_uString_release( pBackSlash );
+ rtl_uString_release( pCurDir );
+ }
+
pDirImpl->uType = DIRECTORYTYPE_FILESYSTEM;
- pDirImpl->hDirectory = OpenDirectory( pDirImpl->szDirectoryPath );
+ pDirImpl->hDirectory = OpenDirectory( pDirImpl->m_pDirectoryPath );
if ( !pDirImpl->hDirectory )
{
error = oslTranslateFileError( GetLastError() );
+ if ( pDirImpl->m_pDirectoryPath )
+ {
+ rtl_uString_release( pDirImpl->m_pDirectoryPath );
+ pDirImpl->m_pDirectoryPath = 0;
+ }
+
rtl_freeMemory(pDirImpl), pDirImpl = 0;
}
@@ -595,6 +645,7 @@ static oslFileError SAL_CALL osl_openNetworkServer(
Directory_Impl *pDirImpl;
pDirImpl = reinterpret_cast<Directory_Impl*>(rtl_allocateMemory(sizeof(Directory_Impl)));
+ ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
pDirImpl->uType = DIRECTORYTYPE_NETROOT;
pDirImpl->hDirectory = hEnum;
*pDirectory = (oslDirectory)pDirImpl;
@@ -612,7 +663,11 @@ static DWORD create_dir_with_callback(
// user specified callback function. On success
// the function returns ERROR_SUCCESS else a Win32 error code.
- if (CreateDirectory(reinterpret_cast<LPCTSTR>(dir_path->buffer), NULL))
+ BOOL bCreated = FALSE;
+
+ bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( dir_path )), NULL );
+
+ if ( bCreated )
{
if (aDirectoryCreationCallbackFunc)
{
@@ -708,15 +763,18 @@ oslFileError SAL_CALL osl_createDirectory(rtl_uString* strPath)
if ( osl_File_E_None == error )
{
- if ( CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strSysPath )), NULL ) )
- error = osl_File_E_None;
-/*@@@ToDo
- The else case is a hack because the ucb or the webtop had some
- problems with the error code that CreateDirectory returns in
- case the path is only a logical drive, should be removed!
-*/
- else
+ BOOL bCreated = FALSE;
+
+ bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strSysPath )), NULL );
+
+ if ( !bCreated )
{
+ /*@@@ToDo
+ The following case is a hack because the ucb or the webtop had some
+ problems with the error code that CreateDirectory returns in
+ case the path is only a logical drive, should be removed!
+ */
+
const sal_Unicode *pBuffer = rtl_uString_getStr( strSysPath );
sal_Int32 nLen = rtl_uString_getLength( strSysPath );
@@ -865,6 +923,12 @@ static oslFileError SAL_CALL osl_getNextDrive(
}
else
{
+ if ( pItemImpl->m_pFullPath )
+ {
+ rtl_uString_release( pItemImpl->m_pFullPath );
+ pItemImpl->m_pFullPath = 0;
+ }
+
rtl_freeMemory( pItemImpl );
return oslTranslateFileError( GetLastError() );
}
@@ -898,14 +962,24 @@ static oslFileError SAL_CALL osl_getNextFileItem(
{
pItemImpl->uType = DIRECTORYITEM_FILE;
pItemImpl->nRefCount = 1;
- _tcscpy( pItemImpl->szFullPath, pDirImpl->szDirectoryPath );
- _tcscat( pItemImpl->szFullPath, pItemImpl->FindData.cFileName );
+
+ rtl_uString* pTmpFileName = 0;
+ rtl_uString_newFromStr( &pTmpFileName, reinterpret_cast<const sal_Unicode *>(pItemImpl->FindData.cFileName) );
+ rtl_uString_newConcat( &pItemImpl->m_pFullPath, pDirImpl->m_pDirectoryPath, pTmpFileName );
+ rtl_uString_release( pTmpFileName );
+
pItemImpl->bFullPathNormalized = FALSE;
*pItem = (oslDirectoryItem)pItemImpl;
return osl_File_E_None;
}
else
{
+ if ( pItemImpl->m_pFullPath )
+ {
+ rtl_uString_release( pItemImpl->m_pFullPath );
+ pItemImpl->m_pFullPath = 0;
+ }
+
rtl_freeMemory( pItemImpl );
return oslTranslateFileError( GetLastError() );
}
@@ -966,6 +1040,12 @@ oslFileError SAL_CALL osl_closeDirectory(oslDirectory Directory)
break;
}
+ if ( pDirImpl->m_pDirectoryPath )
+ {
+ rtl_uString_release( pDirImpl->m_pDirectoryPath );
+ pDirImpl->m_pDirectoryPath = 0;
+ }
+
rtl_freeMemory(pDirImpl);
}
return eError;
@@ -1027,8 +1107,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
pItemImpl->uType = DIRECTORYITEM_SERVER;
osl_acquireDirectoryItem( (oslDirectoryItem)pItemImpl );
-
- _tcscpy( pItemImpl->szFullPath, reinterpret_cast<LPCTSTR>(strSysFilePath->buffer) );
+ rtl_uString_newFromString( &pItemImpl->m_pFullPath, strSysFilePath );
// Assign a title anyway
{
@@ -1091,7 +1170,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
osl_acquireDirectoryItem( (oslDirectoryItem)pItemImpl );
CopyMemory( &pItemImpl->FindData, &aFindData, sizeof(WIN32_FIND_DATA) );
- _tcscpy( pItemImpl->szFullPath, reinterpret_cast<LPCTSTR>(rtl_uString_getStr(strSysFilePath)) );
+ rtl_uString_newFromString( &pItemImpl->m_pFullPath, strSysFilePath );
// MT: This costs 600ms startup time on fast v60x!
// GetCaseCorrectPathName( pItemImpl->szFullPath, pItemImpl->szFullPath, sizeof(pItemImpl->szFullPath) );
@@ -1133,7 +1212,16 @@ oslFileError SAL_CALL osl_releaseDirectoryItem( oslDirectoryItem Item )
return osl_File_E_INVAL;
if ( ! --pItemImpl->nRefCount )
+ {
+ if ( pItemImpl->m_pFullPath )
+ {
+ rtl_uString_release( pItemImpl->m_pFullPath );
+ pItemImpl->m_pFullPath = 0;
+ }
+
rtl_freeMemory( pItemImpl );
+ }
+
return osl_File_E_None;
}
@@ -1347,18 +1435,22 @@ static oslFileError get_filesystem_attributes(
}
if (is_filesystem_attributes_request(field_mask))
{
- WCHAR vn[MAX_PATH];
- WCHAR fsn[MAX_PATH];
+ /* the following two parameters can not be longer than MAX_PATH+1 */
+ WCHAR vn[MAX_PATH+1];
+ WCHAR fsn[MAX_PATH+1];
+
DWORD serial;
DWORD mcl;
DWORD flags;
LPCTSTR pszPath = reinterpret_cast<LPCTSTR>(path.getStr());
- if (GetVolumeInformation(pszPath, vn, MAX_PATH, &serial, &mcl, &flags, fsn, MAX_PATH))
+ if (GetVolumeInformation(pszPath, vn, MAX_PATH+1, &serial, &mcl, &flags, fsn, MAX_PATH+1))
{
+ // Currently sal does not use this value, instead MAX_PATH is used
pInfo->uValidFields |= osl_VolumeInfo_Mask_MaxNameLength;
pInfo->uMaxNameLength = mcl;
+ // Should the uMaxPathLength be set to 32767, "\\?\" prefix allowes it
pInfo->uValidFields |= osl_VolumeInfo_Mask_MaxPathLength;
pInfo->uMaxPathLength = MAX_PATH;
@@ -1561,11 +1653,7 @@ static oslFileError SAL_CALL osl_getServerInfo(
if ( uFieldMask & osl_FileStatus_Mask_FileURL )
{
- rtl_uString *ustrSystemPath = NULL;
-
- rtl_uString_newFromStr( &ustrSystemPath, reinterpret_cast<const sal_Unicode*>(pItemImpl->szFullPath) );
- osl_getFileURLFromSystemPath( ustrSystemPath, &pStatus->ustrFileURL );
- rtl_uString_release( ustrSystemPath );
+ osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrFileURL );
pStatus->uValidFields |= osl_FileStatus_Mask_FileURL;
}
return osl_File_E_None;
@@ -1594,7 +1682,7 @@ oslFileError SAL_CALL osl_getFileStatus(
if ( uFieldMask & osl_FileStatus_Mask_Validate )
{
- HANDLE hFind = FindFirstFile( pItemImpl->szFullPath, &pItemImpl->FindData );
+ HANDLE hFind = FindFirstFile( reinterpret_cast<LPCTSTR>( rtl_uString_getStr( pItemImpl->m_pFullPath ) ), &pItemImpl->FindData );
if ( hFind != INVALID_HANDLE_VALUE )
FindClose( hFind );
@@ -1654,28 +1742,30 @@ oslFileError SAL_CALL osl_getFileStatus(
if ( uFieldMask & osl_FileStatus_Mask_LinkTargetURL )
{
- rtl_uString *ustrFullPath = NULL;
-
- rtl_uString_newFromStr( &ustrFullPath, reinterpret_cast<const sal_Unicode*>(pItemImpl->szFullPath) );
- osl_getFileURLFromSystemPath( ustrFullPath, &pStatus->ustrLinkTargetURL );
- rtl_uString_release( ustrFullPath );
+ osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrLinkTargetURL );
pStatus->uValidFields |= osl_FileStatus_Mask_LinkTargetURL;
}
if ( uFieldMask & osl_FileStatus_Mask_FileURL )
{
- rtl_uString *ustrFullPath = NULL;
-
-
if ( !pItemImpl->bFullPathNormalized )
{
- GetCaseCorrectPathName( pItemImpl->szFullPath, pItemImpl->szFullPath, sizeof(pItemImpl->szFullPath) );
- pItemImpl->bFullPathNormalized = TRUE;
+ sal_uInt32 nLen = rtl_uString_getLength( pItemImpl->m_pFullPath );
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ sal_uInt32 nNewLen = GetCaseCorrectPathName( reinterpret_cast<LPCTSTR>( rtl_uString_getStr( pItemImpl->m_pFullPath ) ),
+ ::osl::mingw_reinterpret_cast<LPTSTR>( aBuffer ),
+ aBuffer.getBufSizeInSymbols(),
+ sal_True );
+
+ if ( nNewLen )
+ {
+ rtl_uString_newFromStr( &pItemImpl->m_pFullPath, aBuffer );
+ pItemImpl->bFullPathNormalized = TRUE;
+ }
}
- rtl_uString_newFromStr( &ustrFullPath, reinterpret_cast<const sal_Unicode*>(pItemImpl->szFullPath) );
- osl_getFileURLFromSystemPath( ustrFullPath, &pStatus->ustrFileURL );
- rtl_uString_release( ustrFullPath );
+
+ osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrFileURL );
pStatus->uValidFields |= osl_FileStatus_Mask_FileURL;
}
diff --git a/sal/osl/w32/file_error.c b/sal/osl/w32/file_error.c
index 3942420eb8da..26e749cc5451 100644
--- a/sal/osl/w32/file_error.c
+++ b/sal/osl/w32/file_error.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_error.c,v $
- * $Revision: 1.0 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/file_error.h b/sal/osl/w32/file_error.h
index caebbdb1c560..3815a021bb5e 100644
--- a/sal/osl/w32/file_error.h
+++ b/sal/osl/w32/file_error.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_error.h,v $
- * $Revision: 1.0 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index 968c4bccc95e..90140cda97c6 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_url.cxx,v $
- * $Revision: 1.0 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -41,6 +38,8 @@
#include "osl/file.h"
#include "osl/mutex.h"
+#include "path_helper.hxx"
+
#include <stdio.h>
#include <tchar.h>
@@ -52,6 +51,11 @@
#define ELEMENTS_OF_ARRAY(arr) (sizeof(arr)/(sizeof((arr)[0])))
+#define WSTR_SYSTEM_ROOT_PATH L"\\\\.\\"
+#define WSTR_LONG_PATH_PREFIX L"\\\\?\\"
+#define WSTR_LONG_PATH_PREFIX_UNC L"\\\\?\\UNC\\"
+
+
//##################################################################
// FileURL functions
//##################################################################
@@ -68,7 +72,7 @@ static BOOL IsValidFilePathComponent(
BOOL fValid = TRUE; /* Assume success */
TCHAR cLast = 0;
- /* Path component length must not exceed MAX_PATH */
+ /* Path component length must not exceed MAX_PATH even if long path with "\\?\" prefix is used */
while ( !lpComponentEnd && lpCurrent && lpCurrent - lpComponent < MAX_PATH )
{
@@ -235,31 +239,56 @@ static BOOL IsValidFilePathComponent(
DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_uString **corrected)
{
LPCTSTR lpszPath = reinterpret_cast< LPCTSTR >(path->buffer);
- LPCTSTR lpComponent;
+ LPCTSTR lpComponent = lpszPath;
BOOL fValid = TRUE;
DWORD dwPathType = PATHTYPE_ERROR;
+ sal_Int32 nLength = rtl_uString_getLength( path );
if ( dwFlags & VALIDATEPATH_ALLOW_RELATIVE )
dwFlags |= VALIDATEPATH_ALLOW_ELLIPSE;
if ( !lpszPath )
- {
fValid = FALSE;
- lpComponent = lpszPath;
- }
- /* Test for UNC path notation */
- if ( 2 == _tcsspn( lpszPath, CHARSET_SEPARATOR ) )
+ DWORD dwCandidatPathType = PATHTYPE_ERROR;
+
+ if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, reinterpret_cast<const sal_Unicode *>(WSTR_LONG_PATH_PREFIX_UNC), ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1 ) )
+ {
+ /* This is long path in UNC notation */
+ lpComponent = lpszPath + ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1;
+ dwCandidatPathType = PATHTYPE_ABSOLUTE_UNC | PATHTYPE_IS_LONGPATH;
+ }
+ else if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, reinterpret_cast<const sal_Unicode *>(WSTR_LONG_PATH_PREFIX), ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) )
{
- /* Place the pointer behind the leading to backslashes */
+ /* This is long path */
+ lpComponent = lpszPath + ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1;
+ if ( _istalpha( lpComponent[0] ) && ':' == lpComponent[1] )
+ {
+ lpComponent += 2;
+ dwCandidatPathType = PATHTYPE_ABSOLUTE_LOCAL | PATHTYPE_IS_LONGPATH;
+ }
+ }
+ else if ( 2 == _tcsspn( lpszPath, CHARSET_SEPARATOR ) )
+ {
+ /* The UNC path notation */
lpComponent = lpszPath + 2;
+ dwCandidatPathType = PATHTYPE_ABSOLUTE_UNC;
+ }
+ else if ( _istalpha( lpszPath[0] ) && ':' == lpszPath[1] )
+ {
+ /* Local path verification. Must start with <drive>: */
+ lpComponent = lpszPath + 2;
+ dwCandidatPathType = PATHTYPE_ABSOLUTE_LOCAL;
+ }
+ if ( ( dwCandidatPathType & PATHTYPE_MASK_TYPE ) == PATHTYPE_ABSOLUTE_UNC )
+ {
fValid = IsValidFilePathComponent( lpComponent, &lpComponent, VALIDATEPATH_ALLOW_ELLIPSE );
/* So far we have a valid servername. Now let's see if we also have a network resource */
- dwPathType = PATHTYPE_ABSOLUTE_UNC;
+ dwPathType = dwCandidatPathType;
if ( fValid )
{
@@ -294,20 +323,14 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
}
}
}
-
- /* Local path verification. Must start with <drive>: */
- else if ( _istalpha( lpszPath[0] ) && ':' == lpszPath[1] )
+ else if ( ( dwCandidatPathType & PATHTYPE_MASK_TYPE ) == PATHTYPE_ABSOLUTE_LOCAL )
{
- /* Place pointer behind correct drive specification */
-
- lpComponent = lpszPath + 2;
-
if ( 1 == _tcsspn( lpComponent, CHARSET_SEPARATOR ) )
lpComponent++;
else if ( *lpComponent )
fValid = FALSE;
- dwPathType = PATHTYPE_ABSOLUTE_LOCAL;
+ dwPathType = dwCandidatPathType;
/* Now we are behind the backslash or it was a simple drive without backslash */
@@ -317,10 +340,9 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
dwPathType |= PATHTYPE_IS_VOLUME;
}
}
-
- /* Can be a relative path */
else if ( dwFlags & VALIDATEPATH_ALLOW_RELATIVE )
{
+ /* Can be a relative path */
lpComponent = lpszPath;
/* Relative path can start with a backslash */
@@ -334,10 +356,9 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
dwPathType = PATHTYPE_RELATIVE;
}
-
- /* Anything else is an error */
else
{
+ /* Anything else is an error */
fValid = FALSE;
lpComponent = lpszPath;
}
@@ -367,7 +388,8 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
}
}
- if ( fValid && _tcslen( lpszPath ) >= MAX_PATH )
+ /* The path can be longer than MAX_PATH only in case it has the longpath prefix */
+ if ( fValid && !( dwPathType & PATHTYPE_IS_LONGPATH ) && _tcslen( lpszPath ) >= MAX_PATH )
{
fValid = FALSE;
lpComponent = lpszPath + MAX_PATH;
@@ -379,38 +401,45 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
return fValid ? dwPathType : PATHTYPE_ERROR;
}
-//#############################################
//#####################################################
-//Undocumented in SHELL32.DLL ordinal 35
-static BOOL PathRemoveFileSpec(LPTSTR lpPath)
+static sal_Int32 PathRemoveFileSpec(LPTSTR lpPath, LPTSTR lpFileName, sal_Int32 nFileBufLen )
{
- BOOL fSuccess = FALSE; // Assume failure
- LPTSTR lpLastBkSlash = _tcsrchr( lpPath, '\\' );
- LPTSTR lpLastSlash = _tcsrchr( lpPath, '/' );
- LPTSTR lpLastDelimiter = lpLastSlash > lpLastBkSlash ? lpLastSlash : lpLastBkSlash;
+ sal_Int32 nRemoved = 0;
- if ( lpLastDelimiter )
+ if ( nFileBufLen )
{
- if ( 0 == *(lpLastDelimiter + 1) )
- {
- if ( lpLastDelimiter > lpPath && *(lpLastDelimiter - 1) != ':' )
+ lpFileName[0] = 0;
+ LPTSTR lpLastBkSlash = _tcsrchr( lpPath, '\\' );
+ LPTSTR lpLastSlash = _tcsrchr( lpPath, '/' );
+ LPTSTR lpLastDelimiter = lpLastSlash > lpLastBkSlash ? lpLastSlash : lpLastBkSlash;
+
+ if ( lpLastDelimiter )
+ {
+ sal_Int32 nDelLen = _tcslen( lpLastDelimiter );
+ if ( 1 == nDelLen )
{
- *lpLastDelimiter = 0;
- fSuccess = TRUE;
+ if ( lpLastDelimiter > lpPath && *(lpLastDelimiter - 1) != ':' )
+ {
+ *lpLastDelimiter = 0;
+ *lpFileName = 0;
+ nRemoved = nDelLen;
+ }
}
- }
- else
- {
- *(++lpLastDelimiter) = 0;
- fSuccess = TRUE;
- }
+ else if ( nDelLen && nDelLen - 1 < nFileBufLen )
+ {
+ _tcscpy( lpFileName, lpLastDelimiter + 1 );
+ *(++lpLastDelimiter) = 0;
+ nRemoved = nDelLen - 1;
+ }
+ }
}
- return fSuccess;
+
+ return nRemoved;
}
//#####################################################
// Undocumented in SHELL32.DLL ordinal 32
-static LPTSTR PathAddBackslash(LPTSTR lpPath)
+static LPTSTR PathAddBackslash(LPTSTR lpPath, sal_Int32 nBufLen)
{
LPTSTR lpEndPath = NULL;
@@ -418,7 +447,7 @@ static LPTSTR PathAddBackslash(LPTSTR lpPath)
{
int nLen = _tcslen(lpPath);
- if ( !nLen || lpPath[nLen-1] != '\\' && lpPath[nLen-1] != '/' && nLen < MAX_PATH - 1 )
+ if ( !nLen || lpPath[nLen-1] != '\\' && lpPath[nLen-1] != '/' && nLen < nBufLen - 1 )
{
lpEndPath = lpPath + nLen;
*lpEndPath++ = '\\';
@@ -431,37 +460,31 @@ static LPTSTR PathAddBackslash(LPTSTR lpPath)
//#####################################################
// Same as GetLongPathName but also 95/NT4
static DWORD GetCaseCorrectPathNameEx(
- LPCTSTR lpszShortPath, // file name
- LPTSTR lpszLongPath, // path buffer
+ LPTSTR lpszPath, // path buffer to convert
DWORD cchBuffer, // size of path buffer
- DWORD nSkipLevels
-)
+ DWORD nSkipLevels,
+ BOOL bCheckExistence )
{
- TCHAR szPath[MAX_PATH];
- BOOL fSuccess;
-
- cchBuffer = cchBuffer; /* avoid warnings */
-
- _tcscpy( szPath, lpszShortPath );
-
- fSuccess = PathRemoveFileSpec( szPath );
+ ::osl::LongPathBuffer< WCHAR > szFile( MAX_PATH + 1 );
+ sal_Int32 nRemoved = PathRemoveFileSpec( lpszPath, szFile, MAX_PATH + 1 );
+ sal_Int32 nLastStepRemoved = nRemoved;
+ while ( nLastStepRemoved && szFile[0] == 0 )
+ {
+ // remove separators
+ nLastStepRemoved = PathRemoveFileSpec( lpszPath, szFile, MAX_PATH + 1 );
+ nRemoved += nLastStepRemoved;
+ }
- if ( fSuccess )
+ if ( nRemoved )
{
- int nLen = _tcslen( szPath );
- LPCTSTR lpszFileSpec = lpszShortPath + nLen;
- BOOL bSkipThis;
+ BOOL bSkipThis = FALSE;
- if ( 0 == _tcscmp( lpszFileSpec, TEXT("..") ) )
+ if ( 0 == _tcscmp( szFile, TEXT("..") ) )
{
bSkipThis = TRUE;
nSkipLevels += 1;
}
- else if (
- 0 == _tcscmp( lpszFileSpec, TEXT(".") ) ||
- 0 == _tcscmp( lpszFileSpec, TEXT("\\") ) ||
- 0 == _tcscmp( lpszFileSpec, TEXT("/") )
- )
+ else if ( 0 == _tcscmp( szFile, TEXT(".") ) )
{
bSkipThis = TRUE;
}
@@ -473,24 +496,36 @@ static DWORD GetCaseCorrectPathNameEx(
else
bSkipThis = FALSE;
- GetCaseCorrectPathNameEx( szPath, szPath, MAX_PATH, nSkipLevels );
+ GetCaseCorrectPathNameEx( lpszPath, cchBuffer, nSkipLevels, bCheckExistence );
- PathAddBackslash( szPath );
+ PathAddBackslash( lpszPath, cchBuffer );
/* Analyze parent if not only a trailing backslash was cutted but a real file spec */
if ( !bSkipThis )
{
- WIN32_FIND_DATA aFindFileData;
- HANDLE hFind = FindFirstFile( lpszShortPath, &aFindFileData );
-
- if ( IsValidHandle(hFind) )
+ if ( bCheckExistence )
{
- _tcscat( szPath, aFindFileData.cFileName[0] ? aFindFileData.cFileName : aFindFileData.cAlternateFileName );
+ ::osl::LongPathBuffer< WCHAR > aShortPath( MAX_LONG_PATH );
+ _tcscpy( aShortPath, lpszPath );
+ _tcscat( aShortPath, szFile );
- FindClose( hFind );
+ WIN32_FIND_DATA aFindFileData;
+ HANDLE hFind = FindFirstFile( aShortPath, &aFindFileData );
+
+ if ( IsValidHandle(hFind) )
+ {
+ _tcscat( lpszPath, aFindFileData.cFileName[0] ? aFindFileData.cFileName : aFindFileData.cAlternateFileName );
+
+ FindClose( hFind );
+ }
+ else
+ lpszPath[0] = 0;
}
else
- return 0;
+ {
+ /* add the segment name back */
+ _tcscat( lpszPath, szFile );
+ }
}
}
else
@@ -499,14 +534,12 @@ static DWORD GetCaseCorrectPathNameEx(
or a network share. If still levels to skip are left, the path specification
tries to travel below the file system root */
if ( nSkipLevels )
- return 0;
-
- _tcsupr( szPath );
+ lpszPath[0] = 0;
+ else
+ _tcsupr( lpszPath );
}
- _tcscpy( lpszLongPath, szPath );
-
- return _tcslen( lpszLongPath );
+ return _tcslen( lpszPath );
}
//#####################################################
@@ -515,7 +548,8 @@ static DWORD GetCaseCorrectPathNameEx(
DWORD GetCaseCorrectPathName(
LPCTSTR lpszShortPath, // file name
LPTSTR lpszLongPath, // path buffer
- DWORD cchBuffer // size of path buffer
+ DWORD cchBuffer, // size of path buffer
+ BOOL bCheckExistence
)
{
/* Special handling for "\\.\" as system root */
@@ -531,12 +565,19 @@ DWORD GetCaseCorrectPathName(
return ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1;
}
}
- else
+ else if ( lpszShortPath )
{
- return GetCaseCorrectPathNameEx( lpszShortPath, lpszLongPath, cchBuffer, 0 );
+ if ( _tcslen( lpszShortPath ) <= cchBuffer )
+ {
+ _tcscpy( lpszLongPath, lpszShortPath );
+ return GetCaseCorrectPathNameEx( lpszLongPath, cchBuffer, 0, bCheckExistence );
+ }
}
+
+ return 0;
}
+
//#############################################
static sal_Bool _osl_decodeURL( rtl_String* strUTF8, rtl_uString** pstrDecodedURL )
{
@@ -670,7 +711,6 @@ static void _osl_encodeURL( rtl_uString *strURL, rtl_String **pstrEncodedURL )
}
//#############################################
-#define WSTR_SYSTEM_ROOT_PATH L"\\\\.\\"
oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **pustrPath, sal_Bool bAllowRelative )
{
@@ -728,13 +768,60 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p
if ( nDecodedLen == nSkip )
rtl_uString_newFromStr_WithLength( &strTempPath, reinterpret_cast<const sal_Unicode*>(WSTR_SYSTEM_ROOT_PATH), ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1 );
else
- rtl_uString_newFromStr_WithLength( &strTempPath, pDecodedURL + nSkip, nDecodedLen - nSkip );
+ {
+ /* do not separate the directory and file case, so the maximal path lengs without prefix is MAX_PATH-12 */
+ if ( nDecodedLen - nSkip <= MAX_PATH - 12 )
+ {
+ rtl_uString_newFromStr_WithLength( &strTempPath, pDecodedURL + nSkip, nDecodedLen - nSkip );
+ }
+ else
+ {
+ ::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH );
+ sal_uInt32 nNewLen = GetCaseCorrectPathName( reinterpret_cast<LPCTSTR>(pDecodedURL + nSkip),
+ ::osl::mingw_reinterpret_cast<LPTSTR>(aBuf),
+ aBuf.getBufSizeInSymbols(),
+ sal_False );
+
+ if ( nNewLen <= MAX_PATH - 12
+ || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, reinterpret_cast<const sal_Unicode*>(WSTR_SYSTEM_ROOT_PATH), ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1 )
+ || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, reinterpret_cast<const sal_Unicode*>(WSTR_LONG_PATH_PREFIX), ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) )
+ {
+ rtl_uString_newFromStr_WithLength( &strTempPath, aBuf, nNewLen );
+ }
+ else if ( pDecodedURL[nSkip] == (sal_Unicode)'\\' && pDecodedURL[nSkip+1] == (sal_Unicode)'\\' )
+ {
+ /* it should be an UNC path, use the according prefix */
+ rtl_uString *strSuffix = NULL;
+ rtl_uString *strPrefix = NULL;
+ rtl_uString_newFromStr_WithLength( &strPrefix, reinterpret_cast<const sal_Unicode*>(WSTR_LONG_PATH_PREFIX_UNC), ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX_UNC ) - 1 );
+ rtl_uString_newFromStr_WithLength( &strSuffix, aBuf + 2, nNewLen - 2 );
+
+ rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix );
+
+ rtl_uString_release( strPrefix );
+ rtl_uString_release( strSuffix );
+ }
+ else
+ {
+ rtl_uString *strSuffix = NULL;
+ rtl_uString *strPrefix = NULL;
+ rtl_uString_newFromStr_WithLength( &strPrefix, reinterpret_cast<const sal_Unicode*>(WSTR_LONG_PATH_PREFIX), ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX ) - 1 );
+ rtl_uString_newFromStr_WithLength( &strSuffix, aBuf, nNewLen );
+
+ rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix );
+
+ rtl_uString_release( strPrefix );
+ rtl_uString_release( strSuffix );
+ }
+ }
+ }
if ( IsValidFilePath( strTempPath, NULL, VALIDATEPATH_ALLOW_ELLIPSE, &strTempPath ) )
nError = osl_File_E_None;
}
else if ( bAllowRelative ) /* This maybe a relative file URL */
{
+ /* In future the relative path could be converted to absolute if it is too long */
rtl_uString_assign( &strTempPath, strDecodedURL );
if ( IsValidFilePath( strTempPath, NULL, VALIDATEPATH_ALLOW_RELATIVE | VALIDATEPATH_ALLOW_ELLIPSE, &strTempPath ) )
@@ -777,8 +864,51 @@ oslFileError _osl_getFileURLFromSystemPath( rtl_uString* strPath, rtl_uString**
{
rtl_uString *strTempPath = NULL;
- /* Replace backslashes */
- rtl_uString_newReplace( &strTempPath, strPath, '\\', '/' );
+ if ( dwPathType & PATHTYPE_IS_LONGPATH )
+ {
+ rtl_uString *strBuffer = NULL;
+ sal_uInt32 nIgnore = 0;
+ sal_uInt32 nLength = 0;
+
+ /* the path has the longpath prefix, lets remove it */
+ switch ( dwPathType & PATHTYPE_MASK_TYPE )
+ {
+ case PATHTYPE_ABSOLUTE_UNC:
+ nIgnore = ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX_UNC ) - 1;
+ OSL_ENSURE( nIgnore == 8, "Unexpected long path UNC prefix!" );
+
+ /* generate the normal UNC path */
+ nLength = rtl_uString_getLength( strPath );
+ rtl_uString_newFromStr_WithLength( &strBuffer, strPath->buffer + nIgnore - 2, nLength - nIgnore + 2 );
+ strBuffer->buffer[0] = '\\';
+
+ rtl_uString_newReplace( &strTempPath, strBuffer, '\\', '/' );
+ rtl_uString_release( strBuffer );
+ break;
+
+ case PATHTYPE_ABSOLUTE_LOCAL:
+ nIgnore = ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX ) - 1;
+ OSL_ENSURE( nIgnore == 4, "Unexpected long path prefix!" );
+
+ /* generate the normal path */
+ nLength = rtl_uString_getLength( strPath );
+ rtl_uString_newFromStr_WithLength( &strBuffer, strPath->buffer + nIgnore, nLength - nIgnore );
+
+ rtl_uString_newReplace( &strTempPath, strBuffer, '\\', '/' );
+ rtl_uString_release( strBuffer );
+ break;
+
+ default:
+ OSL_ASSERT( "Unexpected long path format!" );
+ rtl_uString_newReplace( &strTempPath, strPath, '\\', '/' );
+ break;
+ }
+ }
+ else
+ {
+ /* Replace backslashes */
+ rtl_uString_newReplace( &strTempPath, strPath, '\\', '/' );
+ }
switch ( dwPathType & PATHTYPE_MASK_TYPE )
{
@@ -947,8 +1077,8 @@ oslFileError SAL_CALL osl_getAbsoluteFileURL( rtl_uString* ustrBaseURL, rtl_uStr
if ( !eError )
{
- TCHAR szBuffer[MAX_PATH];
- TCHAR szCurrentDir[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ ::osl::LongPathBuffer< sal_Unicode > aCurrentDir( MAX_LONG_PATH );
LPTSTR lpFilePart = NULL;
DWORD dwResult;
@@ -963,28 +1093,28 @@ oslFileError SAL_CALL osl_getAbsoluteFileURL( rtl_uString* ustrBaseURL, rtl_uStr
{
osl_acquireMutex( g_CurrentDirectoryMutex );
- GetCurrentDirectory( MAX_PATH, szCurrentDir );
- SetCurrentDirectory( reinterpret_cast<LPCTSTR>(ustrBaseSysPath->buffer) );
+ GetCurrentDirectoryW( aCurrentDir.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aCurrentDir) );
+ SetCurrentDirectoryW( reinterpret_cast<LPCWSTR>(ustrBaseSysPath->buffer) );
}
- dwResult = GetFullPathName( reinterpret_cast<LPCTSTR>(ustrRelSysPath->buffer), MAX_PATH, szBuffer, &lpFilePart );
+ dwResult = GetFullPathNameW( reinterpret_cast<LPCWSTR>(ustrRelSysPath->buffer), aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), &lpFilePart );
if ( ustrBaseSysPath )
{
- SetCurrentDirectory( szCurrentDir );
+ SetCurrentDirectoryW( ::osl::mingw_reinterpret_cast<LPCWSTR>(aCurrentDir) );
osl_releaseMutex( g_CurrentDirectoryMutex );
}
if ( dwResult )
{
- if ( dwResult >= MAX_PATH )
+ if ( dwResult >= aBuffer.getBufSizeInSymbols() )
eError = osl_File_E_INVAL;
else
{
rtl_uString *ustrAbsSysPath = NULL;
- rtl_uString_newFromStr( &ustrAbsSysPath, reinterpret_cast<const sal_Unicode*>(szBuffer) );
+ rtl_uString_newFromStr( &ustrAbsSysPath, aBuffer );
eError = osl_getFileURLFromSystemPath( ustrAbsSysPath, pustrAbsoluteURL );
diff --git a/sal/osl/w32/file_url.h b/sal/osl/w32/file_url.h
index af23203fa0a7..d9137c8c2fcc 100644
--- a/sal/osl/w32/file_url.h
+++ b/sal/osl/w32/file_url.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file_url.h,v $
- * $Revision: 1.0 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -57,6 +54,7 @@ extern "C" {
#define PATHTYPE_MASK_TYPE 0xFF
#define PATHTYPE_IS_VOLUME 0x0100
#define PATHTYPE_IS_SERVER 0x0200
+#define PATHTYPE_IS_LONGPATH 0x0400
#define VALIDATEPATH_NORMAL 0x0000
#define VALIDATEPATH_ALLOW_WILDCARDS 0x0001
@@ -64,6 +62,8 @@ extern "C" {
#define VALIDATEPATH_ALLOW_RELATIVE 0x0004
#define VALIDATEPATH_ALLOW_UNC 0x0008
+#define MAX_LONG_PATH 32767
+
DWORD IsValidFilePath (
rtl_uString * path,
LPCTSTR * lppError,
@@ -74,7 +74,8 @@ DWORD IsValidFilePath (
DWORD GetCaseCorrectPathName (
LPCTSTR lpszShortPath, // file name
LPTSTR lpszLongPath, // path buffer
- DWORD cchBuffer // size of path buffer
+ DWORD cchBuffer, // size of path buffer
+ BOOL bCheckExistence
);
oslFileError _osl_getSystemPathFromFileURL (
diff --git a/sal/osl/w32/interlck.c b/sal/osl/w32/interlck.c
index fa7d07811583..14589e56184a 100644
--- a/sal/osl/w32/interlck.c
+++ b/sal/osl/w32/interlck.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: interlck.c,v $
- * $Revision: 1.7 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/libutil.c b/sal/osl/w32/libutil.c
index dcb6153f7cf0..e00aef2e158d 100644
--- a/sal/osl/w32/libutil.c
+++ b/sal/osl/w32/libutil.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: libutil.c,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/module.c b/sal/osl/w32/module.cxx
index 2d001fc425bb..b730bd3347df 100644
--- a/sal/osl/w32/module.c
+++ b/sal/osl/w32/module.cxx
@@ -1,42 +1,42 @@
/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: module.c,v $
- * $Revision: 1.25 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
#include "system.h"
#include <tlhelp32.h>
+#include "file_url.h"
+#include "path_helper.hxx"
+
#include <osl/module.h>
#include <osl/diagnose.h>
#include <osl/thread.h>
#include <osl/file.h>
#include <rtl/logfile.h>
+
/*
under WIN32, we use the void* oslModule
as a WIN32 HANDLE (which is also a 32-bit value)
@@ -64,9 +64,9 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMod
if ( osl_File_E_None != nError )
rtl_uString_assign(&Module, strModuleName);
- hInstance = LoadLibraryW(Module->buffer);
+ hInstance = LoadLibraryW(reinterpret_cast<LPCWSTR>(Module->buffer));
if (hInstance == NULL)
- hInstance = LoadLibraryExW(Module->buffer, NULL,
+ hInstance = LoadLibraryExW(reinterpret_cast<LPCWSTR>(Module->buffer), NULL,
LOAD_WITH_ALTERED_SEARCH_PATH);
if (hInstance <= (HINSTANCE)HINSTANCE_ERROR)
@@ -88,7 +88,7 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMod
sal_Bool SAL_CALL
osl_getModuleHandle(rtl_uString *pModuleName, oslModule *pResult)
{
- HINSTANCE hInstance = GetModuleHandleW(pModuleName->buffer);
+ HINSTANCE hInstance = GetModuleHandleW(reinterpret_cast<LPCWSTR>(pModuleName->buffer));
if( hInstance )
{
*pResult = (oslModule) hInstance;
@@ -312,22 +312,22 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_NT4( void *pv, rtl_uString **p
if ( lpfnSymInitialize && lpfnSymCleanup && lpfnSymGetModuleInfo )
{
IMAGEHLP_MODULE ModuleInfo;
- CHAR szModuleFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aModuleFileName( MAX_LONG_PATH );
LPSTR lpSearchPath = NULL;
- if ( GetModuleFileNameA( NULL, szModuleFileName, sizeof(szModuleFileName) ) )
+ if ( GetModuleFileNameA( NULL, aModuleFileName, aModuleFileName.getBufSizeInSymbols() ) )
{
- char *pLastBkSlash = strrchr( szModuleFileName, '\\' );
+ char *pLastBkSlash = strrchr( aModuleFileName, '\\' );
if (
pLastBkSlash &&
- pLastBkSlash > szModuleFileName
+ pLastBkSlash > (sal_Char*)aModuleFileName
&& *(pLastBkSlash - 1) != ':'
&& *(pLastBkSlash - 1) != '\\'
)
{
*pLastBkSlash = 0;
- lpSearchPath = szModuleFileName;
+ lpSearchPath = aModuleFileName;
}
}
@@ -426,12 +426,12 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_NT( void *pv, rtl_uString **pu
if ( (BYTE *)pv >= (BYTE *)modinfo.lpBaseOfDll && (BYTE *)pv < (BYTE *)modinfo.lpBaseOfDll + modinfo.SizeOfImage )
{
- WCHAR szBuffer[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
rtl_uString *ustrSysPath = NULL;
- GetModuleFileNameW( lpModules[iModule], szBuffer, bufsizeof(szBuffer) );
+ GetModuleFileNameW( lpModules[iModule], ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), aBuffer.getBufSizeInSymbols() );
- rtl_uString_newFromStr( &ustrSysPath, szBuffer );
+ rtl_uString_newFromStr( &ustrSysPath, aBuffer );
osl_getFileURLFromSystemPath( ustrSysPath, pustrURL );
rtl_uString_release( ustrSysPath );
diff --git a/sal/osl/w32/mutex.c b/sal/osl/w32/mutex.c
index c5b5beb76678..db16459d7fe7 100644
--- a/sal/osl/w32/mutex.c
+++ b/sal/osl/w32/mutex.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: mutex.c,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/nlsupport.c b/sal/osl/w32/nlsupport.c
index 8ea44b35e6e8..ad9de5f8492c 100644
--- a/sal/osl/w32/nlsupport.c
+++ b/sal/osl/w32/nlsupport.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: nlsupport.c,v $
- * $Revision: 1.12 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/path_helper.cxx b/sal/osl/w32/path_helper.cxx
index c8da122c3522..a43ff8bca1d8 100644
--- a/sal/osl/w32/path_helper.cxx
+++ b/sal/osl/w32/path_helper.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: path_helper.cxx,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/path_helper.h b/sal/osl/w32/path_helper.h
index 89660c2877ba..79341f538667 100644
--- a/sal/osl/w32/path_helper.h
+++ b/sal/osl/w32/path_helper.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: path_helper.h,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/path_helper.hxx b/sal/osl/w32/path_helper.hxx
index 289f77c8db78..d157b42aa428 100644
--- a/sal/osl/w32/path_helper.hxx
+++ b/sal/osl/w32/path_helper.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: path_helper.hxx,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -37,6 +34,7 @@
#include "path_helper.h"
#include <rtl/ustring.hxx>
+#include <rtl/allocator.hxx>
namespace osl
{
@@ -73,6 +71,48 @@ inline bool systemPathIsLogicalDrivePattern(/*in*/ const rtl::OUString& path)
return osl_systemPathIsLogicalDrivePattern(path.pData);
}
+/*******************************************************************
+ LongPathBuffer
+ ******************************************************************/
+template< class T >
+class LongPathBuffer
+{
+ T* m_pBuffer;
+ sal_uInt32 m_nCharNum;
+
+ LongPathBuffer();
+ LongPathBuffer( const LongPathBuffer& );
+ LongPathBuffer& operator=( const LongPathBuffer& );
+
+public:
+ LongPathBuffer( sal_uInt32 nCharNum )
+ : m_pBuffer( reinterpret_cast<T*>( rtl_allocateMemory( nCharNum * sizeof( T ) ) ) )
+ , m_nCharNum( nCharNum )
+ {
+ OSL_ENSURE( m_pBuffer, "Can not allocate the buffer!" );
+ }
+
+ ~LongPathBuffer()
+ {
+ if ( m_pBuffer )
+ rtl_freeMemory( m_pBuffer );
+ m_pBuffer = 0;
+ }
+
+ sal_uInt32 getBufSizeInSymbols()
+ {
+ return m_nCharNum;
+ }
+
+ operator T* ()
+ {
+ return m_pBuffer;
+ }
+
+};
+
+ template< class U, class T > U mingw_reinterpret_cast(LongPathBuffer<T>& a) { return reinterpret_cast<U>(static_cast<T*>(a)); }
+
} // end namespace osl
#endif
diff --git a/sal/osl/w32/pipe.c b/sal/osl/w32/pipe.c
index f4f893bf58c6..8f9da54dd52d 100644
--- a/sal/osl/w32/pipe.c
+++ b/sal/osl/w32/pipe.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: pipe.c,v $
- * $Revision: 1.20 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/pipeimpl.cxx b/sal/osl/w32/pipeimpl.cxx
index 72c740dd17bc..1d492115e8c5 100644
--- a/sal/osl/w32/pipeimpl.cxx
+++ b/sal/osl/w32/pipeimpl.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: pipeimpl.cxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/process.c b/sal/osl/w32/process.cxx
index 1412282f76c3..b8b2d3893345 100644
--- a/sal/osl/w32/process.c
+++ b/sal/osl/w32/process.cxx
@@ -1,32 +1,29 @@
/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: process.c,v $
- * $Revision: 1.35 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
#define UNICODE
#include "system.h"
@@ -46,6 +43,8 @@
#include "procimpl.h"
#include "sockimpl.h"
+#include "file_url.h"
+#include "path_helper.hxx"
#include <rtl/ustrbuf.h>
#include <rtl/alloc.h>
@@ -75,7 +74,7 @@ oslProcess SAL_CALL osl_getProcess(oslProcessIdentifier Ident)
if (hProcess)
{
- pProcImpl = rtl_allocateMemory(sizeof(oslProcessImpl));
+ pProcImpl = reinterpret_cast< oslProcessImpl*>( rtl_allocateMemory(sizeof(oslProcessImpl)) );
pProcImpl->m_hProcess = hProcess;
pProcImpl->m_IdProcess = Ident;
}
@@ -219,19 +218,19 @@ oslProcessError SAL_CALL osl_joinProcessWithTimeout(oslProcess Process, const Ti
*
***************************************************************************/
-oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl (
+extern "C" oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl (
rtl_uString ** ppFileURL
) SAL_THROW_EXTERN_C()
{
oslProcessError result = osl_Process_E_NotFound;
- TCHAR buffer[MAX_PATH];
- DWORD buflen;
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ DWORD buflen = 0;
- if ((buflen = GetModuleFileNameW (0, buffer, MAX_PATH)) > 0)
+ if ((buflen = GetModuleFileNameW (0, ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), aBuffer.getBufSizeInSymbols())) > 0)
{
rtl_uString * pAbsPath = 0;
- rtl_uString_newFromStr_WithLength (&(pAbsPath), buffer, buflen);
+ rtl_uString_newFromStr_WithLength (&(pAbsPath), aBuffer, buflen);
if (pAbsPath)
{
/* Convert from path to url. */
@@ -280,21 +279,21 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char ** argv)
for (i = 0; i < nArgs; i++)
{
/* Convert to unicode */
- rtl_uString_newFromStr( &(ppArgs[i]), wargv[i] );
+ rtl_uString_newFromStr( &(ppArgs[i]), reinterpret_cast<const sal_Unicode*>(wargv[i]) );
}
if (ppArgs[0] != 0)
{
/* Ensure absolute path */
- DWORD dwResult;
- TCHAR szBuffer[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ DWORD dwResult = 0;
dwResult = SearchPath (
- 0, ppArgs[0]->buffer, L".exe", MAX_PATH, szBuffer, 0);
- if ((0 < dwResult) && (dwResult < MAX_PATH))
+ 0, reinterpret_cast<LPCWSTR>(ppArgs[0]->buffer), L".exe", aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), 0);
+ if ((0 < dwResult) && (dwResult < aBuffer.getBufSizeInSymbols()))
{
/* Replace argv[0] with it's absolute path */
rtl_uString_newFromStr_WithLength(
- &(ppArgs[0]), szBuffer, dwResult);
+ &(ppArgs[0]), aBuffer, dwResult);
}
}
if (ppArgs[0] != 0)
@@ -402,9 +401,9 @@ oslProcessError SAL_CALL osl_getEnvironment(rtl_uString *ustrVar, rtl_uString **
{
WCHAR buff[ENV_BUFFER_SIZE];
- if (GetEnvironmentVariableW(ustrVar->buffer, buff, ENV_BUFFER_SIZE) > 0)
+ if (GetEnvironmentVariableW(reinterpret_cast<LPCWSTR>(ustrVar->buffer), buff, ENV_BUFFER_SIZE) > 0)
{
- rtl_uString_newFromStr(ustrValue, buff);
+ rtl_uString_newFromStr(ustrValue, reinterpret_cast<const sal_Unicode*>(buff));
return osl_Process_E_None;
}
return osl_Process_E_Unknown;
@@ -414,24 +413,24 @@ oslProcessError SAL_CALL osl_getEnvironment(rtl_uString *ustrVar, rtl_uString **
* Current Working Directory.
***************************************************************************/
-extern oslMutex g_CurrentDirectoryMutex;
+extern "C" oslMutex g_CurrentDirectoryMutex;
oslProcessError SAL_CALL osl_getProcessWorkingDir( rtl_uString **pustrWorkingDir )
{
- TCHAR szBuffer[MAX_PATH];
- DWORD dwLen;
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ DWORD dwLen = 0;
osl_acquireMutex( g_CurrentDirectoryMutex );
- dwLen = GetCurrentDirectory( sizeof(szBuffer) / sizeof(TCHAR), szBuffer );
+ dwLen = GetCurrentDirectory( aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer) );
osl_releaseMutex( g_CurrentDirectoryMutex );
- if ( dwLen )
+ if ( dwLen && dwLen < aBuffer.getBufSizeInSymbols() )
{
oslFileError eError;
rtl_uString *ustrTemp = NULL;;
- rtl_uString_newFromStr_WithLength( &ustrTemp, szBuffer, dwLen );
+ rtl_uString_newFromStr_WithLength( &ustrTemp, aBuffer, dwLen );
eError = osl_getFileURLFromSystemPath( ustrTemp, pustrWorkingDir );
rtl_uString_release( ustrTemp );
@@ -449,7 +448,7 @@ oslProcessError SAL_CALL osl_getProcessWorkingDir( rtl_uString **pustrWorkingDir
* Process Locale.
***************************************************************************/
-extern void _imp_getProcessLocale( rtl_Locale ** ppLocale );
+extern "C" void _imp_getProcessLocale( rtl_Locale ** ppLocale );
static rtl_Locale * g_theProcessLocale = NULL;
diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx
index 379caeb5affc..f46c233ee932 100644
--- a/sal/osl/w32/procimpl.cxx
+++ b/sal/osl/w32/procimpl.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: procimpl.cxx,v $
- * $Revision: 1.10 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/procimpl.h b/sal/osl/w32/procimpl.h
index 3356f3858313..b783f9b52ae2 100644
--- a/sal/osl/w32/procimpl.h
+++ b/sal/osl/w32/procimpl.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: procimpl.h,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/profile.c b/sal/osl/w32/profile.cxx
index 59697e7fd698..9f4ea5630e1f 100644
--- a/sal/osl/w32/profile.c
+++ b/sal/osl/w32/profile.cxx
@@ -1,42 +1,44 @@
/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: profile.c,v $
- * $Revision: 1.17 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
#include "system.h"
+#include "file_url.h"
+#include "path_helper.hxx"
+
#include <osl/diagnose.h>
#include <osl/profile.h>
#include <osl/process.h>
#include <osl/file.h>
#include <osl/util.h>
#include <rtl/alloc.h>
+#include <algorithm>
+using std::min;
+static inline void copy_ustr_n( void *dest, const void *source, size_t length ) { rtl_copyMemory(dest, source, length*sizeof(sal_Unicode)); }
#define LINES_INI 32
#define LINES_ADD 10
@@ -502,10 +504,10 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile,
}
else
{
- CHAR szFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, szFileName, MAX_PATH, NULL, NULL);
- GetPrivateProfileString(pszSection, pszEntry, pszDefault, pszString, MaxLen, szFileName);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ GetPrivateProfileString(pszSection, pszEntry, pszDefault, pszString, MaxLen, aFileName);
}
releaseProfile(pProfile);
@@ -683,10 +685,10 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile,
}
else
{
- CHAR szFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, szFileName, MAX_PATH, NULL, NULL);
- WritePrivateProfileString(pszSection, pszEntry, pszString, szFileName);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ WritePrivateProfileString(pszSection, pszEntry, pszString, aFileName);
}
bRet = releaseProfile(pProfile);
@@ -794,10 +796,10 @@ sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile,
}
else
{
- CHAR szFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, szFileName, MAX_PATH, NULL, NULL);
- WritePrivateProfileString(pszSection, pszEntry, NULL, szFileName);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ WritePrivateProfileString(pszSection, pszEntry, NULL, aFileName);
}
bRet = releaseProfile(pProfile);
@@ -868,10 +870,10 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C
}
else
{
- CHAR szFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, szFileName, MAX_PATH, NULL, NULL);
- n = GetPrivateProfileString(pszSection, NULL, NULL, pszBuffer, MaxLen, szFileName);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ n = GetPrivateProfileString(pszSection, NULL, NULL, pszBuffer, MaxLen, aFileName);
}
releaseProfile(pProfile);
@@ -887,9 +889,9 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C
sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, rtl_uString** strProfileName)
{
sal_Bool bFailed;
- sal_Unicode wcsFile[MAX_PATH];
- sal_Unicode wcsPath[MAX_PATH];
- sal_uInt32 nFileLen;
+ ::osl::LongPathBuffer< sal_Unicode > aFile( MAX_LONG_PATH );
+ ::osl::LongPathBuffer< sal_Unicode > aPath( MAX_LONG_PATH );
+ sal_uInt32 nFileLen = 0;
sal_uInt32 nPathLen = 0;
rtl_uString * strTmp = NULL;
@@ -898,19 +900,19 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
/* build file name */
if (strName && strName->length)
{
- if(strName->length >= MAX_PATH)
+ if( ::sal::static_int_cast< sal_uInt32 >( strName->length ) >= aFile.getBufSizeInSymbols() )
return sal_False;
- wcscpy(wcsFile, strName->buffer);
+ copy_ustr_n( aFile, strName->buffer, strName->length+1);
nFileLen = strName->length;
- if (rtl_ustr_indexOfChar( wcsFile, L'.' ) == -1)
+ if (rtl_ustr_indexOfChar( aFile, L'.' ) == -1)
{
- if (nFileLen + wcslen(STR_INI_EXTENSION) >= MAX_PATH)
+ if (nFileLen + wcslen(STR_INI_EXTENSION) >= aFile.getBufSizeInSymbols())
return sal_False;
/* add default extension */
- wcscpy(wcsFile + nFileLen, STR_INI_EXTENSION);
+ copy_ustr_n( aFile + nFileLen, STR_INI_EXTENSION, wcslen(STR_INI_EXTENSION)+1 );
nFileLen += wcslen(STR_INI_EXTENSION);
}
}
@@ -937,22 +939,22 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if ((nPos = rtl_ustr_lastIndexOfChar( pProgName, L'.' )) != -1 )
nLen -= 4;
- if ((nFileLen = nLen - nOffset) >= MAX_PATH)
+ if ((nFileLen = nLen - nOffset) >= aFile.getBufSizeInSymbols())
return sal_False;
- wcsncpy(wcsFile, pProgName + nOffset, nFileLen);
+ copy_ustr_n(aFile, pProgName + nOffset, nFileLen);
- if (nFileLen + wcslen(STR_INI_EXTENSION) >= MAX_PATH)
+ if (nFileLen + wcslen(STR_INI_EXTENSION) >= aFile.getBufSizeInSymbols())
return sal_False;
/* add default extension */
- wcscpy(wcsFile + nFileLen, STR_INI_EXTENSION);
+ copy_ustr_n(aFile + nFileLen, STR_INI_EXTENSION, wcslen(STR_INI_EXTENSION)+1);
nFileLen += wcslen(STR_INI_EXTENSION);
rtl_uString_release( strProgName );
}
- if (wcsFile[0] == 0)
+ if (aFile[0] == 0)
return sal_False;
/* build directory path */
@@ -972,10 +974,10 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if (bFailed) return (sal_False);
- if (strHome->length >= MAX_PATH)
+ if ( ::sal::static_int_cast< sal_uInt32 >( strHome->length ) >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy( wcsPath, strHome->buffer);
+ copy_ustr_n( aPath, strHome->buffer, strHome->length+1);
nPathLen = strHome->length;
if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METAHOME))
@@ -983,10 +985,10 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
pPath += RTL_CONSTASCII_LENGTH(STR_INI_METAHOME);
nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METAHOME);
- if (nLen + nPathLen >= MAX_PATH)
+ if (nLen + nPathLen >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy(wcsPath + nPathLen, pPath);
+ copy_ustr_n(aPath + nPathLen, pPath, nLen+1);
nPathLen += nLen;
}
@@ -1004,10 +1006,10 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if (bFailed) return (sal_False);
- if (strConfig->length >= MAX_PATH)
+ if ( ::sal::static_int_cast< sal_uInt32 >( strConfig->length ) >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy( wcsPath, strConfig->buffer);
+ copy_ustr_n( aPath, strConfig->buffer, strConfig->length+1 );
nPathLen = strConfig->length;
if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METACFG))
@@ -1015,10 +1017,10 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
pPath += RTL_CONSTASCII_LENGTH(STR_INI_METACFG);
nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METACFG);
- if (nLen + nPathLen >= MAX_PATH)
+ if (nLen + nPathLen >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy(wcsPath + nPathLen, pPath);
+ copy_ustr_n(aPath + nPathLen, pPath, nLen+1);
nPathLen += nLen;
}
@@ -1028,7 +1030,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
else if ((rtl_ustr_ascii_compare_WithLength(pPath, RTL_CONSTASCII_LENGTH(STR_INI_METASYS), STR_INI_METASYS) == 0) &&
((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METASYS)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METASYS)] == '/')))
{
- if (((nPathLen = GetWindowsDirectoryW(wcsPath, MAX_PATH)) == 0) || (nPathLen >= MAX_PATH))
+ if (((nPathLen = GetWindowsDirectoryW(::osl::mingw_reinterpret_cast<LPWSTR>(aPath), aPath.getBufSizeInSymbols())) == 0) || (nPathLen >= aPath.getBufSizeInSymbols()))
return (sal_False);
if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METASYS))
@@ -1036,10 +1038,10 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
pPath += RTL_CONSTASCII_LENGTH(STR_INI_METASYS);
nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METASYS);
- if (nLen + nPathLen >= MAX_PATH)
+ if (nLen + nPathLen >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy(wcsPath + nPathLen, pPath);
+ copy_ustr_n(aPath + nPathLen, pPath, nLen+1);
nPathLen += nLen;
}
}
@@ -1048,16 +1050,16 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METAINS)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METAINS)] == '/') ||
(pPath[RTL_CONSTASCII_LENGTH(STR_INI_METAINS)] == '"') ) )
{
- if (! lookupProfile(pPath + RTL_CONSTASCII_LENGTH(STR_INI_METAINS), wcsFile, wcsPath))
+ if (! lookupProfile(pPath + RTL_CONSTASCII_LENGTH(STR_INI_METAINS), aFile, aPath))
return (sal_False);
- nPathLen = wcslen(wcsPath);
+ nPathLen = rtl_ustr_getLength(aPath);
}
- else if(nLen < MAX_PATH)
+ else if( ::sal::static_int_cast< sal_uInt32 >( nLen ) < aPath.getBufSizeInSymbols())
{
- wcscpy(wcsPath, pPath);
- nPathLen = wcslen(wcsPath);
+ copy_ustr_n(aPath, pPath, nLen+1);
+ nPathLen = rtl_ustr_getLength(aPath);
}
else
return sal_False;
@@ -1071,28 +1073,28 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
osl_freeSecurityHandle(security);
if (bFailed) return (sal_False);
- if (strConfigDir->length >= MAX_PATH)
+ if ( ::sal::static_int_cast< sal_uInt32 >( strConfigDir->length ) >= aPath.getBufSizeInSymbols() )
return sal_False;
- wcscpy(wcsPath, strConfigDir->buffer);
+ copy_ustr_n(aPath, strConfigDir->buffer, strConfigDir->length+1);
nPathLen = strConfigDir->length;
}
- if (nPathLen && (wcsPath[nPathLen - 1] != L'/') && (wcsPath[nPathLen - 1] != L'\\'))
+ if (nPathLen && (aPath[nPathLen - 1] != L'/') && (aPath[nPathLen - 1] != L'\\'))
{
- wcsPath[nPathLen++] = L'\\';
- wcsPath[nPathLen] = 0;
+ aPath[nPathLen++] = L'\\';
+ aPath[nPathLen] = 0;
}
- if (nPathLen + nFileLen >= MAX_PATH)
+ if (nPathLen + nFileLen >= aPath.getBufSizeInSymbols())
return sal_False;
/* append file name */
- wcscpy(wcsPath + nPathLen, wcsFile);
+ copy_ustr_n(aPath + nPathLen, aFile, nFileLen+1);
nPathLen += nFileLen;
/* copy filename */
- rtl_uString_newFromStr_WithLength(&strTmp, wcsPath, nPathLen);
+ rtl_uString_newFromStr_WithLength(&strTmp, aPath, nPathLen);
nError = osl_getFileURLFromSystemPath(strTmp, strProfileName);
rtl_uString_release(strTmp);
@@ -1140,10 +1142,10 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff
}
else
{
- CHAR szFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, szFileName, MAX_PATH, NULL, NULL);
- n = GetPrivateProfileSectionNames(pszBuffer, MaxLen, szFileName);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ n = GetPrivateProfileSectionNames(pszBuffer, MaxLen, aFileName);
}
releaseProfile(pProfile);
@@ -1154,35 +1156,6 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/*****************************************************************************/
/* Static Module Functions */
/*****************************************************************************/
@@ -1287,7 +1260,7 @@ static sal_Bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode)
static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption ProfileFlags )
{
- osl_TFile* pFile = calloc(1, sizeof(osl_TFile));
+ osl_TFile* pFile = reinterpret_cast< osl_TFile*>( calloc( 1, sizeof(osl_TFile) ) );
sal_Bool bWriteable = sal_False;
/* if ( ProfileFlags & ( osl_Profile_WRITELOCK | osl_Profile_FLUSHWRITE | osl_Profile_READWRITE ) )*/
@@ -1306,7 +1279,7 @@ static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption Profi
OSL_TRACE("opening '%s' read only\n",pszFilename);
#endif
- pFile->m_Handle = CreateFileW( rtl_uString_getStr( strFileName ), GENERIC_READ,
+ pFile->m_Handle = CreateFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strFileName )), GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -1319,7 +1292,7 @@ static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption Profi
OSL_TRACE("opening '%s' read/write\n",pszFilename);
#endif
- if ((pFile->m_Handle = CreateFileW( rtl_uString_getStr( strFileName ), GENERIC_READ | GENERIC_WRITE,
+ if ((pFile->m_Handle = CreateFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strFileName )), GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL))
== INVALID_HANDLE_VALUE)
@@ -2163,13 +2136,13 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
/* unlink bak */
- DeleteFileW( rtl_uString_getStr( ustrBakFile ) );
+ DeleteFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrBakFile )) );
/* rename ini bak */
- MoveFileExW( rtl_uString_getStr( ustrIniFile ), rtl_uString_getStr( ustrBakFile ), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
+ MoveFileExW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrIniFile )), reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrBakFile )), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
/* rename tmp ini */
- MoveFileExW( rtl_uString_getStr( ustrTmpFile ), rtl_uString_getStr( ustrIniFile ), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
+ MoveFileExW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrTmpFile )), reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrIniFile )), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
return bRet;
}
@@ -2226,7 +2199,7 @@ static osl_TProfileImpl* acquireProfile(oslProfile Profile, sal_Bool bWriteable)
- if ((pProfile = osl_openProfile(NULL, PFlags)) != NULL )
+ if ( ( pProfile = (osl_TProfileImpl*)osl_openProfile( NULL, PFlags ) ) != NULL )
{
pProfile->m_Flags |= FLG_AUTOOPEN;
}
@@ -2333,7 +2306,8 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
sal_Char Buffer[4096] = "";
sal_Char Product[132] = "";
- WCHAR wcsPath[MAX_PATH] = L"";
+ ::osl::LongPathBuffer< sal_Unicode > aPath( MAX_LONG_PATH );
+ aPath[0] = 0;
DWORD dwPathLen = 0;
if (*strPath == L'"')
@@ -2345,7 +2319,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
while ((strPath[i] != L'"') && (strPath[i] != L'\0'))
i++;
- WideCharToMultiByte(CP_ACP,0, strPath, i, Product, sizeof(Product), NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strPath), i, Product, sizeof(Product), NULL, NULL);
Product[i] = '\0';
strPath += i;
@@ -2367,7 +2341,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
rtl_uString * strSVFallback = NULL;
rtl_uString * strSVLocation = NULL;
rtl_uString * strSVName = NULL;
- sal_Char Dir[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aDir( MAX_LONG_PATH );
oslProfile hProfile;
rtl_uString_newFromAscii(&strSVFallback, SVERSION_FALLBACK);
@@ -2393,11 +2367,11 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
&& (stricmp(Product, pChr) < 0))
{
osl_readProfileString(
- hProfile, SVERSION_SECTION, pChr, Dir,
- sizeof(Dir), "");
+ hProfile, SVERSION_SECTION, pChr, aDir,
+ aDir.getBufSizeInSymbols(), "");
/* check for existence of path */
- if (access(Dir, 0) >= 0)
+ if (access(aDir, 0) >= 0)
strcpy(Product, pChr);
}
}
@@ -2428,11 +2402,11 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
&& (stricmp(Product, pChr) < 0))
{
osl_readProfileString(
- hProfile, SVERSION_SECTION, pChr, Dir,
- sizeof(Dir), "");
+ hProfile, SVERSION_SECTION, pChr, aDir,
+ aDir.getBufSizeInSymbols(), "");
/* check for existence of path */
- if (access(Dir, 0) >= 0)
+ if (access(aDir, 0) >= 0)
strcpy(Product, pChr);
}
}
@@ -2472,31 +2446,31 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
((nEnd = rtl_ustr_indexOfChar(pCommandArg + nStart + 1, L']')) != -1))
{
dwPathLen = nEnd;
- wcsncpy(wcsPath, pCommandArg + nStart + 1, dwPathLen );
- wcsPath[dwPathLen] = 0;
+ copy_ustr_n(aPath, pCommandArg + nStart + 1, dwPathLen);
+ aPath[dwPathLen] = 0;
/* build full path */
- if ((wcsPath[dwPathLen - 1] != L'/') && (wcsPath[dwPathLen - 1] != L'\\'))
+ if ((aPath[dwPathLen - 1] != L'/') && (aPath[dwPathLen - 1] != L'\\'))
{
- wcscpy(wcsPath + dwPathLen++, L"/");
+ copy_ustr_n(aPath + dwPathLen++, L"/", 2);
}
if (*strPath)
{
- wcscpy(wcsPath + dwPathLen, strPath);
- dwPathLen += wcslen(strPath);
+ copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1);
+ dwPathLen += rtl_ustr_getLength(strPath);
}
else
{
- CHAR szPath[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
int n;
- if ((n = WideCharToMultiByte(CP_ACP,0, wcsPath, -1, szPath, MAX_PATH, NULL, NULL)) > 0)
+ if ((n = WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL)) > 0)
{
- strcpy(szPath + n, SVERSION_USER);
- if (access(szPath, 0) >= 0)
+ strcpy(aTmpPath + n, SVERSION_USER);
+ if (access(aTmpPath, 0) >= 0)
{
- dwPathLen += MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, wcsPath + dwPathLen, MAX_PATH - dwPathLen );
+ dwPathLen += MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, reinterpret_cast<LPWSTR>(aPath + dwPathLen), aPath.getBufSizeInSymbols() - dwPathLen );
}
}
}
@@ -2536,22 +2510,22 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
}
else
{
- wcsncpy(wcsPath, strExecutable->buffer, nPos );
- wcsPath[nPos] = 0;
+ copy_ustr_n(aPath, strExecutable->buffer, nPos);
+ aPath[nPos] = 0;
dwPathLen = nPos;
}
}
else
{
- wcsncpy(wcsPath, strExecutable->buffer, nPos );
+ copy_ustr_n(aPath, strExecutable->buffer, nPos);
dwPathLen = nPos;
- wcsPath[dwPathLen] = 0;
+ aPath[dwPathLen] = 0;
}
/* if we have no product identification use the executable file name */
if (*Product == 0)
{
- WideCharToMultiByte(CP_ACP,0, strExecutable->buffer + nPos + 1, -1, Product, sizeof(Product), NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strExecutable->buffer + nPos + 1), -1, Product, sizeof(Product), NULL, NULL);
/* remove extension */
if ((pChr = strrchr(Product, '.')) != NULL)
@@ -2561,30 +2535,30 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
rtl_uString_release(strExecutable);
/* remember last subdir */
- nPos = rtl_ustr_lastIndexOfChar(wcsPath, L'\\');
+ nPos = rtl_ustr_lastIndexOfChar(aPath, L'\\');
- wcscpy(wcsPath + dwPathLen++, L"\\");
+ copy_ustr_n(aPath + dwPathLen++, L"\\", 2);
if (*strPath)
{
- wcscpy(wcsPath + dwPathLen, strPath);
- dwPathLen += wcslen(strPath);
+ copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1);
+ dwPathLen += rtl_ustr_getLength(strPath);
}
{
- CHAR szPath[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, wcsPath, -1, szPath, MAX_PATH, NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL);
/* if file not exists, remove any specified subdirectories
like "bin" or "program" */
- if (((access(szPath, 0) < 0) && (nPos != -1)) || (*strPath == 0))
+ if (((access(aTmpPath, 0) < 0) && (nPos != -1)) || (*strPath == 0))
{
static sal_Char *SubDirs[] = SVERSION_DIRS;
int i = 0;
- pStr = szPath + nPos;
+ pStr = aTmpPath + nPos;
for (i = 0; i < (sizeof(SubDirs) / sizeof(SubDirs[0])); i++)
if (strnicmp(pStr + 1, SubDirs[i], strlen(SubDirs[i])) == 0)
@@ -2592,19 +2566,19 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
if ( *strPath == 0)
{
strcpy(pStr + 1,SVERSION_USER);
- if ( access(szPath, 0) < 0 )
+ if ( access(aTmpPath, 0) < 0 )
{
*(pStr+1)='\0';
}
else
{
- dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, wcsPath + nPos + 1, MAX_PATH - (nPos + 1) );
+ dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, reinterpret_cast<LPWSTR>(aPath + nPos + 1), aPath.getBufSizeInSymbols() - (nPos + 1) );
}
}
else
{
- wcscpy(wcsPath + nPos + 1, strPath);
- dwPathLen = nPos + 1 + wcslen(strPath);
+ copy_ustr_n(aPath + nPos + 1, strPath, rtl_ustr_getLength(strPath)+1);
+ dwPathLen = nPos + 1 + rtl_ustr_getLength(strPath);
}
break;
@@ -2612,20 +2586,20 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
}
}
- if ((wcsPath[dwPathLen - 1] != L'/') && (wcsPath[dwPathLen - 1] != L'\\'))
+ if ((aPath[dwPathLen - 1] != L'/') && (aPath[dwPathLen - 1] != L'\\'))
{
- wcsPath[dwPathLen++] = L'\\';
- wcsPath[dwPathLen] = 0;
+ aPath[dwPathLen++] = L'\\';
+ aPath[dwPathLen] = 0;
}
- wcscpy(wcsPath + dwPathLen, strFile);
+ copy_ustr_n(aPath + dwPathLen, strFile, rtl_ustr_getLength(strFile)+1);
{
- CHAR szPath[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, wcsPath, -1, szPath, MAX_PATH, NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL);
- if ((access(szPath, 0) < 0) && (strlen(Product) > 0))
+ if ((access(aTmpPath, 0) < 0) && (strlen(Product) > 0))
{
rtl_uString * strSVFallback = NULL;
rtl_uString * strSVProfile = NULL;
@@ -2674,38 +2648,38 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
if (strlen(Buffer) > 0)
{
dwPathLen = MultiByteToWideChar(
- CP_ACP, 0, Buffer, -1, wcsPath, MAX_PATH );
+ CP_ACP, 0, Buffer, -1, ::osl::mingw_reinterpret_cast<LPWSTR>(aPath), aPath.getBufSizeInSymbols() );
dwPathLen -=1;
/* build full path */
- if ((wcsPath[dwPathLen - 1] != L'/')
- && (wcsPath[dwPathLen - 1] != L'\\'))
+ if ((aPath[dwPathLen - 1] != L'/')
+ && (aPath[dwPathLen - 1] != L'\\'))
{
- wcscpy(wcsPath + dwPathLen++, L"\\");
+ copy_ustr_n(aPath + dwPathLen++, L"\\", 2);
}
if (*strPath)
{
- wcscpy(wcsPath + dwPathLen, strPath);
- dwPathLen += wcslen(strPath);
+ copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1);
+ dwPathLen += rtl_ustr_getLength(strPath);
}
else
{
- CHAR szPath[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
int n;
if ((n = WideCharToMultiByte(
- CP_ACP,0, wcsPath, -1, szPath,
- MAX_PATH, NULL, NULL))
+ CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath,
+ aTmpPath.getBufSizeInSymbols(), NULL, NULL))
> 0)
{
- strcpy(szPath + n, SVERSION_USER);
- if (access(szPath, 0) >= 0)
+ strcpy(aTmpPath + n, SVERSION_USER);
+ if (access(aTmpPath, 0) >= 0)
{
dwPathLen += MultiByteToWideChar(
CP_ACP, 0, SVERSION_USER, -1,
- wcsPath + dwPathLen,
- MAX_PATH - dwPathLen );
+ reinterpret_cast<LPWSTR>(aPath + dwPathLen),
+ aPath.getBufSizeInSymbols() - dwPathLen );
}
}
}
@@ -2721,11 +2695,11 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
}
}
- wcsPath[dwPathLen] = 0;
+ aPath[dwPathLen] = 0;
}
/* copy filename */
- wcscpy(strProfile, wcsPath);
+ copy_ustr_n(strProfile, aPath, dwPathLen+1);
return sal_True;
}
diff --git a/sal/osl/w32/salinit.cxx b/sal/osl/w32/salinit.cxx
index 6ca3ec6286c2..aea584f67970 100644
--- a/sal/osl/w32/salinit.cxx
+++ b/sal/osl/w32/salinit.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: salinit.cxx,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/secimpl.h b/sal/osl/w32/secimpl.h
index 32b50c48fb33..97a9d9c44f9e 100644
--- a/sal/osl/w32/secimpl.h
+++ b/sal/osl/w32/secimpl.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: secimpl.h,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/security.c b/sal/osl/w32/security.c
index 32fb7bc63add..237ea67dc949 100644
--- a/sal/osl/w32/security.c
+++ b/sal/osl/w32/security.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: security.c,v $
- * $Revision: 1.14 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/semaphor.c b/sal/osl/w32/semaphor.c
index 17ad4cd05528..e16a73d998fa 100644
--- a/sal/osl/w32/semaphor.c
+++ b/sal/osl/w32/semaphor.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: semaphor.c,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/signal.c b/sal/osl/w32/signal.cxx
index 9aabe453aa78..f893f7520d40 100644
--- a/sal/osl/w32/signal.c
+++ b/sal/osl/w32/signal.cxx
@@ -1,37 +1,37 @@
/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: signal.c,v $
- * $Revision: 1.12 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
/* system headers */
#include "system.h"
#include <tchar.h>
+#include "file_url.h"
+#include "path_helper.hxx"
+
#include <osl/diagnose.h>
#include <osl/mutex.h>
#include <osl/signal.h>
@@ -115,7 +115,7 @@ static BOOL ReportCrash( LPEXCEPTION_POINTERS lpEP )
BOOL fSuccess = FALSE;
BOOL fAutoReport = FALSE;
TCHAR szBuffer[1024];
- TCHAR szPath[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aPath( MAX_LONG_PATH );
LPTSTR lpFilePart;
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo;
@@ -167,11 +167,11 @@ static BOOL ReportCrash( LPEXCEPTION_POINTERS lpEP )
value_len = quote - value;
}
- lpVariable = _alloca( variable_len + 1 );
+ lpVariable = reinterpret_cast< CHAR* >( _alloca( variable_len + 1 ) );
memcpy( lpVariable, variable, variable_len );
lpVariable[variable_len] = 0;
- lpValue = _alloca( value_len + 1);
+ lpValue = reinterpret_cast< CHAR* >( _alloca( value_len + 1) );
memcpy( lpValue, value, value_len );
lpValue[value_len] = 0;
@@ -180,7 +180,7 @@ static BOOL ReportCrash( LPEXCEPTION_POINTERS lpEP )
}
}
- if ( SearchPath( NULL, TEXT("crashrep.exe"), NULL, MAX_PATH, szPath, &lpFilePart ) )
+ if ( SearchPath( NULL, TEXT( "crashrep.exe" ), NULL, aPath.getBufSizeInSymbols(), aPath, &lpFilePart ) )
{
ZeroMemory( &StartupInfo, sizeof(StartupInfo) );
StartupInfo.cb = sizeof(StartupInfo.cb);
@@ -188,7 +188,7 @@ static BOOL ReportCrash( LPEXCEPTION_POINTERS lpEP )
sntprintf( szBuffer, elementsof(szBuffer),
_T("%s -p %u -excp 0x%p -t %u%s"),
- szPath,
+ aPath,
GetCurrentProcessId(),
lpEP,
GetCurrentThreadId(),
@@ -317,6 +317,8 @@ static long WINAPI SignalHandlerFunction(LPEXCEPTION_POINTERS lpEP)
SetErrorMode(SEM_NOGPFAULTERRORBOX);
exit(255);
break;
+ default:
+ break;
}
return (EXCEPTION_CONTINUE_EXECUTION);
@@ -334,7 +336,7 @@ oslSignalHandler SAL_CALL osl_addSignalHandler(oslSignalHandlerFunction Handler,
if (! bInitSignal)
bInitSignal = InitSignal();
- pHandler = calloc(1, sizeof(oslSignalHandlerImpl));
+ pHandler = reinterpret_cast< oslSignalHandlerImpl* >( calloc( 1, sizeof(oslSignalHandlerImpl) ) );
if (pHandler != NULL)
{
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index bf64e1a2d6a0..191c31fb986a 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: socket.cxx,v $
- * $Revision: 1.14 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/sockimpl.h b/sal/osl/w32/sockimpl.h
index b1156d68bec2..d1278ee8e6ac 100644
--- a/sal/osl/w32/sockimpl.h
+++ b/sal/osl/w32/sockimpl.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: sockimpl.h,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/system.h b/sal/osl/w32/system.h
index 6e1cebc3aa93..1bd86994e6ce 100644
--- a/sal/osl/w32/system.h
+++ b/sal/osl/w32/system.h
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: system.h,v $
- * $Revision: 1.11 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -108,10 +105,22 @@
#endif // #ifdef GCC
#ifdef _DLL_
+
+#ifdef __cplusplus
+ extern "C" DWORD g_dwPlatformId;
+#else
extern DWORD g_dwPlatformId;
+#endif // #ifdef __cplusplus
+
#define IS_NT (g_dwPlatformId == VER_PLATFORM_WIN32_NT)
#else
+
+#ifdef __cplusplus
+ extern "C" DWORD GetPlatformId(void);
+#else
extern DWORD GetPlatformId(void);
+#endif // #ifdef __cplusplus
+
#define IS_NT (GetPlatformId() == VER_PLATFORM_WIN32_NT)
#endif // #ifdef _DLL_
diff --git a/sal/osl/w32/tempfile.cxx b/sal/osl/w32/tempfile.cxx
index 6c591eae8972..6a3d2549004a 100644
--- a/sal/osl/w32/tempfile.cxx
+++ b/sal/osl/w32/tempfile.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: file.cxx,v $
- * $Revision: 1.0 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -37,6 +34,7 @@
#include "file_error.h"
#include "file_url.h"
+#include "path_helper.hxx"
#include "osl/diagnose.h"
@@ -215,7 +213,7 @@ oslFileError SAL_CALL osl_createTempFile(
if (osl_File_E_None != osl_error)
return osl_error;
- /* allocate enough space on the stack */
+ /* allocate enough space on the stack, the file name can not be longer than MAX_PATH */
STACK_ALLOC(tmp_name, WCHAR, (rtl_uString_getLength(base_directory) + MAX_PATH));
if (tmp_name)
@@ -241,25 +239,21 @@ oslFileError SAL_CALL osl_createTempFile(
//#############################################
oslFileError SAL_CALL osl_getTempDirURL(rtl_uString** pustrTempDir)
{
- WCHAR szBuffer[MAX_PATH];
- LPWSTR lpBuffer = szBuffer;
- DWORD nBufferLength = ELEMENTS_OF_ARRAY(szBuffer) - 1;
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ LPWSTR lpBuffer = ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer);
+ DWORD nBufferLength = aBuffer.getBufSizeInSymbols() - 1;
DWORD nLength;
oslFileError error;
- do
+ nLength = GetTempPathW( aBuffer.getBufSizeInSymbols(), lpBuffer );
+
+ if ( nLength > nBufferLength )
{
- nLength = GetTempPathW( ELEMENTS_OF_ARRAY(szBuffer), lpBuffer );
- if ( nLength > nBufferLength )
- {
- nLength++;
- lpBuffer = reinterpret_cast<WCHAR*>(alloca( sizeof(WCHAR) * nLength ));
- nBufferLength = nLength - 1;
- }
- } while ( nLength > nBufferLength );
-
- if ( nLength )
+ // the provided path has invalid length
+ error = osl_File_E_NOENT;
+ }
+ else if ( nLength )
{
rtl_uString *ustrTempPath = NULL;
@@ -277,3 +271,4 @@ oslFileError SAL_CALL osl_getTempDirURL(rtl_uString** pustrTempDir)
return error;
}
+
diff --git a/sal/osl/w32/thread.c b/sal/osl/w32/thread.c
index 3cd5209e5790..88ce87cdf175 100644
--- a/sal/osl/w32/thread.c
+++ b/sal/osl/w32/thread.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: thread.c,v $
- * $Revision: 1.20 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/time.c b/sal/osl/w32/time.c
index b28c5fae241c..a4d0b6fffbad 100644
--- a/sal/osl/w32/time.c
+++ b/sal/osl/w32/time.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: time.c,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/sal/osl/w32/util.c b/sal/osl/w32/util.c
index 34c7b7ada53d..f4d8cbf52d20 100644
--- a/sal/osl/w32/util.c
+++ b/sal/osl/w32/util.c
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: util.c,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify