]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
code analysis for hash functions.
authorMichael Jerris <mike@jerris.com>
Mon, 28 Jan 2008 09:27:01 +0000 (09:27 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 28 Jan 2008 09:27:01 +0000 (09:27 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7404 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_core.h
src/include/switch_platform.h
src/mod/applications/mod_conference/mod_conference.c
src/mod/applications/mod_fifo/mod_fifo.c

index f97db7b50a5a0747f65b19b3b02f170168663605..22d1984406c3eb0977b3e95a31d9a3bdb4925ab3 100644 (file)
@@ -895,7 +895,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(_In_ switch_hash_t * has
   \return SWITCH_STATUS_SUCCESS if the data is added
   \note the string key must be a constant or a dynamic string
 */
-SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(switch_hash_t * hash, const char *key, const void *data, switch_mutex_t *mutex);
+SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_opt_ const void *data, _In_ switch_mutex_t *mutex);
 
 /*! 
   \brief Delete data from a hash based on desired key
@@ -903,7 +903,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(switch_hash_t * h
   \param key the key from which to delete the data
   \return SWITCH_STATUS_SUCCESS if the data is deleted
 */
-SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(switch_hash_t * hash, const char *key);
+SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(_In_ switch_hash_t * hash, _In_z_ const char *key);
 
 /*! 
   \brief Delete data from a hash based on desired key
@@ -912,7 +912,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(switch_hash_t * hash, co
   \param mutex optional mutex to lock
   \return SWITCH_STATUS_SUCCESS if the data is deleted
 */
-SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(switch_hash_t * hash, const char *key, switch_mutex_t *mutex);
+SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
 
 /*! 
   \brief Retrieve data from a given hash
@@ -920,7 +920,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(switch_hash_t * h
   \param key the key to retrieve
   \return a pointer to the data held in the key
 */
-SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash_t * hash, const char *key);
+SWITCH_DECLARE(void *) switch_core_hash_find(_In_ switch_hash_t * hash, _In_z_ const char *key);
 
 
 /*! 
@@ -930,11 +930,11 @@ SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash_t * hash, const char *k
   \param mutex optional mutex to lock
   \return a pointer to the data held in the key
 */
-SWITCH_DECLARE(void *) switch_core_hash_find_locked(switch_hash_t * hash, const char *key, switch_mutex_t *mutex);
+SWITCH_DECLARE(void *) switch_core_hash_find_locked(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
 
-SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *depricate_me, switch_hash_t *hash);
-SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t *hi);
-SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key, switch_ssize_t *klen, void **val);
+SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *depricate_me, _In_ switch_hash_t *hash);
+SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(_In_ switch_hash_index_t *hi);
+SWITCH_DECLARE(void) switch_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen) const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val);
 
 ///\}
 
index 248f551fe57144f900737f86961092571a52961a..1fb86b25f608ae833345033635c82f4bdf68c8b4 100644 (file)
@@ -319,6 +319,8 @@ SWITCH_END_EXTERN_C
 #define _Post_z_
 #define _Out_cap_(x)
 #define _Out_z_cap_(x)
+#define _Out_ptrdiff_cap_(x)
+#define _Out_opt_ptrdiff_cap_(x)
 #endif
 
 
index ea6a8849fa85cd64435b50a8feff13e2e6251e29..19d16aaeee132ce6795cb515013b714bd6d5f39a 100644 (file)
@@ -3578,7 +3578,7 @@ SWITCH_STANDARD_API(conf_api_main)
        argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 
        /* try to find a command to execute */
-       if (argc) {
+       if (argc && argv[0]) {
                conference_obj_t *conference = NULL;
 
                if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[0]))) {
index fa1f651b2a6d5e8208e87201e4bce37a9e13022c..1ca793eefef23f26f0ae7356a69cdba1b29739b7 100644 (file)
@@ -208,7 +208,7 @@ SWITCH_STANDARD_APP(fifo_function)
 
     mydata = switch_core_session_strdup(session, data);
     switch_assert(mydata);
-    if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
+    if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2 || !argv[0]) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
         return;
     }