summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-08 19:48:56 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-08 19:48:56 +0100
commit0cbcba73332ee79e6041febec97575079400267b (patch)
treecbe8ed47c92911b4657649e46e1d2d9a2fb20e68
parent5eca67b6cab7031d8203b1403ba5cddaef833e76 (diff)
set the return type of getFieldDescriptorIndex to ssize_t.
-rw-r--r--src/core/model/Document.cpp4
-rw-r--r--src/core/model/Domain.cpp8
-rw-r--r--src/core/model/Domain.hpp4
3 files changed, 8 insertions, 8 deletions
diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp
index 4579383..bcff41b 100644
--- a/src/core/model/Document.cpp
+++ b/src/core/model/Document.cpp
@@ -274,7 +274,7 @@ void DocumentEntity::setAttributes(const Variant &a)
static int enforceGetFieldDescriptorIndex(Handle<Descriptor> desc,
const std::string &fieldName)
{
- int idx = desc->getFieldDescriptorIndex(fieldName);
+ ssize_t idx = desc->getFieldDescriptorIndex(fieldName);
if (idx == -1) {
throw OusiaException(
std::string("Descriptor \"") + desc->getName() +
@@ -286,7 +286,7 @@ static int enforceGetFieldDescriptorIndex(Handle<Descriptor> desc,
static int enforceGetFieldDescriptorIndex(
Handle<Descriptor> desc, Handle<FieldDescriptor> fieldDescriptor)
{
- int idx = desc->getFieldDescriptorIndex(fieldDescriptor);
+ ssize_t idx = desc->getFieldDescriptorIndex(fieldDescriptor);
if (idx == -1) {
throw OusiaException(std::string("Descriptor \"") +
desc->getName() +
diff --git a/src/core/model/Domain.cpp b/src/core/model/Domain.cpp
index f45bd27..62ee65d 100644
--- a/src/core/model/Domain.cpp
+++ b/src/core/model/Domain.cpp
@@ -228,9 +228,9 @@ bool Descriptor::continuePath(Handle<StructuredClass> target,
return found;
}
-int Descriptor::getFieldDescriptorIndex(const std::string &name) const
+ssize_t Descriptor::getFieldDescriptorIndex(const std::string &name) const
{
- int f = 0;
+ size_t f = 0;
for (auto &fd : getFieldDescriptors()) {
if (fd->getName() == name) {
return f;
@@ -240,9 +240,9 @@ int Descriptor::getFieldDescriptorIndex(const std::string &name) const
return -1;
}
-int Descriptor::getFieldDescriptorIndex(Handle<FieldDescriptor> fd) const
+ssize_t Descriptor::getFieldDescriptorIndex(Handle<FieldDescriptor> fd) const
{
- int f = 0;
+ size_t f = 0;
for (auto &fd2 : getFieldDescriptors()) {
if (fd == fd2) {
return f;
diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp
index 63f4c5d..db3b9e6 100644
--- a/src/core/model/Domain.hpp
+++ b/src/core/model/Domain.hpp
@@ -503,7 +503,7 @@ public:
* @return the index of the FieldDescriptor with the given name or -1 if
* no such FieldDescriptor was found.
*/
- int getFieldDescriptorIndex(
+ ssize_t getFieldDescriptorIndex(
const std::string &name = DEFAULT_FIELD_NAME) const;
/**
* Returns the index of the given FieldDescriptor or -1 of the given
@@ -514,7 +514,7 @@ public:
* @return the index of the given FieldDescriptor or -1 of the given
* FieldDescriptor is not registered at this Descriptor.
*/
- int getFieldDescriptorIndex(Handle<FieldDescriptor> fd) const;
+ ssize_t getFieldDescriptorIndex(Handle<FieldDescriptor> fd) const;
/**
* This returns true if this Descriptor has a FieldDescriptor with the