github.com/cellofellow/gopkg@v0.0.0-20140722061823-eec0544a62ad/image/jxr/jxrlib/common/include/wmspecstring.h (about)

     1  //*@@@+++@@@@******************************************************************
     2  //
     3  // Copyright Microsoft Corp.
     4  // All rights reserved.
     5  // 
     6  // Redistribution and use in source and binary forms, with or without
     7  // modification, are permitted provided that the following conditions are met:
     8  // 
     9  // Redistributions of source code must retain the above copyright notice,
    10  //   this list of conditions and the following disclaimer.
    11  // Redistributions in binary form must reproduce the above copyright notice,
    12  //   this list of conditions and the following disclaimer in the documentation
    13  //   and/or other materials provided with the distribution.
    14  // 
    15  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    16  // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    17  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    18  // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    19  // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    20  // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    21  // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    22  // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    23  // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    24  // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    25  // POSSIBILITY OF SUCH DAMAGE.
    26  //
    27  //*@@@---@@@@******************************************************************
    28  
    29  #ifndef _WMSPECSTRING_H_
    30  #define _WMSPECSTRING_H_
    31  
    32  #if (!defined UNDER_CE && !defined NO_WINDOWS && !defined SPECSTRINGS_H)
    33  #define SPECSTRINGS_H
    34  /*************************************************************************
    35  * See specstrings_strict.h for documentation of all user visible macros.
    36  *************************************************************************/
    37  #if _MSC_VER
    38  #pragma once
    39  #endif
    40  #include <wmsal.h>  
    41  
    42  #ifndef __SAL_H_FULL_VER
    43  #define __SAL_H_FULL_VER 140050727
    44  #endif
    45  
    46  #ifdef  __cplusplus
    47  extern "C" {
    48  #endif 
    49  
    50  /* version specific fixes to bring sal.h upto date */
    51  #if __SAL_H_FULL_VER <= 140050727
    52  
    53  /* Missing from RTM sal.h */
    54  #if !defined(__midl) && defined(_PREFAST_) && _MSC_VER >= 1000
    55  
    56  #define __inexpressible_readableTo(size)  __declspec("SAL_readableTo(inexpressibleCount('" SPECSTRINGIZE(size) "'))")
    57  #define __inexpressible_writableTo(size)  __declspec("SAL_writableTo(inexpressibleCount('" SPECSTRINGIZE(size) "'))")
    58  #define __inner_bound                     __declspec("SAL_bound")
    59  #define __inner_range(lb,ub)              __declspec("SAL_range(" SPECSTRINGIZE(lb) "," SPECSTRINGIZE(ub) ")")
    60  #define __inner_assume_bound_dec          __inline __nothrow void __AssumeBoundInt(__post __inner_bound int i) {i;}
    61  #define __inner_assume_bound(i)           __AssumeBoundInt(i);
    62  #define __inner_allocator                 __declspec("SAL_allocator")
    63  #else 
    64  #define __inexpressible_readableTo(size)
    65  #define __inexpressible_writableTo(size)
    66  #define __inner_bound
    67  #define __inner_range(lb,ub)
    68  #define __inner_assume_bound_dec
    69  #define __inner_assume_bound(i)
    70  #define __inner_allocator
    71  #endif
    72  
    73  #define __xcount(size)                                          __notnull __inexpressible_writableTo(size)
    74  #define __in_xcount(size)                                       __in __pre __inexpressible_readableTo(size)
    75  #define __out_xcount(size)                                      __xcount(size) __post __valid __refparam
    76  #define __out_xcount_part(size,length)                          __out_xcount(size) __post __inexpressible_readableTo(length)
    77  #define __out_xcount_full(size)                                 __out_xcount_part(size,size)
    78  #define __inout_xcount(size)                                    __out_xcount(size) __pre __valid
    79  #define __inout_xcount_part(size,length)                        __out_xcount_part(size,length) __pre __valid __pre __inexpressible_readableTo(length)
    80  #define __inout_xcount_full(size)                               __inout_xcount_part(size,size)
    81  #define __xcount_opt(size)                                      __xcount(size)                              __exceptthat __maybenull
    82  #define __in_xcount_opt(size)                                   __in_xcount(size)                           __exceptthat __maybenull
    83  #define __out_xcount_opt(size)                                  __out_xcount(size)                          __exceptthat __maybenull
    84  #define __out_xcount_part_opt(size,length)                      __out_xcount_part(size,length)              __exceptthat __maybenull
    85  #define __out_xcount_full_opt(size)                             __out_xcount_full(size)                     __exceptthat __maybenull
    86  #define __inout_xcount_opt(size)                                __inout_xcount(size)                        __exceptthat __maybenull
    87  #define __inout_xcount_part_opt(size,length)                    __inout_xcount_part(size,length)            __exceptthat __maybenull
    88  #define __inout_xcount_full_opt(size)                           __inout_xcount_full(size)                   __exceptthat __maybenull
    89  #define __deref_xcount(size)                                    __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __inexpressible_writableTo(size)
    90  #define __deref_in                                              __in __pre __deref __deref __readonly
    91  #define __deref_in_ecount(size)                                 __deref_in __pre __deref __elem_readableTo(size)
    92  #define __deref_in_bcount(size)                                 __deref_in __pre __deref __byte_readableTo(size)
    93  #define __deref_in_xcount(size)                                 __deref_in __pre __deref __inexpressible_readableTo(size)
    94  #define __deref_out_xcount(size)                                __deref_xcount(size) __post __deref __valid __refparam
    95  #define __deref_out_xcount_part(size,length)                    __deref_out_xcount(size) __post __deref __inexpressible_readableTo(length)
    96  #define __deref_out_xcount_full(size)                           __deref_out_xcount_part(size,size)
    97  #define __deref_out_xcount(size)                                __deref_xcount(size) __post __deref __valid __refparam
    98  #define __inout_xcount_opt(size)                                __inout_xcount(size)                        __exceptthat __maybenull
    99  #define __inout_xcount_part_opt(size,length)                    __inout_xcount_part(size,length)            __exceptthat __maybenull
   100  #define __inout_xcount_full_opt(size)                           __inout_xcount_full(size)                   __exceptthat __maybenull
   101  #define __deref_xcount(size)                                    __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __inexpressible_writableTo(size)
   102  #define __deref_in                                              __in __pre __deref __deref __readonly
   103  #define __deref_in_ecount(size)                                 __deref_in __pre __deref __elem_readableTo(size)
   104  #define __deref_in_bcount(size)                                 __deref_in __pre __deref __byte_readableTo(size)
   105  #define __deref_in_xcount(size)                                 __deref_in __pre __deref __inexpressible_readableTo(size)
   106  #define __deref_out_xcount(size)                                __deref_xcount(size) __post __deref __valid __refparam
   107  #define __deref_out_xcount_part(size,length)                    __deref_out_xcount(size) __post __deref __inexpressible_readableTo(length)
   108  #define __deref_out_xcount_full(size)                           __deref_out_xcount_part(size,size)
   109  #define __deref_out_xcount(size)                                __deref_xcount(size) __post __deref __valid __refparam
   110  #define __deref_inout_xcount(size)                              __deref_inout __pre __deref __inexpressible_writableTo(size) __post __deref __inexpressible_writableTo(size)
   111  #define __deref_inout_xcount_part(size,length)                  __deref_inout_xcount(size) __pre __deref __inexpressible_readableTo(length) __post __deref __inexpressible_readableTo(length)
   112  #define __deref_inout_xcount_full(size)                         __deref_inout_xcount_part(size,size)
   113  #define __deref_xcount_opt(size)                                __deref_xcount(size)                        __post __deref __exceptthat __maybenull
   114  #define __deref_in_opt                                          __deref_in                                  __pre __deref __exceptthat __maybenull
   115  #define __deref_in_ecount_opt(size)                             __deref_in_ecount(size)                     __pre __deref __exceptthat __maybenull
   116  #define __deref_in_bcount_opt(size)                             __deref_in_bcount(size)                     __pre __deref __exceptthat __maybenull
   117  #define __deref_in_xcount_opt(size)                             __deref_in_xcount(size)                     __pre __deref __exceptthat __maybenull
   118  #define __deref_out_xcount_opt(size)                            __deref_out_xcount(size)                    __post __deref __exceptthat __maybenull
   119  #define __deref_out_xcount_part_opt(size,length)                __deref_out_xcount_part(size,length)        __post __deref __exceptthat __maybenull
   120  #define __deref_out_xcount_full_opt(size)                       __deref_out_xcount_full(size)               __post __deref __exceptthat __maybenull
   121  #define __deref_inout_xcount_opt(size)                          __deref_inout_xcount(size)                  __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
   122  #define __deref_inout_xcount_part_opt(size,length)              __deref_inout_xcount_part(size,length)      __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
   123  #define __deref_inout_xcount_full_opt(size)                     __deref_inout_xcount_full(size)             __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
   124  #define __deref_opt_xcount(size)                                __deref_xcount(size)                        __exceptthat __maybenull
   125  #define __deref_opt_in                                          __deref_in                                  __exceptthat __maybenull
   126  #define __deref_opt_in_ecount(size)                             __deref_in_ecount(size)                     __exceptthat __maybenull
   127  #define __deref_opt_in_bcount(size)                             __deref_in_bcount(size)                     __exceptthat __maybenull
   128  #define __deref_opt_in_xcount(size)                             __deref_in_xcount(size)                     __exceptthat __maybenull
   129  #define __deref_opt_out_xcount(size)                            __deref_out_xcount(size)                    __exceptthat __maybenull
   130  #define __deref_opt_out_xcount_part(size,length)                __deref_out_xcount_part(size,length)        __exceptthat __maybenull
   131  #define __deref_opt_out_xcount_full(size)                       __deref_out_xcount_full(size)               __exceptthat __maybenull
   132  #define __deref_opt_inout_xcount(size)                          __deref_inout_xcount(size)                  __exceptthat __maybenull
   133  #define __deref_opt_inout_xcount_part(size,length)              __deref_inout_xcount_part(size,length)      __exceptthat __maybenull
   134  #define __deref_opt_inout_xcount_full(size)                     __deref_inout_xcount_full(size)             __exceptthat __maybenull
   135  #define __deref_opt_xcount_opt(size)                            __deref_xcount_opt(size)                    __exceptthat __maybenull
   136  #define __deref_opt_in_opt                                      __deref_in_opt                              __exceptthat __maybenull
   137  #define __deref_opt_in_ecount_opt(size)                         __deref_in_ecount_opt(size)                 __exceptthat __maybenull
   138  #define __deref_opt_in_bcount_opt(size)                         __deref_in_bcount_opt(size)                 __exceptthat __maybenull
   139  #define __deref_opt_in_xcount_opt(size)                         __deref_in_xcount_opt(size)                 __exceptthat __maybenull
   140  #define __deref_opt_out_xcount_opt(size)                        __deref_out_xcount_opt(size)                __exceptthat __maybenull
   141  #define __deref_opt_out_xcount_part_opt(size,length)            __deref_out_xcount_part_opt(size,length)    __exceptthat __maybenull
   142  #define __deref_opt_out_xcount_full_opt(size)                   __deref_out_xcount_full_opt(size)           __exceptthat __maybenull
   143  #define __deref_opt_inout_xcount_opt(size)                      __deref_inout_xcount_opt(size)              __exceptthat __maybenull
   144  #define __deref_opt_inout_xcount_part_opt(size,length)          __deref_inout_xcount_part_opt(size,length)  __exceptthat __maybenull
   145  #define __deref_opt_inout_xcount_full_opt(size)                 __deref_inout_xcount_full_opt(size)         __exceptthat __maybenull
   146  /* Must protect redfinitions of macros to workaround rc.exe issues. */
   147  #ifndef RC_INVOKED
   148  #undef __nullnullterminated
   149  #define __nullnullterminated __xcount("string terminated by two nulls")
   150  #undef __checkReturn
   151  #define __checkReturn __post __inner_checkReturn
   152  #endif
   153  #endif  //__SAL_H_FULL_VER <= 140050727
   154  
   155  /************************************************************************
   156   New extensions to sal.h follow here.
   157  *************************************************************************/
   158  
   159  #if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_)
   160  #define __file_parser(typ)                  __declspec("SAL_file_parser(function, " #typ ")")    
   161  #define __file_parser_class(typ)            __declspec("SAL_file_parser(class, " #typ ")")
   162  #define __file_parser_library(typ)          extern int __declspec("SAL_file_parser(library, " #typ ")") __iSALFileParserLibrary##typ;
   163  #define __source_code_content(typ)          extern int __declspec("SAL_source_code_content(" #typ ")") __iSAL_Source_Code_Content##typ;
   164  #define __class_code_content(typ)           __declspec("SAL_class_code_content(" #typ ")")
   165  #define __analysis_assert(e)                __assume(e)
   166  #define __analysis_hint(hint)               __declspec("SAL_analysisHint(" #hint ")")   
   167  /* Internal defintions */
   168  #define __inner_data_source(src_raw)        __declspec("SAL_untrusted_data_source(" src_raw ")")
   169  #define __inner_this_data_source(src_raw)   __declspec("SAL_untrusted_data_source_this(" src_raw ")")
   170  #define __inner_out_validated(typ_raw)      __declspec("SAL_post") __declspec("SAL_validated(" typ_raw ")") 
   171  #define __inner_this_out_validated(typ_raw) __declspec("SAL_validated_this(" typ_raw ")") 
   172  #define __inner_assume_validated_dec        __inline __nothrow void __AssumeValidated(__inner_out_validated("BY_DESIGN") const void *p) {p;}
   173  #define __inner_assume_validated(p)         __AssumeValidated(p)
   174  #define __inner_transfer(formal)            __declspec("SAL_transfer_adt_property_from(" SPECSTRINGIZE(formal) ")")
   175  #define __inner_encoded                     __declspec("SAL_encoded")
   176  
   177  #define __$adt_prop(adt,prop)               __declspec("SAL_adt("#adt","#prop")")
   178  #define __$adt_add_prop(adt,prop)           __declspec("SAL_add_adt_property("#adt","#prop")")
   179  #define __$adt_remove_prop(adt,prop)        __declspec("SAL_remove_adt_property("#adt","#prop")")
   180  #define __$adt_transfer_prop(arg)           __declspec("SAL_transfer_adt_property_from("#arg")")
   181  #define __$adt_type_props(typ)              __declspec("SAL_post_type("#typ")")
   182  #define __$volatile                         __declspec("SAL_volatile")
   183  #define __$nonvolatile                      __declspec("SAL_nonvolatile")
   184  #define __$possibly_notnulltermiated        __declspec("SAL_RequiresZeroTermination(sometimes)")
   185  #else
   186  #define __file_parser(typ)
   187  #define __file_parser_class(typ)
   188  #define __file_parser_library(typ)
   189  #define __source_code_content(typ)
   190  #define __class_code_content(typ)
   191  #define __analysis_assert(e)
   192  #define __analysis_hint(hint)
   193  /* Internal defintions */
   194  #define __inner_data_source(src_raw)
   195  #define __inner_this_data_source(src_raw)
   196  #define __inner_out_validated(typ_raw)
   197  #define __inner_this_out_validated(typ_raw)
   198  #define __inner_assume_validated_dec
   199  #define __inner_assume_validated(p)
   200  #define __inner_transfer(formal)
   201  #define __inner_encoded
   202  #define __$adt_prop(adt,prop)   
   203  #define __$adt_add_prop(adt,prop)   
   204  #define __$adt_remove_prop(adt,prop)   
   205  #define __$adt_transfer_prop(arg)   
   206  #define __$adt_type_props(typ)   
   207  #define __$volatile 
   208  #define __$nonvolatile 
   209  #define __$possibly_notnulltermiated 
   210  #endif // #if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_)
   211  
   212  #define __field_ecount(size)                __notnull __elem_writableTo(size)
   213  #define __field_bcount(size)                __notnull __byte_writableTo(size)
   214  #define __field_xcount(size)                __notnull __inexpressible_writableTo(size)
   215  
   216  #define __field_ecount_opt(size)            __maybenull __elem_writableTo(size)
   217  #define __field_bcount_opt(size)            __maybenull __byte_writableTo(size)
   218  #define __field_xcount_opt(size)            __maybenull __inexpressible_writableTo(size)
   219  
   220  #define __field_ecount_part(size,init)      __notnull __elem_writableTo(size) __elem_readableTo(init)
   221  #define __field_bcount_part(size,init)      __notnull __byte_writableTo(size) __byte_readableTo(init)
   222  #define __field_xcount_part(size,init)      __notnull __inexpressible_writableTo(size) __inexpressible_readableTo(init)
   223  
   224  #define __field_ecount_part_opt(size,init)  __maybenull __elem_writableTo(size) __elem_readableTo(init)
   225  #define __field_bcount_part_opt(size,init)  __maybenull __byte_writableTo(size) __byte_readableTo(init)
   226  #define __field_xcount_part_opt(size,init)  __maybenull __inexpressible_writableTo(size) __inexpressible_readableTo(init)
   227  
   228  #define __field_ecount_full(size)           __field_ecount_part(size,size)  
   229  #define __field_bcount_full(size)           __field_bcount_part(size,size)  
   230  #define __field_xcount_full(size)           __field_xcount_part(size,size)      
   231  
   232  #define __field_ecount_full_opt(size)       __field_ecount_part_opt(size,size)  
   233  #define __field_bcount_full_opt(size)       __field_bcount_part_opt(size,size)  
   234  #define __field_xcount_full_opt(size)       __field_xcount_part_opt(size,size)      
   235  
   236  #define __struct_bcount(size)               __field_bcount(size)
   237  #define __struct_xcount(size)               __field_xcount(size)
   238  
   239  #if !defined(__out_awcount)
   240  #define __out_awcount(expr,size)            __pre __notnull \
   241  					    __byte_writableTo((expr) ? (size) : (size) * 2) \
   242                                              __post __valid __refparam
   243  #endif
   244  #if !defined(__in_awcount)
   245  #define __in_awcount(expr,size)             __pre __valid \
   246                                              __pre __deref __readonly \
   247  				            __byte_readableTo((expr) ? (size) : (size) * 2)
   248  #endif
   249  
   250  /* integer related macros */
   251  #define __allocator                         __inner_allocator
   252  #define __bound                             __inner_bound
   253  #define __range(lb,ub)                      __inner_range(lb,ub)
   254  #define __in_bound                          __pre __inner_bound
   255  #define __out_bound                         __post __inner_bound
   256  #define __deref_out_bound                   __post __deref __inner_bound
   257  #define __in_range(lb,ub)                   __pre __inner_range(lb,ub)
   258  #define __out_range(lb,ub)                  __post __inner_range(lb,ub)
   259  #define __deref_in_range(lb,ub)             __pre __deref __inner_range(lb,ub)
   260  #define __deref_out_range(lb,ub)            __post __deref __inner_range(lb,ub)
   261  #define __field_range(lb,ub)                __range(lb,ub)
   262  #define __field_data_source(src_sym)        __inner_data_source(#src_sym)
   263  
   264  /* Pentraion review macros */
   265  #define __in_data_source(src_sym)           __pre __inner_data_source(#src_sym)
   266  #define __out_data_source(src_sym)          __post __inner_data_source(#src_sym)
   267  #define __out_validated(typ_sym)            __inner_out_validated(#typ_sym)
   268  #define __this_out_data_source(src_sym)     __inner_this_data_source(#src_sym)
   269  #define __this_out_validated(typ_sym)       __inner_this_out_validated(#typ_sym)
   270  #define __transfer(formal)                  __post __inner_transfer(formal)
   271  #define __rpc_entry                         __inner_control_entrypoint(RPC)
   272  #define __kernel_entry                      __inner_control_entrypoint(UserToKernel)   
   273  #define __gdi_entry                         __inner_control_entrypoint(GDI)
   274  #define __encoded_pointer                   __inner_encoded
   275  #define __encoded_array                     __inner_encoded
   276  #define __field_encoded_pointer             __inner_encoded
   277  #define __field_encoded_array               __inner_encoded
   278  #define __type_has_adt_prop(adt,prop)       __$adt_prop(adt,prop)
   279  #define __out_has_adt_prop(adt,prop)        __post __$adt_add_prop(adt,prop)
   280  #define __out_not_has_adt_prop(adt,prop)    __post __$adt_remove_prop(adt,prop)
   281  #define __out_transfer_adt_prop(arg)        __post __$adt_transfer_prop(arg)
   282  #define __out_has_type_adt_props(typ)       __post __$adt_type_props(typ)
   283  
   284  /* useful PFD related macros */
   285  #define __possibly_notnulltermiated         __post __$possibly_notnulltermiated
   286  
   287  #if defined(_WINDOWS_)
   288  /* Windows Internal */
   289  #define __volatile                          __$volatile
   290  #define __nonvolatile                       __$nonvolatile
   291  #define __deref_volatile                    __deref __volatile
   292  #define __deref_nonvolatile                 __deref __nonvolatile
   293  #endif
   294  
   295  /* declare stub functions for macros */
   296  __inner_assume_validated_dec 
   297  __inner_assume_bound_dec 
   298  
   299  #define __assume_validated(p) __inner_assume_validated(p)
   300  #define __assume_bound(i) __inner_assume_bound(i)
   301  #ifdef  __cplusplus
   302  }
   303  #endif
   304  #include <wmspecstrings_adt.h>
   305  #ifdef _PREFIX_
   306  /**************************************************************************
   307  * Defintion of __pfx_assume and __pfx_assert. Thse should be the only
   308  * defintions of these functions.  
   309  ***************************************************************************/
   310  #if __cplusplus
   311  extern "C" void __pfx_assert(bool, const char *);
   312  extern "C" void __pfx_assume(bool, const char *);
   313  #else
   314  void __pfx_assert(int, const char *);
   315  void __pfx_assume(int, const char *);
   316  #endif
   317  /**************************************************************************
   318  * Redefintion of __analysis_assume and __analysis_assert for PREFIX build
   319  **************************************************************************/
   320  #undef  __analysis_assume
   321  #undef  __analysis_assert
   322  #define __analysis_assume(e) (__pfx_assume(e,"pfx_assume"),__assume(e));
   323  #define __analysis_assert(e) (__pfx_assert(e,"pfx_assert"),__assume(e));
   324  #endif /* ifdef _PREFIX_ */
   325  
   326  /**************************************************************************
   327  * This include should always be the last thing in this file. 
   328  * Must avoid redfinitions of macros to workaround rc.exe issues. 
   329  ***************************************************************************/
   330  #if !(defined(RC_INVOKED) || defined(SORTPP_PASS))
   331  #include <wmspecstrings_strict.h>
   332  #endif /* if !(defined(RC_INVOKED) || defined(SORTPP_PASS)) */
   333  #endif /* #ifndef SPECSTRINGS_H */
   334  
   335  // Some CE versions don't have specstrings.h, some have very old version without
   336  // __specstrings defined. So we handle CE separately in wmasalce.h
   337  #if defined(UNDER_CE) || defined(NO_WINDOWS)
   338    #include "wmspecstringce.h"
   339  #endif
   340  
   341  #endif //_WMSPECSTRING_H_
   342