[Freeswitch-svn] [commit] r5458 - in freeswitch/trunk/src: . include

Freeswitch SVN mikej at freeswitch.org
Sun Jun 24 16:37:41 EDT 2007


Author: mikej
Date: Sun Jun 24 16:37:41 2007
New Revision: 5458

Modified:
   freeswitch/trunk/src/include/switch_apr.h
   freeswitch/trunk/src/switch_apr.c

Log:
change the directory walking functions to pass it the buffer.

Modified: freeswitch/trunk/src/include/switch_apr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_apr.h	(original)
+++ freeswitch/trunk/src/include/switch_apr.h	Sun Jun 24 16:37:41 2007
@@ -744,7 +744,7 @@
 
 SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t **new_dir, const char *dirname, switch_memory_pool_t *pool);
 SWITCH_DECLARE(switch_status_t) switch_dir_close(switch_dir_t *thedir);
-SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir);
+SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *buf, switch_size_t len);
 
 /** @} */
 

Modified: freeswitch/trunk/src/switch_apr.c
==============================================================================
--- freeswitch/trunk/src/switch_apr.c	(original)
+++ freeswitch/trunk/src/switch_apr.c	Sun Jun 24 16:37:41 2007
@@ -402,18 +402,19 @@
 	return apr_dir_close(thedir->dir_handle);
 }
 
-SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir) 
+SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *buf, switch_size_t len) 
 {
 	const char *fname = NULL;
 	apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
 	while (apr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) {
 		if (thedir->finfo.filetype != APR_REG)
 			continue;
-		fname = thedir->finfo.fname;
-		if (!fname)
-			fname = thedir->finfo.name;
-		if (!fname)
+		if (thedir->finfo.fname) {
+			switch_copy_string(buf, thedir->finfo.fname, len);
+			fname = buf;
+		} else {
 			continue;
+		}
 	}
 	return fname;
 }



More information about the Freeswitch-svn mailing list