Subject: [PATCH] include: Add SAL annotations for NLS functions that take an array of elements.

From: unknown <Administrator@.(none)>
Date: Tue, 16 Sep 2008 20:11:22 +0100

---
 include/winnls.h |   54 +++++++++++++++++++++++++++---------------------------
 1 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/include/winnls.h b/include/winnls.h
index 50d6389..dd5c935 100644
--- a/include/winnls.h
+++ b/include/winnls.h
@@ -689,8 +689,8 @@ enum SYSGEOCLASS
 /* NLS Functions.
  */
 
-WINBASEAPI INT         WINAPI CompareStringA(LCID,DWORD,LPCSTR,INT,LPCSTR,INT);
-WINBASEAPI INT         WINAPI CompareStringW(LCID,DWORD,LPCWSTR,INT,LPCWSTR,INT);
+WINBASEAPI INT         WINAPI CompareStringA(LCID,DWORD, __in_ecount(len1) LPCSTR, INT len1, __in_ecount(len2) LPCSTR, INT len2);
+WINBASEAPI INT         WINAPI CompareStringW(LCID,DWORD, __in_ecount(len1) LPCWSTR, INT len1, __in_ecount(len2) LPCWSTR, INT len2);
 #define                       CompareString WINELIB_NAME_AW(CompareString)
 WINBASEAPI LCID        WINAPI ConvertDefaultLocale(LCID);
 WINBASEAPI BOOL        WINAPI EnumCalendarInfoA(CALINFO_ENUMPROCA,LCID,CALID,CALTYPE);
@@ -724,44 +724,44 @@ WINBASEAPI BOOL        WINAPI EnumTimeFormatsW(TIMEFMT_ENUMPROCW,LCID,DWORD);
 WINBASEAPI BOOL        WINAPI EnumUILanguagesA(UILANGUAGE_ENUMPROCA,DWORD,LONG_PTR);
 WINBASEAPI BOOL        WINAPI EnumUILanguagesW(UILANGUAGE_ENUMPROCW,DWORD,LONG_PTR);
 #define                       EnumUILanguages WINELIB_NAME_AW(EnumUILanguages)
-WINBASEAPI INT         WINAPI FoldStringA(DWORD,LPCSTR,INT,LPSTR,INT);
-WINBASEAPI INT         WINAPI FoldStringW(DWORD,LPCWSTR,INT,LPWSTR,INT);
+WINBASEAPI INT         WINAPI FoldStringA(DWORD, __in_ecount(srclen) LPCSTR, INT srclen, __out_ecount_opt(dstlen) LPSTR, INT dstlen);
+WINBASEAPI INT         WINAPI FoldStringW(DWORD, __in_ecount(srclen) LPCWSTR, INT srclen, __out_ecount_opt(dstlen) LPWSTR, INT dstlen);
 #define                       FoldString WINELIB_NAME_AW(FoldString)
 WINBASEAPI UINT        WINAPI GetACP(void);
 WINBASEAPI BOOL        WINAPI GetCPInfo(UINT,LPCPINFO);
 WINBASEAPI BOOL        WINAPI GetCPInfoExA(UINT,DWORD,LPCPINFOEXA);
 WINBASEAPI BOOL        WINAPI GetCPInfoExW(UINT,DWORD,LPCPINFOEXW);
 #define                       GetCPInfoEx WINELIB_NAME_AW(GetCPInfoEx)
-WINBASEAPI INT         WINAPI GetCalendarInfoA(LCID,DWORD,DWORD,LPSTR,INT,LPDWORD);
-WINBASEAPI INT         WINAPI GetCalendarInfoW(LCID,DWORD,DWORD,LPWSTR,INT,LPDWORD);
+WINBASEAPI INT         WINAPI GetCalendarInfoA(LCID,DWORD,DWORD, __out_ecount_opt(len) LPSTR, INT len,LPDWORD);
+WINBASEAPI INT         WINAPI GetCalendarInfoW(LCID,DWORD,DWORD, __out_ecount_opt(len) LPWSTR, INT len,LPDWORD);
 #define                       GetCalendarInfo WINELIB_NAME_AW(GetCalendarInfo)
-WINBASEAPI INT         WINAPI GetCurrencyFormatA(LCID,DWORD,LPCSTR,const CURRENCYFMTA*,LPSTR,INT);
-WINBASEAPI INT         WINAPI GetCurrencyFormatW(LCID,DWORD,LPCWSTR,const CURRENCYFMTW*,LPWSTR,INT);
+WINBASEAPI INT         WINAPI GetCurrencyFormatA(LCID,DWORD,LPCSTR,const CURRENCYFMTA*, __out_ecount_opt(len) LPSTR,INT len);
+WINBASEAPI INT         WINAPI GetCurrencyFormatW(LCID,DWORD,LPCWSTR,const CURRENCYFMTW*, __out_ecount_opt(len) LPWSTR,INT len);
 #define                       GetCurrencyFormat WINELIB_NAME_AW(GetCurrencyFormat)
-WINBASEAPI INT         WINAPI GetDateFormatA(LCID,DWORD,const SYSTEMTIME*,LPCSTR,LPSTR,INT);
-WINBASEAPI INT         WINAPI GetDateFormatW(LCID,DWORD,const SYSTEMTIME*,LPCWSTR,LPWSTR,INT);
+WINBASEAPI INT         WINAPI GetDateFormatA(LCID,DWORD,const SYSTEMTIME*,LPCSTR, __out_ecount_opt(len) LPSTR,INT len);
+WINBASEAPI INT         WINAPI GetDateFormatW(LCID,DWORD,const SYSTEMTIME*,LPCWSTR, __out_ecount_opt(len) LPWSTR,INT len);
 #define                       GetDateFormat WINELIB_NAME_AW(GetDateFormat)
-WINBASEAPI INT         WINAPI GetGeoInfoA(GEOID,GEOTYPE,LPSTR,INT,LANGID);
-WINBASEAPI INT         WINAPI GetGeoInfoW(GEOID,GEOTYPE,LPWSTR,INT,LANGID);
+WINBASEAPI INT         WINAPI GetGeoInfoA(GEOID,GEOTYPE, __out_ecount_opt(len) LPSTR, INT len,LANGID);
+WINBASEAPI INT         WINAPI GetGeoInfoW(GEOID,GEOTYPE, __out_ecount_opt(len) LPWSTR, INT len,LANGID);
 #define                       GetGeoInfo WINELIB_NAME_AW(GetGeoInfo)
-WINBASEAPI INT         WINAPI GetLocaleInfoA(LCID,LCTYPE,LPSTR,INT);
-WINBASEAPI INT         WINAPI GetLocaleInfoW(LCID,LCTYPE,LPWSTR,INT);
+WINBASEAPI INT         WINAPI GetLocaleInfoA(LCID,LCTYPE, __out_ecount_opt(len) LPSTR, INT len);
+WINBASEAPI INT         WINAPI GetLocaleInfoW(LCID,LCTYPE, __out_ecount_opt(len) LPWSTR, INT len);
 #define                       GetLocaleInfo WINELIB_NAME_AW(GetLocaleInfo)
-WINBASEAPI INT         WINAPI GetNumberFormatA(LCID,DWORD,LPCSTR,const NUMBERFMTA*,LPSTR,INT);
-WINBASEAPI INT         WINAPI GetNumberFormatW(LCID,DWORD,LPCWSTR,const NUMBERFMTW*,LPWSTR,INT);
+WINBASEAPI INT         WINAPI GetNumberFormatA(LCID,DWORD,LPCSTR,const NUMBERFMTA*, __out_ecount_opt(len) LPSTR,INT len);
+WINBASEAPI INT         WINAPI GetNumberFormatW(LCID,DWORD,LPCWSTR,const NUMBERFMTW*, __out_ecount_opt(len) LPWSTR,INT len);
 #define                       GetNumberFormat WINELIB_NAME_AW(GetNumberFormat)
 WINBASEAPI UINT        WINAPI GetOEMCP(void);
-WINBASEAPI BOOL        WINAPI GetStringTypeA(LCID,DWORD,LPCSTR,INT,LPWORD);
-WINBASEAPI BOOL        WINAPI GetStringTypeW(DWORD,LPCWSTR,INT,LPWORD);
-WINBASEAPI BOOL        WINAPI GetStringTypeExA(LCID,DWORD,LPCSTR,INT,LPWORD);
-WINBASEAPI BOOL        WINAPI GetStringTypeExW(LCID,DWORD,LPCWSTR,INT,LPWORD);
+WINBASEAPI BOOL        WINAPI GetStringTypeA(LCID,DWORD, __in_ecount(len) LPCSTR,INT len, __out LPWORD);
+WINBASEAPI BOOL        WINAPI GetStringTypeW(DWORD, __in_ecount(len) LPCWSTR,INT len, __out LPWORD);
+WINBASEAPI BOOL        WINAPI GetStringTypeExA(LCID,DWORD, __in_ecount(len) LPCSTR, INT len, __out_ecount(len) LPWORD);
+WINBASEAPI BOOL        WINAPI GetStringTypeExW(LCID,DWORD, __in_ecount(len) LPCWSTR, INT len, __out_ecount(len) LPWORD);
 #define                       GetStringTypeEx WINELIB_NAME_AW(GetStringTypeEx)
 WINBASEAPI LANGID      WINAPI GetSystemDefaultLangID(void);
 WINBASEAPI LCID        WINAPI GetSystemDefaultLCID(void);
 WINBASEAPI LANGID      WINAPI GetSystemDefaultUILanguage(void);
 WINBASEAPI LCID        WINAPI GetThreadLocale(void);
-WINBASEAPI INT         WINAPI GetTimeFormatA(LCID,DWORD,const SYSTEMTIME*,LPCSTR,LPSTR,INT);
-WINBASEAPI INT         WINAPI GetTimeFormatW(LCID,DWORD,const SYSTEMTIME*,LPCWSTR,LPWSTR,INT);
+WINBASEAPI INT         WINAPI GetTimeFormatA(LCID,DWORD,const SYSTEMTIME*,LPCSTR, __out_ecount_opt(len) LPSTR, INT len);
+WINBASEAPI INT         WINAPI GetTimeFormatW(LCID,DWORD,const SYSTEMTIME*,LPCWSTR, __out_ecount_opt(len) LPWSTR, INT len);
 #define                       GetTimeFormat WINELIB_NAME_AW(GetTimeFormat)
 WINBASEAPI LANGID      WINAPI GetUserDefaultLangID(void);
 WINBASEAPI LCID        WINAPI GetUserDefaultLCID(void);
@@ -772,12 +772,12 @@ WINBASEAPI BOOL        WINAPI IsDBCSLeadByteEx(UINT,BYTE);
 WINBASEAPI BOOL        WINAPI IsValidCodePage(UINT);
 WINBASEAPI BOOL        WINAPI IsValidLocale(LCID,DWORD);
 WINBASEAPI BOOL        WINAPI IsValidLanguageGroup(LGRPID,DWORD);
-WINBASEAPI INT         WINAPI LCIDToLocaleName(LCID,LPWSTR,INT,DWORD);
-WINBASEAPI INT         WINAPI LCMapStringA(LCID,DWORD,LPCSTR,INT,LPSTR,INT);
-WINBASEAPI INT         WINAPI LCMapStringW(LCID,DWORD,LPCWSTR,INT,LPWSTR,INT);
+WINBASEAPI INT         WINAPI LCIDToLocaleName(LCID, __out_ecount_opt(len) LPWSTR, INT len, DWORD);
+WINBASEAPI INT         WINAPI LCMapStringA(LCID,DWORD, __in_ecount(srclen) LPCSTR, INT srclen, __out_ecount_opt(dstlen) LPSTR, INT dstlen);
+WINBASEAPI INT         WINAPI LCMapStringW(LCID,DWORD, __in_ecount(srclen) LPCWSTR, INT srclen, LPWSTR, INT);
 #define                       LCMapString WINELIB_NAME_AW(LCMapString)
 WINBASEAPI LCID        WINAPI LocaleNameToLCID(LPCWSTR,DWORD);
-WINBASEAPI INT         WINAPI MultiByteToWideChar(UINT,DWORD,LPCSTR,INT,LPWSTR,INT);
+WINBASEAPI INT         WINAPI MultiByteToWideChar(UINT,DWORD, __in_bcount(srclen) LPCSTR, INT srclen, __out_ecount_opt(dstlen) LPWSTR, INT dstlen);
 WINBASEAPI INT         WINAPI SetCalendarInfoA(LCID,CALID,CALTYPE,LPCSTR);
 WINBASEAPI INT         WINAPI SetCalendarInfoW(LCID,CALID,CALTYPE,LPCWSTR);
 #define                       SetCalendarInfo WINELIB_NAME_AW(SetCalendarInfo)
@@ -786,7 +786,7 @@ WINBASEAPI BOOL        WINAPI SetLocaleInfoW(LCID,LCTYPE,LPCWSTR);
 #define                       SetLocaleInfo WINELIB_NAME_AW(SetLocaleInfo)
 WINBASEAPI BOOL        WINAPI SetThreadLocale(LCID);
 WINBASEAPI BOOL        WINAPI SetUserGeoID(GEOID);
-WINBASEAPI INT         WINAPI WideCharToMultiByte(UINT,DWORD,LPCWSTR,INT,LPSTR,INT,LPCSTR,LPBOOL);
+WINBASEAPI INT         WINAPI WideCharToMultiByte(UINT,DWORD, __in_ecount_opt(srclen) LPCWSTR, INT srclen, __out_ecount_opt(dstlen) LPSTR, INT dstlen, LPCSTR, __out_opt LPBOOL);
 
 #ifdef __cplusplus
 }
-- 
1.5.4.3