summaryrefslogtreecommitdiff
path: root/navit/attr.c
diff options
context:
space:
mode:
authorSebastian Leske <sebastian.leske@sleske.name>2015-11-12 18:10:36 +0100
committerSebastian Leske <sebastian.leske@sleske.name>2015-11-14 00:34:06 +0100
commitb1c61538efd863473ce1fa1b3a8effd59b48e219 (patch)
tree394a225536559b0dbb101199a032344e11e7658c /navit/attr.c
parent655d54922f552ffc493ef5f24d8351ed21d25c0a (diff)
downloadnavit-b1c61538efd863473ce1fa1b3a8effd59b48e219.tar.gz
Refactor:Add comments and #defines for relative attribute values.
Diffstat (limited to 'navit/attr.c')
-rw-r--r--navit/attr.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/navit/attr.c b/navit/attr.c
index 187299c5d..a4e38f09e 100644
--- a/navit/attr.c
+++ b/navit/attr.c
@@ -249,17 +249,15 @@ attr_new_from_text(const char *name, const char *value)
ret->u.num=0;
}
}
- /* Absolute values are from -0x40000000 - 0x40000000, with 0x0 being 0 (who would have thought that?)
- Relative values are from 0x40000001 - 0x80000000, with 0x60000000 being 0 */
if (value_is_relative) {
- if ((ret->u.num > 0x20000000) || (ret->u.num < -0x1FFFFFFF)) {
- dbg(lvl_error, "Relative possibly-relative attribute with invalid value %li\n", ret->u.num);
+ if ((ret->u.num > ATTR_REL_MAXREL) || (ret->u.num < ATTR_REL_MINREL)) {
+ dbg(lvl_error, "Relative possibly-relative attribute with value out of range: %li\n", ret->u.num);
}
- ret->u.num += 0x60000000;
+ ret->u.num += ATTR_REL_RELSHIFT;
} else {
- if ((ret->u.num > 0x40000000) || (ret->u.num < -0x40000000)) {
- dbg(lvl_error, "Non-relative possibly-relative attribute with invalid value %li\n", ret->u.num);
+ if ((ret->u.num > ATTR_REL_MAXABS) || (ret->u.num < ATTR_REL_MINABS)) {
+ dbg(lvl_error, "Non-relative possibly-relative attribute with value out of range: %li\n", ret->u.num);
}
}
break;