Changeset 24529

Show
Ignore:
Timestamp:
11/21/08 02:19:19 (7 weeks ago)
Author:
saturday06
Message:

君主online

Location:
lang/c/libintl-msvc
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/c/libintl-msvc/README.txt

    r24179 r24529  
    33to make libintl.lib for msvc 
    44 
    5 1. execute "1.sh". 
     51. execute "step1.sh". 
    66 
    7 sh 1.sh 
     7sh step1.sh 
    88 
    9 2. execute "2.bat". using Visual Studio Command Prompt 
     92. execute "step2.bat". using Visual Studio Command Prompt 
    1010 
    11 2.bat 
     11step2.bat 
    1212 
  • lang/c/libintl-msvc/libintl.h

    r24522 r24529  
    490490#define WCHAR_LIBINTL_MAX_PATH 33000 
    491491 
    492 WCHAR_LIBINTL_STATIC_INLINE const wchar_t* 
    493 windows_wbindtextdomain(const char* domainname, const wchar_t* dirname16) 
     492WCHAR_LIBINTL_STATIC_INLINE 
     493const wchar_t *windows_wbindtextdomain (const char* domainname, const wchar_t* dirname16) 
    494494{ 
    495495  char* dirname8 = NULL; 
     
    497497 
    498498 
    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); 
     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); 
    505505  if (num_elements == 0) 
    506506    { 
     
    508508    } 
    509509 
    510   dirname8 = (char*)malloc(num_elements); 
     510  dirname8 = (char *)malloc (num_elements); 
    511511  if (!dirname8) 
    512512    { 
     
    514514    } 
    515515 
    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); 
     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); 
    529529 
    530530  return dirname16; 
    531531} 
    532532 
    533 WCHAR_LIBINTL_STATIC_INLINE const char* 
    534 windows_bindtextdomain(const char* domainname, const char* dirname) 
     533WCHAR_LIBINTL_STATIC_INLINE 
     534const char *windows_bindtextdomain(const char* domainname, const char* dirname) 
    535535{ 
    536536  wchar_t* dirname16 = NULL; 
     
    538538  UINT acp = 0; 
    539539   
    540   acp = GetACP(); 
     540  acp = GetACP (); 
    541541   
    542   num_elements = MultiByteToWideChar(acp, 0, dirname, -1, NULL, 0); 
     542  num_elements = MultiByteToWideChar (acp, 0, dirname, -1, NULL, 0); 
    543543  if (num_elements == 0) 
    544544    { 
     
    551551    } 
    552552 
    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); 
     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); 
    569569 
    570570  return dirname; 
  • lang/c/libintl-msvc/recipes/loadmsgcat-windows.h

    r24522 r24529  
    1616 
    1717int 
    18 open_windows_utf8(const char *pathname8, int flags) 
     18open_windows_utf8 (const char *pathname8, int flags) 
    1919{ 
    20   wchar_t* pathname16 = NULL; 
     20  wchar_t *pathname16 = NULL; 
    2121  unsigned int num_elements = 0; 
    2222  int result = 0; 
    2323 
    24   num_elements = MultiByteToWideChar(CP_UTF8, 0, pathname8, -1, NULL, 0); 
     24  num_elements = MultiByteToWideChar (CP_UTF8, 0, pathname8, -1, NULL, 0); 
    2525  if (num_elements == 0) 
    2626    { 
     
    3535    } 
    3636 
    37   pathname16 = (wchar_t*)malloc(num_elements*sizeof(wchar_t)); 
    38   if (0 == MultiByteToWideChar(CP_UTF8, 0, pathname8, -1,  
    39                                pathname16, num_elements)) 
     37  pathname16 = (wchar_t *)malloc (num_elements*sizeof(wchar_t)); 
     38  if (0 == MultiByteToWideChar (CP_UTF8, 0, pathname8, -1,  
     39                                pathname16, num_elements)) 
    4040    { 
    41       free(pathname16); 
     41      free (pathname16); 
    4242      errno = EACCES; 
    4343      return -1; 
    4444    } 
    4545 
    46   result = _wopen(pathname16, flags); 
    47   free(pathname16); 
     46  result = _wopen (pathname16, flags); 
     47  free (pathname16); 
    4848  return result; 
    4949}