[Libreoffice-commits] core.git: 2 commits - xmlhelp/source
Michael Stahl
mstahl at redhat.com
Thu Jun 6 02:13:10 PDT 2013
xmlhelp/source/treeview/tvread.cxx | 86 ++++---------------------------------
1 file changed, 10 insertions(+), 76 deletions(-)
New commits:
commit 52e0ff83639809b8f2e92a9899ed5ed795f3d780
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Jun 5 21:33:03 2013 +0200
stop this decadent waste of precious newlines
Change-Id: I803d7d56ba7350fd0f5b2c4efa392d55a0fd4542
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index d96d4a5..0669911 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -40,7 +40,6 @@
namespace treeview {
-
class TVDom
{
friend class TVChildTarget;
@@ -61,7 +60,6 @@ namespace treeview {
delete children[i];
}
-
TVDom* newChild()
{
children.push_back( new TVDom( this ) );
@@ -75,7 +73,6 @@ namespace treeview {
return children.back();
}
-
TVDom* getParent() const
{
if( parent )
@@ -95,7 +92,6 @@ namespace treeview {
void setKind( Kind ind ) { kind = ind; }
Kind getKind( ) const { return kind; }
-
void setApplication( const char* appl )
{
application = OUString( (sal_Char*)(appl),
@@ -170,7 +166,6 @@ namespace treeview {
}
-
using namespace treeview;
using namespace com::sun::star;
using namespace com::sun::star::uno;
@@ -236,8 +231,6 @@ void SAL_CALL ConfigData::replaceName( OUString& oustring ) const
}
-
-
//////////////////////////////////////////////////////////////////////////
// XInterface
//////////////////////////////////////////////////////////////////////////
@@ -251,7 +244,6 @@ TVBase::acquire(
OWeakObject::acquire();
}
-
void SAL_CALL
TVBase::release(
void )
@@ -260,7 +252,6 @@ TVBase::release(
OWeakObject::release();
}
-
Any SAL_CALL
TVBase::queryInterface(
const Type& rType )
@@ -276,7 +267,6 @@ TVBase::queryInterface(
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
}
-
////////////////////////////////////////////////////////////////////////////////
//
// XTypeProvider methods.
@@ -288,14 +278,8 @@ XTYPEPROVIDER_IMPL_5( TVBase,
XChangesNotifier,
XComponent );
-
-
-
-
-
// TVRead
-
TVRead::TVRead( const ConfigData& configData,TVDom* tvDom )
{
if( ! tvDom )
@@ -314,17 +298,10 @@ TVRead::TVRead( const ConfigData& configData,TVDom* tvDom )
Children = new TVChildTarget( configData,tvDom );
}
-
-
TVRead::~TVRead()
{
}
-
-
-
-
-
// XNameAccess
Any SAL_CALL
@@ -353,9 +330,6 @@ TVRead::getByName( const OUString& aName )
throw NoSuchElementException();
}
-
-
-
Sequence< OUString > SAL_CALL
TVRead::getElementNames( )
throw( RuntimeException )
@@ -369,8 +343,6 @@ TVRead::getElementNames( )
return seq;
}
-
-
sal_Bool SAL_CALL
TVRead::hasByName( const OUString& aName )
throw( RuntimeException )
@@ -383,7 +355,6 @@ TVRead::hasByName( const OUString& aName )
return false;
}
-
// XHierarchicalNameAccess
Any SAL_CALL
@@ -401,9 +372,6 @@ TVRead::getByHierarchicalName( const OUString& aName )
return getByName( name );
}
-
-
-
sal_Bool SAL_CALL
TVRead::hasByHierarchicalName( const OUString& aName )
throw( RuntimeException )
@@ -418,17 +386,12 @@ TVRead::hasByHierarchicalName( const OUString& aName )
return hasByName( name );
}
-
-
/**************************************************************************/
/* */
/* TVChildTarget */
/* */
/**************************************************************************/
-
-
-
extern "C" void start_handler(void *userData,
const XML_Char *name,
const XML_Char **atts)
@@ -466,7 +429,6 @@ extern "C" void start_handler(void *userData,
}
}
-
extern "C" void end_handler(void *userData,
const XML_Char *name )
{
@@ -476,7 +438,6 @@ extern "C" void end_handler(void *userData,
*tvDom = (*tvDom)->getParent();
}
-
extern "C" void data_handler( void *userData,
const XML_Char *s,
int len)
@@ -539,7 +500,6 @@ TVChildTarget::TVChildTarget( const Reference< XComponentContext >& xContext )
Elements[i] = new TVRead( configData,tvDom.children[i] );
}
-
TVChildTarget::~TVChildTarget()
{
}
@@ -635,9 +595,6 @@ TVChildTarget::getByName( const OUString& aName )
return aAny;
}
-
-
-
Sequence< OUString > SAL_CALL
TVChildTarget::getElementNames( )
throw( RuntimeException )
@@ -649,8 +606,6 @@ TVChildTarget::getElementNames( )
return seq;
}
-
-
sal_Bool SAL_CALL
TVChildTarget::hasByName( const OUString& aName )
throw( RuntimeException )
@@ -663,8 +618,6 @@ TVChildTarget::hasByName( const OUString& aName )
return true;
}
-
-
// XHierarchicalNameAccess
Any SAL_CALL
@@ -689,8 +642,6 @@ TVChildTarget::getByHierarchicalName( const OUString& aName )
return getByName( name );
}
-
-
sal_Bool SAL_CALL
TVChildTarget::hasByHierarchicalName( const OUString& aName )
throw( RuntimeException )
@@ -711,11 +662,6 @@ TVChildTarget::hasByHierarchicalName( const OUString& aName )
return hasByName( name );
}
-
-
-
-
-
ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
{
ConfigData configData;
@@ -878,14 +824,6 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
return configData;
}
-
-
-
-
-
-
-
-
Reference< XMultiServiceFactory >
TVChildTarget::getConfiguration(const Reference< XComponentContext >& rxContext) const
{
@@ -905,8 +843,6 @@ TVChildTarget::getConfiguration(const Reference< XComponentContext >& rxContext)
return xProvider;
}
-
-
Reference< XHierarchicalNameAccess >
TVChildTarget::getHierAccess( const Reference< XMultiServiceFactory >& sProvider,
const char* file ) const
@@ -936,8 +872,6 @@ TVChildTarget::getHierAccess( const Reference< XMultiServiceFactory >& sProvider
return xHierAccess;
}
-
-
OUString
TVChildTarget::getKey( const Reference< XHierarchicalNameAccess >& xHierAccess,
const char* key ) const
@@ -959,7 +893,6 @@ TVChildTarget::getKey( const Reference< XHierarchicalNameAccess >& xHierAccess,
return instPath;
}
-
sal_Bool
TVChildTarget::getBooleanKey(const Reference<
XHierarchicalNameAccess >& xHierAccess,
@@ -990,7 +923,6 @@ void TVChildTarget::subst( OUString& instpath ) const
instpath = aOptions.SubstituteVariable( instpath );
}
-
//===================================================================
// class ExtensionIteratorBase
@@ -1204,7 +1136,6 @@ void ExtensionIteratorBase::implGetLanguageVectorFromPackage( ::std::vector< OUS
}
}
-
//===================================================================
// class TreeFileIterator
@@ -1326,6 +1257,4 @@ OUString TreeFileIterator::implGetTreeFileFromPackage
return aRetFile;
}
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 3ddf70dc1129e9b2294b582256c657305bbf3b3e
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Jun 5 21:27:07 2013 +0200
xmlhelp: fix reading symlinked .tree files
Apparently the .tree files nowadays are symlinked, which was not the
case on the libreoffice-4-0 branch... and on viewing the Contents tab
it's evident we can't actually read symlinked .tree files, and crash
with an STL assert because the children vector is empty.
Change-Id: I5a543ef85b827e194120530a486cf19a76837d87
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 8a2d494..d96d4a5 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -546,6 +546,11 @@ TVChildTarget::~TVChildTarget()
void TVChildTarget::Check(TVDom* tvDom)
{
+ if (tvDom->children.empty())
+ {
+ return;
+ }
+
unsigned i = 0;
bool h = false;
@@ -808,7 +813,8 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
}
osl::Directory aDirectory( url );
- osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileSize | osl_FileStatus_Mask_FileURL );
+ osl::FileStatus aFileStatus(
+ osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileURL );
if( osl::Directory::E_None == aDirectory.open() )
{
int idx_ = 0;
@@ -832,18 +838,17 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
( str[idx_ + 3] == 'e' || str[idx_ + 3] == 'E' ) &&
( str[idx_ + 4] == 'e' || str[idx_ + 4] == 'E' ) )
{
- OSL_ENSURE( aFileStatus.isValid( osl_FileStatus_Mask_FileSize ),
- "invalid file size" );
-
OUString baseName = aFileName.copy(0,idx_).toAsciiLowerCase();
if(! showBasic && baseName.compareToAscii("sbasic") == 0 )
continue;
osl::File aFile( aFileUrl );
if( osl::FileBase::E_None == aFile.open( osl_File_OpenFlag_Read ) )
{
+ // use the file size, not aFileStatus size, in case the
+ // tree file is a symlink
sal_uInt64 nSize;
aFile.getSize( nSize );
- configData.vFileLen.push_back( aFileStatus.getFileSize() );
+ configData.vFileLen.push_back( nSize );
configData.vFileURL.push_back( aFileUrl );
aFile.close();
}
More information about the Libreoffice-commits
mailing list