version 1.7.4.1, 2004/08/20 17:48:55
|
version 1.16.2.3, 2005/09/30 03:46:46
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L. P., IBM Corp., The Open Group, Tivoli Systems. |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; | // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
// IBM Corp.; EMC Corporation, The Open Group. | // IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
// Author: Dave Rosckes (rosckes@us.ibm.com) | // Author: Dave Rosckes (rosckes@us.ibm.com) |
// | // |
|
// Modified By: David Dillard, VERITAS Software Corp. |
|
// (david.dillard@veritas.com) |
|
// Yi Zhou, Hewlett-Packard Company (yi.zhou@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/Array.h> | #include <Pegasus/Common/Array.h> |
|
#include <Pegasus/Common/Logger.h> |
#include "CommonUTF.h" | #include "CommonUTF.h" |
#include <cctype> |
|
#include <cstdio> | #include <cstdio> |
#include <cstring> | #include <cstring> |
|
#include <cctype> |
|
|
|
#ifdef PEGASUS_HAS_ICU |
|
#include <unicode/uclean.h> |
|
#endif |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
| |
inline Uint8 _hexCharToNumeric(const Uint16 c) |
inline Uint8 _hexCharToNumeric(Char16 c) |
{ | { |
Uint8 n; | Uint8 n; |
| |
|
|
} | } |
| |
// Note: Caller must ensure that "src" contains "size" bytes. | // Note: Caller must ensure that "src" contains "size" bytes. |
int isValid_U8(const Uint8 *src, int size) |
Boolean isValid_U8(const Uint8 *src, int size) |
{ | { |
Uint8 U8_char; | Uint8 U8_char; |
const Uint8 *srcptr = src+size; | const Uint8 *srcptr = src+size; |
|
|
Uint8* tgt = *tgtHead; | Uint8* tgt = *tgtHead; |
while (src < srcEnd) | while (src < srcEnd) |
{ | { |
|
if (*src < 128) |
|
{ |
|
if (tgt == tgtEnd) |
|
{ |
|
returnCode = -1; |
|
break; |
|
} |
|
|
|
*tgt++ = *src++; |
|
continue; |
|
} |
|
|
Uint32 tempchar; | Uint32 tempchar; |
Uint16 numberOfBytes = 0; | Uint16 numberOfBytes = 0; |
const Uint16* oldsrc = src; | const Uint16* oldsrc = src; |
|
|
0x00};*/ | 0x00};*/ |
// char tmp_[] = "class"; | // char tmp_[] = "class"; |
// char * tmp = legal; | // char * tmp = legal; |
Uint32 count = 0; |
size_t count = 0; |
Uint32 size = strlen(legal); |
const size_t size = strlen(legal); |
// printf("size = %d\n",size); | // printf("size = %d\n",size); |
while(count<size) | while(count<size) |
{ | { |
|
|
} | } |
} | } |
| |
|
#ifdef PEGASUS_HAS_ICU |
|
|
|
Boolean InitializeICU::_initAttempted = false; |
|
Boolean InitializeICU::_initSuccessful = false; |
|
Mutex InitializeICU::_initMutex; |
|
|
|
Boolean InitializeICU::initICUSuccessful() |
|
{ |
|
if (!_initAttempted) |
|
{ |
|
{ |
|
AutoMutex lock(_initMutex); |
|
|
|
if (!_initAttempted) |
|
{ |
|
UErrorCode _status = U_ZERO_ERROR; |
|
|
|
// Initialize ICU |
|
u_init(&_status); |
|
|
|
if (U_FAILURE(_status)) |
|
{ |
|
_initSuccessful = false; |
|
Logger::put (Logger::STANDARD_LOG , System::CIMSERVER, |
|
Logger::WARNING, |
|
"ICU initialization failed with error: $0.", |
|
_status); |
|
} |
|
else |
|
{ |
|
_initSuccessful = true; |
|
} |
|
_initAttempted = true; |
|
} |
|
} |
|
} |
|
|
|
return _initSuccessful; |
|
} |
|
|
|
#endif |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |