summaryrefslogtreecommitdiff
path: root/src/libical/icalenums.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libical/icalenums.c')
-rw-r--r--src/libical/icalenums.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libical/icalenums.c b/src/libical/icalenums.c
index 4e184795..6f2ee32a 100644
--- a/src/libical/icalenums.c
+++ b/src/libical/icalenums.c
@@ -81,7 +81,8 @@ const char *icalenum_reqstat_desc(icalrequeststatus stat)
{
int i;
- for (i = 0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
+ int len = (int)(sizeof(request_status_map) / sizeof(request_status_map[0]));
+ for (i = 0; i < len && request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
if (request_status_map[i].kind == stat) {
return request_status_map[i].str;
}
@@ -104,7 +105,8 @@ char *icalenum_reqstat_code_r(icalrequeststatus stat)
int i, major, minor;
char tmpbuf[36];
- for (i = 0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
+ int len = (int)(sizeof(request_status_map) / sizeof(request_status_map[0]));
+ for (i = 0; i < len && request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
if (request_status_map[i].kind == stat) {
major = request_status_map[i].major;
minor = request_status_map[i].minor;
@@ -119,7 +121,8 @@ short icalenum_reqstat_major(icalrequeststatus stat)
{
int i;
- for (i = 0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
+ int len = (int)(sizeof(request_status_map) / sizeof(request_status_map[0]));
+ for (i = 0; i < len && request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
if (request_status_map[i].kind == stat) {
return request_status_map[i].major;
}
@@ -131,7 +134,8 @@ short icalenum_reqstat_minor(icalrequeststatus stat)
{
int i;
- for (i = 0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
+ int len = (int)(sizeof(request_status_map) / sizeof(request_status_map[0]));
+ for (i = 0; i < len && request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
if (request_status_map[i].kind == stat) {
return request_status_map[i].minor;
}
@@ -143,7 +147,8 @@ icalrequeststatus icalenum_num_to_reqstat(short major, short minor)
{
int i;
- for (i = 0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
+ int len = (int)(sizeof(request_status_map) / sizeof(request_status_map[0]));
+ for (i = 0; i < len && request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
if (request_status_map[i].major == major && request_status_map[i].minor == minor) {
return request_status_map[i].kind;
}