From: <sp...@us...> - 2004-02-28 21:16:58
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30850/src/core Modified Files: rchar.cpp Log Message: The linux build was broken (Mikko, have you tested the CVT macron in rchar.cpp ;-)?) Index: rchar.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/rchar.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rchar.cpp 28 Feb 2004 07:39:44 -0000 1.3 --- rchar.cpp 28 Feb 2004 20:59:24 -0000 1.4 *************** *** 32,37 **** #if !defined(_RTK_WIN32_) && defined(UNICODE) #define CVT(fmt_len) \ ! RCHAR *fmt2 = (RCHAR*)alloca(fmt_len); \ const RCHAR *s_ptr = fmt; RCHAR *d_ptr = fmt2; \ bool check = false; \ --- 32,54 ---- #if !defined(_RTK_WIN32_) && defined(UNICODE) + /* + I'm not sure if this is faster then the old one! + Write the value if check in EACH cycle? + What about this: + [...] + while (*s_ptr) { + if(s_ptr[0] == '%' && s_ptr[1] == 's') { + *d_ptr++ = '%'; + *d_ptr++ = 'S'; + s_ptr++; + } else { + *d_ptr++ = *s_ptr++; + } + } + [...] + IMHO smaller and faster + */ #define CVT(fmt_len) \ ! RCHAR *fmt2 = (RCHAR*)alloca((fmt_len)*sizeof(RCHAR)); \ const RCHAR *s_ptr = fmt; RCHAR *d_ptr = fmt2; \ bool check = false; \ *************** *** 46,50 **** *d_ptr++ = *s_ptr++; \ } \ ! } fmt = fmt2 // printf --- 63,69 ---- *d_ptr++ = *s_ptr++; \ } \ ! } \ ! *d_ptr = 0; \ ! fmt = fmt2 // printf *************** *** 58,62 **** int rvfprintf(FILE* f, const RCHAR* fmt, va_list args) { ! CVT(rstrlen(fmt)); return vfwprintf(f, fmt, args); } --- 77,81 ---- int rvfprintf(FILE* f, const RCHAR* fmt, va_list args) { ! CVT(rstrlen(fmt)+1); // +\0 return vfwprintf(f, fmt, args); } *************** *** 64,68 **** int rvprintf(const RCHAR* fmt, va_list args) { ! CVT(rstrlen(fmt)); return vfwprintf(stdout, fmt, args); } --- 83,87 ---- int rvprintf(const RCHAR* fmt, va_list args) { ! CVT(rstrlen(fmt)+1); // +\0 return vfwprintf(stdout, fmt, args); } *************** *** 99,103 **** int rvsscanf(const RCHAR* src, const RCHAR* fmt, va_list args) { ! CVT(rstrlen(fmt)); return vswscanf(src, fmt2, args); } --- 118,122 ---- int rvsscanf(const RCHAR* src, const RCHAR* fmt, va_list args) { ! CVT(rstrlen(fmt)); // +\0 return vswscanf(src, fmt2, args); } *************** *** 105,109 **** int rvfscanf(FILE* f, const RCHAR* fmt, va_list args) { ! CVT(rstrlen(fmt)); return vfwscanf(f, fmt2, args); } --- 124,128 ---- int rvfscanf(FILE* f, const RCHAR* fmt, va_list args) { ! CVT(rstrlen(fmt)); // +\0 return vfwscanf(f, fmt2, args); } *************** *** 111,115 **** int rvscanf(const RCHAR* fmt, va_list args) { ! CVT(rstrlen(fmt)); return vfwscanf(stdin, fmt2, args); } --- 130,134 ---- int rvscanf(const RCHAR* fmt, va_list args) { ! CVT(rstrlen(fmt)); // +\0 return vfwscanf(stdin, fmt2, args); } |