2 ** NetXMS - Network Management System
4 ** Copyright (C) 2003-2010 Victor Kirhenshtein
6 ** This program is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU Lesser General Public License as published
8 ** by the Free Software Foundation; either version 3 of the License, or
9 ** (at your option) any later version.
11 ** This program is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ** GNU General Public License for more details.
16 ** You should have received a copy of the GNU Lesser General Public License
17 ** along with this program; if not, write to the Free Software
18 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "libnetxms.h"
28 // Swap byte order in 64-bit integer
31 #if defined(_WIN32) || !(HAVE_DECL___BSWAP_64)
33 QWORD LIBNETXMS_EXPORTABLE
__bswap_64(QWORD qwVal
)
36 BYTE
*sptr
= (BYTE
*)&qwVal
;
37 BYTE
*dptr
= (BYTE
*)&qwResult
+ 7;
40 for(i
= 0; i
< 8; i
++, sptr
++, dptr
--)
50 // Swap bytes in double
53 double LIBNETXMS_EXPORTABLE
__bswap_double(double dVal
)
56 BYTE
*sptr
= (BYTE
*)&dVal
;
57 BYTE
*dptr
= (BYTE
*)&dResult
+ 7;
60 for(i
= 0; i
< 8; i
++, sptr
++, dptr
--)
68 // Swap bytes in wide string (UCS-2)
71 void LIBNETXMS_EXPORTABLE
__bswap_wstr(UCS2CHAR
*pStr
)
75 for(pch
= pStr
; *pch
!= 0; pch
++)
81 // strupr() implementation for non-windows platforms
84 #if !defined(_WIN32) && !defined(_NETWARE)
86 void LIBNETXMS_EXPORTABLE
strupr(char *in
)
97 // TODO: check/set locale
102 #if defined(UNICODE_UCS2) || defined(UNICODE_UCS4)
104 void LIBNETXMS_EXPORTABLE
wcsupr(WCHAR
*in
)
115 // TODO: check/set locale
121 *p
= (WCHAR
)toupper(*p
);
138 #ifndef UNDER_CE // FIXME
139 BOOL WINAPI
DllMain(HINSTANCE hInstance
, DWORD dwReason
, LPVOID lpReserved
)
141 if (dwReason
== DLL_PROCESS_ATTACH
)
143 DisableThreadLibraryCalls(hInstance
);
154 // NetWare library entry point