INTEGRATION: CWS warnings01 (1.2.42); FILE MERGED

2005/11/24 14:59:59 sb 1.2.42.4: #i53898# Made code warning-free.
2005/09/22 22:28:31 sb 1.2.42.3: RESYNC: (1.2-1.3); FILE MERGED
2005/08/30 07:15:28 sb 1.2.42.2: #i53898# Made code warning-free.
2005/08/29 14:21:29 sb 1.2.42.1: #i53898# Made code warning-free.
This commit is contained in:
Jens-Heiner Rechtien 2006-06-20 01:24:56 +00:00
parent 6c95220ccb
commit b3ebac8fc0

View file

@ -4,9 +4,9 @@
* *
* $RCSfile: classfile.cxx,v $ * $RCSfile: classfile.cxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: rt $ $Date: 2005-09-08 02:17:03 $ * last change: $Author: hr $ $Date: 2006-06-20 02:24:56 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
@ -39,6 +39,7 @@
#include "codemaker/options.hxx" #include "codemaker/options.hxx"
#include "codemaker/unotype.hxx" #include "codemaker/unotype.hxx"
#include "boost/static_assert.hpp"
#include "osl/diagnose.h" #include "osl/diagnose.h"
#include "rtl/string.h" #include "rtl/string.h"
#include "rtl/string.hxx" #include "rtl/string.hxx"
@ -117,7 +118,12 @@ void writeU4(FileStream & file, sal_uInt32 data) {
void writeStream(FileStream & file, std::vector< unsigned char > const & stream) void writeStream(FileStream & file, std::vector< unsigned char > const & stream)
{ {
std::vector< unsigned char >::size_type n = stream.size(); std::vector< unsigned char >::size_type n = stream.size();
OSL_ASSERT(n <= SAL_MAX_UINT64); BOOST_STATIC_ASSERT(
sizeof (std::vector< unsigned char >::size_type)
<= sizeof (sal_uInt64));
// both unsigned integral, so sizeof is a practically sufficient
// approximation of std::numeric_limits<T1>::max() <=
// std::numeric_limits<T2>::max()
if (n != 0) { if (n != 0) {
write(file, &stream[0], static_cast< sal_uInt64 >(n)); write(file, &stream[0], static_cast< sal_uInt64 >(n));
} }
@ -519,9 +525,11 @@ sal_uInt16 ClassFile::addIntegerInfo(sal_Int32 value) {
sal_uInt16 index = nextConstantPoolIndex(1); sal_uInt16 index = nextConstantPoolIndex(1);
appendU1(m_constantPool, 3); appendU1(m_constantPool, 3);
appendU4(m_constantPool, static_cast< sal_uInt32 >(value)); appendU4(m_constantPool, static_cast< sal_uInt32 >(value));
bool ok = m_integerInfos.insert( if (!m_integerInfos.insert(
std::map< sal_Int32, sal_uInt16 >::value_type(value, index)).second; std::map< sal_Int32, sal_uInt16 >::value_type(value, index)).second)
OSL_ASSERT(ok); {
OSL_ASSERT(false);
}
return index; return index;
} }
@ -535,9 +543,11 @@ sal_uInt16 ClassFile::addFloatInfo(float value) {
union { float floatBytes; sal_uInt32 uint32Bytes; } bytes; union { float floatBytes; sal_uInt32 uint32Bytes; } bytes;
bytes.floatBytes = value; bytes.floatBytes = value;
appendU4(m_constantPool, bytes.uint32Bytes); appendU4(m_constantPool, bytes.uint32Bytes);
bool ok = m_floatInfos.insert( if (!m_floatInfos.insert(
std::map< float, sal_uInt16 >::value_type(value, index)).second; std::map< float, sal_uInt16 >::value_type(value, index)).second)
OSL_ASSERT(ok); {
OSL_ASSERT(false);
}
return index; return index;
} }
@ -549,9 +559,11 @@ sal_uInt16 ClassFile::addLongInfo(sal_Int64 value) {
sal_uInt16 index = nextConstantPoolIndex(2); sal_uInt16 index = nextConstantPoolIndex(2);
appendU1(m_constantPool, 5); appendU1(m_constantPool, 5);
appendU8(m_constantPool, static_cast< sal_uInt64 >(value)); appendU8(m_constantPool, static_cast< sal_uInt64 >(value));
bool ok = m_longInfos.insert( if (!m_longInfos.insert(
std::map< sal_Int64, sal_uInt16 >::value_type(value, index)).second; std::map< sal_Int64, sal_uInt16 >::value_type(value, index)).second)
OSL_ASSERT(ok); {
OSL_ASSERT(false);
}
return index; return index;
} }
@ -565,9 +577,11 @@ sal_uInt16 ClassFile::addDoubleInfo(double value) {
union { double doubleBytes; sal_uInt64 uint64Bytes; } bytes; union { double doubleBytes; sal_uInt64 uint64Bytes; } bytes;
bytes.doubleBytes = value; bytes.doubleBytes = value;
appendU8(m_constantPool, bytes.uint64Bytes); appendU8(m_constantPool, bytes.uint64Bytes);
bool ok = m_doubleInfos.insert( if (!m_doubleInfos.insert(
std::map< double, sal_uInt16 >::value_type(value, index)).second; std::map< double, sal_uInt16 >::value_type(value, index)).second)
OSL_ASSERT(ok); {
OSL_ASSERT(false);
}
return index; return index;
} }
@ -716,7 +730,7 @@ sal_uInt16 ClassFile::nextConstantPoolIndex(sal_uInt16 width) {
" format"))); " format")));
} }
sal_uInt16 index = m_constantPoolCount; sal_uInt16 index = m_constantPoolCount;
m_constantPoolCount += width; m_constantPoolCount = m_constantPoolCount + width;
return index; return index;
} }
@ -737,9 +751,12 @@ sal_uInt16 ClassFile::addUtf8Info(rtl::OString const & value) {
for (sal_Int32 j = 0; j < value.getLength(); ++j) { for (sal_Int32 j = 0; j < value.getLength(); ++j) {
appendU1(m_constantPool, static_cast< sal_uInt8 >(value[j])); appendU1(m_constantPool, static_cast< sal_uInt8 >(value[j]));
} }
bool ok = m_utf8Infos.insert( if (!m_utf8Infos.insert(
std::map< rtl::OString, sal_uInt16 >::value_type(value, index)).second; std::map< rtl::OString, sal_uInt16 >::value_type(value, index)).
OSL_ASSERT(ok); second)
{
OSL_ASSERT(false);
}
return index; return index;
} }
@ -753,10 +770,12 @@ sal_uInt16 ClassFile::addClassInfo(rtl::OString const & type) {
sal_uInt16 index = nextConstantPoolIndex(1); sal_uInt16 index = nextConstantPoolIndex(1);
appendU1(m_constantPool, 7); appendU1(m_constantPool, 7);
appendU2(m_constantPool, nameIndex); appendU2(m_constantPool, nameIndex);
bool ok = m_classInfos.insert( if (!m_classInfos.insert(
std::map< sal_uInt16, sal_uInt16 >::value_type(nameIndex, index)). std::map< sal_uInt16, sal_uInt16 >::value_type(nameIndex, index)).
second; second)
OSL_ASSERT(ok); {
OSL_ASSERT(false);
}
return index; return index;
} }
@ -770,10 +789,12 @@ sal_uInt16 ClassFile::addStringInfo(rtl::OString const & value) {
sal_uInt16 index = nextConstantPoolIndex(1); sal_uInt16 index = nextConstantPoolIndex(1);
appendU1(m_constantPool, 8); appendU1(m_constantPool, 8);
appendU2(m_constantPool, stringIndex); appendU2(m_constantPool, stringIndex);
bool ok = m_stringInfos.insert( if (!m_stringInfos.insert(
std::map< sal_uInt16, sal_uInt16 >::value_type(stringIndex, index)). std::map< sal_uInt16, sal_uInt16 >::value_type(stringIndex, index)).
second; second)
OSL_ASSERT(ok); {
OSL_ASSERT(false);
}
return index; return index;
} }
@ -793,9 +814,11 @@ sal_uInt16 ClassFile::addFieldrefInfo(
appendU1(m_constantPool, 9); appendU1(m_constantPool, 9);
appendU2(m_constantPool, classIndex); appendU2(m_constantPool, classIndex);
appendU2(m_constantPool, nameAndTypeIndex); appendU2(m_constantPool, nameAndTypeIndex);
bool ok = m_fieldrefInfos.insert( if (!m_fieldrefInfos.insert(
std::map< sal_uInt32, sal_uInt16 >::value_type(key, index)).second; std::map< sal_uInt32, sal_uInt16 >::value_type(key, index)).second)
OSL_ASSERT(ok); {
OSL_ASSERT(false);
}
return index; return index;
} }
@ -815,9 +838,11 @@ sal_uInt16 ClassFile::addMethodrefInfo(
appendU1(m_constantPool, 10); appendU1(m_constantPool, 10);
appendU2(m_constantPool, classIndex); appendU2(m_constantPool, classIndex);
appendU2(m_constantPool, nameAndTypeIndex); appendU2(m_constantPool, nameAndTypeIndex);
bool ok = m_methodrefInfos.insert( if (!m_methodrefInfos.insert(
std::map< sal_uInt32, sal_uInt16 >::value_type(key, index)).second; std::map< sal_uInt32, sal_uInt16 >::value_type(key, index)).second)
OSL_ASSERT(ok); {
OSL_ASSERT(false);
}
return index; return index;
} }
@ -838,9 +863,11 @@ sal_uInt16 ClassFile::addInterfaceMethodrefInfo(
appendU1(m_constantPool, 11); appendU1(m_constantPool, 11);
appendU2(m_constantPool, classIndex); appendU2(m_constantPool, classIndex);
appendU2(m_constantPool, nameAndTypeIndex); appendU2(m_constantPool, nameAndTypeIndex);
bool ok = m_interfaceMethodrefInfos.insert( if (!m_interfaceMethodrefInfos.insert(
std::map< sal_uInt32, sal_uInt16 >::value_type(key, index)).second; std::map< sal_uInt32, sal_uInt16 >::value_type(key, index)).second)
OSL_ASSERT(ok); {
OSL_ASSERT(false);
}
return index; return index;
} }
@ -860,9 +887,11 @@ sal_uInt16 ClassFile::addNameAndTypeInfo(
appendU1(m_constantPool, 12); appendU1(m_constantPool, 12);
appendU2(m_constantPool, nameIndex); appendU2(m_constantPool, nameIndex);
appendU2(m_constantPool, descriptorIndex); appendU2(m_constantPool, descriptorIndex);
bool ok = m_nameAndTypeInfos.insert( if (!m_nameAndTypeInfos.insert(
std::map< sal_uInt32, sal_uInt16 >::value_type(key, index)).second; std::map< sal_uInt32, sal_uInt16 >::value_type(key, index)).second)
OSL_ASSERT(ok); {
OSL_ASSERT(false);
}
return index; return index;
} }