Changeset 1074


Ignore:
Timestamp:
Mar 16, 2007 9:25:47 AM (17 years ago)
Author:
bennylp
Message:

Implemented ticket #185: Added pj_file_flush() to file I/O API to flush file buffers

Location:
pjproject/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/file_io.h

    r974 r1074  
    164164                                    pj_off_t *pos); 
    165165 
     166/** 
     167 * Flush file buffers. 
     168 * 
     169 * @param fd            The file descriptor. 
     170 * 
     171 * @return              PJ_SUCCESS or the appropriate error code on error. 
     172 */ 
     173PJ_DECL(pj_status_t) pj_file_flush(pj_oshandle_t fd); 
     174 
     175 
    166176/** @} */ 
    167177 
  • pjproject/trunk/pjlib/src/pj/config.c

    r995 r1074  
    2222 
    2323static const char *id = "config.c"; 
    24 const char *PJ_VERSION = "0.5.10.1-trunk"; 
     24const char *PJ_VERSION = "0.5.10.2-trunk"; 
    2525 
    2626PJ_DEF(void) pj_dump_config(void) 
  • pjproject/trunk/pjlib/src/pj/file_io_ansi.c

    r974 r1074  
    155155} 
    156156 
     157PJ_DEF(pj_status_t) pj_file_flush(pj_oshandle_t fd) 
     158{ 
     159    int rc; 
    157160 
     161    rc = fflush((FILE*)fd); 
     162    if (rc == EOF) { 
     163        return PJ_RETURN_OS_ERROR(errno); 
     164    } 
     165 
     166    return PJ_SUCCESS; 
     167} 
  • pjproject/trunk/pjlib/src/pj/file_io_win32.c

    r974 r1074  
    205205} 
    206206 
     207PJ_DEF(pj_status_t) pj_file_flush(pj_oshandle_t fd) 
     208{ 
     209    BOOL rc; 
     210 
     211    rc = FlushFileBuffers(fd); 
     212 
     213    if (!rc) { 
     214        DWORD dwStatus = GetLastError(); 
     215        if (dwStatus != 0) 
     216            return PJ_RETURN_OS_ERROR(dwStatus); 
     217    } 
     218 
     219    return PJ_SUCCESS; 
     220} 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r992 r1074  
    291291        pj_ssize_t size = len; 
    292292        pj_file_write(pjsua_var.log_file, buffer, &size); 
     293        pj_file_flush(pjsua_var.log_file); 
    293294    } 
    294295 
Note: See TracChangeset for help on using the changeset viewer.