add record overwrite

This commit is contained in:
Anthony Minessale
2010-10-26 19:34:47 -05:00
parent e10bc0a965
commit 17ac6ba9c6
5 changed files with 52 additions and 14 deletions
@@ -58,7 +58,7 @@ static switch_status_t native_file_file_open(switch_file_handle_t *handle, const
if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
flags |= SWITCH_FOPEN_WRITE | SWITCH_FOPEN_CREATE;
if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) {
if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND) || switch_test_flag(handle, SWITCH_FILE_WRITE_OVER)) {
flags |= SWITCH_FOPEN_READ;
} else {
flags |= SWITCH_FOPEN_TRUNCATE;
+3 -1
View File
@@ -82,7 +82,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
}
if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) {
if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND) || switch_test_flag(handle, SWITCH_FILE_WRITE_OVER)) {
mode += SFM_RDWR;
} else {
mode += SFM_WRITE;
@@ -208,6 +208,8 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) {
handle->pos = sf_seek(context->handle, 0, SEEK_END);
} else if (switch_test_flag(handle, SWITCH_FILE_WRITE_OVER)) {
handle->pos = sf_seek(context->handle, 0, SEEK_SET);
} else {
sf_count_t frames = 0;
sf_command(context->handle, SFC_FILE_TRUNCATE, &frames, sizeof(frames));