diff options
Diffstat (limited to 'registry')
-rw-r--r-- | registry/source/regimpl.cxx | 88 | ||||
-rw-r--r-- | registry/tools/fileurl.cxx | 35 | ||||
-rw-r--r-- | registry/tools/options.cxx | 52 |
3 files changed, 87 insertions, 88 deletions
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index 5976d0a1a219..7a32772b2f38 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -1122,61 +1122,61 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue, std::set< OUString > nameSet; sal_uInt32 count = checkTypeReaders(reader, reader2, nameSet); - if (count != reader.getFieldCount()) - { - sal_uInt16 index = 0; + if (count == reader.getFieldCount()) + return RegError::NO_ERROR; + + sal_uInt16 index = 0; - RegistryTypeWriter writer(reader.getTypeClass(), - reader.getTypeName(), - reader.getSuperTypeName(), - static_cast<sal_uInt16>(count)); + RegistryTypeWriter writer(reader.getTypeClass(), + reader.getTypeName(), + reader.getSuperTypeName(), + static_cast<sal_uInt16>(count)); - for (sal_uInt32 i=0 ; i < reader.getFieldCount(); i++) + for (sal_uInt32 i=0 ; i < reader.getFieldCount(); i++) + { + writer.setFieldData(index, + reader.getFieldName(i), + reader.getFieldType(i), + reader.getFieldDoku(i), + reader.getFieldFileName(i), + reader.getFieldAccess(i), + reader.getFieldConstValue(i)); + index++; + } + for (sal_uInt32 i=0 ; i < reader2.getFieldCount(); i++) + { + if (nameSet.find(reader2.getFieldName(i)) == nameSet.end()) { writer.setFieldData(index, - reader.getFieldName(i), - reader.getFieldType(i), - reader.getFieldDoku(i), - reader.getFieldFileName(i), - reader.getFieldAccess(i), - reader.getFieldConstValue(i)); + reader2.getFieldName(i), + reader2.getFieldType(i), + reader2.getFieldDoku(i), + reader2.getFieldFileName(i), + reader2.getFieldAccess(i), + reader2.getFieldConstValue(i)); index++; } - for (sal_uInt32 i=0 ; i < reader2.getFieldCount(); i++) - { - if (nameSet.find(reader2.getFieldName(i)) == nameSet.end()) - { - writer.setFieldData(index, - reader2.getFieldName(i), - reader2.getFieldType(i), - reader2.getFieldDoku(i), - reader2.getFieldFileName(i), - reader2.getFieldAccess(i), - reader2.getFieldConstValue(i)); - index++; - } - } + } - const sal_uInt8* pBlop = writer.getBlop(); - sal_uInt32 aBlopSize = writer.getBlopSize(); + const sal_uInt8* pBlop = writer.getBlop(); + sal_uInt32 aBlopSize = writer.getBlopSize(); - sal_uInt8 type = sal_uInt8(RegValueType::BINARY); - std::vector<sal_uInt8> aBuffer(VALUE_HEADERSIZE + aBlopSize); + sal_uInt8 type = sal_uInt8(RegValueType::BINARY); + std::vector<sal_uInt8> aBuffer(VALUE_HEADERSIZE + aBlopSize); - memcpy(aBuffer.data(), &type, 1); - writeUINT32(aBuffer.data() + VALUE_TYPEOFFSET, aBlopSize); - memcpy(aBuffer.data() + VALUE_HEADEROFFSET, pBlop, aBlopSize); + memcpy(aBuffer.data(), &type, 1); + writeUINT32(aBuffer.data() + VALUE_TYPEOFFSET, aBlopSize); + memcpy(aBuffer.data() + VALUE_HEADEROFFSET, pBlop, aBlopSize); - sal_uInt32 rwBytes; - if (rTargetValue.writeAt(0, aBuffer.data(), VALUE_HEADERSIZE+aBlopSize, rwBytes)) - { - return RegError::INVALID_VALUE; - } + sal_uInt32 rwBytes; + if (rTargetValue.writeAt(0, aBuffer.data(), VALUE_HEADERSIZE+aBlopSize, rwBytes)) + { + return RegError::INVALID_VALUE; + } - if (rwBytes != VALUE_HEADERSIZE+aBlopSize) - { - return RegError::INVALID_VALUE; - } + if (rwBytes != VALUE_HEADERSIZE+aBlopSize) + { + return RegError::INVALID_VALUE; } return RegError::NO_ERROR; } diff --git a/registry/tools/fileurl.cxx b/registry/tools/fileurl.cxx index 155995115b92..ce99be5a198b 100644 --- a/registry/tools/fileurl.cxx +++ b/registry/tools/fileurl.cxx @@ -46,28 +46,27 @@ OUString convertToFileUrl(char const* filename, sal_Int32 length) } OUString uFileUrl; - if (length > 0) + if (length <= 0) + return uFileUrl; + if (filename[0] != SEPARATOR) { - if (filename[0] != SEPARATOR) + // relative path name. + OUString uWorkingDir; + if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None) { - // relative path name. - OUString uWorkingDir; - if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None) - { - assert(false); - } - if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uFileUrl) != FileBase::E_None) - { - assert(false); - } + assert(false); } - else + if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uFileUrl) != FileBase::E_None) { - // absolute path name. - if (FileBase::getFileURLFromSystemPath(uFileName, uFileUrl) != FileBase::E_None) - { - assert(false); - } + assert(false); + } + } + else + { + // absolute path name. + if (FileBase::getFileURLFromSystemPath(uFileName, uFileUrl) != FileBase::E_None) + { + assert(false); } } return uFileUrl; diff --git a/registry/tools/options.cxx b/registry/tools/options.cxx index 81d1131f75c2..0212c94e9f55 100644 --- a/registry/tools/options.cxx +++ b/registry/tools/options.cxx @@ -38,37 +38,37 @@ bool Options::checkArgument(std::vector< std::string> & rArgs, char const * arg, { bool result = ((arg != nullptr) && (len > 0)); OSL_PRECOND(result, "registry::tools::Options::checkArgument(): invalid arguments"); - if (result) + if (!result) + return false; + + switch (arg[0]) { - switch (arg[0]) + case '@': + result = len > 1; + if (result) { - case '@': - result = len > 1; - if (result) - { - // "@<cmdfile>" - result = Options::checkCommandFile(rArgs, &(arg[1])); - } - break; - case '-': - result = len > 1; - if (result) + // "@<cmdfile>" + result = Options::checkCommandFile(rArgs, &(arg[1])); + } + break; + case '-': + result = len > 1; + if (result) + { + // "-<option>" + std::string option (&(arg[0]), 2); + rArgs.push_back(option); + if (len > 2) { - // "-<option>" - std::string option (&(arg[0]), 2); - rArgs.push_back(option); - if (len > 2) - { - // "-<option><param>" - std::string param(&(arg[2]), len - 2); - rArgs.push_back(param); - } + // "-<option><param>" + std::string param(&(arg[2]), len - 2); + rArgs.push_back(param); } - break; - default: - rArgs.push_back(std::string(arg, len)); - break; } + break; + default: + rArgs.push_back(std::string(arg, len)); + break; } return result; } |