(file) Return to util.cpp CVS log (file) (dir) Up to [OMI] / omi / tests / indication

 1 krisbash 1.1 /*
 2              **==============================================================================
 3              **
 4              ** Open Management Infrastructure (OMI)
 5              **
 6              ** Copyright (c) Microsoft Corporation
 7              ** 
 8              ** Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 9              ** use this file except in compliance with the License. You may obtain a copy 
10              ** of the License at 
11              **
12              **     http://www.apache.org/licenses/LICENSE-2.0 
13              **
14              ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15              ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
16              ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
17              ** MERCHANTABLITY OR NON-INFRINGEMENT. 
18              **
19              ** See the Apache 2 License for the specific language governing permissions 
20              ** and limitations under the License.
21              **
22 krisbash 1.1 **==============================================================================
23              */
24              
25              #include "util.h"
26              #include <pal/strings.h>
27              
28              CimBaseAutoRelease::CimBaseAutoRelease(_In_ CimBase* obj):
29                  m_cimbase(obj)
30              {
31                  DEBUG_ASSERT(obj);
32              }
33              
34              CimBaseAutoRelease::~CimBaseAutoRelease()
35              {
36                  if (m_cimbase)
37                  {
38                      CimBase_Release(m_cimbase);
39                      m_cimbase = NULL;
40                  }
41              }
42              
43 krisbash 1.1 _Use_decl_annotations_
44              MI_Uint32 IsInArray(
45                  MI_ConstString str,
46                  StringTagElement* strarr,
47                  MI_Uint32 size)
48              {
49                  StringTagElement* ste = IsInArrayEx(str, strarr, size);
50                  return (ste) ? ste->tag : 0;
51              }
52              
53              _Use_decl_annotations_
54              StringTagElement* IsInArrayEx(
55                  MI_ConstString str,
56                  StringTagElement* strarr,
57                  MI_Uint32 size)
58              {
59                  for(MI_Uint32 i = 0; i < size; i++)
60                  {
61                      if (Tcscasecmp(strarr[i].element, str) == 0)
62                      {
63                          strarr[i].tag++;
64 krisbash 1.1             return &(strarr[i]);
65                      }
66                  }
67                  return NULL;
68              }
69              

ViewCVS 0.9.2