Project

General

Profile

Feature #1966 » lighttpd-1.4.x-add-T_CONFIG_INT-fixed.patch

fixed the T_CONFIG_INT patch (?) - virbyte, 2009-06-16 14:31

View differences:

src/configfile-glue.c (working copy)
116 116
				return -1;
117 117
			}
118 118
			break;
119
		case T_CONFIG_INT:
120
			switch(du->type) {
121
			case TYPE_INTEGER: {
122
				data_integer *di = (data_integer *)du;
123

  
124
				*((unsigned int *)(cv[i].destination)) = di->value;
125
				break;
126
			}
127
			case TYPE_STRING: {
128
				data_string *ds = (data_string *)du;
129

  
130
				if (ds->value->ptr && *ds->value->ptr) {
131
					char *e;
132
					long l = strtol(ds->value->ptr, &e, 10);
133
					if (e != ds->value->ptr && !*e && l >=0 && l <= 4294967295) {
134
						*((unsigned int *)(cv[i].destination)) = l;
135
						break;
136

  
137
					}
138
				}
139

  
140
				log_error_write(srv, __FILE__, __LINE__, "ssb", "got a string but expected an int:", cv[i].key, ds->value);
141

  
142
				return -1;
143
			}
144
			default:
145
				log_error_write(srv, __FILE__, __LINE__, "ssds", "unexpected type for key:", cv[i].key, du->type, "expected a integer, range 0 ... 4294967295");
146
				return -1;
147
			}
148
			break;
119 149
		case T_CONFIG_BOOLEAN:
120 150
			if (du->type == TYPE_STRING) {
121 151
				data_string *ds = (data_string *)du;
src/base.h (working copy)
84 84
typedef enum { T_CONFIG_UNSET,
85 85
		T_CONFIG_STRING,
86 86
		T_CONFIG_SHORT,
87
		T_CONFIG_INT,
87 88
		T_CONFIG_BOOLEAN,
88 89
		T_CONFIG_ARRAY,
89 90
		T_CONFIG_LOCAL,
(4-4/4)