Changeset 6646 for trunk/src


Ignore:
Timestamp:
Sep 5, 2001, 2:58:00 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

Location:
trunk/src
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/DPlayX/initterm.cpp

    r5135 r6646  
    1 /*
     1/* $Id: initterm.cpp,v 1.7 2001-09-05 12:51:21 bird Exp $
     2 *
    23 * DLL entry point
    34 *
     
    6970
    7071         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    71  
     72
    7273         dllHandle = RegisterLxDll(hModule, DPLAYX_LibMain, (PVOID)&_Resource_PEResTab);
    7374         if(dllHandle == 0)
  • trunk/src/ddraw/initterm.cpp

    r5326 r6646  
    1 /*
     1/* $Id: initterm.cpp,v 1.19 2001-09-05 12:50:39 bird Exp $
     2 *
    23 * DLL entry point
    34 *
     
    9192      case 0 :
    9293      {
    93              APIRET rc;
    94                
     94         APIRET rc;
     95
    9596#ifdef __IBMCPP__
    9697         ctordtorInit();
     
    99100         char *endofpath = strrchr(ddrawPath, '\\');
    100101         if (endofpath)
    101                         *(endofpath+1) = '\0';
     102            *(endofpath+1) = '\0';
    102103
    103104         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
     
    107108                                   IMAGE_SUBSYSTEM_WINDOWS_GUI);
    108109         if (dllHandle == 0)
    109                         return 0UL;
     110            return 0UL;
    110111
    111112         rc = DosExitList(EXITLIST_NONCOREDLL | EXLST_ADD, cleanup);
    112113         if (rc)
    113                         return 0UL;
     114            return 0UL;
    114115
    115116         break;
     
    117118      case 1 :
    118119         if(dllHandle) {
    119                         UnregisterLxDll(dllHandle);
     120            UnregisterLxDll(dllHandle);
    120121         }
    121122         break;
  • trunk/src/ddraw/os2fsdd.cpp

    r5330 r6646  
    1 /*
     1/* $Id: os2fsdd.cpp,v 1.2 2001-09-05 12:50:39 bird Exp $
     2 *
    23 * Few routines for full-screen DirectDraw on OS/2
    34 *
  • trunk/src/driverdll/testdrv.cpp

    r6457 r6646  
     1/* $Id: testdrv.cpp,v 1.3 2001-09-05 12:52:27 bird Exp $ */
    12//******************************************************************************
    23//******************************************************************************
     
    1617#define INCL_DOSPROCESS          /* DOS Process values       */
    1718#define INCL_DOSMISC             /* DOS Miscellanous values  */
    18 #include <os2wrap.h>             //Odin32 OS/2 api wrappers
     19#include <os2wrap.h>             //Odin32 OS/2 api wrappers
    1920
    2021#include <winconst.h>
     
    2425#include <win\winioctl.h>
    2526
    26 #define TESTDRV_CATEGORY        0x40
     27#define TESTDRV_CATEGORY    0x40
    2728
    2829//******************************************************************************
     
    5455
    5556tryopen:
    56   rc = DosOpen( "TESTDRV$",                     /* File path name */
    57                 &hfFileHandle,                  /* File handle */
    58                 &ulAction,                      /* Action taken */
    59                 0,
    60                 FILE_NORMAL,
    61                 FILE_OPEN,
    62                 sharetype,
    63                 0L);                            /* No extended attribute */
     57  rc = DosOpen( "TESTDRV$",                     /* File path name */
     58                &hfFileHandle,                  /* File handle */
     59                &ulAction,                      /* Action taken */
     60            0,
     61            FILE_NORMAL,
     62            FILE_OPEN,
     63            sharetype,
     64                0L);                            /* No extended attribute */
    6465
    6566  if(rc == ERROR_TOO_MANY_OPEN_FILES) {
     
    6768   LONG  ReqCount = 32;
    6869
    69         rc = DosSetRelMaxFH(&ReqCount, &CurMaxFH);
    70         if(rc) {
    71                 dprintf(("DosSetRelMaxFH returned %d", rc));
    72                 return rc;
    73         }
    74         dprintf(("DosOpen failed -> increased nr open files to %d", CurMaxFH));
    75         goto tryopen;
     70    rc = DosSetRelMaxFH(&ReqCount, &CurMaxFH);
     71    if(rc) {
     72        dprintf(("DosSetRelMaxFH returned %d", rc));
     73        return rc;
     74    }
     75    dprintf(("DosOpen failed -> increased nr open files to %d", CurMaxFH));
     76    goto tryopen;
    7677  }
    7778
    7879  if(rc == NO_ERROR) {
    79         return hfFileHandle;
     80        return hfFileHandle;
    8081  }
    8182  else  return -1;
     
    105106  *lpBytesReturned = nOutBufferSize;
    106107
    107   rc = DosDevIOCtl(hDevice, TESTDRV_CATEGORY, ioctl, 
     108  rc = DosDevIOCtl(hDevice, TESTDRV_CATEGORY, ioctl,
    108109                   lpInBuffer, nInBufferSize, &nInBufferSize,
    109110                   lpOutBuffer, nOutBufferSize, lpBytesReturned);
  • trunk/src/dsound/initterm.cpp

    r5305 r6646  
    1 /*
     1/* $Id: initterm.cpp,v 1.17 2001-09-05 12:53:02 bird Exp $
     2 *
    23 * DLL entry point
    34 *
  • trunk/src/gdi32/initgdi32.cpp

    r6467 r6646  
    1 /*
     1/* $Id: initgdi32.cpp,v 1.5 2001-09-05 12:53:52 bird Exp $
     2 *
    23 * DLL entry point
    34 *
     
    3435#include <odinlx.h>
    3536#include <misc.h>       /*PLF Wed  98-03-18 23:18:15*/
    36 #define DBG_LOCALLOG    DBG_initterm
     37#define DBG_LOCALLOG    DBG_initterm
    3738#include "dbglocal.h"
    3839#include "region.h"
     
    5152   {
    5253   case DLL_PROCESS_ATTACH:
    53         return TRUE;
     54    return TRUE;
    5455
    5556   case DLL_THREAD_ATTACH:
    5657   case DLL_THREAD_DETACH:
    57         return TRUE;
     58    return TRUE;
    5859
    5960   case DLL_PROCESS_DETACH:
    60         ctordtorTerm();
    61         return TRUE;
     61    ctordtorTerm();
     62    return TRUE;
    6263   }
    6364   return FALSE;
     
    8889         InitializeKernel32();
    8990         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    90         if(InitRegionSpace() == FALSE) {
    91                 return 0UL;
     91    if(InitRegionSpace() == FALSE) {
     92        return 0UL;
    9293         }
    93         dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&gdi32_PEResTab,
     94    dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&gdi32_PEResTab,
    9495                                   GDI32_MAJORIMAGE_VERSION, GDI32_MINORIMAGE_VERSION,
    9596                                   IMAGE_SUBSYSTEM_NATIVE);
    96          if(dllHandle == 0) 
    97                 return 0UL;
     97         if(dllHandle == 0)
     98        return 0UL;
    9899
    99100         dprintf(("gdi32 init %s %s (%x)", __DATE__, __TIME__, inittermGdi32));
     
    102103      case 1 :
    103104         if(dllHandle) {
    104                 UnregisterLxDll(dllHandle);
     105        UnregisterLxDll(dllHandle);
    105106         }
    106107         break;
  • trunk/src/gdi32/initterm.cpp

    r6467 r6646  
    1 /*
     1/* $Id: initterm.cpp,v 1.20 2001-09-05 12:53:52 bird Exp $
     2 *
    23 * DLL entry point
    34 *
     
    3435#include <odinlx.h>
    3536#include <misc.h>       /*PLF Wed  98-03-18 23:18:15*/
    36 #define DBG_LOCALLOG    DBG_initterm
     37#define DBG_LOCALLOG    DBG_initterm
    3738#include "dbglocal.h"
    3839#include "region.h"
  • trunk/src/imagehlp/initterm.cpp

    r5135 r6646  
    1 /*
     1/* $Id: initterm.cpp,v 1.7 2001-09-05 12:55:49 bird Exp $
     2 *
    23 * DLL entry point
    34 *
     
    5354   case DLL_THREAD_ATTACH:
    5455   case DLL_THREAD_DETACH:
    55         return IMAGEHLP_LibMain(hinstDLL, fdwReason, fImpLoad);
     56    return IMAGEHLP_LibMain(hinstDLL, fdwReason, fImpLoad);
    5657
    5758   case DLL_PROCESS_DETACH:
    58         IMAGEHLP_LibMain(hinstDLL, fdwReason, fImpLoad);
    59         ctordtorTerm();
    60         return TRUE;
     59    IMAGEHLP_LibMain(hinstDLL, fdwReason, fImpLoad);
     60    ctordtorTerm();
     61    return TRUE;
    6162   }
    6263   return FALSE;
     
    8889         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    8990
    90         dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
    91          if(dllHandle == 0) 
    92                 return 0UL;
     91    dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
     92         if(dllHandle == 0)
     93        return 0UL;
    9394
    9495         break;
    9596      case 1 :
    9697         if(dllHandle) {
    97                 UnregisterLxDll(dllHandle);
     98        UnregisterLxDll(dllHandle);
    9899         }
    99100         break;
  • trunk/src/kernel32/codepage.cpp

    r5764 r6646  
    1 /*
     1/* $Id: codepage.cpp,v 1.17 2001-09-05 12:57:58 bird Exp $
     2 *
    23 * Code page functions
    34 *
    45 * Based on Wine code (memory\codepage.c)
    5  * 
     6 *
    67 * Copyright 2000 Alexandre Julliard
    78 *
     
    2526#include "codepage.h"
    2627
    27 #define DBG_LOCALLOG    DBG_codepage
     28#define DBG_LOCALLOG    DBG_codepage
    2829#include "dbglocal.h"
    2930#endif
     
    9293
    9394    if (!ansi_cptable) init_codepages();  /* just in case */
    94    
     95
    9596    if ((table = get_locale_cp( lcid, LOCALE_IDEFAULTANSICODEPAGE ))) ansi_cptable = table;
    9697    if ((table = get_locale_cp( lcid, LOCALE_IDEFAULTMACCODEPAGE ))) mac_cptable = table;
     
    197198#endif
    198199
    199     if (!table) 
     200    if (!table)
    200201    {
    201202        SetLastError( ERROR_INVALID_PARAMETER );
     
    366367 *   dstlen [in]  Length of destination buffer
    367368 *   defchar [in] Default character to use for conversion if no exact
    368  *                  conversion can be made
     369 *          conversion can be made
    369370 *   used [out]   Set if default character was used in the conversion
    370371 *
  • trunk/src/kernel32/hmmailslot.cpp

    r5587 r6646  
    1 /*
     1/* $Id: hmmailslot.cpp,v 1.2 2001-09-05 12:57:58 bird Exp $
     2 *
    23 * Win32 mailslot APIs
    34 *
     
    2223#include "dbglocal.h"
    2324
    24 HMMailSlotInfo::HMMailSlotInfo(LPCSTR lpszName, HANDLE hPipe, DWORD nMaxMessageSize, 
     25HMMailSlotInfo::HMMailSlotInfo(LPCSTR lpszName, HANDLE hPipe, DWORD nMaxMessageSize,
    2526                               DWORD lReadTimeout, BOOL fServer,
    2627                               LPSECURITY_ATTRIBUTES lpSecurityAttributes)
     
    129130  strcat(pipename, lpName);
    130131  //TODO: lookup name and fail if exists
    131   hPipe = CreateNamedPipeA(pipename, PIPE_ACCESS_INBOUND, 
    132                            PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_NOWAIT, 
    133                            PIPE_UNLIMITED_INSTANCES, MAILSLOT_SIZE, 
    134                            (nMaxMessageSize) ? nMaxMessageSize : MAILSLOT_SIZE, 
     132  hPipe = CreateNamedPipeA(pipename, PIPE_ACCESS_INBOUND,
     133                           PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_NOWAIT,
     134                           PIPE_UNLIMITED_INSTANCES, MAILSLOT_SIZE,
     135                           (nMaxMessageSize) ? nMaxMessageSize : MAILSLOT_SIZE,
    135136                           lReadTimeout, lpSecurityAttributes);
    136137
    137   if(hPipe == INVALID_HANDLE_VALUE) { 
     138  if(hPipe == INVALID_HANDLE_VALUE) {
    138139      dprintf(("CreateMailslotA: unable to create pipe %s", pipename));
    139140      return FALSE;
     
    146147  }
    147148  else
    148   if(lReadTimeout != 0) { 
     149  if(lReadTimeout != 0) {
    149150     dprintf(("WARNING: timeout %x not supported", lReadTimeout));
    150151  }
     
    168169 * Variables :
    169170 * Result    :
    170  * Remark    : 
     171 * Remark    :
    171172 * Status    : NO_ERROR - API succeeded
    172173 *             other    - what is to be set in SetLastError
     
    202203                        pHMHandleData->dwFlags, 0);
    203204
    204   if(hPipe == INVALID_HANDLE_VALUE) { 
     205  if(hPipe == INVALID_HANDLE_VALUE) {
    205206      if(pipename[11] == '*') {
    206207          dprintf(("pipename with asterix not supported; connect only to one mailslot"));
  • trunk/src/kernel32/initkernel32.cpp

    r6468 r6646  
    1 /*
     1/* $Id: initkernel32.cpp,v 1.7 2001-09-05 12:57:58 bird Exp $
     2 *
    23 * KERNEL32 DLL entry point
    34 *
     
    8485    APIRET rc;
    8586    ULONG  ulSysinfo, version[2];
    86    
     87
    8788    /*-------------------------------------------------------------------------*/
    8889    /* If ulFlag is zero then the DLL is being loaded so initialization should */
  • trunk/src/kernel32/initterm.cpp

    r6468 r6646  
    1 /*
     1/* $Id: initterm.cpp,v 1.63 2001-09-05 12:57:58 bird Exp $
     2 *
    23 * KERNEL32 DLL entry point
    34 *
     
    8889    APIRET rc;
    8990    ULONG  ulSysinfo, version[2];
    90    
     91
    9192    /*-------------------------------------------------------------------------*/
    9293    /* If ulFlag is zero then the DLL is being loaded so initialization should */
     
    122123                }
    123124            }
    124            
     125
    125126            rc = inittermKernel32(hModule, ulFlag);
    126127            break;
  • trunk/src/kernel32/mailslot.cpp

    r5587 r6646  
    1 /*
     1/* $Id: mailslot.cpp,v 1.2 2001-09-05 12:57:59 bird Exp $
     2 *
    23 * Win32 mailslot APIs
    34 *
     
    3738 *             If the function fails, the return value is INVALID_HANDLE_VALUE.
    3839 * Remark    :
    39  * Status    : 
     40 * Status    :
    4041 *
    4142 * Author    : SvL
     
    6667 *             If the function fails, the return value is INVALID_HANDLE_VALUE.
    6768 * Remark    :
    68  * Status    : 
     69 * Status    :
    6970 *
    7071 * Author    : SvL
     
    9697 * Result    : TRUE / FALSE
    9798 * Remark    :
    98  * Status    : 
     99 * Status    :
    99100 *
    100101 * Author    : SvL
     
    120121 * Result    : TRUE / FALSE
    121122 * Remark    :
    122  * Status    : 
     123 * Status    :
    123124 *
    124125 * Author    : SvL
  • trunk/src/kernel32/module.cpp

    r5587 r6646  
    1 /*
     1/* $Id: module.cpp,v 1.3 2001-09-05 12:57:59 bird Exp $
     2 *
    23 * GetBinaryTypeA/W (Wine Port)
    34 *
     
    1314#include <misc.h>
    1415
    15 #define DBG_LOCALLOG    DBG_module
     16#define DBG_LOCALLOG    DBG_module
    1617#include "dbglocal.h"
    1718
     
    3839      || (!(ReadFile(hfile, modtab, ne->ne_cmod*sizeof(WORD), &len, NULL)))
    3940      || (len != ne->ne_cmod*sizeof(WORD)) )
    40         goto broken;
     41    goto broken;
    4142
    4243    /* read imported names table */
     
    4546      || (!(ReadFile(hfile, nametab, ne->ne_enttab - ne->ne_imptab, &len, NULL)))
    4647      || (len != ne->ne_enttab - ne->ne_imptab) )
    47         goto broken;
     48    goto broken;
    4849
    4950    for (i=0; i < ne->ne_cmod; i++)
    5051    {
    51         LPSTR module = &nametab[modtab[i]];
    52         TRACE("modref: %.*s\n", module[0], &module[1]);
    53         if (!(strncmp(&module[1], "KERNEL", module[0])))
    54         { /* very old Windows file */
    55             MESSAGE("This seems to be a very old (pre-3.0) Windows executable. Expect crashes, especially if this is a real-mode binary !\n");
    56             type = SCS_WOW_BINARY;
    57             goto good;
    58         }
     52    LPSTR module = &nametab[modtab[i]];
     53    TRACE("modref: %.*s\n", module[0], &module[1]);
     54    if (!(strncmp(&module[1], "KERNEL", module[0])))
     55    { /* very old Windows file */
     56        MESSAGE("This seems to be a very old (pre-3.0) Windows executable. Expect crashes, especially if this is a real-mode binary !\n");
     57        type = SCS_WOW_BINARY;
     58        goto good;
     59    }
    5960    }
    6061
     
    107108    /* Seek to the start of the file and read the DOS header information.
    108109     */
    109     if (    SetFilePointer( hfile, 0, NULL, SEEK_SET ) != -1 
     110    if (    SetFilePointer( hfile, 0, NULL, SEEK_SET ) != -1
    110111         && ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL )
    111112         && len == sizeof(mz_header) )
     
    132133                     ( mz_header.e_lfarlc >= sizeof(IMAGE_DOS_HEADER) ) )
    133134                    if (    mz_header.e_lfanew >= sizeof(IMAGE_DOS_HEADER)
    134                          && SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ) != -1 
     135                         && SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ) != -1
    135136                         && ReadFile( hfile, magic, sizeof(magic), &len, NULL )
    136137                         && len == sizeof(magic) )
     
    162163                     * "extended header is a Windows executable (NE)
    163164                     * header."  This can mean either a 16-bit OS/2
    164                      * or a 16-bit Windows or even a DOS program 
     165                     * or a 16-bit Windows or even a DOS program
    165166                     * (running under a DOS extender).  To decide
    166167                     * which, we'll have to read the NE header.
     
    168169
    169170                     IMAGE_OS2_HEADER ne;
    170                      if (    SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ) != -1 
     171                     if (    SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ) != -1
    171172                          && ReadFile( hfile, &ne, sizeof(ne), &len, NULL )
    172173                          && len == sizeof(ne) )
     
    177178                         case 5:  *lpBinaryType = SCS_DOS_BINARY;   return TRUE;
    178179                         default: *lpBinaryType =
    179                                   MODULE_Decide_OS2_OldWin(hfile, &mz_header, &ne);
    180                                   return TRUE;
     180                  MODULE_Decide_OS2_OldWin(hfile, &mz_header, &ne);
     181                  return TRUE;
    181182                         }
    182183                     }
     
    187188                {
    188189                    /* Unknown extended header, but this file is nonetheless
    189                        DOS-executable.
     190               DOS-executable.
    190191                     */
    191192                    *lpBinaryType = SCS_DOS_BINARY;
    192                     return TRUE;
     193                return TRUE;
    193194                }
    194195            }
  • trunk/src/kernel32/ole2nls.cpp

    r6607 r6646  
    1 /*
    2  *      National Language Support library
     1/* $Id: ole2nls.cpp,v 1.14 2001-09-05 12:57:59 bird Exp $
    32 *
    4  *      Copyright 1995  Martin von Loewis
     3 *  National Language Support library
     4 *
     5 *  Copyright 1995  Martin von Loewis
    56 *      Copyright 1998  David Lee Lambert
    67 *      Copyright 2000  Julio César Gázquez
     
    4142#include <unicode.h>
    4243
    43 #define DBG_LOCALLOG    DBG_kernel32
     44#define DBG_LOCALLOG    DBG_kernel32
    4445#include "dbglocal.h"
    4546
     
    4950DEFAULT_DEBUG_CHANNEL(string);
    5051
    51 /* Locale name to id map. used by EnumSystemLocales, GetLocaleInfoA 
     52/* Locale name to id map. used by EnumSystemLocales, GetLocaleInfoA
    5253 * MUST contain all #defines from winnls.h
    5354 * last entry has NULL name, 0 id.
    54  */ 
    55 #define LOCALE_ENTRY(x) {#x,LOCALE_##x}
     55 */
     56#define LOCALE_ENTRY(x) {#x,LOCALE_##x}
    5657static const struct tagLOCALE_NAME2ID {
    57     const char  *name;
    58     LCTYPE      id;
     58    const char  *name;
     59    LCTYPE  id;
    5960} locale_name2id[]= {
    60         LOCALE_ENTRY(ILANGUAGE),
    61         LOCALE_ENTRY(SLANGUAGE),
    62         LOCALE_ENTRY(SENGLANGUAGE),
    63         LOCALE_ENTRY(SABBREVLANGNAME),
    64         LOCALE_ENTRY(SNATIVELANGNAME),
    65         LOCALE_ENTRY(ICOUNTRY),
    66         LOCALE_ENTRY(SCOUNTRY),
    67         LOCALE_ENTRY(SENGCOUNTRY),
    68         LOCALE_ENTRY(SABBREVCTRYNAME),
    69         LOCALE_ENTRY(SNATIVECTRYNAME),
    70         LOCALE_ENTRY(IDEFAULTLANGUAGE),
    71         LOCALE_ENTRY(IDEFAULTCOUNTRY),
    72         LOCALE_ENTRY(IDEFAULTCODEPAGE),
    73         LOCALE_ENTRY(IDEFAULTANSICODEPAGE),
    74         LOCALE_ENTRY(IDEFAULTMACCODEPAGE),
    75         LOCALE_ENTRY(SLIST),
    76         LOCALE_ENTRY(IMEASURE),
    77         LOCALE_ENTRY(SDECIMAL),
    78         LOCALE_ENTRY(STHOUSAND),
    79         LOCALE_ENTRY(SGROUPING),
    80         LOCALE_ENTRY(IDIGITS),
    81         LOCALE_ENTRY(ILZERO),
    82         LOCALE_ENTRY(INEGNUMBER),
    83         LOCALE_ENTRY(SNATIVEDIGITS),
    84         LOCALE_ENTRY(SCURRENCY),
    85         LOCALE_ENTRY(SINTLSYMBOL),
    86         LOCALE_ENTRY(SMONDECIMALSEP),
    87         LOCALE_ENTRY(SMONTHOUSANDSEP),
    88         LOCALE_ENTRY(SMONGROUPING),
    89         LOCALE_ENTRY(ICURRDIGITS),
    90         LOCALE_ENTRY(IINTLCURRDIGITS),
    91         LOCALE_ENTRY(ICURRENCY),
    92         LOCALE_ENTRY(INEGCURR),
    93         LOCALE_ENTRY(SDATE),
    94         LOCALE_ENTRY(STIME),
    95         LOCALE_ENTRY(SSHORTDATE),
    96         LOCALE_ENTRY(SLONGDATE),
    97         LOCALE_ENTRY(STIMEFORMAT),
    98         LOCALE_ENTRY(IDATE),
    99         LOCALE_ENTRY(ILDATE),
    100         LOCALE_ENTRY(ITIME),
    101         LOCALE_ENTRY(ITIMEMARKPOSN),
    102         LOCALE_ENTRY(ICENTURY),
    103         LOCALE_ENTRY(ITLZERO),
    104         LOCALE_ENTRY(IDAYLZERO),
    105         LOCALE_ENTRY(IMONLZERO),
    106         LOCALE_ENTRY(S1159),
    107         LOCALE_ENTRY(S2359),
    108         LOCALE_ENTRY(ICALENDARTYPE),
    109         LOCALE_ENTRY(IOPTIONALCALENDAR),
    110         LOCALE_ENTRY(IFIRSTDAYOFWEEK),
    111         LOCALE_ENTRY(IFIRSTWEEKOFYEAR),
    112         LOCALE_ENTRY(SDAYNAME1),
    113         LOCALE_ENTRY(SDAYNAME2),
    114         LOCALE_ENTRY(SDAYNAME3),
    115         LOCALE_ENTRY(SDAYNAME4),
    116         LOCALE_ENTRY(SDAYNAME5),
    117         LOCALE_ENTRY(SDAYNAME6),
    118         LOCALE_ENTRY(SDAYNAME7),
    119         LOCALE_ENTRY(SABBREVDAYNAME1),
    120         LOCALE_ENTRY(SABBREVDAYNAME2),
    121         LOCALE_ENTRY(SABBREVDAYNAME3),
    122         LOCALE_ENTRY(SABBREVDAYNAME4),
    123         LOCALE_ENTRY(SABBREVDAYNAME5),
    124         LOCALE_ENTRY(SABBREVDAYNAME6),
    125         LOCALE_ENTRY(SABBREVDAYNAME7),
    126         LOCALE_ENTRY(SMONTHNAME1),
    127         LOCALE_ENTRY(SMONTHNAME2),
    128         LOCALE_ENTRY(SMONTHNAME3),
    129         LOCALE_ENTRY(SMONTHNAME4),
    130         LOCALE_ENTRY(SMONTHNAME5),
    131         LOCALE_ENTRY(SMONTHNAME6),
    132         LOCALE_ENTRY(SMONTHNAME7),
    133         LOCALE_ENTRY(SMONTHNAME8),
    134         LOCALE_ENTRY(SMONTHNAME9),
    135         LOCALE_ENTRY(SMONTHNAME10),
    136         LOCALE_ENTRY(SMONTHNAME11),
    137         LOCALE_ENTRY(SMONTHNAME12),
    138         LOCALE_ENTRY(SMONTHNAME13),
    139         LOCALE_ENTRY(SABBREVMONTHNAME1),
    140         LOCALE_ENTRY(SABBREVMONTHNAME2),
    141         LOCALE_ENTRY(SABBREVMONTHNAME3),
    142         LOCALE_ENTRY(SABBREVMONTHNAME4),
    143         LOCALE_ENTRY(SABBREVMONTHNAME5),
    144         LOCALE_ENTRY(SABBREVMONTHNAME6),
    145         LOCALE_ENTRY(SABBREVMONTHNAME7),
    146         LOCALE_ENTRY(SABBREVMONTHNAME8),
    147         LOCALE_ENTRY(SABBREVMONTHNAME9),
    148         LOCALE_ENTRY(SABBREVMONTHNAME10),
    149         LOCALE_ENTRY(SABBREVMONTHNAME11),
    150         LOCALE_ENTRY(SABBREVMONTHNAME12),
    151         LOCALE_ENTRY(SABBREVMONTHNAME13),
    152         LOCALE_ENTRY(SPOSITIVESIGN),
    153         LOCALE_ENTRY(SNEGATIVESIGN),
    154         LOCALE_ENTRY(IPOSSIGNPOSN),
    155         LOCALE_ENTRY(INEGSIGNPOSN),
    156         LOCALE_ENTRY(IPOSSYMPRECEDES),
    157         LOCALE_ENTRY(IPOSSEPBYSPACE),
    158         LOCALE_ENTRY(INEGSYMPRECEDES),
    159         LOCALE_ENTRY(INEGSEPBYSPACE),
    160         LOCALE_ENTRY(FONTSIGNATURE),
    161         LOCALE_ENTRY(SISO639LANGNAME),
    162         LOCALE_ENTRY(SISO3166CTRYNAME),
    163         {NULL,0}
     61    LOCALE_ENTRY(ILANGUAGE),
     62    LOCALE_ENTRY(SLANGUAGE),
     63    LOCALE_ENTRY(SENGLANGUAGE),
     64    LOCALE_ENTRY(SABBREVLANGNAME),
     65    LOCALE_ENTRY(SNATIVELANGNAME),
     66    LOCALE_ENTRY(ICOUNTRY),
     67    LOCALE_ENTRY(SCOUNTRY),
     68    LOCALE_ENTRY(SENGCOUNTRY),
     69    LOCALE_ENTRY(SABBREVCTRYNAME),
     70    LOCALE_ENTRY(SNATIVECTRYNAME),
     71    LOCALE_ENTRY(IDEFAULTLANGUAGE),
     72    LOCALE_ENTRY(IDEFAULTCOUNTRY),
     73    LOCALE_ENTRY(IDEFAULTCODEPAGE),
     74    LOCALE_ENTRY(IDEFAULTANSICODEPAGE),
     75    LOCALE_ENTRY(IDEFAULTMACCODEPAGE),
     76    LOCALE_ENTRY(SLIST),
     77    LOCALE_ENTRY(IMEASURE),
     78    LOCALE_ENTRY(SDECIMAL),
     79    LOCALE_ENTRY(STHOUSAND),
     80    LOCALE_ENTRY(SGROUPING),
     81    LOCALE_ENTRY(IDIGITS),
     82    LOCALE_ENTRY(ILZERO),
     83    LOCALE_ENTRY(INEGNUMBER),
     84    LOCALE_ENTRY(SNATIVEDIGITS),
     85    LOCALE_ENTRY(SCURRENCY),
     86    LOCALE_ENTRY(SINTLSYMBOL),
     87    LOCALE_ENTRY(SMONDECIMALSEP),
     88    LOCALE_ENTRY(SMONTHOUSANDSEP),
     89    LOCALE_ENTRY(SMONGROUPING),
     90    LOCALE_ENTRY(ICURRDIGITS),
     91    LOCALE_ENTRY(IINTLCURRDIGITS),
     92    LOCALE_ENTRY(ICURRENCY),
     93    LOCALE_ENTRY(INEGCURR),
     94    LOCALE_ENTRY(SDATE),
     95    LOCALE_ENTRY(STIME),
     96    LOCALE_ENTRY(SSHORTDATE),
     97    LOCALE_ENTRY(SLONGDATE),
     98    LOCALE_ENTRY(STIMEFORMAT),
     99    LOCALE_ENTRY(IDATE),
     100    LOCALE_ENTRY(ILDATE),
     101    LOCALE_ENTRY(ITIME),
     102    LOCALE_ENTRY(ITIMEMARKPOSN),
     103    LOCALE_ENTRY(ICENTURY),
     104    LOCALE_ENTRY(ITLZERO),
     105    LOCALE_ENTRY(IDAYLZERO),
     106    LOCALE_ENTRY(IMONLZERO),
     107    LOCALE_ENTRY(S1159),
     108    LOCALE_ENTRY(S2359),
     109    LOCALE_ENTRY(ICALENDARTYPE),
     110    LOCALE_ENTRY(IOPTIONALCALENDAR),
     111    LOCALE_ENTRY(IFIRSTDAYOFWEEK),
     112    LOCALE_ENTRY(IFIRSTWEEKOFYEAR),
     113    LOCALE_ENTRY(SDAYNAME1),
     114    LOCALE_ENTRY(SDAYNAME2),
     115    LOCALE_ENTRY(SDAYNAME3),
     116    LOCALE_ENTRY(SDAYNAME4),
     117    LOCALE_ENTRY(SDAYNAME5),
     118    LOCALE_ENTRY(SDAYNAME6),
     119    LOCALE_ENTRY(SDAYNAME7),
     120    LOCALE_ENTRY(SABBREVDAYNAME1),
     121    LOCALE_ENTRY(SABBREVDAYNAME2),
     122    LOCALE_ENTRY(SABBREVDAYNAME3),
     123    LOCALE_ENTRY(SABBREVDAYNAME4),
     124    LOCALE_ENTRY(SABBREVDAYNAME5),
     125    LOCALE_ENTRY(SABBREVDAYNAME6),
     126    LOCALE_ENTRY(SABBREVDAYNAME7),
     127    LOCALE_ENTRY(SMONTHNAME1),
     128    LOCALE_ENTRY(SMONTHNAME2),
     129    LOCALE_ENTRY(SMONTHNAME3),
     130    LOCALE_ENTRY(SMONTHNAME4),
     131    LOCALE_ENTRY(SMONTHNAME5),
     132    LOCALE_ENTRY(SMONTHNAME6),
     133    LOCALE_ENTRY(SMONTHNAME7),
     134    LOCALE_ENTRY(SMONTHNAME8),
     135    LOCALE_ENTRY(SMONTHNAME9),
     136    LOCALE_ENTRY(SMONTHNAME10),
     137    LOCALE_ENTRY(SMONTHNAME11),
     138    LOCALE_ENTRY(SMONTHNAME12),
     139    LOCALE_ENTRY(SMONTHNAME13),
     140    LOCALE_ENTRY(SABBREVMONTHNAME1),
     141    LOCALE_ENTRY(SABBREVMONTHNAME2),
     142    LOCALE_ENTRY(SABBREVMONTHNAME3),
     143    LOCALE_ENTRY(SABBREVMONTHNAME4),
     144    LOCALE_ENTRY(SABBREVMONTHNAME5),
     145    LOCALE_ENTRY(SABBREVMONTHNAME6),
     146    LOCALE_ENTRY(SABBREVMONTHNAME7),
     147    LOCALE_ENTRY(SABBREVMONTHNAME8),
     148    LOCALE_ENTRY(SABBREVMONTHNAME9),
     149    LOCALE_ENTRY(SABBREVMONTHNAME10),
     150    LOCALE_ENTRY(SABBREVMONTHNAME11),
     151    LOCALE_ENTRY(SABBREVMONTHNAME12),
     152    LOCALE_ENTRY(SABBREVMONTHNAME13),
     153    LOCALE_ENTRY(SPOSITIVESIGN),
     154    LOCALE_ENTRY(SNEGATIVESIGN),
     155    LOCALE_ENTRY(IPOSSIGNPOSN),
     156    LOCALE_ENTRY(INEGSIGNPOSN),
     157    LOCALE_ENTRY(IPOSSYMPRECEDES),
     158    LOCALE_ENTRY(IPOSSEPBYSPACE),
     159    LOCALE_ENTRY(INEGSYMPRECEDES),
     160    LOCALE_ENTRY(INEGSEPBYSPACE),
     161    LOCALE_ENTRY(FONTSIGNATURE),
     162    LOCALE_ENTRY(SISO639LANGNAME),
     163    LOCALE_ENTRY(SISO3166CTRYNAME),
     164    {NULL,0}
    164165};
    165166
     
    168169#ifndef __WIN32OS2__
    169170/***********************************************************************
    170  *              GetUserDefaultLCID (KERNEL32.@)
    171  *              GetUserDefaultLCID (OLE2NLS.1)
     171 *      GetUserDefaultLCID (KERNEL32.@)
     172 *      GetUserDefaultLCID (OLE2NLS.1)
    172173 */
    173174LCID WINAPI GetUserDefaultLCID(void)
    174175{
    175         return MAKELCID( GetUserDefaultLangID() , SORT_DEFAULT );
     176    return MAKELCID( GetUserDefaultLangID() , SORT_DEFAULT );
    176177}
    177178
    178179/***********************************************************************
    179  *              GetSystemDefaultLCID (KERNEL32.@)
    180  *              GetSystemDefaultLCID (OLE2NLS.2)
     180 *      GetSystemDefaultLCID (KERNEL32.@)
     181 *      GetSystemDefaultLCID (OLE2NLS.2)
    181182 */
    182183LCID WINAPI GetSystemDefaultLCID(void)
    183184{
    184         return GetUserDefaultLCID();
     185    return GetUserDefaultLCID();
    185186}
    186187#endif //__WIN32OS2__
     
    222223    if(l_data->lang && strlen(l_data->lang) > 0 && !strcasecmp(l_data->lang, buf_language))
    223224    {
    224         if(l_data->country && strlen(l_data->country) > 0)
    225         {
    226             if(!strcasecmp(l_data->country, buf_country))
    227             {
    228                 l_data->found_lang_id[0] = LangID;
    229                 l_data->n_found = 1;
    230                 TRACE("Found lang_id %04X for %s_%s\n", LangID, l_data->lang, l_data->country);
    231                 return FALSE; /* stop enumeration */
    232             }
    233         }
    234         else /* l_data->country not specified */
    235         {
    236             if(l_data->n_found < NLS_MAX_LANGUAGES)
    237             {
    238                 l_data->found_lang_id[l_data->n_found] = LangID;
    239                 strncpy(l_data->found_country[l_data->n_found], buf_country, 3);
    240                 strncpy(l_data->found_language[l_data->n_found], buf_language, 3);
    241                 l_data->n_found++;
    242                 TRACE("Found lang_id %04X for %s\n", LangID, l_data->lang);
    243                 return TRUE; /* continue search */
    244             }
    245         }
     225    if(l_data->country && strlen(l_data->country) > 0)
     226    {
     227        if(!strcasecmp(l_data->country, buf_country))
     228        {
     229        l_data->found_lang_id[0] = LangID;
     230        l_data->n_found = 1;
     231        TRACE("Found lang_id %04X for %s_%s\n", LangID, l_data->lang, l_data->country);
     232        return FALSE; /* stop enumeration */
     233        }
     234    }
     235    else /* l_data->country not specified */
     236    {
     237        if(l_data->n_found < NLS_MAX_LANGUAGES)
     238        {
     239        l_data->found_lang_id[l_data->n_found] = LangID;
     240        strncpy(l_data->found_country[l_data->n_found], buf_country, 3);
     241        strncpy(l_data->found_language[l_data->n_found], buf_language, 3);
     242        l_data->n_found++;
     243        TRACE("Found lang_id %04X for %s\n", LangID, l_data->lang);
     244        return TRUE; /* continue search */
     245        }
     246    }
    246247    }
    247248
     
    256257    if(l_data->lang && strlen(l_data->lang) > 0 && !strcasecmp(l_data->lang, buf_en_language))
    257258    {
    258         l_data->found_lang_id[l_data->n_found] = LangID;
    259         strncpy(l_data->found_country[l_data->n_found], buf_country, 3);
    260         strncpy(l_data->found_language[l_data->n_found], buf_language, 3);
    261         l_data->n_found++;
    262         TRACE("Found lang_id %04X for %s\n", LangID, l_data->lang);
     259    l_data->found_lang_id[l_data->n_found] = LangID;
     260    strncpy(l_data->found_country[l_data->n_found], buf_country, 3);
     261    strncpy(l_data->found_language[l_data->n_found], buf_language, 3);
     262    l_data->n_found++;
     263    TRACE("Found lang_id %04X for %s\n", LangID, l_data->lang);
    263264    }
    264265
     
    270271 *
    271272 * INPUT:
    272  *      Lang: a string whose two first chars are the iso name of a language.
    273  *      Country: a string whose two first chars are the iso name of country
    274  *      Charset: a string defining the chossen charset encoding
    275  *      Dialect: a string defining a variation of the locale
     273 *  Lang: a string whose two first chars are the iso name of a language.
     274 *  Country: a string whose two first chars are the iso name of country
     275 *  Charset: a string defining the chossen charset encoding
     276 *  Dialect: a string defining a variation of the locale
    276277 *
    277  *      all those values are from the standardized format of locale
    278  *      name in unix which is: Lang[_Country][.Charset][@Dialect]
     278 *  all those values are from the standardized format of locale
     279 *  name in unix which is: Lang[_Country][.Charset][@Dialect]
    279280 *
    280281 * RETURNS:
    281  *      the numeric code of the language used by Windows
     282 *  the numeric code of the language used by Windows
    282283 *
    283284 * FIXME: Charset and Dialect are not handled
     
    290291    if(!Lang)
    291292    {
    292         l_data.found_lang_id[0] = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT);
    293         goto END;
     293    l_data.found_lang_id[0] = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT);
     294    goto END;
    294295    }
    295296
     
    298299
    299300    if(Country && strlen(Country) > 0)
    300         strncpy(l_data.country, Country, sizeof(l_data.country));
     301    strncpy(l_data.country, Country, sizeof(l_data.country));
    301302
    302303    EnumResourceLanguagesA(GetModuleHandleA("KERNEL32"), RT_STRINGA,
    303         (LPCSTR)LOCALE_ILANGUAGE, NLS_FindLanguageID_ProcA, (LONG)&l_data);
     304    (LPCSTR)LOCALE_ILANGUAGE, NLS_FindLanguageID_ProcA, (LONG)&l_data);
    304305
    305306    strcpy(lang_string, l_data.lang);
    306307    if(l_data.country && strlen(l_data.country) > 0)
    307308    {
    308         strcat(lang_string, "_");
    309         strcat(lang_string, l_data.country);
     309    strcat(lang_string, "_");
     310    strcat(lang_string, l_data.country);
    310311    }
    311312
    312313    if(!l_data.n_found)
    313314    {
    314         if(l_data.country && strlen(l_data.country) > 0)
    315         {
    316             MESSAGE("Warning: Language '%s' was not found, retrying without country name...\n", lang_string);
    317             l_data.country[0] = 0;
    318             EnumResourceLanguagesA(GetModuleHandleA("KERNEL32"), RT_STRINGA,
    319                 (LPCSTR)LOCALE_ILANGUAGE, NLS_FindLanguageID_ProcA, (LONG)&l_data);
    320         }
     315    if(l_data.country && strlen(l_data.country) > 0)
     316    {
     317        MESSAGE("Warning: Language '%s' was not found, retrying without country name...\n", lang_string);
     318        l_data.country[0] = 0;
     319        EnumResourceLanguagesA(GetModuleHandleA("KERNEL32"), RT_STRINGA,
     320        (LPCSTR)LOCALE_ILANGUAGE, NLS_FindLanguageID_ProcA, (LONG)&l_data);
     321    }
    321322    }
    322323
     
    325326    if(l_data.country && strlen(l_data.country) > 0)
    326327    {
    327         strcat(lang_string, "_");
    328         strcat(lang_string, l_data.country);
     328    strcat(lang_string, "_");
     329    strcat(lang_string, l_data.country);
    329330    }
    330331
    331332    if(!l_data.n_found)
    332333    {
    333         MESSAGE("Warning: Language '%s' was not recognized, defaulting to English\n", lang_string);
    334         l_data.found_lang_id[0] = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT);
     334    MESSAGE("Warning: Language '%s' was not recognized, defaulting to English\n", lang_string);
     335    l_data.found_lang_id[0] = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT);
    335336    }
    336337    else
    337338    {
    338         if(l_data.n_found == 1)
    339             TRACE("For language '%s' lang_id %04X was found\n", lang_string, l_data.found_lang_id[0]);
    340         else /* l_data->n_found > 1 */
    341         {
    342             int i;
    343             MESSAGE("For language '%s' several language ids were found:\n", lang_string);
    344             for(i = 0; i < l_data.n_found; i++)
    345                 MESSAGE("%s_%s - %04X; ", l_data.found_language[i], l_data.found_country[i], l_data.found_lang_id[i]);
    346 
    347             MESSAGE("\nInstead of using first in the list, suggest to define\n"
    348                     "your LANG environment variable like this: LANG=%s_%s\n",
    349                     l_data.found_language[0], l_data.found_country[0]);
    350         }
     339    if(l_data.n_found == 1)
     340        TRACE("For language '%s' lang_id %04X was found\n", lang_string, l_data.found_lang_id[0]);
     341    else /* l_data->n_found > 1 */
     342    {
     343        int i;
     344        MESSAGE("For language '%s' several language ids were found:\n", lang_string);
     345        for(i = 0; i < l_data.n_found; i++)
     346        MESSAGE("%s_%s - %04X; ", l_data.found_language[i], l_data.found_country[i], l_data.found_lang_id[i]);
     347
     348        MESSAGE("\nInstead of using first in the list, suggest to define\n"
     349            "your LANG environment variable like this: LANG=%s_%s\n",
     350            l_data.found_language[0], l_data.found_country[0]);
     351    }
    351352    }
    352353END:
     
    356357#ifndef __WIN32OS2__
    357358/***********************************************************************
    358  *              GetUserDefaultLangID (KERNEL32.@)
    359  *              GetUserDefaultLangID (OLE2NLS.3)
     359 *      GetUserDefaultLangID (KERNEL32.@)
     360 *      GetUserDefaultLangID (OLE2NLS.3)
    360361 */
    361362LANGID WINAPI GetUserDefaultLangID(void)
    362363{
    363         /* caching result, if defined from environment, which should (?) not change during a WINE session */
    364         static  LANGID  userLCID = 0;
    365 
    366         if (userLCID == 0)
     364    /* caching result, if defined from environment, which should (?) not change during a WINE session */
     365    static  LANGID  userLCID = 0;
     366
     367    if (userLCID == 0)
    367368        {
    368369                char buf[256];
    369                 char *lang,*country,*charset,*dialect,*next;
    370 
    371                 if (GetEnvironmentVariableA( "LANGUAGE", buf, sizeof(buf) )) goto ok;
    372                 if (GetEnvironmentVariableA( "LANG", buf, sizeof(buf) )) goto ok;
    373                 if (GetEnvironmentVariableA( "LC_ALL", buf, sizeof(buf) )) goto ok;
    374                 if (GetEnvironmentVariableA( "LC_MESSAGES", buf, sizeof(buf) )) goto ok;
    375                 if (GetEnvironmentVariableA( "LC_CTYPE", buf, sizeof(buf) )) goto ok;
    376 
    377                 return userLCID = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT );
     370        char *lang,*country,*charset,*dialect,*next;
     371
     372        if (GetEnvironmentVariableA( "LANGUAGE", buf, sizeof(buf) )) goto ok;
     373        if (GetEnvironmentVariableA( "LANG", buf, sizeof(buf) )) goto ok;
     374        if (GetEnvironmentVariableA( "LC_ALL", buf, sizeof(buf) )) goto ok;
     375        if (GetEnvironmentVariableA( "LC_MESSAGES", buf, sizeof(buf) )) goto ok;
     376        if (GetEnvironmentVariableA( "LC_CTYPE", buf, sizeof(buf) )) goto ok;
     377
     378        return userLCID = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT );
    378379
    379380        ok:
    380                 if (!strcmp(buf,"POSIX") || !strcmp(buf,"C"))
     381        if (!strcmp(buf,"POSIX") || !strcmp(buf,"C"))
    381382                    return userLCID = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT );
    382                
    383                 lang=buf;
    384                
    385                 do {
    386                         next=strchr(lang,':'); if (next) *next++='\0';
    387                         dialect=strchr(lang,'@'); if (dialect) *dialect++='\0';
    388                         charset=strchr(lang,'.'); if (charset) *charset++='\0';
    389                         country=strchr(lang,'_'); if (country) *country++='\0';
    390                        
    391                         userLCID = NLS_GetLanguageID(lang, country, charset, dialect);
    392                        
    393                         lang=next;
    394                 } while (lang && !userLCID);
    395 
    396                 if (!userLCID)
     383
     384        lang=buf;
     385
     386        do {
     387            next=strchr(lang,':'); if (next) *next++='\0';
     388            dialect=strchr(lang,'@'); if (dialect) *dialect++='\0';
     389            charset=strchr(lang,'.'); if (charset) *charset++='\0';
     390            country=strchr(lang,'_'); if (country) *country++='\0';
     391
     392            userLCID = NLS_GetLanguageID(lang, country, charset, dialect);
     393
     394            lang=next;
     395        } while (lang && !userLCID);
     396
     397        if (!userLCID)
    397398                {
    398399                    MESSAGE( "Warning: language '%s' not recognized, defaulting to English\n",
     
    400401                    userLCID = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT );
    401402                }
    402         }
    403         return userLCID;
     403    }
     404    return userLCID;
    404405}
    405406
    406407/***********************************************************************
    407  *              GetSystemDefaultLangID (KERNEL32.@)
    408  *              GetSystemDefaultLangID (OLE2NLS.4)
     408 *      GetSystemDefaultLangID (KERNEL32.@)
     409 *      GetSystemDefaultLangID (OLE2NLS.4)
    409410 */
    410411LANGID WINAPI GetSystemDefaultLangID(void)
    411412{
    412         return GetUserDefaultLangID();
     413    return GetUserDefaultLangID();
    413414}
    414415#endif //__WIN32OS2__
    415416/******************************************************************************
    416  *              ConvertDefaultLocale (KERNEL32.@)
     417 *      ConvertDefaultLocale (KERNEL32.@)
    417418 */
    418419LCID WINAPI ConvertDefaultLocale (LCID lcid)
    419 {       switch (lcid)
    420         {  case LOCALE_SYSTEM_DEFAULT:
    421              return GetSystemDefaultLCID();
    422            case LOCALE_USER_DEFAULT:
    423              return GetUserDefaultLCID();
    424            case LOCALE_NEUTRAL:
    425              return MAKELCID (LANG_NEUTRAL, SUBLANG_NEUTRAL);
    426         } 
    427         return MAKELANGID( PRIMARYLANGID(lcid), SUBLANG_NEUTRAL);
     420{   switch (lcid)
     421    {  case LOCALE_SYSTEM_DEFAULT:
     422         return GetSystemDefaultLCID();
     423       case LOCALE_USER_DEFAULT:
     424         return GetUserDefaultLCID();
     425       case LOCALE_NEUTRAL:
     426         return MAKELCID (LANG_NEUTRAL, SUBLANG_NEUTRAL);
     427    }
     428    return MAKELANGID( PRIMARYLANGID(lcid), SUBLANG_NEUTRAL);
    428429}
    429430
     
    447448    hmem = LoadResource(hModule, hrsrc);
    448449    if(!hmem) return 0;
    449    
     450
    450451#ifdef __WIN32OS2__
    451452    p = (WCHAR*)LockResource(hmem);
     
    455456    string_num = res_id & 0x000f;
    456457    for(i = 0; i < string_num; i++)
    457         p += *p + 1;
    458    
     458    p += *p + 1;
     459
    459460    TRACE("strlen = %d\n", (int)*p );
    460    
     461
    461462    if (buffer == NULL) return *p;
    462463    i = min(buflen - 1, *p);
    463464    if (i > 0) {
    464         memcpy(buffer, p + 1, i * sizeof (WCHAR));
    465         buffer[i] = (WCHAR) 0;
     465    memcpy(buffer, p + 1, i * sizeof (WCHAR));
     466    buffer[i] = (WCHAR) 0;
    466467    } else {
    467         if (buflen > 1)
    468             buffer[0] = (WCHAR) 0;
     468    if (buflen > 1)
     469        buffer[0] = (WCHAR) 0;
    469470    }
    470471
     
    475476#ifndef __WIN32OS2__
    476477/******************************************************************************
    477  *              GetLocaleInfoA (KERNEL32.@)
     478 *      GetLocaleInfoA (KERNEL32.@)
    478479 *
    479  * NOTES 
     480 * NOTES
    480481 *  LANG_NEUTRAL is equal to LOCALE_SYSTEM_DEFAULT
    481482 *
     
    487488{
    488489    LPCSTR  retString = NULL;
    489     int found = 0, i;
     490    int found = 0, i;
    490491    char    *pacKey;
    491492    char    acBuffer[128];
     
    497498  if (len && (! buf) ) {
    498499    SetLastError(ERROR_INSUFFICIENT_BUFFER);
    499                 return 0;
    500         }
    501 
    502         if (lcid == LOCALE_NEUTRAL || lcid == LANG_SYSTEM_DEFAULT)
    503         {
     500        return 0;
     501    }
     502
     503    if (lcid == LOCALE_NEUTRAL || lcid == LANG_SYSTEM_DEFAULT)
     504    {
    504505            lcid = GetSystemDefaultLCID();
    505         }
    506         else if (lcid == LANG_USER_DEFAULT) /*0x800*/
    507         {
     506    }
     507    else if (lcid == LANG_USER_DEFAULT) /*0x800*/
     508    {
    508509            lcid = GetUserDefaultLCID();
    509         }
     510    }
    510511
    511512    /* LOCALE_NOUSEROVERRIDE means: do not get user redefined settings
     
    513514    NoUserOverride = (LCType & LOCALE_NOUSEROVERRIDE) != 0;
    514515
    515         LCType &= ~(LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP);
     516    LCType &= ~(LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP);
    516517
    517518    /* First, check if it's in the registry. */
     
    524525        sprintf( acRealKey, "Control Panel\\International\\%s", pacKey );
    525526
    526         if ( RegOpenKeyExA( HKEY_CURRENT_USER, acRealKey, 
     527        if ( RegOpenKeyExA( HKEY_CURRENT_USER, acRealKey,
    527528                            0, KEY_READ, &hKey) == ERROR_SUCCESS )
    528529        {
    529             if ( RegQueryValueExA( hKey, NULL, NULL, NULL, (LPBYTE)acBuffer, 
     530            if ( RegQueryValueExA( hKey, NULL, NULL, NULL, (LPBYTE)acBuffer,
    530531                                   &dwBufferSize ) == ERROR_SUCCESS )
    531532            {
     
    539540    /* If not in the registry, get it from the NLS entries. */
    540541    if(!found) {
    541         WCHAR wcBuffer[128];
    542         int res_size;
    543 
    544         /* check if language is registered in the kernel32 resources */
    545         if((res_size = NLS_LoadStringExW(GetModuleHandleA("KERNEL32"), LANGIDFROMLCID(lcid),
    546                 LCType, wcBuffer, sizeof(wcBuffer)/sizeof(wcBuffer[0])))) {
    547             WideCharToMultiByte(CP_ACP, 0, wcBuffer, res_size, acBuffer, dwBufferSize, NULL, NULL);
    548             retString = acBuffer;
    549             found = 1;
    550         }
     542    WCHAR wcBuffer[128];
     543    int res_size;
     544
     545    /* check if language is registered in the kernel32 resources */
     546    if((res_size = NLS_LoadStringExW(GetModuleHandleA("KERNEL32"), LANGIDFROMLCID(lcid),
     547        LCType, wcBuffer, sizeof(wcBuffer)/sizeof(wcBuffer[0])))) {
     548        WideCharToMultiByte(CP_ACP, 0, wcBuffer, res_size, acBuffer, dwBufferSize, NULL, NULL);
     549        retString = acBuffer;
     550        found = 1;
     551    }
    551552    }
    552553
    553554    /* if not found report a most descriptive error */
    554555    if(!found) {
    555         retString=0;
    556         /* If we are through all of this, retLen should not be zero anymore.
    557            If it is, the value is not supported */
    558         i=0;
    559         while (locale_name2id[i].name!=NULL) {
    560             if (LCType == locale_name2id[i].id) {
    561                 retString = locale_name2id[i].name;
    562                 break;
    563             }
    564             i++;
    565         }
    566         if(!retString)
    567             FIXME("Unkown LC type %lX\n", LCType);
    568         else
    569             FIXME("'%s' is not defined for your language (%04X).\n"
    570                 "Please define it in dlls/kernel/nls/YourLanguage.nls\n"
    571                 "and submit patch for inclusion into the next Wine release.\n",
    572                         retString, LOWORD(lcid));
    573         SetLastError(ERROR_INVALID_PARAMETER);
    574         return 0;                       
     556    retString=0;
     557    /* If we are through all of this, retLen should not be zero anymore.
     558       If it is, the value is not supported */
     559    i=0;
     560    while (locale_name2id[i].name!=NULL) {
     561        if (LCType == locale_name2id[i].id) {
     562        retString = locale_name2id[i].name;
     563        break;
     564        }
     565        i++;
     566    }
     567    if(!retString)
     568        FIXME("Unkown LC type %lX\n", LCType);
     569    else
     570        FIXME("'%s' is not defined for your language (%04X).\n"
     571        "Please define it in dlls/kernel/nls/YourLanguage.nls\n"
     572        "and submit patch for inclusion into the next Wine release.\n",
     573            retString, LOWORD(lcid));
     574    SetLastError(ERROR_INVALID_PARAMETER);
     575    return 0;
    575576    }
    576577
     
    578579    if (LCType == LOCALE_FONTSIGNATURE) {
    579580        if (len) {
    580             len = (len < sizeof(FONTSIGNATURE)) ? len : sizeof(FONTSIGNATURE);
     581        len = (len < sizeof(FONTSIGNATURE)) ? len : sizeof(FONTSIGNATURE);
    581582            memcpy(buf, retString, len);
    582             return len;
    583         }
     583        return len;
     584    }
    584585        return sizeof(FONTSIGNATURE);
    585586    }
    586587    /* if len=0 return only the length, don't touch the buffer*/
    587588    if (len) {
    588         lstrcpynA(buf,retString,len);
    589         return strlen(buf) + 1;
     589    lstrcpynA(buf,retString,len);
     590    return strlen(buf) + 1;
    590591    }
    591592    return strlen(retString)+1;
     
    593594
    594595/******************************************************************************
    595  *              GetLocaleInfoW (KERNEL32.@)
     596 *      GetLocaleInfoW (KERNEL32.@)
    596597 *
    597598 * NOTES
     
    601602 */
    602603INT WINAPI GetLocaleInfoW(LCID lcid,LCTYPE LCType,LPWSTR wbuf,INT len)
    603 {       WORD wlen;
    604         LPSTR abuf;
    605        
    606         if (len && (! wbuf) )
    607         { SetLastError(ERROR_INSUFFICIENT_BUFFER);
    608           return 0;
    609         }
    610 
    611         abuf = (LPSTR)HeapAlloc(GetProcessHeap(),0,len);
    612         wlen = GetLocaleInfoA(lcid, LCType, abuf, len);
    613 
    614         if (wlen && len)        /* if len=0 return only the length*/
     604{   WORD wlen;
     605    LPSTR abuf;
     606
     607    if (len && (! wbuf) )
     608    { SetLastError(ERROR_INSUFFICIENT_BUFFER);
     609      return 0;
     610    }
     611
     612    abuf = (LPSTR)HeapAlloc(GetProcessHeap(),0,len);
     613    wlen = GetLocaleInfoA(lcid, LCType, abuf, len);
     614
     615    if (wlen && len)    /* if len=0 return only the length*/
    615616            MultiByteToWideChar( CP_ACP, 0, abuf, -1, wbuf, len );
    616617
    617         HeapFree(GetProcessHeap(),0,abuf);
    618         return wlen;
     618    HeapFree(GetProcessHeap(),0,abuf);
     619    return wlen;
    619620}
    620621#endif //__WIN32OS2__
     
    622623/******************************************************************************
    623624 *
    624  *              GetLocaleSubkeyName [helper function]
     625 *      GetLocaleSubkeyName [helper function]
    625626 *
    626627 *          - For use with the registry.
     
    730731        break;
    731732
    732     /* The following are not listed under MSDN as supported, 
     733    /* The following are not listed under MSDN as supported,
    733734     * but seem to be used and also stored in the registry.
    734735     */
     
    755756
    756757/******************************************************************************
    757  *              SetLocaleInfoA  [KERNEL32.656]
     758 *      SetLocaleInfoA  [KERNEL32.656]
    758759 */
    759760BOOL WINAPI SetLocaleInfoA(DWORD lcid, DWORD lctype, LPCSTR data)
     
    766767    {
    767768        sprintf( acRealKey, "Control Panel\\International\\%s", pacKey );
    768         if ( RegCreateKeyA( HKEY_CURRENT_USER, acRealKey, 
     769        if ( RegCreateKeyA( HKEY_CURRENT_USER, acRealKey,
    769770                               &hKey ) == ERROR_SUCCESS )
    770771        {
    771             if ( RegSetValueExA( hKey, NULL, 0, REG_SZ, 
     772            if ( RegSetValueExA( hKey, NULL, 0, REG_SZ,
    772773#ifdef __WIN32OS2__
    773774                                 (LPBYTE)data, strlen(data)+1 ) != ERROR_SUCCESS )
     
    829830
    830831/******************************************************************************
    831  *              IsValidLocale   [KERNEL32.489]
     832 *      IsValidLocale   [KERNEL32.489]
    832833 */
    833834BOOL WINAPI IsValidLocale(LCID lcid,DWORD flags)
     
    840841    /* check if language is registered in the kernel32 resources */
    841842    if(!FindResourceExW(GetModuleHandleA("KERNEL32"), RT_STRINGW, (LPCWSTR)LOCALE_ILANGUAGE, LOWORD(lcid)))
    842         return FALSE;
     843    return FALSE;
    843844    else
    844         return TRUE;
     845    return TRUE;
    845846#endif
    846847}
    847848
    848849static BOOL CALLBACK EnumResourceLanguagesProcW(HMODULE hModule, LPCWSTR type,
    849                 LPCWSTR name, WORD LangID, LONG lParam)
     850        LPCWSTR name, WORD LangID, LONG lParam)
    850851{
    851852    CHAR bufA[20];
     
    858859
    859860/******************************************************************************
    860  *              EnumSystemLocalesW      [KERNEL32.209]
     861 *      EnumSystemLocalesW  [KERNEL32.209]
    861862 */
    862863BOOL WINAPI EnumSystemLocalesW( LOCALE_ENUMPROCW lpfnLocaleEnum,
     
    866867
    867868    EnumResourceLanguagesW(GetModuleHandleA("KERNEL32"), RT_STRINGW,
    868             (LPCWSTR)LOCALE_ILANGUAGE, EnumResourceLanguagesProcW,
    869             (LONG)lpfnLocaleEnum);
     869        (LPCWSTR)LOCALE_ILANGUAGE, EnumResourceLanguagesProcW,
     870        (LONG)lpfnLocaleEnum);
    870871
    871872    return TRUE;
     
    873874
    874875static BOOL CALLBACK EnumResourceLanguagesProcA(HMODULE hModule, LPCSTR type,
    875                 LPCSTR name, WORD LangID, LONG lParam)
     876        LPCSTR name, WORD LangID, LONG lParam)
    876877{
    877878    CHAR bufA[20];
     
    882883
    883884/******************************************************************************
    884  *              EnumSystemLocalesA      [KERNEL32.208]
     885 *      EnumSystemLocalesA  [KERNEL32.208]
    885886 */
    886887BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA lpfnLocaleEnum,
     
    890891
    891892    EnumResourceLanguagesA(GetModuleHandleA("KERNEL32"), RT_STRINGA,
    892             (LPCSTR)LOCALE_ILANGUAGE, EnumResourceLanguagesProcA,
    893             (LONG)lpfnLocaleEnum);
     893        (LPCSTR)LOCALE_ILANGUAGE, EnumResourceLanguagesProcA,
     894        (LONG)lpfnLocaleEnum);
    894895
    895896    return TRUE;
     
    11561157};
    11571158
    1158 const WORD OLE2NLS_CT_CType3_LUT[] = { 
     1159const WORD OLE2NLS_CT_CType3_LUT[] = {
    11591160  0x0000, /*   -   0 */
    11601161  0x0000, /*   -   1 */
     
    14171418
    14181419/******************************************************************************
    1419  *              GetStringTypeA  [KERNEL32.396]
     1420 *      GetStringTypeA  [KERNEL32.396]
    14201421 */
    14211422BOOL WINAPI GetStringTypeA(LCID locale,DWORD dwInfoType,LPCSTR src,
    14221423                               INT cchSrc,LPWORD chartype)
    14231424{
    1424         return GetStringTypeExA(locale,dwInfoType,src,cchSrc,chartype);
     1425    return GetStringTypeExA(locale,dwInfoType,src,cchSrc,chartype);
    14251426}
    14261427
    14271428/******************************************************************************
    1428  *              GetStringTypeExA        [KERNEL32.397]
     1429 *      GetStringTypeExA    [KERNEL32.397]
    14291430 *
    14301431 * FIXME: Ignores the locale.
     
    14331434                                 INT cchSrc,LPWORD chartype)
    14341435{
    1435         int     i;
    1436        
    1437         if ((src==NULL) || (chartype==NULL) || (src==(LPSTR)chartype))
    1438         {
    1439           SetLastError(ERROR_INVALID_PARAMETER);
    1440           return FALSE;
    1441         }
    1442 
    1443         if (cchSrc==-1)
    1444           cchSrc=strlen(src)+1;
    1445          
    1446         switch (dwInfoType) {
    1447         case CT_CTYPE1:
    1448           for (i=0;i<cchSrc;i++)
    1449           {
    1450             chartype[i] = 0;
    1451             if (isdigit(src[i])) chartype[i]|=C1_DIGIT;
    1452             if (isalpha(src[i])) chartype[i]|=C1_ALPHA;
    1453             if (islower(src[i])) chartype[i]|=C1_LOWER;
    1454             if (isupper(src[i])) chartype[i]|=C1_UPPER;
    1455             if (isspace(src[i])) chartype[i]|=C1_SPACE;
    1456             if (ispunct(src[i])) chartype[i]|=C1_PUNCT;
    1457             if (iscntrl(src[i])) chartype[i]|=C1_CNTRL;
     1436    int i;
     1437
     1438    if ((src==NULL) || (chartype==NULL) || (src==(LPSTR)chartype))
     1439    {
     1440      SetLastError(ERROR_INVALID_PARAMETER);
     1441      return FALSE;
     1442    }
     1443
     1444    if (cchSrc==-1)
     1445      cchSrc=strlen(src)+1;
     1446
     1447    switch (dwInfoType) {
     1448    case CT_CTYPE1:
     1449      for (i=0;i<cchSrc;i++)
     1450      {
     1451        chartype[i] = 0;
     1452        if (isdigit(src[i])) chartype[i]|=C1_DIGIT;
     1453        if (isalpha(src[i])) chartype[i]|=C1_ALPHA;
     1454        if (islower(src[i])) chartype[i]|=C1_LOWER;
     1455        if (isupper(src[i])) chartype[i]|=C1_UPPER;
     1456        if (isspace(src[i])) chartype[i]|=C1_SPACE;
     1457        if (ispunct(src[i])) chartype[i]|=C1_PUNCT;
     1458        if (iscntrl(src[i])) chartype[i]|=C1_CNTRL;
    14581459/* FIXME: isblank() is a GNU extension */
    1459 /*              if (isblank(src[i])) chartype[i]|=C1_BLANK; */
    1460             if ((src[i] == ' ') || (src[i] == '\t')) chartype[i]|=C1_BLANK;
    1461             /* C1_XDIGIT */
    1462         }
    1463         return TRUE;
    1464 
    1465         case CT_CTYPE2:
    1466           for (i=0;i<cchSrc;i++)
    1467           {
    1468             chartype[i]=(WORD)CT_CType2_LUT[i];
    1469           }
    1470           return TRUE;
    1471 
    1472         case CT_CTYPE3:
    1473           for (i=0;i<cchSrc;i++)
    1474           {
    1475             chartype[i]=OLE2NLS_CT_CType3_LUT[i];
    1476           }
    1477           return TRUE;
    1478 
    1479         default:
    1480           ERR("Unknown dwInfoType:%ld\n",dwInfoType);
    1481           return FALSE;
    1482         }
     1460/*      if (isblank(src[i])) chartype[i]|=C1_BLANK; */
     1461        if ((src[i] == ' ') || (src[i] == '\t')) chartype[i]|=C1_BLANK;
     1462        /* C1_XDIGIT */
     1463    }
     1464    return TRUE;
     1465
     1466    case CT_CTYPE2:
     1467      for (i=0;i<cchSrc;i++)
     1468      {
     1469        chartype[i]=(WORD)CT_CType2_LUT[i];
     1470      }
     1471      return TRUE;
     1472
     1473    case CT_CTYPE3:
     1474      for (i=0;i<cchSrc;i++)
     1475      {
     1476        chartype[i]=OLE2NLS_CT_CType3_LUT[i];
     1477      }
     1478      return TRUE;
     1479
     1480    default:
     1481      ERR("Unknown dwInfoType:%ld\n",dwInfoType);
     1482      return FALSE;
     1483    }
    14831484}
    14841485
     
    14891490{
    14901491    if(!szLang)
    1491         return 0;
     1492    return 0;
    14921493
    14931494    return GetLocaleInfoA(MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize);
     
    15001501{
    15011502    if(!szLang)
    1502         return 0;
     1503    return 0;
    15031504
    15041505    return GetLocaleInfoW(MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize);
    15051506}
    15061507
    1507  
     1508
    15081509static const unsigned char LCM_Unicode_LUT[] = {
    1509   6      ,   3, /*   -   1 */ 
    1510   6      ,   4, /*   -   2 */ 
    1511   6      ,   5, /*   -   3 */ 
    1512   6      ,   6, /*   -   4 */ 
    1513   6      ,   7, /*   -   5 */ 
    1514   6      ,   8, /*   -   6 */ 
    1515   6      ,   9, /*   -   7 */ 
    1516   6      ,  10, /*   -   8 */ 
    1517   7      ,   5, /*   -   9 */ 
    1518   7      ,   6, /*   -  10 */ 
    1519   7      ,   7, /*   -  11 */ 
    1520   7      ,   8, /*   -  12 */ 
    1521   7      ,   9, /*   -  13 */ 
    1522   6      ,  11, /*   -  14 */ 
    1523   6      ,  12, /*   -  15 */ 
    1524   6      ,  13, /*   -  16 */ 
    1525   6      ,  14, /*   -  17 */ 
    1526   6      ,  15, /*   -  18 */ 
    1527   6      ,  16, /*   -  19 */ 
    1528   6      ,  17, /*   -  20 */ 
    1529   6      ,  18, /*   -  21 */ 
    1530   6      ,  19, /*   -  22 */ 
    1531   6      ,  20, /*   -  23 */ 
    1532   6      ,  21, /*   -  24 */ 
    1533   6      ,  22, /*   -  25 */ 
    1534   6      ,  23, /*   -  26 */ 
    1535   6      ,  24, /*   -  27 */ 
    1536   6      ,  25, /*   -  28 */ 
    1537   6      ,  26, /*   -  29 */ 
    1538   6      ,  27, /*   -  30 */ 
    1539   6      ,  28, /*   -  31 */ 
     1510  6      ,   3, /*   -   1 */
     1511  6      ,   4, /*   -   2 */
     1512  6      ,   5, /*   -   3 */
     1513  6      ,   6, /*   -   4 */
     1514  6      ,   7, /*   -   5 */
     1515  6      ,   8, /*   -   6 */
     1516  6      ,   9, /*   -   7 */
     1517  6      ,  10, /*   -   8 */
     1518  7      ,   5, /*   -   9 */
     1519  7      ,   6, /*   -  10 */
     1520  7      ,   7, /*   -  11 */
     1521  7      ,   8, /*   -  12 */
     1522  7      ,   9, /*   -  13 */
     1523  6      ,  11, /*   -  14 */
     1524  6      ,  12, /*   -  15 */
     1525  6      ,  13, /*   -  16 */
     1526  6      ,  14, /*   -  17 */
     1527  6      ,  15, /*   -  18 */
     1528  6      ,  16, /*   -  19 */
     1529  6      ,  17, /*   -  20 */
     1530  6      ,  18, /*   -  21 */
     1531  6      ,  19, /*   -  22 */
     1532  6      ,  20, /*   -  23 */
     1533  6      ,  21, /*   -  24 */
     1534  6      ,  22, /*   -  25 */
     1535  6      ,  23, /*   -  26 */
     1536  6      ,  24, /*   -  27 */
     1537  6      ,  25, /*   -  28 */
     1538  6      ,  26, /*   -  29 */
     1539  6      ,  27, /*   -  30 */
     1540  6      ,  28, /*   -  31 */
    15401541  7      ,   2, /*   -  32 */
    15411542  7      ,  28, /* ! -  33 */
     
    17681769#define LCM_Diacritic_Start 131
    17691770
    1770 static const unsigned char LCM_Diacritic_LUT[] = { 
     1771static const unsigned char LCM_Diacritic_LUT[] = {
    17711772123,  /* ƒ - 131 */
    17721773  2,  /* „ - 132 */
     
    19001901 * OLE2NLS_isPunctuation [INTERNAL]
    19011902 */
    1902 static int OLE2NLS_isPunctuation(unsigned char c) 
    1903 {
    1904   /* "punctuation character" in this context is a character which is 
     1903static int OLE2NLS_isPunctuation(unsigned char c)
     1904{
     1905  /* "punctuation character" in this context is a character which is
    19051906     considered "less important" during word sort comparison.
    1906      See LCMapString implementation for the precise definition 
     1907     See LCMapString implementation for the precise definition
    19071908     of "less important". */
    19081909
     
    19131914 * OLE2NLS_isNonSpacing [INTERNAL]
    19141915 */
    1915 static int OLE2NLS_isNonSpacing(unsigned char c) 
    1916 {
    1917   /* This function is used by LCMapStringA.  Characters 
     1916static int OLE2NLS_isNonSpacing(unsigned char c)
     1917{
     1918  /* This function is used by LCMapStringA.  Characters
    19181919     for which it returns true are ignored when mapping a
    19191920     string with NORM_IGNORENONSPACE */
     
    19241925 * OLE2NLS_isSymbol [INTERNAL]
    19251926 */
    1926 static int OLE2NLS_isSymbol(unsigned char c) 
    1927 {
    1928   /* This function is used by LCMapStringA.  Characters 
     1927static int OLE2NLS_isSymbol(unsigned char c)
     1928{
     1929  /* This function is used by LCMapStringA.  Characters
    19291930     for which it returns true are ignored when mapping a
    19301931     string with NORM_IGNORESYMBOLS */
     
    19371938
    19381939/******************************************************************************
    1939  *              identity        [Internal]
     1940 *      identity    [Internal]
    19401941 */
    19411942#ifdef __WIN32OS2__
     
    19631964 * NOTES
    19641965 *    If called with scrlen = -1, the function will compute the length
    1965  *      of the 0-terminated string strsrc by itself.     
    1966  * 
    1967  *    If called with dstlen = 0, returns the buffer length that 
     1966 *      of the 0-terminated string strsrc by itself.
     1967 *
     1968 *    If called with dstlen = 0, returns the buffer length that
    19681969 *      would be required.
    19691970 *
    19701971 *    NORM_IGNOREWIDTH means to compare ASCII and wide characters
    1971  *    as if they are equal. 
     1972 *    as if they are equal.
    19721973 *    In the only code page implemented so far, there may not be
    19731974 *    wide characters in strings passed to LCMapStringA,
     
    19761977#ifdef __WIN32OS2__
    19771978ODINFUNCTION6(INT, LCMapStringA,
    1978         LCID, lcid,      /* [in] locale identifier created with MAKELCID;
    1979                                 LOCALE_SYSTEM_DEFAULT and LOCALE_USER_DEFAULT are
     1979    LCID, lcid,      /* [in] locale identifier created with MAKELCID;
     1980                        LOCALE_SYSTEM_DEFAULT and LOCALE_USER_DEFAULT are
    19801981                                predefined values. */
    1981         DWORD, mapflags, /* [in] flags */
    1982         LPCSTR, srcstr,  /* [in] source buffer */
    1983         INT, srclen,     /* [in] source length */
    1984         LPSTR, dststr,   /* [out] destination buffer */
    1985         INT, dstlen)     /* [in] destination buffer length */
     1982    DWORD, mapflags, /* [in] flags */
     1983    LPCSTR, srcstr,  /* [in] source buffer */
     1984    INT, srclen,     /* [in] source length */
     1985    LPSTR, dststr,   /* [out] destination buffer */
     1986    INT, dstlen)     /* [in] destination buffer length */
    19861987#else
    19871988INT WINAPI LCMapStringA(
    1988         LCID lcid,      /* [in] locale identifier created with MAKELCID;
    1989                                 LOCALE_SYSTEM_DEFAULT and LOCALE_USER_DEFAULT are
     1989    LCID lcid,      /* [in] locale identifier created with MAKELCID;
     1990                        LOCALE_SYSTEM_DEFAULT and LOCALE_USER_DEFAULT are
    19901991                                predefined values. */
    1991         DWORD mapflags, /* [in] flags */
    1992         LPCSTR srcstr,  /* [in] source buffer */
    1993         INT srclen,     /* [in] source length */
    1994         LPSTR dststr,   /* [out] destination buffer */
    1995         INT dstlen)     /* [in] destination buffer length */
     1992    DWORD mapflags, /* [in] flags */
     1993    LPCSTR srcstr,  /* [in] source buffer */
     1994    INT srclen,     /* [in] source length */
     1995    LPSTR dststr,   /* [out] destination buffer */
     1996    INT dstlen)     /* [in] destination buffer length */
    19961997#endif
    19971998{
     
    19992000
    20002001  TRACE("(0x%04lx,0x%08lx,%s,%d,%p,%d)\n",
    2001         lcid,mapflags,srcstr,srclen,dststr,dstlen);
     2002    lcid,mapflags,srcstr,srclen,dststr,dstlen);
    20022003
    20032004  if ( ((dstlen!=0) && (dststr==NULL)) || (srcstr==NULL) )
     
    20072008    return 0;
    20082009  }
    2009   if (srclen == -1) 
     2010  if (srclen == -1)
    20102011    srclen = strlen(srcstr) + 1 ;    /* (include final '\0') */
    20112012
     
    20182019                                        NORM_IGNOREWIDTH    | \
    20192020                                        NORM_IGNOREKANATYPE)
    2020   /* FIXME: as long as we don't support Katakana nor Hiragana 
     2021  /* FIXME: as long as we don't support Katakana nor Hiragana
    20212022   * characters, we can support NORM_IGNOREKANATYPE
    20222023   */
     
    20242025  {
    20252026    FIXME("(0x%04lx,0x%08lx,%p,%d,%p,%d): "
    2026           "unimplemented flags: 0x%08lx\n",
    2027           lcid,
    2028           mapflags,
    2029           srcstr,
    2030           srclen,
    2031           dststr,
    2032           dstlen,
    2033           mapflags & ~LCMAPSTRINGA_SUPPORTED_FLAGS
     2027      "unimplemented flags: 0x%08lx\n",
     2028      lcid,
     2029      mapflags,
     2030      srcstr,
     2031      srclen,
     2032      dststr,
     2033      dstlen,
     2034      mapflags & ~LCMAPSTRINGA_SUPPORTED_FLAGS
    20342035     );
    20352036  }
     
    20392040    int i,j;
    20402041#ifdef __WIN32OS2__
    2041     int (* _Optlink f)(int) = identity; 
     2042    int (* _Optlink f)(int) = identity;
    20422043#else
    2043     int (* f)(int) = identity; 
     2044    int (* f)(int) = identity;
    20442045#endif
    20452046    int flag_ignorenonspace = mapflags & NORM_IGNORENONSPACE;
     
    20482049    if (flag_ignorenonspace || flag_ignoresymbols)
    20492050    {
    2050       /* For some values of mapflags, the length of the resulting 
    2051         string is not known at this point.  Windows does map the string
    2052         and does not SetLastError ERROR_INSUFFICIENT_BUFFER in
    2053         these cases. */
     2051      /* For some values of mapflags, the length of the resulting
     2052    string is not known at this point.  Windows does map the string
     2053    and does not SetLastError ERROR_INSUFFICIENT_BUFFER in
     2054    these cases. */
    20542055      if (dstlen==0)
    20552056      {
    2056         /* Compute required length */
    2057         for (i=j=0; i < srclen; i++)
    2058         {
    2059           if ( !(flag_ignorenonspace && OLE2NLS_isNonSpacing(srcstr[i]))
    2060                && !(flag_ignoresymbols && OLE2NLS_isSymbol(srcstr[i])) )
    2061             j++;
    2062         }
    2063         return j;
     2057    /* Compute required length */
     2058    for (i=j=0; i < srclen; i++)
     2059    {
     2060      if ( !(flag_ignorenonspace && OLE2NLS_isNonSpacing(srcstr[i]))
     2061           && !(flag_ignoresymbols && OLE2NLS_isSymbol(srcstr[i])) )
     2062        j++;
     2063    }
     2064    return j;
    20642065      }
    20652066    }
     
    20672068    {
    20682069      if (dstlen==0)
    2069         return srclen; 
    2070       if (dstlen<srclen) 
    2071            {
    2072              SetLastError(ERROR_INSUFFICIENT_BUFFER);
    2073              return 0;
    2074            }
     2070    return srclen;
     2071      if (dstlen<srclen)
     2072       {
     2073         SetLastError(ERROR_INSUFFICIENT_BUFFER);
     2074         return 0;
     2075       }
    20752076    }
    20762077    if (mapflags & LCMAP_UPPERCASE)
     
    20822083    {
    20832084      if ( !(flag_ignorenonspace && OLE2NLS_isNonSpacing(srcstr[i]))
    2084            && !(flag_ignoresymbols && OLE2NLS_isSymbol(srcstr[i])) )
     2085       && !(flag_ignoresymbols && OLE2NLS_isSymbol(srcstr[i])) )
    20852086      {
    2086         dststr[j] = (CHAR) f(srcstr[i]);
    2087         j++;
     2087    dststr[j] = (CHAR) f(srcstr[i]);
     2088    j++;
    20882089      }
    20892090    }
     
    21092110      int ofs;
    21102111      unsigned char source_char = srcstr[i];
    2111       if (source_char!='\0') 
     2112      if (source_char!='\0')
    21122113      {
    2113         if (flag_stringsort || !OLE2NLS_isPunctuation(source_char))
    2114         {
    2115           unicode_len++;
    2116           if ( LCM_Unicode_LUT[-2+2*source_char] & ~15 )
    2117             unicode_len++;             /* double letter */
    2118         }
    2119         else
    2120         {
    2121           delayed_punctuation_len++;
    2122         }         
     2114    if (flag_stringsort || !OLE2NLS_isPunctuation(source_char))
     2115    {
     2116      unicode_len++;
     2117      if ( LCM_Unicode_LUT[-2+2*source_char] & ~15 )
     2118        unicode_len++;             /* double letter */
     2119    }
     2120    else
     2121    {
     2122      delayed_punctuation_len++;
     2123    }
    21232124      }
    2124          
     2125
    21252126      if (isupper(source_char))
    2126         case_len=unicode_len;
     2127    case_len=unicode_len;
    21272128
    21282129      ofs = source_char - LCM_Diacritic_Start;
    21292130      if ((ofs>=0) && (LCM_Diacritic_LUT[ofs]!=2))
    2130         diacritic_len=unicode_len;
     2131    diacritic_len=unicode_len;
    21312132    }
    21322133
    21332134    if (mapflags & NORM_IGNORECASE)
    2134       case_len=0;                   
     2135      case_len=0;
    21352136    if (mapflags & NORM_IGNORENONSPACE)
    21362137      diacritic_len=0;
     
    21432144      +     1  ;                         /* terminal '\0' */
    21442145    if (dstlen==0)
    2145       return room;     
     2146      return room;
    21462147    else if (dstlen<room)
    21472148    {
     
    21592160    /* locate each component, write separators */
    21602161    diacritic_component = dststr + 2*unicode_len ;
    2161     *diacritic_component++ = '\1'; 
     2162    *diacritic_component++ = '\1';
    21622163    case_component = diacritic_component + diacritic_len ;
    2163     *case_component++ = '\1'; 
     2164    *case_component++ = '\1';
    21642165    delayed_punctuation_component = case_component + case_len ;
    21652166    *delayed_punctuation_component++ = '\1';
    21662167    *delayed_punctuation_component++ = '\1';
    21672168
    2168     /* read source string char by char, write 
     2169    /* read source string char by char, write
    21692170       corresponding weight in each component. */
    21702171    for (i=0,count=0;i<srclen;i++)
    21712172    {
    21722173      unsigned char source_char=srcstr[i];
    2173       if (source_char!='\0') 
     2174      if (source_char!='\0')
    21742175      {
    2175         int type,longcode;
    2176         type = LCM_Unicode_LUT[-2+2*source_char];
    2177         longcode = type >> 4;
    2178         type &= 15;
    2179         if (!flag_stringsort && OLE2NLS_isPunctuation(source_char))
    2180         {
    2181           WORD encrypted_location = (1<<15) + 7 + 4*count;
    2182           *delayed_punctuation_component++ = (unsigned char) (encrypted_location>>8);
    2183           *delayed_punctuation_component++ = (unsigned char) (encrypted_location&255);
     2176    int type,longcode;
     2177    type = LCM_Unicode_LUT[-2+2*source_char];
     2178    longcode = type >> 4;
     2179    type &= 15;
     2180    if (!flag_stringsort && OLE2NLS_isPunctuation(source_char))
     2181    {
     2182      WORD encrypted_location = (1<<15) + 7 + 4*count;
     2183      *delayed_punctuation_component++ = (unsigned char) (encrypted_location>>8);
     2184      *delayed_punctuation_component++ = (unsigned char) (encrypted_location&255);
    21842185                     /* big-endian is used here because it lets string comparison be
    2185                         compatible with numerical comparison */
    2186 
    2187           *delayed_punctuation_component++ = type;
    2188           *delayed_punctuation_component++ = LCM_Unicode_LUT[-1+2*source_char]; 
    2189                      /* assumption : a punctuation character is never a 
    2190                         double or accented letter */
    2191         }
    2192         else
    2193         {
    2194           dststr[2*count] = type;
    2195           dststr[2*count+1] = LCM_Unicode_LUT[-1+2*source_char]; 
    2196           if (longcode)
    2197           {
    2198             if (count<case_len)
    2199               case_component[count] = ( isupper(source_char) ? 18 : 2 ) ;
    2200             if (count<diacritic_len)
    2201               diacritic_component[count] = 2; /* assumption: a double letter
    2202                                                 is never accented */
    2203             count++;
    2204            
    2205             dststr[2*count] = type;
    2206             dststr[2*count+1] = *(LCM_Unicode_LUT_2 - 1 + longcode);
    2207             /* 16 in the first column of LCM_Unicode_LUT  -->  longcode = 1
    2208                32 in the first column of LCM_Unicode_LUT  -->  longcode = 2
    2209                48 in the first column of LCM_Unicode_LUT  -->  longcode = 3 */
    2210           }
    2211 
    2212           if (count<case_len)
    2213             case_component[count] = ( isupper(source_char) ? 18 : 2 ) ;
    2214           if (count<diacritic_len)
    2215           {
    2216             int ofs = source_char - LCM_Diacritic_Start;
    2217             diacritic_component[count] = (ofs>=0 ? LCM_Diacritic_LUT[ofs] : 2);
    2218           }
    2219           count++;
    2220         }
     2186            compatible with numerical comparison */
     2187
     2188      *delayed_punctuation_component++ = type;
     2189      *delayed_punctuation_component++ = LCM_Unicode_LUT[-1+2*source_char];
     2190                     /* assumption : a punctuation character is never a
     2191            double or accented letter */
     2192    }
     2193    else
     2194    {
     2195      dststr[2*count] = type;
     2196      dststr[2*count+1] = LCM_Unicode_LUT[-1+2*source_char];
     2197      if (longcode)
     2198      {
     2199        if (count<case_len)
     2200          case_component[count] = ( isupper(source_char) ? 18 : 2 ) ;
     2201        if (count<diacritic_len)
     2202          diacritic_component[count] = 2; /* assumption: a double letter
     2203                        is never accented */
     2204        count++;
     2205
     2206        dststr[2*count] = type;
     2207        dststr[2*count+1] = *(LCM_Unicode_LUT_2 - 1 + longcode);
     2208        /* 16 in the first column of LCM_Unicode_LUT  -->  longcode = 1
     2209           32 in the first column of LCM_Unicode_LUT  -->  longcode = 2
     2210           48 in the first column of LCM_Unicode_LUT  -->  longcode = 3 */
     2211      }
     2212
     2213      if (count<case_len)
     2214        case_component[count] = ( isupper(source_char) ? 18 : 2 ) ;
     2215      if (count<diacritic_len)
     2216      {
     2217        int ofs = source_char - LCM_Diacritic_Start;
     2218        diacritic_component[count] = (ofs>=0 ? LCM_Diacritic_LUT[ofs] : 2);
     2219      }
     2220      count++;
     2221    }
    22212222      }
    22222223    }
     
    22252226  }
    22262227}
    2227                      
     2228
    22282229/*************************************************************************
    22292230 *              LCMapStringW                [KERNEL32.493]
     
    22372238#ifdef __WIN32OS2__
    22382239ODINFUNCTION6(INT, LCMapStringW,
    2239         LCID, lcid,DWORD, mapflags,LPCWSTR, srcstr,INT, srclen,LPWSTR, dststr,
    2240         INT, dstlen)
     2240    LCID, lcid,DWORD, mapflags,LPCWSTR, srcstr,INT, srclen,LPWSTR, dststr,
     2241    INT, dstlen)
    22412242#else
    22422243INT WINAPI LCMapStringW(
    2243         LCID lcid,DWORD mapflags,LPCWSTR srcstr,INT srclen,LPWSTR dststr,
    2244         INT dstlen)
     2244    LCID lcid,DWORD mapflags,LPCWSTR srcstr,INT srclen,LPWSTR dststr,
     2245    INT dstlen)
    22452246#endif
    22462247{
    22472248  int i;
    2248  
     2249
    22492250  TRACE("(0x%04lx,0x%08lx,%p,%d,%p,%d)\n",
    22502251                 lcid, mapflags, srcstr, srclen, dststr, dstlen);
    2251  
     2252
    22522253  if ( ((dstlen!=0) && (dststr==NULL)) || (srcstr==NULL) )
    22532254  {
     
    22562257    return 0;
    22572258  }
    2258   if (srclen==-1) 
     2259  if (srclen==-1)
    22592260    srclen = strlenW(srcstr)+1;
    22602261
     
    22632264   * parameter the application must set the "LC_COLLATE" or "LC_ALL"
    22642265   * environment variable prior to invoking this function.  */
    2265   if (mapflags & LCMAP_SORTKEY) 
     2266  if (mapflags & LCMAP_SORTKEY)
    22662267  {
    22672268      /* Possible values of LC_COLLATE. */
     
    23202321       * current value is backed up so it can be restored after the
    23212322       * last LC_COLLATE sensitive function returns.
    2322        * 
     2323       *
    23232324       * Even though the locale is adjusted for a minimum amount of
    23242325       * time a race condition exists where other threads may be
     
    23602361      {
    23612362          LPSTR srcstr_ascii = (LPSTR)HEAP_strdupWtoA(GetProcessHeap(),
    2362                                            0, srcstr);
     2363                       0, srcstr);
    23632364          ERR("wcstombs failed.  The string specified (%s) may contains an "
    23642365              "invalid character.\n", srcstr_ascii);
     
    23732374      {
    23742375          src_native[src_native_len - 1] = 0;
    2375           ERR("wcstombs returned a string (%s) that was longer (%d bytes) " 
     2376          ERR("wcstombs returned a string (%s) that was longer (%d bytes) "
    23762377              "than expected (%d bytes).\n", src_native, returned_len,
    23772378              dst_native_len);
     
    24152416       * not sure what those tables are. */
    24162417      returned_len = strxfrm(dst_native, src_native, dst_native_len) + 1;
    2417      
     2418
    24182419      if(returned_len > dst_native_len)
    24192420      {
    24202421          dst_native[dst_native_len - 1] = 0;
    2421           ERR("strxfrm returned a string (%s) that was longer (%d bytes) " 
     2422          ERR("strxfrm returned a string (%s) that was longer (%d bytes) "
    24222423              "than expected (%d bytes).\n", dst_native, returned_len,
    24232424              dst_native_len);
     
    24342435      }
    24352436      dst_native_len = returned_len;
    2436      
     2437
    24372438      TRACE("dst_native = %s  dst_native_len = %d\n",
    24382439             dst_native, dst_native_len);
     
    24572458      /* Restore LC_COLLATE now that the last LC_COLLATE sensitive
    24582459       * function has returned. */
    2459       setlocale(LC_COLLATE, lc_collate_default); 
     2460      setlocale(LC_COLLATE, lc_collate_default);
    24602461
    24612462      if(returned_len == 0)
     
    24742475          if(returned_len > dstlen)
    24752476          {
    2476               ERR("mbstowcs returned a string that was longer (%d chars) " 
     2477              ERR("mbstowcs returned a string that was longer (%d chars) "
    24772478                  "than the buffer provided (%d chars).\n", returned_len,
    24782479                  dstlen);
     
    24822483              if(dst_native) HeapFree(GetProcessHeap(), 0, dst_native);
    24832484              if(dststr_libc) HeapFree(GetProcessHeap(), 0, dststr_libc);
    2484               return 0;         
     2485              return 0;
    24852486          }
    24862487          dstlen = returned_len;
     
    25112512  {
    25122513#ifdef __WIN32OS2__
    2513     int (* _Optlink f)(int) = identity; 
     2514    int (* _Optlink f)(int) = identity;
    25142515#else
    2515     int (*f)(int)=identity; 
     2516    int (*f)(int)=identity;
    25162517#endif
    25172518
    25182519    if (dstlen==0)
    2519         return srclen; 
    2520     if (dstlen<srclen) 
     2520        return srclen;
     2521    if (dstlen<srclen)
    25212522    {
    25222523        SetLastError(ERROR_INSUFFICIENT_BUFFER);
     
    25472548 */
    25482549static inline int OLE2NLS_EstimateMappingLength(LCID lcid, DWORD dwMapFlags,
    2549                                                 LPCSTR str, DWORD len)
     2550                        LPCSTR str, DWORD len)
    25502551{
    25512552    /* Estimate only for small strings to keep the estimation error from
     
    25562557
    25572558/******************************************************************************
    2558  *              CompareStringA  [KERNEL32.143]
     2559 *      CompareStringA  [KERNEL32.143]
    25592560 * Compares two strings using locale
    25602561 *
     
    25692570 * SORT_STRINGSORT is set.
    25702571 * Calls SetLastError for ERROR_INVALID_FLAGS, ERROR_INVALID_PARAMETER.
    2571  * 
     2572 *
    25722573 * BUGS
    25732574 *
     
    25752576 *
    25762577 * FIXME
    2577  * 
     2578 *
    25782579 * Quite inefficient.
    25792580 */
     
    25912592  LPSTR sk1,sk2;
    25922593  TRACE("%s and %s\n",
    2593         debugstr_a (s1), debugstr_a (s2));
     2594    debugstr_a (s1), debugstr_a (s2));
    25942595
    25952596  if ( (s1==NULL) || (s2==NULL) )
    2596   {   
     2597  {
    25972598    ERR("(s1=%s,s2=%s): Invalid NULL string\n", s1, s2);
    25982599    SetLastError(ERROR_INVALID_PARAMETER);
     
    26052606  if (l1 == -1) l1 = strlen(s1);
    26062607  if (l2 == -1) l2 = strlen(s2);
    2607        
     2608
    26082609  mapstring_flags = LCMAP_SORTKEY | fdwStyle ;
    26092610  len1 = OLE2NLS_EstimateMappingLength(lcid, mapstring_flags, s1, l1);
     
    26162617  sk2 = sk1 + len1;
    26172618  if ( (!LCMapStringA(lcid,mapstring_flags,s1,l1,sk1,len1))
    2618         || (!LCMapStringA(lcid,mapstring_flags,s2,l2,sk2,len2)) )
     2619    || (!LCMapStringA(lcid,mapstring_flags,s2,l2,sk2,len2)) )
    26192620  {
    26202621    ERR("Bug in LCmapStringA.\n");
     
    26382639
    26392640/******************************************************************************
    2640  *              CompareStringW  [KERNEL32.144]
     2641 *      CompareStringW  [KERNEL32.144]
    26412642 * This implementation ignores the locale
    26422643 * FIXME :  Does only string sort.  Should
    26432644 * be reimplemented the same way as CompareStringA.
    26442645 */
    2645 UINT WINAPI CompareStringW(DWORD lcid, DWORD fdwStyle, 
     2646UINT WINAPI CompareStringW(DWORD lcid, DWORD fdwStyle,
    26462647                               LPCWSTR s1, DWORD l1, LPCWSTR s2,DWORD l2)
    26472648{
    2648         int len,ret;
    2649         if(fdwStyle & NORM_IGNORENONSPACE)
    2650                 FIXME("IGNORENONSPACE not supprted\n");
    2651         if(fdwStyle & NORM_IGNORESYMBOLS)
    2652                 FIXME("IGNORESYMBOLS not supported\n");
    2653 
    2654         /* Is strcmp defaulting to string sort or to word sort?? */
    2655         /* FIXME: Handle NORM_STRINGSORT */
    2656         l1 = (l1==-1)?strlenW(s1):l1;
    2657         l2 = (l2==-1)?strlenW(s2):l2;
    2658         len = l1<l2 ? l1:l2;
    2659         ret = (fdwStyle & NORM_IGNORECASE) ? strncmpiW(s1,s2,len) : strncmpW(s1,s2,len);
    2660         /* not equal, return 1 or 3 */
    2661         if(ret!=0) {
    2662                 /* need to translate result */
    2663                 return ((int)ret < 0) ? 1 : 3;
    2664         }
    2665         /* same len, return 2 */
    2666         if(l1==l2) return 2;
    2667         /* the longer one is lexically greater */
    2668         return (l1<l2)? 1 : 3;
     2649    int len,ret;
     2650    if(fdwStyle & NORM_IGNORENONSPACE)
     2651        FIXME("IGNORENONSPACE not supprted\n");
     2652    if(fdwStyle & NORM_IGNORESYMBOLS)
     2653        FIXME("IGNORESYMBOLS not supported\n");
     2654
     2655    /* Is strcmp defaulting to string sort or to word sort?? */
     2656    /* FIXME: Handle NORM_STRINGSORT */
     2657    l1 = (l1==-1)?strlenW(s1):l1;
     2658    l2 = (l2==-1)?strlenW(s2):l2;
     2659    len = l1<l2 ? l1:l2;
     2660    ret = (fdwStyle & NORM_IGNORECASE) ? strncmpiW(s1,s2,len) : strncmpW(s1,s2,len);
     2661    /* not equal, return 1 or 3 */
     2662    if(ret!=0) {
     2663        /* need to translate result */
     2664        return ((int)ret < 0) ? 1 : 3;
     2665    }
     2666    /* same len, return 2 */
     2667    if(l1==l2) return 2;
     2668    /* the longer one is lexically greater */
     2669    return (l1<l2)? 1 : 3;
    26692670}
    26702671
    26712672/******************************************************************************
    2672  *              OLE_GetFormatA  [Internal]
     2673 *      OLE_GetFormatA  [Internal]
    26732674 *
    26742675 * FIXME
    26752676 *    If datelen == 0, it should return the reguired string length.
    26762677 *
    2677  This function implements stuff for GetDateFormat() and 
     2678 This function implements stuff for GetDateFormat() and
    26782679 GetTimeFormat().
    26792680
     
    27032704  ''   (within a quoted string) indicates a literal '
    27042705
    2705  These functions REQUIRE valid locale, date,  and format. 
     2706 These functions REQUIRE valid locale, date,  and format.
    27062707 */
    27072708static INT OLE_GetFormatA(LCID locale,
    2708                             DWORD flags,
    2709                             DWORD tflags,
    2710                             LPSYSTEMTIME xtime,
    2711                             LPCSTR _format,     /*in*/
    2712                             LPSTR date,         /*out*/
    2713                             INT datelen)
     2709                DWORD flags,
     2710                DWORD tflags,
     2711                LPSYSTEMTIME xtime,
     2712                LPCSTR _format,     /*in*/
     2713                LPSTR date,     /*out*/
     2714                INT datelen)
    27142715{
    27152716   INT inpos, outpos;
     
    27212722
    27222723   const char * _dgfmt[] = { "%d", "%02d" };
    2723    const char ** dgfmt = _dgfmt - 1; 
     2724   const char ** dgfmt = _dgfmt - 1;
    27242725
    27252726   /* report, for debugging */
    27262727   TRACE("(0x%lx,0x%lx, 0x%lx, time(y=%d m=%d wd=%d d=%d,h=%d,m=%d,s=%d), fmt=%p \'%s\' , %p, len=%d)\n",
    2727          locale, flags, tflags,
    2728         xtime->wYear,xtime->wMonth,xtime->wDayOfWeek,xtime->wDay, xtime->wHour, xtime->wMinute, xtime->wSecond,
    2729         _format, _format, date, datelen);
    2730  
     2728     locale, flags, tflags,
     2729    xtime->wYear,xtime->wMonth,xtime->wDayOfWeek,xtime->wDay, xtime->wHour, xtime->wMinute, xtime->wSecond,
     2730    _format, _format, date, datelen);
     2731
    27312732   if(datelen == 0) {
    27322733     FIXME("datelen = 0, returning 255\n");
     
    27392740   type = '\0';
    27402741   date[0] = buf[0] = '\0';
    2741      
     2742
    27422743   strcpy(format,_format);
    27432744
    27442745   /* alter the formatstring, while it works for all languages now in wine
    2745    its possible that it fails when the time looks like ss:mm:hh as example*/   
     2746   its possible that it fails when the time looks like ss:mm:hh as example*/
    27462747   if (tflags & (TIME_NOMINUTESORSECONDS))
    27472748   { if ((pos = strstr ( format, ":mm")))
     
    27542755     }
    27552756   }
    2756    
     2757
    27572758   for (inpos = 0;; inpos++) {
    27582759      /* TRACE("STATE inpos=%2d outpos=%2d count=%d inquote=%d type=%c buf,date = %c,%c\n", inpos, outpos, count, inquote, type, buf[inpos], date[outpos]); */
    27592760      if (inquote) {
    2760         if (format[inpos] == '\'') {
    2761             if (format[inpos+1] == '\'') {
    2762                inpos += 1;
    2763                date[outpos++] = '\'';
    2764             } else {
    2765                inquote = 0;
    2766                continue; /* we did nothing to the output */
    2767             }
    2768         } else if (format[inpos] == '\0') {
    2769             date[outpos++] = '\0';
    2770             if (outpos > datelen) Overflow = 1;
    2771             break;
    2772         } else {
    2773             date[outpos++] = format[inpos];
    2774             if (outpos > datelen) {
    2775                Overflow = 1;
    2776                date[outpos-1] = '\0'; /* this is the last place where
    2777                                         it's safe to write */
    2778                break;
    2779             }
    2780         }
     2761    if (format[inpos] == '\'') {
     2762        if (format[inpos+1] == '\'') {
     2763           inpos += 1;
     2764           date[outpos++] = '\'';
     2765        } else {
     2766           inquote = 0;
     2767           continue; /* we did nothing to the output */
     2768        }
     2769    } else if (format[inpos] == '\0') {
     2770        date[outpos++] = '\0';
     2771        if (outpos > datelen) Overflow = 1;
     2772        break;
     2773    } else {
     2774        date[outpos++] = format[inpos];
     2775        if (outpos > datelen) {
     2776           Overflow = 1;
     2777           date[outpos-1] = '\0'; /* this is the last place where
     2778                    it's safe to write */
     2779           break;
     2780        }
     2781    }
    27812782      } else if (  (count && (format[inpos] != type))
    2782                    || count == 4
    2783                    || (count == 2 && strchr("ghHmst", type)) ) {
    2784             if (type == 'h' && (tflags & TIME_FORCE24HOURFORMAT)) type= 'H';
    2785             if (type == 'd') {
    2786                if (count == 4) {
    2787                   GetLocaleInfoA(locale,
    2788                                    LOCALE_SDAYNAME1
    2789                                    + (xtime->wDayOfWeek+6)%7,
    2790                                    buf, sizeof(buf));
    2791                } else if (count == 3) {
    2792                            GetLocaleInfoA(locale,
    2793                                             LOCALE_SABBREVDAYNAME1
    2794                                             + (xtime->wDayOfWeek+6)%7,
    2795                                             buf, sizeof(buf));
    2796                       } else {
    2797                   sprintf(buf, dgfmt[count], xtime->wDay);
    2798                }
    2799             } else if (type == 'M') {
    2800                if (count == 3) {
    2801                   GetLocaleInfoA(locale,
    2802                                    LOCALE_SABBREVMONTHNAME1
    2803                                    + xtime->wMonth - 1,
    2804                                    buf, sizeof(buf));
    2805                } else if (count == 4) {
    2806                   GetLocaleInfoA(locale,
    2807                                    LOCALE_SMONTHNAME1
    2808                                    + xtime->wMonth - 1,
    2809                                    buf, sizeof(buf));
    2810                 } else {
    2811                   sprintf(buf, dgfmt[count], xtime->wMonth);
    2812                }
    2813             } else if (type == 'y') {
    2814                if (count == 4) {
    2815                       sprintf(buf, "%d", xtime->wYear);
    2816                } else if (count == 3) {
    2817                   strcpy(buf, "yyy");
    2818                   WARN("unknown format, c=%c, n=%d\n",  type, count);
    2819                 } else {
    2820                   sprintf(buf, dgfmt[count], xtime->wYear % 100);
    2821                }
    2822             } else if (type == 'g') {
    2823                if        (count == 2) {
    2824                   FIXME("LOCALE_ICALENDARTYPE unimp.\n");
    2825                   strcpy(buf, "AD");
    2826             } else {
    2827                   strcpy(buf, "g");
    2828                   WARN("unknown format, c=%c, n=%d\n", type, count);
    2829                }
    2830             } else if (type == 'h') {
    2831                /* gives us hours 1:00 -- 12:00 */
    2832                sprintf(buf, dgfmt[count], (xtime->wHour-1)%12 +1);
    2833             } else if (type == 'H') {
    2834                /* 24-hour time */
    2835                sprintf(buf, dgfmt[count], xtime->wHour);
    2836             } else if ( type == 'm') {
    2837                sprintf(buf, dgfmt[count], xtime->wMinute);
    2838             } else if ( type == 's') {
    2839                sprintf(buf, dgfmt[count], xtime->wSecond);
    2840             } else if (type == 't') {
     2783           || count == 4
     2784           || (count == 2 && strchr("ghHmst", type)) ) {
     2785        if (type == 'h' && (tflags & TIME_FORCE24HOURFORMAT)) type= 'H';
     2786        if (type == 'd') {
     2787           if (count == 4) {
     2788          GetLocaleInfoA(locale,
     2789                   LOCALE_SDAYNAME1
     2790                   + (xtime->wDayOfWeek+6)%7,
     2791                   buf, sizeof(buf));
     2792           } else if (count == 3) {
     2793               GetLocaleInfoA(locale,
     2794                        LOCALE_SABBREVDAYNAME1
     2795                        + (xtime->wDayOfWeek+6)%7,
     2796                        buf, sizeof(buf));
     2797              } else {
     2798          sprintf(buf, dgfmt[count], xtime->wDay);
     2799           }
     2800        } else if (type == 'M') {
     2801           if (count == 3) {
     2802          GetLocaleInfoA(locale,
     2803                   LOCALE_SABBREVMONTHNAME1
     2804                   + xtime->wMonth - 1,
     2805                   buf, sizeof(buf));
     2806           } else if (count == 4) {
     2807          GetLocaleInfoA(locale,
     2808                   LOCALE_SMONTHNAME1
     2809                   + xtime->wMonth - 1,
     2810                   buf, sizeof(buf));
     2811        } else {
     2812          sprintf(buf, dgfmt[count], xtime->wMonth);
     2813           }
     2814        } else if (type == 'y') {
     2815           if (count == 4) {
     2816              sprintf(buf, "%d", xtime->wYear);
     2817           } else if (count == 3) {
     2818          strcpy(buf, "yyy");
     2819          WARN("unknown format, c=%c, n=%d\n",  type, count);
     2820        } else {
     2821          sprintf(buf, dgfmt[count], xtime->wYear % 100);
     2822           }
     2823        } else if (type == 'g') {
     2824           if        (count == 2) {
     2825          FIXME("LOCALE_ICALENDARTYPE unimp.\n");
     2826          strcpy(buf, "AD");
     2827        } else {
     2828          strcpy(buf, "g");
     2829          WARN("unknown format, c=%c, n=%d\n", type, count);
     2830           }
     2831        } else if (type == 'h') {
     2832           /* gives us hours 1:00 -- 12:00 */
     2833           sprintf(buf, dgfmt[count], (xtime->wHour-1)%12 +1);
     2834        } else if (type == 'H') {
     2835           /* 24-hour time */
     2836           sprintf(buf, dgfmt[count], xtime->wHour);
     2837        } else if ( type == 'm') {
     2838           sprintf(buf, dgfmt[count], xtime->wMinute);
     2839        } else if ( type == 's') {
     2840           sprintf(buf, dgfmt[count], xtime->wSecond);
     2841        } else if (type == 't') {
    28412842               if ((tflags & TIME_NOTIMEMARKER))
    28422843                  buf[0]='\0';
    28432844               else if (count == 1) {
    2844                   sprintf(buf, "%c", (xtime->wHour < 12) ? 'A' : 'P');
     2845          sprintf(buf, "%c", (xtime->wHour < 12) ? 'A' : 'P');
    28452846               } else if (count == 2) {
    28462847                 /* sprintf(buf, "%s", (xtime->wHour < 12) ? "AM" : "PM"); */
    28472848                  GetLocaleInfoA(locale,
    2848                            (xtime->wHour<12) 
     2849                           (xtime->wHour<12)
    28492850                           ? LOCALE_S1159 : LOCALE_S2359,
    28502851                           buf, sizeof(buf));
    28512852               }
    2852             };
    2853 
    2854             /* we need to check the next char in the format string
    2855                again, no matter what happened */
    2856             inpos--;
    2857            
    2858             /* add the contents of buf to the output */
    2859             buflen = strlen(buf);
    2860             if (outpos + buflen < datelen) {
    2861                date[outpos] = '\0'; /* for strcat to hook onto */
    2862                 strcat(date, buf);
    2863                outpos += buflen;
    2864             } else {
    2865                date[outpos] = '\0';
    2866                strncat(date, buf, datelen - outpos);
    2867                 date[datelen - 1] = '\0';
    2868                 SetLastError(ERROR_INSUFFICIENT_BUFFER);
    2869                WARN("insufficient buffer\n");
    2870                 return 0;
    2871             }
    2872 
    2873             /* reset the variables we used to keep track of this item */
    2874             count = 0;
    2875             type = '\0';
    2876         } else if (format[inpos] == '\0') {
    2877             /* we can't check for this at the loop-head, because
    2878                that breaks the printing of the last format-item */
    2879             date[outpos] = '\0';
    2880             break;
     2853        };
     2854
     2855        /* we need to check the next char in the format string
     2856           again, no matter what happened */
     2857        inpos--;
     2858
     2859        /* add the contents of buf to the output */
     2860        buflen = strlen(buf);
     2861        if (outpos + buflen < datelen) {
     2862           date[outpos] = '\0'; /* for strcat to hook onto */
     2863        strcat(date, buf);
     2864           outpos += buflen;
     2865        } else {
     2866           date[outpos] = '\0';
     2867           strncat(date, buf, datelen - outpos);
     2868        date[datelen - 1] = '\0';
     2869        SetLastError(ERROR_INSUFFICIENT_BUFFER);
     2870           WARN("insufficient buffer\n");
     2871        return 0;
     2872        }
     2873
     2874        /* reset the variables we used to keep track of this item */
     2875        count = 0;
     2876        type = '\0';
     2877    } else if (format[inpos] == '\0') {
     2878        /* we can't check for this at the loop-head, because
     2879           that breaks the printing of the last format-item */
     2880        date[outpos] = '\0';
     2881        break;
    28812882         } else if (count) {
    2882             /* continuing a code for an item */
    2883             count +=1;
    2884             continue;
    2885         } else if (strchr("hHmstyMdg", format[inpos])) {
    2886             type = format[inpos];
    2887             count = 1;
    2888             continue;
    2889         } else if (format[inpos] == '\'') {
    2890             inquote = 1;
    2891             continue;
     2883        /* continuing a code for an item */
     2884        count +=1;
     2885        continue;
     2886    } else if (strchr("hHmstyMdg", format[inpos])) {
     2887        type = format[inpos];
     2888        count = 1;
     2889        continue;
     2890    } else if (format[inpos] == '\'') {
     2891        inquote = 1;
     2892        continue;
    28922893       } else {
    2893             date[outpos++] = format[inpos];
    2894         }
     2894        date[outpos++] = format[inpos];
     2895    }
    28952896      /* now deal with a possible buffer overflow */
    28962897      if (outpos >= datelen) {
     
    29002901      }
    29012902   }
    2902    
     2903
    29032904   if (Overflow) {
    29042905      SetLastError(ERROR_INSUFFICIENT_BUFFER);
     
    29102911   if (outpos > datelen-1) outpos = datelen-1;
    29112912   date[outpos] = '\0';
    2912    
     2913
    29132914   TRACE("returns string '%s', len %d\n", date, outpos);
    29142915   return outpos;
     
    29192920 */
    29202921static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
    2921                             LPSYSTEMTIME xtime,
    2922                             LPCWSTR format,
    2923                             LPWSTR output, INT outlen)
     2922                LPSYSTEMTIME xtime,
     2923                LPCWSTR format,
     2924                LPWSTR output, INT outlen)
    29242925{
    29252926   INT   inpos, outpos;
     
    29402941   /* make a debug report */
    29412942   TRACE("args: 0x%lx, 0x%lx, 0x%lx, time(d=%d,h=%d,m=%d,s=%d), fmt:%s (at %p), "
    2942               "%p with max len %d\n",
    2943         locale, flags, tflags,
    2944         xtime->wDay, xtime->wHour, xtime->wMinute, xtime->wSecond,
    2945         debugstr_w(format), format, output, outlen);
    2946    
     2943          "%p with max len %d\n",
     2944    locale, flags, tflags,
     2945    xtime->wDay, xtime->wHour, xtime->wMinute, xtime->wSecond,
     2946    debugstr_w(format), format, output, outlen);
     2947
    29472948   if(outlen == 0) {
    29482949     FIXME("outlen = 0, returning 255\n");
     
    29562957   /* this is really just a sanity check */
    29572958   output[0] = buf[0] = 0;
    2958    
     2959
    29592960   /* this loop is the core of the function */
    29602961   for (inpos = 0; /* we have several break points */ ; inpos++) {
    29612962      if (inquote) {
    2962         if (format[inpos] == (WCHAR) '\'') {
    2963             if (format[inpos+1] == '\'') {
    2964                inpos++;
    2965                output[outpos++] = '\'';
    2966             } else {
    2967                inquote = 0;
    2968                continue;
    2969             }
    2970         } else if (format[inpos] == 0) {
    2971             output[outpos++] = 0;
    2972             if (outpos > outlen) Overflow = 1;
    2973             break;  /*  normal exit (within a quote) */
    2974         } else {
    2975             output[outpos++] = format[inpos]; /* copy input */
    2976             if (outpos > outlen) {
    2977                Overflow = 1;
    2978                output[outpos-1] = 0;
    2979                break;
    2980             }
    2981         }
     2963    if (format[inpos] == (WCHAR) '\'') {
     2964        if (format[inpos+1] == '\'') {
     2965           inpos++;
     2966           output[outpos++] = '\'';
     2967        } else {
     2968           inquote = 0;
     2969           continue;
     2970        }
     2971    } else if (format[inpos] == 0) {
     2972        output[outpos++] = 0;
     2973        if (outpos > outlen) Overflow = 1;
     2974        break;  /*  normal exit (within a quote) */
     2975    } else {
     2976        output[outpos++] = format[inpos]; /* copy input */
     2977        if (outpos > outlen) {
     2978           Overflow = 1;
     2979           output[outpos-1] = 0;
     2980           break;
     2981        }
     2982    }
    29822983      } else if (  (count && (format[inpos] != type))
    2983                    || ( (count==4 && type =='y') ||
    2984                         (count==4 && type =='M') ||
    2985                         (count==4 && type =='d') ||
    2986                         (count==2 && type =='g') ||
    2987                         (count==2 && type =='h') ||
    2988                         (count==2 && type =='H') ||
    2989                         (count==2 && type =='m') ||
    2990                         (count==2 && type =='s') ||
    2991                         (count==2 && type =='t') )  ) {
     2984           || ( (count==4 && type =='y') ||
     2985            (count==4 && type =='M') ||
     2986            (count==4 && type =='d') ||
     2987            (count==2 && type =='g') ||
     2988            (count==2 && type =='h') ||
     2989            (count==2 && type =='H') ||
     2990            (count==2 && type =='m') ||
     2991            (count==2 && type =='s') ||
     2992            (count==2 && type =='t') )  ) {
    29922993          switch(type)
    29932994          {
    29942995          case 'd':
    2995             if        (count == 4) {
    2996                GetLocaleInfoW(locale,
    2997                              LOCALE_SDAYNAME1 + (xtime->wDayOfWeek +6)%7,
    2998                              buf, sizeof(buf)/sizeof(WCHAR) );
    2999             } else if (count == 3) {
    3000                GetLocaleInfoW(locale,
    3001                                 LOCALE_SABBREVDAYNAME1 +
    3002                                 (xtime->wDayOfWeek +6)%7,
    3003                                 buf, sizeof(buf)/sizeof(WCHAR) );
    3004             } else {
     2996        if        (count == 4) {
     2997           GetLocaleInfoW(locale,
     2998                 LOCALE_SDAYNAME1 + (xtime->wDayOfWeek +6)%7,
     2999                 buf, sizeof(buf)/sizeof(WCHAR) );
     3000        } else if (count == 3) {
     3001           GetLocaleInfoW(locale,
     3002                LOCALE_SABBREVDAYNAME1 +
     3003                (xtime->wDayOfWeek +6)%7,
     3004                buf, sizeof(buf)/sizeof(WCHAR) );
     3005        } else {
    30053006                sprintf( tmp, "%.*d", count, xtime->wDay );
    30063007                MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
    3007             }
     3008        }
    30083009            break;
    30093010
    30103011          case 'M':
    3011             if        (count == 4) {
    3012                GetLocaleInfoW(locale,  LOCALE_SMONTHNAME1 +
    3013                                 xtime->wMonth -1, buf,
    3014                                 sizeof(buf)/sizeof(WCHAR) );
    3015             } else if (count == 3) {
    3016                GetLocaleInfoW(locale,  LOCALE_SABBREVMONTHNAME1 +
    3017                                 xtime->wMonth -1, buf,
    3018                                 sizeof(buf)/sizeof(WCHAR) );
    3019             } else {
     3012        if        (count == 4) {
     3013           GetLocaleInfoW(locale,  LOCALE_SMONTHNAME1 +
     3014                xtime->wMonth -1, buf,
     3015                sizeof(buf)/sizeof(WCHAR) );
     3016        } else if (count == 3) {
     3017           GetLocaleInfoW(locale,  LOCALE_SABBREVMONTHNAME1 +
     3018                xtime->wMonth -1, buf,
     3019                sizeof(buf)/sizeof(WCHAR) );
     3020        } else {
    30203021                sprintf( tmp, "%.*d", count, xtime->wMonth );
    30213022                MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
    3022             }
     3023        }
    30233024            break;
    30243025          case 'y':
    3025             if        (count == 4) {
     3026        if        (count == 4) {
    30263027                sprintf( tmp, "%d", xtime->wYear );
    3027             } else if (count == 3) {
     3028        } else if (count == 3) {
    30283029                strcpy( tmp, "yyy" );
    3029             } else {
     3030        } else {
    30303031                sprintf( tmp, "%.*d", count, xtime->wYear % 100 );
    3031             }
     3032        }
    30323033            MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
    30333034            break;
    30343035
    30353036          case 'g':
    3036             if        (count == 2) {
    3037                FIXME("LOCALE_ICALENDARTYPE unimplemented\n");
     3037        if        (count == 2) {
     3038           FIXME("LOCALE_ICALENDARTYPE unimplemented\n");
    30383039               strcpy( tmp, "AD" );
    3039             } else {
    3040                /* Win API sez we copy it verbatim */
     3040        } else {
     3041           /* Win API sez we copy it verbatim */
    30413042                strcpy( tmp, "g" );
    3042             }
     3043        }
    30433044            MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
    30443045            break;
     
    30663067
    30673068          case 't':
    3068             GetLocaleInfoW(locale, (xtime->wHour < 12) ?
    3069                              LOCALE_S1159 : LOCALE_S2359,
    3070                              buf, sizeof(buf) );
    3071             if        (count == 1) {
    3072                buf[1] = 0;
    3073             }
     3069        GetLocaleInfoW(locale, (xtime->wHour < 12) ?
     3070                 LOCALE_S1159 : LOCALE_S2359,
     3071                 buf, sizeof(buf) );
     3072        if        (count == 1) {
     3073           buf[1] = 0;
     3074        }
    30743075            break;
    30753076          }
    30763077
    3077          /* no matter what happened,  we need to check this next
    3078             character the next time we loop through */
    3079         inpos--;
    3080 
    3081         /* cat buf onto the output */
    3082         outlen = strlenW(buf);
    3083         if (outpos + buflen < outlen) {
     3078     /* no matter what happened,  we need to check this next
     3079        character the next time we loop through */
     3080    inpos--;
     3081
     3082    /* cat buf onto the output */
     3083    outlen = strlenW(buf);
     3084    if (outpos + buflen < outlen) {
    30843085            strcpyW( output + outpos, buf );
    3085             outpos += buflen;
    3086         } else {
     3086        outpos += buflen;
     3087    } else {
    30873088            lstrcpynW( output + outpos, buf, outlen - outpos );
    3088             Overflow = 1;
    3089             break; /* Abnormal exit */
    3090         }
    3091 
    3092         /* reset the variables we used this time */
    3093         count = 0;
    3094         type = '\0';
     3089        Overflow = 1;
     3090        break; /* Abnormal exit */
     3091    }
     3092
     3093    /* reset the variables we used this time */
     3094    count = 0;
     3095    type = '\0';
    30953096      } else if (format[inpos] == 0) {
    3096          /* we can't check for this at the beginning,  because that
    3097          would keep us from printing a format spec that ended the
    3098         string */
    3099         output[outpos] = 0;
    3100         break;  /*  NORMAL EXIT  */
     3097     /* we can't check for this at the beginning,  because that
     3098     would keep us from printing a format spec that ended the
     3099    string */
     3100    output[outpos] = 0;
     3101    break;  /*  NORMAL EXIT  */
    31013102      } else if (count) {
    3102         /* how we keep track of the middle of a format spec */
    3103         count++;
    3104         continue;
     3103    /* how we keep track of the middle of a format spec */
     3104    count++;
     3105    continue;
    31053106      } else if ( (datevars && (format[inpos]=='d' ||
    3106                                 format[inpos]=='M' ||
    3107                                 format[inpos]=='y' ||
    3108                                 format[inpos]=='g')  ) ||
    3109                   (timevars && (format[inpos]=='H' ||
    3110                                 format[inpos]=='h' ||
    3111                                 format[inpos]=='m' ||
    3112                                 format[inpos]=='s' ||
    3113                                 format[inpos]=='t') )    ) {
    3114         type = format[inpos];
    3115         count = 1;
    3116         continue;
     3107                format[inpos]=='M' ||
     3108                format[inpos]=='y' ||
     3109                format[inpos]=='g')  ) ||
     3110          (timevars && (format[inpos]=='H' ||
     3111                format[inpos]=='h' ||
     3112                format[inpos]=='m' ||
     3113                format[inpos]=='s' ||
     3114                format[inpos]=='t') )    ) {
     3115    type = format[inpos];
     3116    count = 1;
     3117    continue;
    31173118      } else if (format[inpos] == '\'') {
    3118         inquote = 1;
    3119         continue;
     3119    inquote = 1;
     3120    continue;
    31203121      } else {
    3121         /* unquoted literals */
    3122         output[outpos++] = format[inpos];
     3122    /* unquoted literals */
     3123    output[outpos++] = format[inpos];
    31233124      }
    31243125   }
     
    31353136
    31363137   TRACE(" returning %s\n", debugstr_w(output));
    3137        
     3138
    31383139   return (!Overflow) ? outlen : 0;
    3139    
     3140
    31403141}
    31413142
    31423143
    31433144/******************************************************************************
    3144  *              GetDateFormatA  [KERNEL32.310]
     3145 *      GetDateFormatA  [KERNEL32.310]
    31453146 * Makes an ASCII string of the date
    31463147 *
     
    31643165 */
    31653166INT WINAPI GetDateFormatA(LCID locale,DWORD flags,
    3166                               LPSYSTEMTIME xtime,
    3167                               LPCSTR format, LPSTR date,INT datelen)
    3168 {
    3169    
     3167                  LPSYSTEMTIME xtime,
     3168                  LPCSTR format, LPSTR date,INT datelen)
     3169{
     3170
    31703171  char format_buf[40];
    31713172  LPCSTR thisformat;
     
    31783179
    31793180  TRACE("(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",
    3180               locale,flags,xtime,format,date,datelen);
    3181  
     3181          locale,flags,xtime,format,date,datelen);
     3182
    31823183  if (!locale) {
    31833184     locale = LOCALE_SYSTEM_DEFAULT;
    31843185     };
    3185  
     3186
    31863187  if (locale == LOCALE_SYSTEM_DEFAULT) {
    31873188     thislocale = GetSystemDefaultLCID();
     
    32003201      /*FIXME: SystemTimeToFileTime doesn't yet do that ckeck*/
    32013202      if(!res)
    3202         {
    3203           SetLastError(ERROR_INVALID_PARAMETER);
    3204           return 0;
    3205         }
    3206       FileTimeToSystemTime(&ft,&t); 
    3207      
     3203    {
     3204      SetLastError(ERROR_INVALID_PARAMETER);
     3205      return 0;
     3206    }
     3207      FileTimeToSystemTime(&ft,&t);
     3208
    32083209  };
    32093210  thistime = &t;
    32103211
    32113212  if (format == NULL) {
    3212      GetLocaleInfoA(thislocale, ((flags&DATE_LONGDATE) 
    3213                                    ? LOCALE_SLONGDATE
    3214                                    : LOCALE_SSHORTDATE),
    3215                       format_buf, sizeof(format_buf));
     3213     GetLocaleInfoA(thislocale, ((flags&DATE_LONGDATE)
     3214                   ? LOCALE_SLONGDATE
     3215                   : LOCALE_SSHORTDATE),
     3216              format_buf, sizeof(format_buf));
    32163217     thisformat = format_buf;
    32173218  } else {
     
    32193220  };
    32203221
    3221  
    3222   ret = OLE_GetFormatA(thislocale, flags, 0, thistime, thisformat, 
    3223                        date, datelen);
    3224  
     3222
     3223  ret = OLE_GetFormatA(thislocale, flags, 0, thistime, thisformat,
     3224               date, datelen);
     3225
    32253226
    32263227   TRACE(
    3227                "GetDateFormatA() returning %d, with data=%s\n",
    3228                ret, date);
     3228           "GetDateFormatA() returning %d, with data=%s\n",
     3229           ret, date);
    32293230  return ret;
    32303231}
    32313232
    32323233/******************************************************************************
    3233  *              GetDateFormatW  [KERNEL32.311]
     3234 *      GetDateFormatW  [KERNEL32.311]
    32343235 * Makes a Unicode string of the date
    32353236 *
     
    32393240 */
    32403241INT WINAPI GetDateFormatW(LCID locale,DWORD flags,
    3241                               LPSYSTEMTIME xtime,
    3242                               LPCWSTR format,
    3243                               LPWSTR date, INT datelen)
     3242                  LPSYSTEMTIME xtime,
     3243                  LPCWSTR format,
     3244                  LPWSTR date, INT datelen)
    32443245{
    32453246  // convert "format" on passing in into ASCII
    32463247  LPSTR pszAsciiFormat = UnicodeToAsciiString((LPWSTR) format);
    32473248  LPSTR pszAsciiDate = (char *)alloca(datelen);
    3248  
     3249
    32493250  TRACE("Kernel32-ole2nls: GetDateFormatW(0x%04lx,0x%08lx,%p,%s,%p,%d) not yet complete\n",
    3250               locale,flags,xtime,pszAsciiFormat,date,datelen);
     3251          locale,flags,xtime,pszAsciiFormat,date,datelen);
    32513252
    32523253  // call ASCII variant
     
    32573258                          pszAsciiDate,
    32583259                          datelen);  // is in "characters", not bytes
    3259    
     3260
    32603261  FreeAsciiString(pszAsciiFormat);
    3261  
     3262
    32623263  // convert "date" on returning to UNICODE
    32633264  if (datelen != 0)
     
    32663267    lstrcpynAtoW(date, pszAsciiDate, rc);
    32673268  }
    3268  
     3269
    32693270  return rc;
    3270  
     3271
    32713272#if PH_OFF
    32723273   unsigned short datearr[] = {'1','9','9','4','-','1','-','1',0};
    32733274
    3274    FIXME("STUB (should call OLE_GetFormatW)\n");   
     3275   FIXME("STUB (should call OLE_GetFormatW)\n");
    32753276   lstrcpynW(date, datearr, datelen);
    32763277   return (  datelen < 9) ? datelen : 9;
     
    32793280
    32803281/**************************************************************************
    3281  *              EnumDateFormatsA        (KERNEL32.198)
     3282 *              EnumDateFormatsA    (KERNEL32.198)
    32823283 */
    32833284BOOL WINAPI EnumDateFormatsA(
    32843285  DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale,  DWORD dwFlags)
    32853286{
    3286   LCID Loc = GetUserDefaultLCID(); 
     3287  LCID Loc = GetUserDefaultLCID();
    32873288  if(!lpDateFmtEnumProc)
    32883289    {
     
    32993300    {
    33003301      case DATE_SHORTDATE:
    3301         if(!(*lpDateFmtEnumProc)("dd.MM.yy")) return TRUE;
    3302         if(!(*lpDateFmtEnumProc)("d.M.yyyy")) return TRUE;
    3303         if(!(*lpDateFmtEnumProc)("d.MM.yy")) return TRUE;
    3304         if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
    3305         return TRUE;
     3302    if(!(*lpDateFmtEnumProc)("dd.MM.yy")) return TRUE;
     3303    if(!(*lpDateFmtEnumProc)("d.M.yyyy")) return TRUE;
     3304    if(!(*lpDateFmtEnumProc)("d.MM.yy")) return TRUE;
     3305    if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
     3306    return TRUE;
    33063307      case DATE_LONGDATE:
    33073308        if(!(*lpDateFmtEnumProc)("dddd,d. MMMM yyyy")) return TRUE;
    33083309        if(!(*lpDateFmtEnumProc)("d. MMMM yyyy")) return TRUE;
    33093310        if(!(*lpDateFmtEnumProc)("d. MMM yyyy")) return TRUE;
    3310         return TRUE;
     3311    return TRUE;
    33113312      default:
    3312         FIXME("Unknown date format (%ld)\n", dwFlags);
    3313         SetLastError(ERROR_INVALID_PARAMETER);
    3314         return FALSE;
     3313    FIXME("Unknown date format (%ld)\n", dwFlags);
     3314    SetLastError(ERROR_INVALID_PARAMETER);
     3315    return FALSE;
    33153316     }
    3316    }       
     3317   }
    33173318
    33183319   case 0x0000040c:  /* (Loc,"fr_FR") */
     
    33213322    {
    33223323      case DATE_SHORTDATE:
    3323         if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
    3324         if(!(*lpDateFmtEnumProc)("dd.MM.yy")) return TRUE;
    3325         if(!(*lpDateFmtEnumProc)("dd-MM-yy")) return TRUE;
    3326         if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
    3327         return TRUE;
     3324    if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
     3325    if(!(*lpDateFmtEnumProc)("dd.MM.yy")) return TRUE;
     3326    if(!(*lpDateFmtEnumProc)("dd-MM-yy")) return TRUE;
     3327    if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
     3328    return TRUE;
    33283329      case DATE_LONGDATE:
    33293330        if(!(*lpDateFmtEnumProc)("dddd d MMMM yyyy")) return TRUE;
    33303331        if(!(*lpDateFmtEnumProc)("d MMM yy")) return TRUE;
    33313332        if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
    3332         return TRUE;
     3333    return TRUE;
    33333334      default:
    3334         FIXME("Unknown date format (%ld)\n", dwFlags);
    3335         SetLastError(ERROR_INVALID_PARAMETER);
    3336         return FALSE;
     3335    FIXME("Unknown date format (%ld)\n", dwFlags);
     3336    SetLastError(ERROR_INVALID_PARAMETER);
     3337    return FALSE;
    33373338     }
    33383339   }
     
    33433344    {
    33443345      case DATE_SHORTDATE:
    3345         if(!(*lpDateFmtEnumProc)("yy-MM-dd")) return TRUE;
    3346         if(!(*lpDateFmtEnumProc)("dd-MM-yy")) return TRUE;
    3347         if(!(*lpDateFmtEnumProc)("yy MM dd")) return TRUE;
    3348         if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
    3349         return TRUE;
     3346    if(!(*lpDateFmtEnumProc)("yy-MM-dd")) return TRUE;
     3347    if(!(*lpDateFmtEnumProc)("dd-MM-yy")) return TRUE;
     3348    if(!(*lpDateFmtEnumProc)("yy MM dd")) return TRUE;
     3349    if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
     3350    return TRUE;
    33503351      case DATE_LONGDATE:
    33513352        if(!(*lpDateFmtEnumProc)("d MMMM, yyyy")) return TRUE;
    33523353        if(!(*lpDateFmtEnumProc)("d MMM yyyy")) return TRUE;
    3353         return TRUE;
     3354    return TRUE;
    33543355      default:
    3355         FIXME("Unknown date format (%ld)\n", dwFlags);
    3356         SetLastError(ERROR_INVALID_PARAMETER);
    3357         return FALSE;
     3356    FIXME("Unknown date format (%ld)\n", dwFlags);
     3357    SetLastError(ERROR_INVALID_PARAMETER);
     3358    return FALSE;
    33583359     }
    33593360   }
    33603361
    3361    case 0x00000809:  /* (Loc,"en_UK") */ 
    3362   {   
     3362   case 0x00000809:  /* (Loc,"en_UK") */
     3363  {
    33633364   switch(dwFlags)
    33643365    {
    33653366      case DATE_SHORTDATE:
    3366         if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
    3367         if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
    3368         if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
    3369         if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
    3370         return TRUE;
     3367    if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
     3368    if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
     3369    if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
     3370    if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
     3371    return TRUE;
    33713372      case DATE_LONGDATE:
    33723373        if(!(*lpDateFmtEnumProc)("dd MMMM yyyy")) return TRUE;
    33733374        if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
    3374         return TRUE;
     3375    return TRUE;
    33753376      default:
    3376         FIXME("Unknown date format (%ld)\n", dwFlags);
    3377         SetLastError(ERROR_INVALID_PARAMETER);
    3378         return FALSE;
     3377    FIXME("Unknown date format (%ld)\n", dwFlags);
     3378    SetLastError(ERROR_INVALID_PARAMETER);
     3379    return FALSE;
    33793380    }
    33803381  }
    33813382
    3382    case 0x00000c09:  /* (Loc,"en_AU") */   
    3383   {   
     3383   case 0x00000c09:  /* (Loc,"en_AU") */
     3384  {
    33843385   switch(dwFlags)
    33853386    {
    33863387      case DATE_SHORTDATE:
    3387         if(!(*lpDateFmtEnumProc)("d/MM/yy")) return TRUE;
    3388         if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
    3389         if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
    3390         return TRUE;
     3388    if(!(*lpDateFmtEnumProc)("d/MM/yy")) return TRUE;
     3389    if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
     3390    if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
     3391    return TRUE;
    33913392      case DATE_LONGDATE:
    33923393        if(!(*lpDateFmtEnumProc)("dddd,d MMMM yyyy")) return TRUE;
    33933394        if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
    3394         return TRUE;
     3395    return TRUE;
    33953396      default:
    3396         FIXME("Unknown date format (%ld)\n", dwFlags);
    3397         SetLastError(ERROR_INVALID_PARAMETER);
    3398         return FALSE;
     3397    FIXME("Unknown date format (%ld)\n", dwFlags);
     3398    SetLastError(ERROR_INVALID_PARAMETER);
     3399    return FALSE;
    33993400    }
    34003401  }
    34013402
    3402    case 0x00001009:  /* (Loc,"en_CA") */ 
    3403   {   
     3403   case 0x00001009:  /* (Loc,"en_CA") */
     3404  {
    34043405   switch(dwFlags)
    34053406    {
    34063407      case DATE_SHORTDATE:
    3407         if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
    3408         if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
    3409         if(!(*lpDateFmtEnumProc)("yy-MM-dd")) return TRUE;
    3410         if(!(*lpDateFmtEnumProc)("M/dd/yy")) return TRUE;
    3411         return TRUE;
     3408    if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
     3409    if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
     3410    if(!(*lpDateFmtEnumProc)("yy-MM-dd")) return TRUE;
     3411    if(!(*lpDateFmtEnumProc)("M/dd/yy")) return TRUE;
     3412    return TRUE;
    34123413      case DATE_LONGDATE:
    34133414        if(!(*lpDateFmtEnumProc)("d-MMM-yy")) return TRUE;
    34143415        if(!(*lpDateFmtEnumProc)("MMMM d, yyyy")) return TRUE;
    3415         return TRUE;
     3416    return TRUE;
    34163417      default:
    3417         FIXME("Unknown date format (%ld)\n", dwFlags);
    3418         SetLastError(ERROR_INVALID_PARAMETER);
    3419         return FALSE;
     3418    FIXME("Unknown date format (%ld)\n", dwFlags);
     3419    SetLastError(ERROR_INVALID_PARAMETER);
     3420    return FALSE;
    34203421    }
    34213422  }
    34223423
    3423    case 0x00001409:  /* (Loc,"en_NZ") */ 
    3424   {   
     3424   case 0x00001409:  /* (Loc,"en_NZ") */
     3425  {
    34253426   switch(dwFlags)
    34263427    {
    34273428      case DATE_SHORTDATE:
    3428         if(!(*lpDateFmtEnumProc)("d/MM/yy")) return TRUE;
    3429         if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
    3430         if(!(*lpDateFmtEnumProc)("d.MM.yy")) return TRUE;
    3431         return TRUE;
     3429    if(!(*lpDateFmtEnumProc)("d/MM/yy")) return TRUE;
     3430    if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
     3431    if(!(*lpDateFmtEnumProc)("d.MM.yy")) return TRUE;
     3432    return TRUE;
    34323433      case DATE_LONGDATE:
    34333434        if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
    34343435        if(!(*lpDateFmtEnumProc)("dddd, d MMMM yyyy")) return TRUE;
    3435         return TRUE;
     3436    return TRUE;
    34363437      default:
    3437         FIXME("Unknown date format (%ld)\n", dwFlags);
    3438         SetLastError(ERROR_INVALID_PARAMETER);
    3439         return FALSE;
     3438    FIXME("Unknown date format (%ld)\n", dwFlags);
     3439    SetLastError(ERROR_INVALID_PARAMETER);
     3440    return FALSE;
    34403441    }
    34413442  }
    34423443
    3443    case 0x00001809:  /* (Loc,"en_IE") */   
    3444   {   
     3444   case 0x00001809:  /* (Loc,"en_IE") */
     3445  {
    34453446   switch(dwFlags)
    34463447    {
    34473448      case DATE_SHORTDATE:
    3448         if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
    3449         if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
    3450         if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
    3451         return TRUE;
     3449    if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
     3450    if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
     3451    if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
     3452    return TRUE;
    34523453      case DATE_LONGDATE:
    34533454        if(!(*lpDateFmtEnumProc)("dd MMMM yyyy")) return TRUE;
    34543455        if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
    3455         return TRUE;
     3456    return TRUE;
    34563457      default:
    3457         FIXME("Unknown date format (%ld)\n", dwFlags);
    3458         SetLastError(ERROR_INVALID_PARAMETER);
    3459         return FALSE;
     3458    FIXME("Unknown date format (%ld)\n", dwFlags);
     3459    SetLastError(ERROR_INVALID_PARAMETER);
     3460    return FALSE;
    34603461    }
    34613462  }
    34623463
    3463    case 0x00001c09:  /* (Loc,"en_ZA") */   
    3464   {   
     3464   case 0x00001c09:  /* (Loc,"en_ZA") */
     3465  {
    34653466   switch(dwFlags)
    34663467    {
    34673468      case DATE_SHORTDATE:
    3468         if(!(*lpDateFmtEnumProc)("yy/MM/dd")) return TRUE;
    3469         return TRUE;
     3469    if(!(*lpDateFmtEnumProc)("yy/MM/dd")) return TRUE;
     3470    return TRUE;
    34703471      case DATE_LONGDATE:
    34713472        if(!(*lpDateFmtEnumProc)("dd MMMM yyyy")) return TRUE;
    3472         return TRUE;
     3473    return TRUE;
    34733474      default:
    3474         FIXME("Unknown date format (%ld)\n", dwFlags);
    3475         SetLastError(ERROR_INVALID_PARAMETER);
    3476         return FALSE;
     3475    FIXME("Unknown date format (%ld)\n", dwFlags);
     3476    SetLastError(ERROR_INVALID_PARAMETER);
     3477    return FALSE;
    34773478    }
    34783479  }
    34793480
    3480    case 0x00002009:  /* (Loc,"en_JM") */ 
    3481   {   
     3481   case 0x00002009:  /* (Loc,"en_JM") */
     3482  {
    34823483   switch(dwFlags)
    34833484    {
    34843485      case DATE_SHORTDATE:
    3485         if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
    3486         return TRUE;
     3486    if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
     3487    return TRUE;
    34873488      case DATE_LONGDATE:
    34883489        if(!(*lpDateFmtEnumProc)("dddd,MMMM dd,yyyy")) return TRUE;
     
    34903491        if(!(*lpDateFmtEnumProc)("dddd,dd MMMM,yyyy")) return TRUE;
    34913492        if(!(*lpDateFmtEnumProc)("dd MMMM,yyyy")) return TRUE;
    3492         return TRUE;
     3493    return TRUE;
    34933494      default:
    3494         FIXME("Unknown date format (%ld)\n", dwFlags);
    3495         SetLastError(ERROR_INVALID_PARAMETER);
    3496         return FALSE;
     3495    FIXME("Unknown date format (%ld)\n", dwFlags);
     3496    SetLastError(ERROR_INVALID_PARAMETER);
     3497    return FALSE;
    34973498    }
    34983499  }
    34993500
    35003501   case 0x00002809:  /* (Loc,"en_BZ") */
    3501    case 0x00002c09:  /* (Loc,"en_TT") */ 
    3502   {   
     3502   case 0x00002c09:  /* (Loc,"en_TT") */
     3503  {
    35033504   switch(dwFlags)
    35043505    {
    35053506      case DATE_SHORTDATE:
    3506         if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
    3507         return TRUE;
     3507    if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
     3508    return TRUE;
    35083509      case DATE_LONGDATE:
    35093510        if(!(*lpDateFmtEnumProc)("dddd,dd MMMM yyyy")) return TRUE;
    3510         return TRUE;
     3511    return TRUE;
    35113512      default:
    3512         FIXME("Unknown date format (%ld)\n", dwFlags);
    3513         SetLastError(ERROR_INVALID_PARAMETER);
    3514         return FALSE;
     3513    FIXME("Unknown date format (%ld)\n", dwFlags);
     3514    SetLastError(ERROR_INVALID_PARAMETER);
     3515    return FALSE;
    35153516    }
    35163517  }
     
    35213522    {
    35223523      case DATE_SHORTDATE:
    3523         if(!(*lpDateFmtEnumProc)("M/d/yy")) return TRUE;
    3524         if(!(*lpDateFmtEnumProc)("M/d/yyyy")) return TRUE;
    3525         if(!(*lpDateFmtEnumProc)("MM/dd/yy")) return TRUE;
    3526         if(!(*lpDateFmtEnumProc)("MM/dd/yyyy")) return TRUE;
    3527         if(!(*lpDateFmtEnumProc)("yy/MM/dd")) return TRUE;
    3528         if(!(*lpDateFmtEnumProc)("dd-MMM-yy")) return TRUE;
    3529         return TRUE;
     3524    if(!(*lpDateFmtEnumProc)("M/d/yy")) return TRUE;
     3525    if(!(*lpDateFmtEnumProc)("M/d/yyyy")) return TRUE;
     3526    if(!(*lpDateFmtEnumProc)("MM/dd/yy")) return TRUE;
     3527    if(!(*lpDateFmtEnumProc)("MM/dd/yyyy")) return TRUE;
     3528    if(!(*lpDateFmtEnumProc)("yy/MM/dd")) return TRUE;
     3529    if(!(*lpDateFmtEnumProc)("dd-MMM-yy")) return TRUE;
     3530    return TRUE;
    35303531      case DATE_LONGDATE:
    35313532        if(!(*lpDateFmtEnumProc)("dddd, MMMM dd, yyyy")) return TRUE;
     
    35333534        if(!(*lpDateFmtEnumProc)("dddd, dd MMMM, yyyy")) return TRUE;
    35343535        if(!(*lpDateFmtEnumProc)("dd MMMM, yyyy")) return TRUE;
    3535         return TRUE;
     3536    return TRUE;
    35363537      default:
    3537         FIXME("Unknown date format (%ld)\n", dwFlags);
    3538         SetLastError(ERROR_INVALID_PARAMETER);
    3539         return FALSE;
     3538    FIXME("Unknown date format (%ld)\n", dwFlags);
     3539    SetLastError(ERROR_INVALID_PARAMETER);
     3540    return FALSE;
    35403541    }
    35413542  }
     
    35443545
    35453546/**************************************************************************
    3546  *              EnumDateFormatsW        (KERNEL32.199)
     3547 *              EnumDateFormatsW    (KERNEL32.199)
    35473548 */
    35483549BOOL WINAPI EnumDateFormatsW(
     
    35553556
    35563557/**************************************************************************
    3557  *              EnumTimeFormatsA        (KERNEL32.210)
     3558 *              EnumTimeFormatsA    (KERNEL32.210)
    35583559 */
    35593560BOOL WINAPI EnumTimeFormatsA(
    35603561  TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags)
    35613562{
    3562   LCID Loc = GetUserDefaultLCID(); 
     3563  LCID Loc = GetUserDefaultLCID();
    35633564  if(!lpTimeFmtEnumProc)
    35643565    {
     
    35683569  if(dwFlags)
    35693570    {
    3570       FIXME("Unknown time format (%ld)\n", dwFlags); 
     3571      FIXME("Unknown time format (%ld)\n", dwFlags);
    35713572    }
    35723573
     
    35753576   case 0x00000407:  /* (Loc,"de_DE") */
    35763577   {
    3577     if(!(*lpTimeFmtEnumProc)("HH.mm")) return TRUE; 
     3578    if(!(*lpTimeFmtEnumProc)("HH.mm")) return TRUE;
    35783579    if(!(*lpTimeFmtEnumProc)("HH:mm:ss")) return TRUE;
    35793580    if(!(*lpTimeFmtEnumProc)("H:mm:ss")) return TRUE;
     
    35813582    if(!(*lpTimeFmtEnumProc)("H.mm'Uhr'")) return TRUE;
    35823583    return TRUE;
    3583    }       
     3584   }
    35843585
    35853586   case 0x0000040c:  /* (Loc,"fr_FR") */
     
    35953596
    35963597   case 0x00000809:  /* (Loc,"en_UK") */
    3597    case 0x00000c09:  /* (Loc,"en_AU") */ 
     3598   case 0x00000c09:  /* (Loc,"en_AU") */
    35983599   case 0x00001409:  /* (Loc,"en_NZ") */
    3599    case 0x00001809:  /* (Loc,"en_IE") */ 
     3600   case 0x00001809:  /* (Loc,"en_IE") */
    36003601   {
    36013602    if(!(*lpTimeFmtEnumProc)("h:mm:ss tt")) return TRUE;
     
    36053606   }
    36063607
    3607    case 0x00001c09:  /* (Loc,"en_ZA") */   
     3608   case 0x00001c09:  /* (Loc,"en_ZA") */
    36083609   case 0x00002809:  /* (Loc,"en_BZ") */
    3609    case 0x00002c09:  /* (Loc,"en_TT") */ 
     3610   case 0x00002c09:  /* (Loc,"en_TT") */
    36103611   {
    36113612    if(!(*lpTimeFmtEnumProc)("h:mm:ss tt")) return TRUE;
    3612     if(!(*lpTimeFmtEnumProc)("hh:mm:ss tt")) return TRUE; 
    3613     return TRUE; 
     3613    if(!(*lpTimeFmtEnumProc)("hh:mm:ss tt")) return TRUE;
     3614    return TRUE;
    36143615   }
    36153616
    3616    default:  /* default to US style "en_US" */   
     3617   default:  /* default to US style "en_US" */
    36173618   {
    36183619    if(!(*lpTimeFmtEnumProc)("h:mm:ss tt")) return TRUE;
     
    36263627
    36273628/**************************************************************************
    3628  *              EnumTimeFormatsW        (KERNEL32.211)
     3629 *              EnumTimeFormatsW    (KERNEL32.211)
    36293630 */
    36303631BOOL WINAPI EnumTimeFormatsW(
     
    36393640 *           This function is used just locally !
    36403641 *  Description: Inverts a string.
    3641  */ 
     3642 */
    36423643static void OLE_InvertString(char* string)
    3643 {   
     3644{
    36443645    char    sTmpArray[128];
    36453646    INT     counter, i = 0;
     
    36583659 *  Description: Test if the given string (psNumber) is valid or not.
    36593660 *               The valid characters are the following:
    3660  *               - Characters '0' through '9'. 
    3661  *               - One decimal point (dot) if the number is a floating-point value. 
    3662  *               - A minus sign in the first character position if the number is 
     3661 *               - Characters '0' through '9'.
     3662 *               - One decimal point (dot) if the number is a floating-point value.
     3663 *               - A minus sign in the first character position if the number is
    36633664 *                 a negative value.
    36643665 *              If the function succeeds, psBefore/psAfter will point to the string
    3665  *              on the right/left of the decimal symbol. pbNegative indicates if the 
     3666 *              on the right/left of the decimal symbol. pbNegative indicates if the
    36663667 *              number is negative.
    36673668 */
    36683669static INT OLE_GetNumberComponents(char* pInput, char* psBefore, char* psAfter, BOOL* pbNegative)
    36693670{
    3670 char    sNumberSet[] = "0123456789";
    3671 BOOL    bInDecimal = FALSE;
    3672 
    3673         /* Test if we do have a minus sign */
    3674         if ( *pInput == '-' )
    3675         {
    3676                 *pbNegative = TRUE;
    3677                 pInput++; /* Jump to the next character. */
    3678         }
    3679        
    3680         while(*pInput != '\0')
    3681         {
    3682                 /* Do we have a valid numeric character */
    3683                 if ( strchr(sNumberSet, *pInput) != NULL )
    3684                 {
    3685                         if (bInDecimal == TRUE)
     3671char    sNumberSet[] = "0123456789";
     3672BOOL    bInDecimal = FALSE;
     3673
     3674    /* Test if we do have a minus sign */
     3675    if ( *pInput == '-' )
     3676    {
     3677        *pbNegative = TRUE;
     3678        pInput++; /* Jump to the next character. */
     3679    }
     3680
     3681    while(*pInput != '\0')
     3682    {
     3683        /* Do we have a valid numeric character */
     3684        if ( strchr(sNumberSet, *pInput) != NULL )
     3685        {
     3686            if (bInDecimal == TRUE)
    36863687                *psAfter++ = *pInput;
    3687                         else
     3688            else
    36883689                *psBefore++ = *pInput;
    3689                 }
    3690                 else
    3691                 {
    3692                         /* Is this a decimal point (dot) */
    3693                         if ( *pInput == '.' )
    3694                         {
    3695                                 /* Is it the first time we find it */
    3696                                 if ((bInDecimal == FALSE))
    3697                                         bInDecimal = TRUE;
    3698                                 else
    3699                                         return -1; /* ERROR: Invalid parameter */
    3700                         }
    3701                         else
    3702                         {
    3703                                 /* It's neither a numeric character, nor a decimal point.
    3704                                 * Thus, return an error.
     3690        }
     3691        else
     3692        {
     3693            /* Is this a decimal point (dot) */
     3694            if ( *pInput == '.' )
     3695            {
     3696                /* Is it the first time we find it */
     3697                if ((bInDecimal == FALSE))
     3698                    bInDecimal = TRUE;
     3699                else
     3700                    return -1; /* ERROR: Invalid parameter */
     3701            }
     3702            else
     3703            {
     3704                /* It's neither a numeric character, nor a decimal point.
     3705                * Thus, return an error.
    37053706                 */
    3706                                 return -1;
    3707                         }
    3708                 }
     3707                return -1;
     3708            }
     3709        }
    37093710        pInput++;
    3710         }
    3711        
    3712         /* Add an End of Line character to the output buffers */
    3713         *psBefore = '\0';
    3714         *psAfter = '\0';
    3715 
    3716         return 0;
     3711    }
     3712
     3713    /* Add an End of Line character to the output buffers */
     3714    *psBefore = '\0';
     3715    *psAfter = '\0';
     3716
     3717    return 0;
    37173718}
    37183719
    37193720/**************************************************************************
    37203721 *           This function is used just locally !
    3721  *  Description: A number could be formatted using different numbers 
     3722 *  Description: A number could be formatted using different numbers
    37223723 *               of "digits in group" (example: 4;3;2;0).
    37233724 *               The first parameter of this function is an array
     
    37423743        memcpy(sData, sRule+index, 1);
    37433744        memcpy(sData+1, "\0", 1);
    3744         nData = atoi(sData);           
    3745     }
    3746        
     3745        nData = atoi(sData);
     3746    }
     3747
    37473748    else
    37483749    {
    37493750        memcpy(sData, sRule+nRuleSize-1, 1);
    37503751        memcpy(sData+1, "\0", 1);
    3751         nData = atoi(sData);           
    3752     }
    3753    
     3752        nData = atoi(sData);
     3753    }
     3754
    37543755    return nData;
    37553756}
    37563757
    37573758/**************************************************************************
    3758  *              GetNumberFormatA        (KERNEL32.355)
     3759 *              GetNumberFormatA    (KERNEL32.355)
    37593760 */
    37603761INT WINAPI GetNumberFormatA(LCID locale, DWORD dwflags,
    3761                                LPCSTR lpvalue,   const NUMBERFMTA * lpFormat,
    3762                                LPSTR lpNumberStr, int cchNumber)
     3762                   LPCSTR lpvalue,   const NUMBERFMTA * lpFormat,
     3763                   LPSTR lpNumberStr, int cchNumber)
    37633764{
    37643765    char   sNumberDigits[3], sDecimalSymbol[5], sDigitsInGroup[11], sDigitGroupSymbol[5], sILZero[2];
    37653766    INT    nNumberDigits, nNumberDecimal, i, j, nCounter, nStep, nRuleIndex, nGrouping, nDigits, retVal, nLZ;
    37663767    char   sNumber[128], sDestination[128], sDigitsAfterDecimal[10], sDigitsBeforeDecimal[128];
    3767     char   sRule[10], sSemiColumn[]=";", sBuffer[5], sNegNumber[2];   
     3768    char   sRule[10], sSemiColumn[]=";", sBuffer[5], sNegNumber[2];
    37683769    char   *pStr = NULL, *pTmpStr = NULL;
    37693770    LCID   systemDefaultLCID;
    37703771    BOOL   bNegative = FALSE;
    3771     enum   Operations 
     3772    enum   Operations
    37723773    {
    37733774        USE_PARAMETER,
     
    38003801    {
    38013802        if (dwflags == 0)
    3802             used_operation = USE_PARAMETER; 
     3803            used_operation = USE_PARAMETER;
    38033804    }
    38043805    else
     
    38443845
    38453846    nNumberDigits = atoi(sNumberDigits);
    3846    
     3847
    38473848    /* Remove the ";" */
    38483849    i=0;
     
    38603861    memcpy(sRule, sBuffer, 1); /* Number of digits in the groups ( used by OLE_GetGrouping() ) */
    38613862    memcpy(sRule + j, "\0", 1);
    3862    
     3863
    38633864    /* First, format the digits before the decimal. */
    3864     if ((nNumberDecimal>0) && (atoi(sDigitsBeforeDecimal) != 0)) 
     3865    if ((nNumberDecimal>0) && (atoi(sDigitsBeforeDecimal) != 0))
    38653866    {
    38663867        /* Working on an inverted string is easier ! */
     
    38703871        nRuleIndex = 1;
    38713872        nGrouping = OLE_GetGrouping(sRule, nRuleIndex);
    3872        
     3873
    38733874        /* Here, we will loop until we reach the end of the string.
    3874          * An internal counter (j) is used in order to know when to 
     3875         * An internal counter (j) is used in order to know when to
    38753876         * insert the "digit group symbol".
    38763877         */
     
    39023903        nLZ = atoi(sILZero);
    39033904        if (nLZ != 0)
    3904         {       
     3905        {
    39053906            /* Use 0.xxx instead of .xxx */
    39063907            memcpy(sDestination, "0", 1);
     
    39173918    if ( (nDigits>0) && (pStr = strstr (sNumber, ".")) )
    39183919    {
    3919         i = strlen(sNumber) - strlen(pStr) + 1;       
     3920        i = strlen(sNumber) - strlen(pStr) + 1;
    39203921        strncpy ( sDigitsAfterDecimal, sNumber + i, nNumberDigits);
    39213922        j = strlen(sDigitsAfterDecimal);
    39223923        if (j < nNumberDigits)
    3923             nCounter = nNumberDigits-j;           
     3924            nCounter = nNumberDigits-j;
    39243925    }
    39253926    for (i=0;i<nCounter;i++)
    3926          memcpy(sDigitsAfterDecimal+i+j, "0", 1);   
    3927     memcpy(sDigitsAfterDecimal + nNumberDigits, "\0", 1);   
     3927         memcpy(sDigitsAfterDecimal+i+j, "0", 1);
     3928    memcpy(sDigitsAfterDecimal + nNumberDigits, "\0", 1);
    39283929
    39293930    i = strlen(sDestination);
    39303931    j = strlen(sDigitsAfterDecimal);
    39313932    /* Finally, construct the resulting formatted string. */
    3932        
     3933
    39333934    for (nCounter=0; nCounter<i; nCounter++)
    39343935        memcpy(sNumber + nCounter, sDestination + nCounter, 1);
    3935        
     3936
    39363937    memcpy(sNumber + nCounter, sDecimalSymbol, strlen(sDecimalSymbol));
    39373938
     
    39393940        memcpy(sNumber + nCounter+i+strlen(sDecimalSymbol), sDigitsAfterDecimal + i, 1);
    39403941    memcpy(sNumber + nCounter+i+strlen(sDecimalSymbol), "\0", 1);
    3941        
     3942
    39423943    /* Is it a negative number */
    39433944    if (bNegative == TRUE)
     
    39473948        pTmpStr = sNumber;
    39483949        switch (i)
    3949         {         
     3950        {
    39503951        case 0:
    39513952            *pStr++ = '(';
    39523953            while (*sNumber != '\0')
    39533954                *pStr++ =  *pTmpStr++;
    3954             *pStr++ = ')';               
    3955             break; 
     3955            *pStr++ = ')';
     3956            break;
    39563957        case 1:
    39573958            *pStr++ = '-';
     
    39853986        strcpy(sDestination, sNumber);
    39863987
    3987     /* If cchNumber is zero, then returns the number of bytes or characters 
     3988    /* If cchNumber is zero, then returns the number of bytes or characters
    39883989     * required to hold the formatted number string
    39893990     */
    39903991    if (cchNumber==0)
    39913992        retVal = strlen(sDestination) + 1;
    3992     else           
     3993    else
    39933994    {
    39943995        strncpy (lpNumberStr, sDestination, cchNumber-1);
     
    39963997        retVal = strlen(lpNumberStr);
    39973998    }
    3998          
     3999
    39994000    return retVal;
    40004001}
    40014002
    40024003/**************************************************************************
    4003  *              GetNumberFormatW        (KERNEL32.@)
     4004 *              GetNumberFormatW    (KERNEL32.@)
    40044005 */
    40054006INT WINAPI GetNumberFormatW(LCID locale, DWORD dwflags,
    4006                                LPCWSTR lpvalue,  const NUMBERFMTW * lpFormat,
    4007                                LPWSTR lpNumberStr, int cchNumber)
     4007                   LPCWSTR lpvalue,  const NUMBERFMTW * lpFormat,
     4008                   LPWSTR lpNumberStr, int cchNumber)
    40084009{
    40094010 FIXME("%s: stub, no reformating done\n",debugstr_w(lpvalue));
     
    40144015
    40154016/**************************************************************************
    4016  *              GetCurrencyFormatA      (KERNEL32.302)
     4017 *              GetCurrencyFormatA  (KERNEL32.302)
    40174018 */
    40184019INT WINAPI GetCurrencyFormatA(LCID locale, DWORD dwflags,
    4019                                LPCSTR lpvalue,   const CURRENCYFMTA * lpFormat,
    4020                                LPSTR lpCurrencyStr, int cchCurrency)
     4020                   LPCSTR lpvalue,   const CURRENCYFMTA * lpFormat,
     4021                   LPSTR lpCurrencyStr, int cchCurrency)
    40214022{
    40224023    UINT   nPosOrder, nNegOrder;
     
    40284029    LCID   systemDefaultLCID;
    40294030    BOOL   bIsPositive = FALSE, bValidFormat = FALSE;
    4030     enum   Operations 
     4031    enum   Operations
    40314032    {
    40324033        USE_PARAMETER,
     
    40434044    {
    40444045        if (dwflags == 0)
    4045             used_operation = USE_PARAMETER; 
     4046            used_operation = USE_PARAMETER;
    40464047    }
    40474048    else
     
    40564057    switch(used_operation)
    40574058    {
    4058     case USE_LOCALEINFO:       
     4059    case USE_LOCALEINFO:
    40594060        /* Specific to CURRENCYFMTA*/
    40604061        GetLocaleInfoA(locale, LOCALE_INEGCURR, sNegOrder, sizeof(sNegOrder));
    40614062        GetLocaleInfoA(locale, LOCALE_ICURRENCY, sPosOrder, sizeof(sPosOrder));
    40624063        GetLocaleInfoA(locale, LOCALE_SCURRENCY, sCurrencySymbol, sizeof(sCurrencySymbol));
    4063        
     4064
    40644065        nPosOrder = atoi(sPosOrder);
    40654066        nNegOrder = atoi(sNegOrder);
    40664067        break;
    4067     case USE_PARAMETER:       
     4068    case USE_PARAMETER:
    40684069        /* Specific to CURRENCYFMTA*/
    40694070        nNegOrder = lpFormat->NegativeOrder;
     
    40724073        break;
    40734074    case USE_SYSTEMDEFAULT:
    4074         systemDefaultLCID = GetSystemDefaultLCID();       
     4075        systemDefaultLCID = GetSystemDefaultLCID();
    40754076        /* Specific to CURRENCYFMTA*/
    40764077        GetLocaleInfoA(systemDefaultLCID, LOCALE_INEGCURR, sNegOrder, sizeof(sNegOrder));
    40774078        GetLocaleInfoA(systemDefaultLCID, LOCALE_ICURRENCY, sPosOrder, sizeof(sPosOrder));
    40784079        GetLocaleInfoA(systemDefaultLCID, LOCALE_SCURRENCY, sCurrencySymbol, sizeof(sCurrencySymbol));
    4079        
     4080
    40804081        nPosOrder = atoi(sPosOrder);
    40814082        nNegOrder = atoi(sNegOrder);
     
    40854086        return 0;
    40864087    }
    4087    
     4088
    40884089    /* Construct a temporary number format structure */
    40894090    if (lpFormat != NULL)
     
    41094110        retVal = GetNumberFormatA(locale,0,lpvalue,(bValidFormat)?&numberFmt:NULL,pNumberFormated,128);
    41104111    }
    4111        
     4112
    41124113    if (retVal == 0)
    41134114        return 0;
     
    42244225            break;
    42254226        case 14:   /* format: ($ 1.1) */
    4226             strcpy (pDestination, "("); 
     4227            strcpy (pDestination, "(");
    42274228            strcat (pDestination, sCurrencySymbol);
    42284229            strcat (pDestination, " ");
     
    42314232            break;
    42324233        case 15:   /* format: (1.1 $) */
    4233             strcpy (pDestination, "("); 
     4234            strcpy (pDestination, "(");
    42344235            strcat (pDestination, pNumberFormated);
    42354236            strcat (pDestination, " ");
     
    42514252        *(lpCurrencyStr+cchCurrency-1) = '\0';   /* ensure we got a NULL at the end */
    42524253        return  strlen(lpCurrencyStr);
    4253     }   
     4254    }
    42544255}
    42554256
    42564257/**************************************************************************
    4257  *              GetCurrencyFormatW      (KERNEL32.303)
     4258 *              GetCurrencyFormatW  (KERNEL32.303)
    42584259 */
    42594260INT WINAPI GetCurrencyFormatW(LCID locale, DWORD dwflags,
    4260                                LPCWSTR lpvalue,   const CURRENCYFMTW * lpFormat,
    4261                                LPWSTR lpCurrencyStr, int cchCurrency)
     4261                   LPCWSTR lpvalue,   const CURRENCYFMTW * lpFormat,
     4262                   LPWSTR lpCurrencyStr, int cchCurrency)
    42624263{
    42634264    FIXME("This API function is NOT implemented !\n");
     
    42664267
    42674268/******************************************************************************
    4268  *              OLE2NLS_CheckLocale     [intern]
    4269  */ 
     4269 *      OLE2NLS_CheckLocale [intern]
     4270 */
    42704271static LCID OLE2NLS_CheckLocale (LCID locale)
    42714272{
    4272         if (!locale)
    4273         { locale = LOCALE_SYSTEM_DEFAULT;
    4274         }
    4275  
    4276         if (locale == LOCALE_SYSTEM_DEFAULT)
    4277         { return GetSystemDefaultLCID();
    4278         }
    4279         else if (locale == LOCALE_USER_DEFAULT)
    4280         { return GetUserDefaultLCID();
    4281         }
    4282         else
    4283         { return locale;
    4284         }
     4273    if (!locale)
     4274    { locale = LOCALE_SYSTEM_DEFAULT;
     4275    }
     4276
     4277    if (locale == LOCALE_SYSTEM_DEFAULT)
     4278    { return GetSystemDefaultLCID();
     4279    }
     4280    else if (locale == LOCALE_USER_DEFAULT)
     4281    { return GetUserDefaultLCID();
     4282    }
     4283    else
     4284    { return locale;
     4285    }
    42854286}
    42864287/******************************************************************************
    4287  *              GetTimeFormatA  [KERNEL32.422]
     4288 *      GetTimeFormatA  [KERNEL32.422]
    42884289 * Makes an ASCII string of the time
    42894290 *
     
    43034304 *
    43044305 */
    4305 INT WINAPI 
     4306INT WINAPI
    43064307GetTimeFormatA(LCID locale,        /* [in]  */
    4307                DWORD flags,        /* [in]  */
    4308                LPSYSTEMTIME xtime, /* [in]  */
    4309                LPCSTR format,      /* [in]  */
    4310                LPSTR timestr,      /* [out] */
    4311                INT timelen         /* [in]  */)
     4308           DWORD flags,        /* [in]  */
     4309           LPSYSTEMTIME xtime, /* [in]  */
     4310           LPCSTR format,      /* [in]  */
     4311           LPSTR timestr,      /* [out] */
     4312           INT timelen         /* [in]  */)
    43124313{ char format_buf[40];
    43134314  LPCSTR thisformat;
     
    43174318  DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */
    43184319  INT ret;
    4319    
     4320
    43204321  TRACE("GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags,xtime,format,timestr,timelen);
    43214322
    43224323  thislocale = OLE2NLS_CheckLocale ( locale );
    43234324
    4324   if (format == NULL) 
     4325  if (format == NULL)
    43254326  { if (flags & LOCALE_NOUSEROVERRIDE)  /*use system default*/
    43264327    { thislocale = GetSystemDefaultLCID();
     
    43294330    thisformat = format_buf;
    43304331  }
    4331   else 
     4332  else
    43324333  { thisformat = format;
    43334334  }
    4334  
     4335
    43354336  if (xtime == NULL) /* NULL means use the current local time*/
    43364337  { GetLocalTime(&t);
    43374338    thistime = &t;
    4338   } 
     4339  }
    43394340  else
    43404341  { thistime = xtime;
     
    43424343  }
    43434344  ret = OLE_GetFormatA(thislocale, thisflags, flags, thistime, thisformat,
    4344                         timestr, timelen);
     4345            timestr, timelen);
    43454346  return ret;
    43464347}
     
    43484349
    43494350/******************************************************************************
    4350  *              GetTimeFormatW  [KERNEL32.423]
     4351 *      GetTimeFormatW  [KERNEL32.423]
    43514352 * Makes a Unicode string of the time
    43524353 */
    4353 INT WINAPI 
     4354INT WINAPI
    43544355GetTimeFormatW(LCID locale,        /* [in]  */
    4355                DWORD flags,        /* [in]  */
    4356                LPSYSTEMTIME xtime, /* [in]  */
    4357                LPCWSTR format,     /* [in]  */
    4358                LPWSTR timestr,     /* [out] */
    4359                INT timelen         /* [in]  */)
    4360 {       WCHAR format_buf[40];
    4361         LPCWSTR thisformat;
    4362         SYSTEMTIME t;
    4363         LPSYSTEMTIME thistime;
    4364         LCID thislocale=0;
    4365         DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */
    4366         INT ret;
    4367            
    4368         TRACE("GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags,
    4369         xtime,debugstr_w(format),timestr,timelen);
    4370 
    4371         thislocale = OLE2NLS_CheckLocale ( locale );
    4372 
    4373         if (format == NULL)
    4374         { if (flags & LOCALE_NOUSEROVERRIDE)  /*use system default*/
    4375           { thislocale = GetSystemDefaultLCID();
    4376           }
    4377           GetLocaleInfoW(thislocale, thisflags, format_buf, 40);
    4378           thisformat = format_buf;
    4379         }         
    4380         else
    4381         { thisformat = format;
    4382         }
    4383  
    4384         if (xtime == NULL) /* NULL means use the current local time*/
    4385         { GetLocalTime(&t);
    4386           thistime = &t;
    4387         }
    4388         else
    4389         { thistime = xtime;
    4390         }
    4391 
    4392         ret = OLE_GetFormatW(thislocale, thisflags, flags, thistime, thisformat,
    4393                         timestr, timelen);
    4394         return ret;
     4356           DWORD flags,        /* [in]  */
     4357           LPSYSTEMTIME xtime, /* [in]  */
     4358           LPCWSTR format,     /* [in]  */
     4359           LPWSTR timestr,     /* [out] */
     4360           INT timelen         /* [in]  */)
     4361{   WCHAR format_buf[40];
     4362    LPCWSTR thisformat;
     4363    SYSTEMTIME t;
     4364    LPSYSTEMTIME thistime;
     4365    LCID thislocale=0;
     4366    DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */
     4367    INT ret;
     4368
     4369    TRACE("GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags,
     4370    xtime,debugstr_w(format),timestr,timelen);
     4371
     4372    thislocale = OLE2NLS_CheckLocale ( locale );
     4373
     4374    if (format == NULL)
     4375    { if (flags & LOCALE_NOUSEROVERRIDE)  /*use system default*/
     4376      { thislocale = GetSystemDefaultLCID();
     4377      }
     4378      GetLocaleInfoW(thislocale, thisflags, format_buf, 40);
     4379      thisformat = format_buf;
     4380    }
     4381    else
     4382    { thisformat = format;
     4383    }
     4384
     4385    if (xtime == NULL) /* NULL means use the current local time*/
     4386    { GetLocalTime(&t);
     4387      thistime = &t;
     4388    }
     4389    else
     4390    { thistime = xtime;
     4391    }
     4392
     4393    ret = OLE_GetFormatW(thislocale, thisflags, flags, thistime, thisformat,
     4394            timestr, timelen);
     4395    return ret;
    43954396}
    43964397
    43974398/******************************************************************************
    4398  *              EnumCalendarInfoA       [KERNEL32.196]
     4399 *      EnumCalendarInfoA   [KERNEL32.196]
    43994400 */
    44004401BOOL WINAPI EnumCalendarInfoA(
    4401         CALINFO_ENUMPROCA calinfoproc,LCID locale,CALID calendar,CALTYPE caltype
     4402    CALINFO_ENUMPROCA calinfoproc,LCID locale,CALID calendar,CALTYPE caltype
    44024403) {
    4403         FIXME("(%p,0x%04lx,0x%08lx,0x%08lx),stub!\n",calinfoproc,locale,calendar,caltype);
    4404         return FALSE;
     4404    FIXME("(%p,0x%04lx,0x%08lx,0x%08lx),stub!\n",calinfoproc,locale,calendar,caltype);
     4405    return FALSE;
    44054406}
    44064407
  • trunk/src/kernel32/ordinals.cpp

    r5308 r6646  
    1 
    2 /*
     1/* $Id: ordinals.cpp,v 1.4 2001-09-05 12:58:00 bird Exp $
     2 *
    33 * Win32 KERNEL32 Subsystem for OS/2
    44 *
     
    5757
    5858/**********************************************************************
    59  *              _KERNEL32_100
     59 *      _KERNEL32_100
    6060 */
    6161BOOL WINAPI KERNEL32_100(HANDLE threadid,DWORD exitcode,DWORD x)
    6262{
    63         dprintf(("_KERNEL32_100 (%d,%ld,0x%08lx): STUB",threadid,exitcode,x));
    64         return TRUE;
     63    dprintf(("_KERNEL32_100 (%d,%ld,0x%08lx): STUB",threadid,exitcode,x));
     64    return TRUE;
    6565}
    6666
     
    101101  // it's some function dispatcher
    102102  SetLastError(0x78);
    103  
     103
    104104  //@@@PH we should now get the correct CL value */
    105105  BYTE CL;
     
    114114    default: ret = 0; break;
    115115  }
    116  
     116
    117117  // select jump function
    118118  VOID* pfn = (VOID*)pFunctionTable[CL & 0x0F];
     
    127127 * Variables :
    128128 * Result    : Unknown
    129  * Remark    : 
     129 * Remark    :
    130130 * Status    : UNTESTED STUB
    131131 *
  • trunk/src/kernel32/stubs.cpp

    r5587 r6646  
    1 
    2 /*
     1/* $Id: stubs.cpp,v 1.32 2001-09-05 12:58:00 bird Exp $
     2 *
    33 * Win32 KERNEL32 Subsystem for OS/2
    44 *
Note: See TracChangeset for help on using the changeset viewer.