From: <sp...@us...> - 2004-02-26 20:18:15
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13628/src/core Modified Files: rchar.cpp Log Message: Minor fixes (eg namespace) Index: rchar.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/rchar.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rchar.cpp 23 Feb 2004 20:16:43 -0000 1.1 --- rchar.cpp 26 Feb 2004 20:02:16 -0000 1.2 *************** *** 4,25 **** #include <stdlib.h> RCHAR* rstrlwr(const RCHAR* str) { ! RCHAR* ret = (RCHAR*)malloc(sizeof(RCHAR)*rstrlen(str)); ! RCHAR* ptr = ret; ! while (*str) { *ptr++ = rtolower(*str++); ! } ! return ret; } RCHAR* rstrupr(const RCHAR* str) { ! RCHAR* ret = (RCHAR*)malloc(sizeof(RCHAR)*rstrlen(str)); ! RCHAR* ptr = ret; ! while (*str) { *ptr++ = rtoupper(*str++); ! } ! return ret; } --- 4,27 ---- #include <stdlib.h> + namespace Rtk { + RCHAR* rstrlwr(const RCHAR* str) { ! RCHAR* ret = (RCHAR*)malloc(sizeof(RCHAR)*rstrlen(str)); ! RCHAR* ptr = ret; ! while (*str) { *ptr++ = rtolower(*str++); ! } ! return ret; } RCHAR* rstrupr(const RCHAR* str) { ! RCHAR* ret = (RCHAR*)malloc(sizeof(RCHAR)*rstrlen(str)); ! RCHAR* ptr = ret; ! while (*str) { *ptr++ = rtoupper(*str++); ! } ! return ret; } *************** *** 28,42 **** static RCHAR* convert(const RCHAR* fmt) { ! RCHAR* fmt2 = rstrdup(fmt); ! RCHAR* ptr = fmt2; ! while (*ptr) { ! if (ptr[0] == '%' && ptr[1] == 's') { ! ptr[1] = 'S'; ! ptr+=2; ! } else { ! ptr++; } ! } ! return fmt2; } --- 30,44 ---- static RCHAR* convert(const RCHAR* fmt) { ! RCHAR* fmt2 = rstrdup(fmt); ! RCHAR* ptr = fmt2; ! while (*ptr) { ! if (ptr[0] == '%' && ptr[1] == 's') { ! ptr[1] = 'S'; ! ptr+=2; ! } else { ! ptr++; ! } } ! return fmt2; } *************** *** 45,95 **** int rvsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vswprintf(dst, max_len, fmt2, args); ! free(fmt2); ! return ret; } int rvfprintf(FILE* f, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwprintf(f, fmt2, args); ! free(fmt2); ! return ret; } int rvprintf(const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwprintf(stdout, fmt2, args); ! free(fmt2); ! return ret; } int rsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvsnprintf(dst, max_len, fmt, args); ! va_end(args); ! return ret; } int rfprintf(FILE* f, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfprintf(f, fmt, args); ! va_end(args); ! return ret; } int rprintf(const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfprintf(stdout, fmt, args); ! va_end(args); ! return ret; } --- 47,97 ---- int rvsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vswprintf(dst, max_len, fmt2, args); ! free(fmt2); ! return ret; } int rvfprintf(FILE* f, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwprintf(f, fmt2, args); ! free(fmt2); ! return ret; } int rvprintf(const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwprintf(stdout, fmt2, args); ! free(fmt2); ! return ret; } int rsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvsnprintf(dst, max_len, fmt, args); ! va_end(args); ! return ret; } int rfprintf(FILE* f, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfprintf(f, fmt, args); ! va_end(args); ! return ret; } int rprintf(const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfprintf(stdout, fmt, args); ! va_end(args); ! return ret; } *************** *** 98,148 **** int rvsscanf(const RCHAR* src, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vswscanf(src, fmt2, args); ! free(fmt2); ! return ret; } int rvfscanf(FILE* f, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwscanf(f, fmt2, args); ! free(fmt2); ! return ret; } int rvscanf(const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwscanf(stdin, fmt2, args); ! free(fmt2); ! return ret; } int rsscanf(const RCHAR* src, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvsscanf(src, fmt, args); ! va_end(args); ! return ret; } int rfscanf(FILE* f, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfscanf(f, fmt, args); ! va_end(args); ! return ret; } int rscanf(const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfscanf(stdin, fmt, args); ! va_end(args); ! return ret; } --- 100,150 ---- int rvsscanf(const RCHAR* src, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vswscanf(src, fmt2, args); ! free(fmt2); ! return ret; } int rvfscanf(FILE* f, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwscanf(f, fmt2, args); ! free(fmt2); ! return ret; } int rvscanf(const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwscanf(stdin, fmt2, args); ! free(fmt2); ! return ret; } int rsscanf(const RCHAR* src, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvsscanf(src, fmt, args); ! va_end(args); ! return ret; } int rfscanf(FILE* f, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfscanf(f, fmt, args); ! va_end(args); ! return ret; } int rscanf(const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfscanf(stdin, fmt, args); ! va_end(args); ! return ret; } *************** *** 150,151 **** --- 152,155 ---- #endif /* !UNICODE */ + + } // namespace Rtk |