Changeset 25302 for lang/cplusplus/i3

Show
Ignore:
Timestamp:
11/29/08 02:41:55 (6 weeks ago)
Author:
saturday06
Message:

analyzer

Location:
lang/cplusplus/i3/trunk/src/os-windows
Files:
1 added
4 modified
1 moved

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/i3/trunk/src/os-windows/Os.cpp

    r25007 r25302  
    44namespace i3 
    55{ 
    6 TCHAR config_dir_path[MAX_PATH] = {}; 
     6 
     7TCHAR config_dir_path[WINDOWS_MAX_PATH] = {}; 
     8 
    79void init_config_dir_path() 
    810{ 
     
    5860    return config_dir_path; 
    5961} 
     62 
    6063void init_windows_gettext() 
    6164{ 
     
    6770    } 
    6871 
    69     TCHAR locale_dir[3000] = {}; 
     72    TCHAR locale_dir[WINDOWS_MAX_PATH] = {}; 
    7073    DWORD result = GetModuleFileName( 
    7174                       GetModuleHandle(NULL), 
  • lang/cplusplus/i3/trunk/src/os-windows/WindowsCommon.h

    r23158 r25302  
    1010void init_hInstance(); 
    1111HINSTANCE get_hInstance(); // hInstance cache 
     12 
     13#if defined(UNICODE) || defined(_UNICODE) 
     14const size_t WINDOWS_MAX_PATH = 3000; 
     15#else 
     16const size_t WINDOWS_MAX_PATH = MAX_PATH; 
     17#endif 
     18 
    1219} 
    1320 
  • lang/cplusplus/i3/trunk/src/os-windows/msvc/iconv.h

    r19422 r25302  
    22   http://yukihiro.nakadaira.googlepages.com/#win_iconv 
    33*/ 
    4 #ifndef WIN_ICONV_H__64865792 
    5 #define WIN_ICONV_H__64865792 
     4#ifndef WIN_ICONV_H 
     5#define WIN_ICONV_H 1 
    66 
    77#include <stddef.h> 
     
    1212#endif 
    1313 
    14     typedef void* iconv_t; 
    15     iconv_t iconv_open(const char *tocode, const char *fromcode); 
    16     int iconv_close(iconv_t cd); 
    17     size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); 
     14  typedef void* iconv_t; 
     15  iconv_t iconv_open(const char *tocode, const char *fromcode); 
     16  int iconv_close(iconv_t cd); 
     17  size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); 
    1818 
    1919#ifdef __cplusplus 
     
    2121#endif 
    2222 
    23 #endif //WIN_ICONV_H__64865792 
     23#endif //WIN_ICONV_H 
  • lang/cplusplus/i3/trunk/src/os-windows/msvc/libintl.h

    r24539 r25302  
    348348extern int vsprintf (char *, const char *, va_list); 
    349349 
    350 #if 1 
     350#if 0 
    351351 
    352352#undef snprintf 
     
    410410                                      const char *curr_prefix); 
    411411 
    412 /* wchar_t support */ 
    413 #ifdef _INTL_REDIRECT_INLINE 
    414 #define WCHAR_LIBINTL_STATIC_INLINE static inline 
    415 #elif defined(_MSC_VER) 
    416 #define WCHAR_LIBINTL_STATIC_INLINE static _inline 
    417 #else 
    418 #define WCHAR_LIBINTL_STATIC_INLINE static 
    419 #endif 
    420  
    421 #define wgettext(msgid) wgettext_(msgid, L##msgid) 
    422 #define dwgettext(domainname, msgid) dwgettext_(domainname, msgid, L##msgid) 
    423 #define dcwgettext(domainname, msgid, category) dwgettext_(domainname, msgid, category, L##msgid) 
    424 #define nwgettext(msgid1, msgid2, n) nwgettext_(msgid1, msgid2, n, L##msgid1,  L##msgid2) 
    425 #define dnwgettext(domainname, msgid1, msgid2, n) dnwgettext_(domainname, msgid1, msgid2, n, L##msgid1,  L##msgid2) 
    426 #define dcnwgettext(domainname, msgid1, msgid2, n, category) dnwgettext_(domainname, msgid1, msgid2, n, L##msgid1,  L##msgid2) 
    427  
    428 WCHAR_LIBINTL_STATIC_INLINE  
    429 const wchar_t *wgettext_ (const char *msgid, const wchar_t *wmsgid) 
    430 { 
    431   const char *translated = gettext (msgid); 
    432   return translated != msgid ? (const wchar_t *)translated : wmsgid; 
    433 } 
    434  
    435 WCHAR_LIBINTL_STATIC_INLINE  
    436 const wchar_t *dwgettext_ (const char *domainname, const char *msgid, const wchar_t *wmsgid) 
    437 { 
    438   const char *translated = dgettext (domainname, msgid); 
    439   return translated != msgid ? (const wchar_t *)translated : wmsgid; 
    440 } 
    441  
    442 WCHAR_LIBINTL_STATIC_INLINE  
    443 const wchar_t *dcwgettext_ (const char *domainname, const char *msgid, int category,  const wchar_t *wmsgid) 
    444 { 
    445   const char *translated = dcgettext (domainname, msgid, category); 
    446   return translated != msgid ? (const wchar_t *)translated : wmsgid; 
    447 } 
    448  
    449 WCHAR_LIBINTL_STATIC_INLINE  
    450 const wchar_t *nwgettext_ (const char *msgid1, const char *msgid2, unsigned long n, const wchar_t *wmsgid1, const wchar_t *wmsgid2) 
    451 { 
    452   const char *translated = ngettext (msgid1, msgid2, n); 
    453   return translated == msgid1 ? wmsgid1 : (translated == msgid2 ? wmsgid2 : (const wchar_t *)translated); 
    454 } 
    455  
    456 WCHAR_LIBINTL_STATIC_INLINE  
    457 const wchar_t *dnwgettext_ (const char *domainname, const char *msgid1, const char *msgid2, unsigned long n, const wchar_t *wmsgid1, const wchar_t *wmsgid2) 
    458 { 
    459   const char *translated = dngettext (domainname, msgid1, msgid2, n); 
    460   return translated == msgid1 ? wmsgid1 : (translated == msgid2 ? wmsgid2 : (const wchar_t *)translated); 
    461 } 
    462  
    463 WCHAR_LIBINTL_STATIC_INLINE  
    464 const wchar_t *dcnwgettext_ (const char *domainname, const char *msgid1, const char *msgid2, unsigned long n, const wchar_t *wmsgid1, const wchar_t *wmsgid2, int category) 
    465 { 
    466   const char *translated = dcngettext (domainname, msgid1, msgid2, n, category); 
    467   return translated == msgid1 ? wmsgid1 : (translated == msgid2 ? wmsgid2 : (const wchar_t *)translated); 
    468 } 
    469412 
    470413#ifdef __cplusplus 
     
    472415#endif 
    473416 
    474 /* MS Windows Wide character support.  */ 
    475 #if (defined(WIN32) || defined(_WIN32) || defined(_WIN64) || defined(_WIN32_WCE)) \ 
    476     && !defined(__CYGWIN__) && (defined(UNICODE) || defined(_UNICODE)) 
    477  
    478 #include <windows.h> 
    479  
    480 #ifdef __cplusplus 
    481 extern "C" 
    482 { 
    483 #endif 
    484  
    485 #undef bindtextdomain 
    486 #define bindtextdomain windows_bindtextdomain 
    487 #define wbindtextdomain windows_wbindtextdomain 
    488  
    489 /* http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx */ 
    490 #define WCHAR_LIBINTL_MAX_PATH 33000 
    491  
    492 WCHAR_LIBINTL_STATIC_INLINE 
    493 const wchar_t *windows_wbindtextdomain (const char *domainname, const wchar_t *dirname16) 
    494 { 
    495   char *dirname8 = NULL; 
    496   unsigned int num_elements = 0; 
    497  
    498  
    499   if (wcslen (dirname16) >= WCHAR_LIBINTL_MAX_PATH) 
    500     { 
    501       return NULL; 
    502     } 
    503  
    504   num_elements = WideCharToMultiByte (CP_UTF8, 0, dirname16, -1, NULL, 0, 0, 0); 
    505   if (num_elements == 0) 
    506     { 
    507       return NULL; 
    508     } 
    509  
    510   dirname8 = (char *)malloc (num_elements); 
    511   if (!dirname8) 
    512     { 
    513       return NULL; 
    514     } 
    515  
    516   if (0 == WideCharToMultiByte (CP_UTF8, 0, dirname16, -1, dirname8, num_elements, 0, 0)) 
    517     { 
    518       free (dirname8); 
    519       return NULL; 
    520     } 
    521  
    522   if (libintl_bindtextdomain (domainname, dirname8) == NULL) 
    523     { 
    524       free (dirname8); 
    525       return NULL; 
    526     } 
    527  
    528   free (dirname8); 
    529  
    530   return dirname16; 
    531 } 
    532  
    533 WCHAR_LIBINTL_STATIC_INLINE 
    534 const char *windows_bindtextdomain(const char *domainname, const char *dirname) 
    535 { 
    536   wchar_t *dirname16 = NULL; 
    537   unsigned int num_elements = 0; 
    538   UINT acp = 0; 
    539    
    540   acp = GetACP (); 
    541    
    542   num_elements = MultiByteToWideChar (acp, 0, dirname, -1, NULL, 0); 
    543   if (num_elements == 0) 
    544     { 
    545       return NULL; 
    546     } 
    547  
    548   if (num_elements >= WCHAR_LIBINTL_MAX_PATH) 
    549     { 
    550       return NULL; 
    551     } 
    552  
    553   dirname16 = (wchar_t *)malloc (num_elements * sizeof(wchar_t)); 
    554  
    555   if (0 == MultiByteToWideChar (acp, 0, dirname, -1, 
    556                                 dirname16, num_elements)) 
    557     { 
    558       free (dirname16); 
    559       return NULL; 
    560     } 
    561  
    562   if (windows_wbindtextdomain (domainname, dirname16) == NULL) 
    563     { 
    564       free (dirname16); 
    565       return NULL; 
    566     } 
    567  
    568   free (dirname16); 
    569  
    570   return dirname; 
    571 } 
    572  
    573 #ifdef __cplusplus 
    574 } 
    575 #endif 
    576  
    577 #endif /*  (defined(WIN32) || defined(_WIN32) || defined(_WIN64) || defined(_WIN32_WCE)) \ 
    578     && !defined(__CYGWIN__) && (defined(UNICODE) || defined(_UNICODE)) */ 
    579  
    580 #undef WCHAR_LIBINTL_MAX_PATH 
    581 #undef WCHAR_LIBINTL_STATIC_INLINE  
    582  
    583417#endif /* libintl.h */ 
    584  
    585  
  • lang/cplusplus/i3/trunk/src/os-windows/msvc/win_iconv.c

    r24774 r25302  
    3535#ifdef _MSC_VER 
    3636__declspec (thread) int errno = 0; 
     37#elif (MINGW32_MAJOR_VERSION >= 4) 
     38__thread int errno = 0; 
    3739#else 
    38 //_thread int errno = 0; 
    39 int errno = 0; 
     40#error "tls required" 
    4041#endif 
    4142