comparison libfdproto/dictionary_functions.c @ 1052:b3d623f04b6d

Fix a number of remaining compilation warnings
author Sebastien Decugis <sdecugis@freediameter.net>
date Wed, 24 Apr 2013 12:49:00 +0800
parents 2f989d1a21e9
children 7d7266115a34
comparison
equal deleted inserted replaced
1051:69c6167d88d1 1052:b3d623f04b6d
229 /* We sanitize the returned string to avoid UTF8 boundary problem. 229 /* We sanitize the returned string to avoid UTF8 boundary problem.
230 We do this whether the string is trucated at TRUNC_LEN or not, to avoid potential problem 230 We do this whether the string is trucated at TRUNC_LEN or not, to avoid potential problem
231 with malformed AVP */ 231 with malformed AVP */
232 232
233 char * end = strchr(ret, '\0'); 233 char * end = strchr(ret, '\0');
234 char * oldend = end;
235 while (end > ret) { 234 while (end > ret) {
236 end--; 235 end--;
237 char b = *end; 236 char b = *end;
238 /* after the position pointed by end, we have only \0s */ 237 /* after the position pointed by end, we have only \0s */
239 if ((b & 0x80) == 0) { 238 if ((b & 0x80) == 0) {
334 CHECK_MALLOC_DO( ret = malloc(STR_LEN), return NULL ); 333 CHECK_MALLOC_DO( ret = malloc(STR_LEN), return NULL );
335 if (avp_value->os.len != 4) { 334 if (avp_value->os.len != 4) {
336 snprintf(ret, STR_LEN, "[invalid length: %zd]", avp_value->os.len); 335 snprintf(ret, STR_LEN, "[invalid length: %zd]", avp_value->os.len);
337 return ret; 336 return ret;
338 } 337 }
339 if (diameter_string_to_time_t(avp_value->os.data, avp_value->os.len, &val) != 0) { 338 if (diameter_string_to_time_t((char *)avp_value->os.data, avp_value->os.len, &val) != 0) {
340 snprintf(ret, STR_LEN, "[time conversion error]"); 339 snprintf(ret, STR_LEN, "[time conversion error]");
341 return ret; 340 return ret;
342 } 341 }
343 gmtime_r(&val, &conv); 342 gmtime_r(&val, &conv);
344 snprintf(ret, STR_LEN, "%d%02d%02dT%02d%02d%02d+00", conv.tm_year+1900, conv.tm_mon+1, conv.tm_mday, conv.tm_hour, conv.tm_min, conv.tm_sec); 343 snprintf(ret, STR_LEN, "%d%02d%02dT%02d%02d%02d+00", conv.tm_year+1900, conv.tm_mon+1, conv.tm_mday, conv.tm_hour, conv.tm_min, conv.tm_sec);
"Welcome to our mercurial repository"