summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-03-29 12:06:33 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-03-29 12:07:36 +0200
commit66a88dc17e91d03a130b21a511ce298dd5a52e12 (patch)
tree51d837b95391d760f815e576a1a9cc8888674a4b
parent633cbb4954a2469f3c8911fbdffcaa4340ca6ac9 (diff)
UNO BYTE is signed
This is hopefully a better fix for c589fa17b8f3e6ded0d1e04120781eb5d6735bc7 "Dalvik enforces byte constants being in range (-128..127)."
-rw-r--r--codemaker/source/cppumaker/cpputype.cxx3
-rw-r--r--codemaker/source/javamaker/javatype.cxx5
-rw-r--r--registry/inc/registry/types.h2
-rw-r--r--registry/source/reflread.cxx9
-rw-r--r--registry/source/reflwrit.cxx3
-rw-r--r--registry/source/regimpl.cxx4
6 files changed, 11 insertions, 15 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index 7c0326d7cff2..64dad4dd87dc 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -1262,8 +1262,7 @@ void CppuType::dumpConstantValue(FileStream& o, sal_uInt16 index)
o << "sal_False";
break;
case RT_TYPE_BYTE:
- o << "(sal_Int8)"
- << sal::static_int_cast< sal_Int8 >(constValue.m_value.aByte);
+ o << "(sal_Int8)" << constValue.m_value.aByte;
break;
case RT_TYPE_INT16:
o << "(sal_Int16)" << constValue.m_value.aShort;
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index f297980f397a..1453122ce749 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -2447,10 +2447,7 @@ void addConstant(
rtl::OString(
RTL_CONSTASCII_STRINGPARAM("Bad type information"))); //TODO
}
- if (fieldValue.m_value.aByte < 0x80)
- valueIndex = classFile->addIntegerInfo(fieldValue.m_value.aByte);
- else
- valueIndex = classFile->addIntegerInfo(-256 + (int) fieldValue.m_value.aByte);
+ valueIndex = classFile->addIntegerInfo(fieldValue.m_value.aByte);
break;
case codemaker::UnoType::SORT_SHORT:
diff --git a/registry/inc/registry/types.h b/registry/inc/registry/types.h
index cee37bb24001..77ae249925fd 100644
--- a/registry/inc/registry/types.h
+++ b/registry/inc/registry/types.h
@@ -218,7 +218,7 @@ enum RTValueType {
*/
union RTConstValueUnion {
sal_Bool aBool;
- sal_uInt8 aByte;
+ sal_Int8 aByte;
sal_Int16 aShort;
sal_uInt16 aUShort;
sal_Int32 aLong;
diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx
index cac943f58e46..e8ddab00b093 100644
--- a/registry/source/reflread.cxx
+++ b/registry/source/reflread.cxx
@@ -259,7 +259,7 @@ public:
const sal_Char* readUTF8NameConstant(sal_uInt16 index);
sal_Bool readBOOLConstant(sal_uInt16 index);
- sal_uInt8 readBYTEConstant(sal_uInt16 index);
+ sal_Int8 readBYTEConstant(sal_uInt16 index);
sal_Int16 readINT16Constant(sal_uInt16 index);
sal_uInt16 readUINT16Constant(sal_uInt16 index);
sal_Int32 readINT32Constant(sal_uInt16 index);
@@ -367,15 +367,16 @@ sal_Bool ConstantPool::readBOOLConstant(sal_uInt16 index)
return aBool;
}
-sal_uInt8 ConstantPool::readBYTEConstant(sal_uInt16 index)
+sal_Int8 ConstantPool::readBYTEConstant(sal_uInt16 index)
{
- sal_uInt8 aByte = sal_False;
+ sal_Int8 aByte = 0;
if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
{
if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_BYTE)
{
- aByte = readBYTE(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+ aByte = static_cast< sal_Int8 >(
+ readBYTE(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA));
}
}
diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx
index 9fb415aa2277..791a6e4b68c1 100644
--- a/registry/source/reflwrit.cxx
+++ b/registry/source/reflwrit.cxx
@@ -302,7 +302,8 @@ sal_uInt32 CPInfo::toBlop(sal_uInt8* buffer)
buff += writeBYTE(buff, (sal_uInt8) m_value.aConst.aBool);
break;
case CP_TAG_CONST_BYTE:
- buff += writeBYTE(buff, m_value.aConst.aByte);
+ buff += writeBYTE(
+ buff, static_cast< sal_uInt8 >(m_value.aConst.aByte));
break;
case CP_TAG_CONST_INT16:
buff += writeINT16(buff, m_value.aConst.aShort);
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index e82789b43cc4..401fb988ecec 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -242,9 +242,7 @@ void dumpType(typereg::Reader const & reader, rtl::OString const & indent) {
break;
case RT_TYPE_BYTE:
- printf(
- "byte 0x%02X",
- static_cast< unsigned int >(value.m_value.aByte));
+ printf("byte %d", static_cast< int >(value.m_value.aByte));
break;
case RT_TYPE_INT16: