[asterisk-commits] twilson: branch twilson/calendaring r166948 - /team/twilson/calendaring/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 30 18:35:15 CST 2008


Author: twilson
Date: Tue Dec 30 18:35:14 2008
New Revision: 166948

URL: http://svn.digium.com/view/asterisk?view=rev&rev=166948
Log:
More fixes as per russell on reviewboard

Modified:
    team/twilson/calendaring/res/res_caldav.c
    team/twilson/calendaring/res/res_exchangecal.c

Modified: team/twilson/calendaring/res/res_caldav.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/res/res_caldav.c?view=diff&rev=166948&r1=166947&r2=166948
==============================================================================
--- team/twilson/calendaring/res/res_caldav.c (original)
+++ team/twilson/calendaring/res/res_caldav.c Tue Dec 30 18:35:14 2008
@@ -602,7 +602,7 @@
 	ast_free(data);
 
 	/* The only writing from another thread will be if unload is true */
-	for(;;) {
+	for (;;) {
 		struct timeval tv = ast_tvnow();
 		struct timespec ts = {0,};
 

Modified: team/twilson/calendaring/res/res_exchangecal.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/res/res_exchangecal.c?view=diff&rev=166948&r1=166947&r2=166948
==============================================================================
--- team/twilson/calendaring/res/res_exchangecal.c (original)
+++ team/twilson/calendaring/res/res_exchangecal.c Tue Dec 30 18:35:14 2008
@@ -68,7 +68,7 @@
 };
 
 struct xmlstate {
-	const char *tag;
+	char tag[80];
 	int in_response;
 	int in_propstat;
 	int in_prop;
@@ -85,7 +85,7 @@
 	if (tmp)
 		tmp++;
 
-	state->tag = strdup(tmp);
+	ast_copy_string(state->tag, tmp, sizeof(state->tag));
 
 	switch (type) {
 	case IKS_OPEN:
@@ -135,7 +135,7 @@
 {
 	char *read, *write;
 	icaltimetype tt;
-	for(read = write = mstime; *read; read++) {
+	for (read = write = mstime; *read; read++) {
 		if (*read == '.') {
 			*write++ = 'Z';
 			*write = '\0';
@@ -183,7 +183,7 @@
 	}
 	/* We use ast_string_field_build here because libiksemel is parsing CDATA with < as
 	 * new elements which is a bit odd and shouldn't happen */
-	if(!strcasecmp(state->tag, "subject")) {
+	if (!strcasecmp(state->tag, "subject")) {
 		ast_string_field_build(event, summary, "%s%s", event->summary, str);
 	} else if (!strcasecmp(state->tag, "location")) {
 		ast_string_field_build(event, location, "%s%s", event->location, str);
@@ -273,10 +273,10 @@
 
 static struct ast_str *xml_encode_str(struct ast_str *dst, const char *src)
 {
-	char *tmp;
+	const char *tmp;
 	char buf[7];
 
-	for (tmp = (char *)src; *tmp; tmp++) {
+	for (tmp = src; *tmp; tmp++) {
 		switch (*tmp) {
 		case '\"':
 			strcpy(buf, """);
@@ -315,7 +315,7 @@
 	char tmp[30];
 	int i;
 
-	strncpy(tmp, icaltime_as_ical_string(tt), sizeof(tmp));
+	ast_copy_string(tmp, icaltime_as_ical_string(tt), sizeof(tmp));
 	for (i = 0; tmp[i]; i++) {
 		ast_str_append(&dst, 0, "%c", tmp[i]);
 		if (i == 3 || i == 5)
@@ -506,17 +506,39 @@
 
 	ret = 0;
 write_cleanup:
-	if (uid) ast_free(uid);
-	if (summary) ast_free(summary);
-	if (description) ast_free(description);
-	if (organizer) ast_free(organizer);
-	if (location) ast_free(location);
-	if (start) ast_free(start);
-	if (end) ast_free(end);
-	if (busystate) ast_free(busystate);
-	if (body) ast_free(body);
-	if (response) ast_free(response);
-	if (subdir) ast_free(subdir);
+	if (uid) {
+		ast_free(uid);
+	}
+	if (summary) {
+		ast_free(summary);
+	}
+	if (description) {
+		ast_free(description);
+	}
+	if (organizer) {
+		ast_free(organizer);
+	}
+	if (location) {
+		ast_free(location);
+	}
+	if (start) {
+		ast_free(start);
+	}
+	if (end) {
+		ast_free(end);
+	}
+	if (busystate) {
+		ast_free(busystate);
+	}
+	if (body) {
+		ast_free(body);
+	}
+	if (response) {
+		ast_free(response);
+	}
+	if (subdir) {
+		ast_free(subdir);
+	}
 
 	return ret;
 }
@@ -679,7 +701,7 @@
 	ast_free(data);
 
 	/* The only writing from another thread will be if unload is true */
-	for(;;) {
+	for (;;) {
 		struct timeval tv = ast_tvnow();
 		struct timespec ts = {0,};
 




More information about the asterisk-commits mailing list