3 ** NetXMS - Network Management System
5 ** Copyright (C) 2003, 2004, 2005, 2006, 2007 Victor Kirhenshtein
7 ** This program is free software; you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License as published by
9 ** the Free Software Foundation; either version 2 of the License, or
10 ** (at your option) any later version.
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; if not, write to the Free Software
19 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include "libnetxms.h"
29 // Swap byte order in 64-bit integer
32 #if defined(_WIN32) || !(HAVE_DECL___BSWAP_64)
34 QWORD LIBNETXMS_EXPORTABLE
__bswap_64(QWORD qwVal
)
37 BYTE
*sptr
= (BYTE
*)&qwVal
;
38 BYTE
*dptr
= (BYTE
*)&qwResult
+ 7;
41 for(i
= 0; i
< 8; i
++, sptr
++, dptr
--)
51 // Swap bytes in double
54 double LIBNETXMS_EXPORTABLE
__bswap_double(double dVal
)
57 BYTE
*sptr
= (BYTE
*)&dVal
;
58 BYTE
*dptr
= (BYTE
*)&dResult
+ 7;
61 for(i
= 0; i
< 8; i
++, sptr
++, dptr
--)
69 // Swap bytes in wide string (UCS-2)
72 void LIBNETXMS_EXPORTABLE
__bswap_wstr(UCS2CHAR
*pStr
)
76 for(pch
= pStr
; *pch
!= 0; pch
++)
82 // strupr() implementation for non-windows platforms
85 #if !defined(_WIN32) && !defined(_NETWARE)
87 void LIBNETXMS_EXPORTABLE
strupr(char *in
)
98 // TODO: check/set locale
103 #if defined(UNICODE_UCS2) || defined(UNICODE_UCS4)
105 void LIBNETXMS_EXPORTABLE
wcsupr(WCHAR
*in
)
116 // TODO: check/set locale
122 *p
= (WCHAR
)toupper(*p
);
139 #ifndef UNDER_CE // FIXME
140 BOOL WINAPI
DllMain(HINSTANCE hInstance
, DWORD dwReason
, LPVOID lpReserved
)
142 if (dwReason
== DLL_PROCESS_ATTACH
)
144 DisableThreadLibraryCalls(hInstance
);
155 // NetWare library entry point