From cd0f7c70e20ea27fbc8b9ebb0a1610694302e9ee Mon Sep 17 00:00:00 2001
From: Mathieu Rene <mrene@avgs.ca>
Date: Tue, 9 Feb 2010 18:09:55 +0000
Subject: [PATCH] fix some code analysis tags

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16592 d0543943-73ff-0310-b7d9-9358b9ac24b2
---
 src/include/switch_core.h     |  2 +-
 src/include/switch_platform.h |  1 +
 src/include/switch_utils.h    | 14 +++++++++-----
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/include/switch_core.h b/src/include/switch_core.h
index 20a465a49d..c2688d0f41 100644
--- a/src/include/switch_core.h
+++ b/src/include/switch_core.h
@@ -857,7 +857,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(_In_ switch_core_sessio
   \return the application's return value
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flags(_In_ switch_core_session_t *session,
-																				  _In_ const char *app, _In_opt_z_ const char *arg, _Out_ int32_t *flags);
+																				  _In_ const char *app, _In_opt_z_ const char *arg, _Out_opt_ int32_t *flags);
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *app, int32_t *flags);
 
diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h
index 8b5d60bf82..c1ad51f92e 100644
--- a/src/include/switch_platform.h
+++ b/src/include/switch_platform.h
@@ -338,6 +338,7 @@ SWITCH_END_EXTERN_C
 #define _Out_z_cap_(x)
 #define _Out_ptrdiff_cap_(x)
 #define _Out_opt_ptrdiff_cap_(x)
+#define _Post_count_(x)
 #endif
 /* For Emacs:
  * Local Variables:
diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h
index 91027d59f6..0872d7a64c 100644
--- a/src/include/switch_utils.h
+++ b/src/include/switch_utils.h
@@ -72,11 +72,15 @@ SWITCH_DECLARE(int) switch_isxdigit(int c);
   \param s the string to test
   \return true value if the string is NULL or zero length
 */
-	 static inline int zstr(const char *s)
+_Check_return_ static inline switch_bool_t _zstr(_In_opt_z_ const char *s)
 {
 	return !s || *s == '\0';
 }
-
+#ifdef _PREFAST_
+#define zstr(x) (_zstr(x) ? 1 : __analysis_assume(x),0)
+#else
+#define zstr(x) _zstr(x)
+#endif
 #define switch_strlen_zero(x) zstr(x)
 #define switch_strlen_zero_buf(x) zstr_buf(x)
 #define zstr_buf(s) (*(s) == '\0')
@@ -113,7 +117,7 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size
 SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
 SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len);
 
-	 static inline switch_bool_t switch_is_digit_string(const char *s)
+static inline switch_bool_t switch_is_digit_string(const char *s)
 {
 
 	while (s && *s) {
@@ -536,8 +540,8 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(const char *in);
   \param arraylen the max number of elements in the array
   \return the number of elements added to the array
 */
-SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char **array, unsigned int arraylen);
-SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *delim, char **array, unsigned int arraylen);
+SWITCH_DECLARE(unsigned int) switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen);
+SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *delim, _Post_count_(return) char **array, unsigned int arraylen);
 
 SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str);
 SWITCH_DECLARE(char *) switch_strip_spaces(const char *str);