[Libreoffice-commits] .: Branch 'libreoffice-3-6' - sal/inc

2012-12-03 Thread Libreoffice Gerrit user
 sal/inc/rtl/ustring.hxx |  123 +++-
 1 file changed, 61 insertions(+), 62 deletions(-)

New commits:
commit 049a1e029d0f4aaa65495af359c507066ce0d505
Author: Naser Sharifi sharifina...@gmail.com
Date:   Mon Nov 26 14:50:11 2012 -0600

Improve English comments

Corrected types and grammer errors in comments

Change-Id: I47ce77a8d36d71677720be6dd80594ec76970376

diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index 5962752..1c77a09 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -65,27 +65,26 @@ namespace rtl
 /* === */
 
 /**
-  This String class provide base functionality for C++ like Unicode
-  character array handling. The advantage of this class is, that it
-  handle all the memory management for you - and it do it
-  more efficient. If you assign a string to another string, the
+  This String class provides base functionality for C++ like Unicode
+  character array handling. The advantage of this class is that it
+  handles all the memory management for you - and it does it
+  more efficiently. If you assign a string to another string, the
   data of both strings are shared (without any copy operation or
   memory allocation) as long as you do not change the string. This class
-  stores also the length of the string, so that many operations are
-  faster as the C-str-functions.
+  also stores the length of the string, so that many operations are
+  faster than the C-str-functions.
 
-  This class provide only readonly string handling. So you could create
+  This class provides only readonly string handling. So you could create
   a string and you could only query the content from this string.
-  It provide also functionality to change the string, but this results
-  in every case in a new string instance (in the most cases with an
+  It provides also functionality to change the string, but this results
+  in every case in a new string instance (in the most cases with a
   memory allocation). You don't have functionality to change the
-  content of the string. If you want change the string content, than
-  you should us the OStringBuffer class, which provide these
-  functionality and avoid to much memory allocation.
+  content of the string. If you want to change the string content, then
+  you should use the OStringBuffer class, which provides these
+  functionalities and avoids too much memory allocation.
 
-  The design of this class is similar to the string classes in Java
-  and so more people should have fewer understanding problems when they
-  use this class.
+  The design of this class is similar to the string classes in Java so
+  less people should have understanding problems when they use this class.
 */
 
 class OUString
@@ -173,8 +172,8 @@ public:
 
   @paramvalue   a Unicode character array.
   @paramlength  the number of character which should be copied.
-The character array length must be greater or
-equal than this value.
+The character array length must be greater than
+or equal to this value.
 */
 OUString( const sal_Unicode * value, sal_Int32 length ) SAL_THROW(())
 {
@@ -266,15 +265,15 @@ public:
 #endif
 
 /**
-  New string from a 8-Bit character buffer array.
+  New string from an 8-Bit character buffer array.
 
-  @paramvalue   a 8-Bit character array.
-  @paramlength  the number of character which should be 
converted.
+  @paramvalue   An 8-Bit character array.
+  @paramlength  The number of character which should be 
converted.
 The 8-Bit character array length must be
-greater or equal than this value.
-  @paramencodingthe text encoding from which the 8-Bit 
character
+greater than or equal to this value.
+  @paramencodingThe text encoding from which the 8-Bit 
character
 sequence should be converted.
-  @paramconvertFlagsflags which controls the conversion.
+  @paramconvertFlagsFlags which control the conversion.
 see RTL_TEXTTOUNICODE_FLAGS_...
 
   @exception std::bad_alloc is thrown if an out-of-memory condition occurs
@@ -411,11 +410,11 @@ public:
 }
 
 /**
-  Returns a pointer to the Unicode character buffer from this string.
+  Returns a pointer to the Unicode character buffer for this string.
 
   It isn't necessarily NULL terminated.
 
-  @return   a pointer to the Unicode characters buffer from this object.
+  @return   a pointer to the Unicode characters buffer for this object.
 */
 const sal_Unicode * getStr() const 

[Libreoffice-commits] .: Branch 'libreoffice-3-6' - sal/inc

2012-09-20 Thread Libreoffice Gerrit user
 sal/inc/rtl/string.hxx  |7 ++-
 sal/inc/rtl/ustring.hxx |7 ++-
 2 files changed, 4 insertions(+), 10 deletions(-)

New commits:
commit ab76bfc0366d72d80698e4145130a072aed64d31
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Jul 23 12:09:12 2012 +0200

Make rtl::O[U]String::isEmpty return true bool

...instead of sal_Bool, to work around MSVC warning C4805: unsafe mix of 
type
'sal_Bool' and type 'bool'.

Change-Id: Ia3477539ccc23aa9daec49d633f023d414f2b4bf
(cherry picked from commit 8ee7c47404cdf408bcd3b6ea0267fbe54193c93f)
Reviewed-on: https://gerrit.libreoffice.org/650
Reviewed-by: Luboš Luňák l.lu...@suse.cz
Reviewed-by: Miklos Vajna vmik...@suse.cz
Tested-by: Miklos Vajna vmik...@suse.cz

diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index 4e76b74..e70f3ac 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -320,12 +320,9 @@ public:
 
   @since LibreOffice 3.4
 */
-sal_Bool isEmpty() const SAL_THROW(())
+bool isEmpty() const SAL_THROW(())
 {
-if ( pData-length )
-return sal_False;
-else
-return sal_True;
+return pData-length == 0;
 }
 
 /**
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index f3d224e..5962752 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -405,12 +405,9 @@ public:
 
   @since LibreOffice 3.4
 */
-sal_Bool isEmpty() const SAL_THROW(())
+bool isEmpty() const SAL_THROW(())
 {
-if ( pData-length )
-return sal_False;
-else
-return sal_True;
+return pData-length == 0;
 }
 
 /**
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-6' - sal/inc

2012-08-21 Thread Libreoffice Gerrit user
 sal/inc/osl/file.hxx |   67 +++
 1 file changed, 47 insertions(+), 20 deletions(-)

New commits:
commit fa4fec47a8bb713f960acb474920f2c640e1c58a
Author: Stephan Bergmann sberg...@redhat.com
Date:   Tue Aug 21 12:27:12 2012 +0200

Related fdo#46249: FileStatus can have fewer fields than requested

Turns out 608fe962cc649ad62c489811d3a8666e0e06e5e7 Let osl::FileStatus 
getters
assert programming errors was overly optimistic and misunderstood that
osl_getFileStatus(..., nMask) /can/ return a FileStatus for which 
isValid(nMask)
is false, esp. for stuff like file names and URLs of Windows drives and 
servers.
That in turn leads to existing code now calling
rtl::OUString(_aStatus.ustrFileName) etc. with null argument and crashing.

Change-Id: Icd2168e209aa1c7a6df30cd954513d01034923db
Signed-off-by: Michael Meeks michael.me...@suse.com

diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
index 16f7a06..96a7cda 100644
--- a/sal/inc/osl/file.hxx
+++ b/sal/inc/osl/file.hxx
@@ -729,8 +729,11 @@ public:
 */
 inline Type getFileType() const
 {
-assert(isValid(osl_FileStatus_Mask_Type));
-return static_cast Type (_aStatus.eType);
+SAL_INFO_IF(
+!isValid(osl_FileStatus_Mask_Type), sal,
+no FileStatus Type determined);
+return isValid(osl_FileStatus_Mask_Type)
+? static_cast Type (_aStatus.eType) : Unknown;
 }
 
 /** Is it a directory?
@@ -783,93 +786,117 @@ public:
 
 inline sal_uInt64 getAttributes() const
 {
-assert(isValid(osl_FileStatus_Mask_Attributes));
+SAL_INFO_IF(
+!isValid(osl_FileStatus_Mask_Attributes), sal,
+no FileStatus Attributes determined);
 return _aStatus.uAttributes;
 }
 
 /** Get the creation time of this file.
 
 @return
-The creation time.
+The creation time if this information is valid, an uninitialized
+TimeValue otherwise.
 */
 
 inline TimeValue getCreationTime() const
 {
-assert(isValid(osl_FileStatus_Mask_CreationTime));
+SAL_INFO_IF(
+!isValid(osl_FileStatus_Mask_CreationTime), sal,
+no FileStatus CreationTime determined);
 return _aStatus.aCreationTime;
 }
 
 /** Get the file access time.
 
 @return
-The last access time.
+The last access time if this information is valid, an uninitialized
+TimeValue otherwise.
 */
 
 inline TimeValue getAccessTime() const
 {
-assert(isValid(osl_FileStatus_Mask_AccessTime));
+SAL_INFO_IF(
+!isValid(osl_FileStatus_Mask_AccessTime), sal,
+no FileStatus AccessTime determined);
 return _aStatus.aAccessTime;
 }
 
 /** Get the file modification time.
 
 @return
-The last modified time.
+The last modified time if this information is valid, an uninitialized
+TimeValue otherwise.
 */
 
 inline TimeValue getModifyTime() const
 {
-assert(isValid(osl_FileStatus_Mask_ModifyTime));
+SAL_INFO_IF(
+!isValid(osl_FileStatus_Mask_ModifyTime), sal,
+no FileStatus ModifyTime determined);
 return _aStatus.aModifyTime;
 }
 
 /** Get the size of the file.
 
 @return
-The actual file size.
+The actual file size if this information is valid, 0 otherwise.
 */
 
 inline sal_uInt64 getFileSize() const
 {
-assert(isValid(osl_FileStatus_Mask_FileSize));
+SAL_INFO_IF(
+!isValid(osl_FileStatus_Mask_FileSize), sal,
+no FileStatus FileSize determined);
 return _aStatus.uFileSize;
 }
 
 /** Get the file name.
 
 @return
-The file name.
+The file name if this information is valid, an empty string otherwise.
 */
 
 inline ::rtl::OUString getFileName() const
 {
-assert(isValid(osl_FileStatus_Mask_FileName));
-return rtl::OUString(_aStatus.ustrFileName);
+SAL_INFO_IF(
+!isValid(osl_FileStatus_Mask_FileName), sal,
+no FileStatus FileName determined);
+return isValid(osl_FileStatus_Mask_FileName)
+? rtl::OUString(_aStatus.ustrFileName) : rtl::OUString();
 }
 
 
 /** Get the URL of the file.
 
 @return
-The full qualified URL of the file.
+The full qualified URL of the file if this information is valid, an
+empty string otherwise.
 */
 
 inline ::rtl::OUString getFileURL() const
 {
-assert(isValid(osl_FileStatus_Mask_FileURL));
-return rtl::OUString(_aStatus.ustrFileURL);
+SAL_INFO_IF(
+!isValid(osl_FileStatus_Mask_FileURL), sal,
+no FileStatus FileURL determined);
+return isValid(osl_FileStatus_Mask_FileURL)
+? rtl::OUString(_aStatus.ustrFileURL)