PropagateDocumentVersion(me: mutable; theVersion : Integer from Standard)
is virtual protected;
+
+ CheckDocumentVersion(me: mutable;
+ theFileVersion : Integer from Standard;
+ theCurVersion : Integer from Standard)
+ returns Boolean from Standard
+ is virtual protected;
+ ---Purpose: Check a file version(in which file was written) with a current version.
+ -- Redefining this method is a chance for application to read files
+ -- written by newer applications.
+ -- The default implementation: if the version of the file is greater than the
+ -- current or lesser than 2, then return false, else true
WriteMessage(me: mutable; theMessage : ExtendedString from TCollection)
is protected;
return;
}
- TCollection_AsciiString aFileName (theFileName,'?');
+ TCollection_AsciiString aFileName (theFileName);
// 1. Read the information section
Handle(Storage_HeaderData) aHeaderData;
Standard_Integer aFileVer = aHeaderData->StorageVersion().IntegerValue();
Standard_Integer aCurrVer = BinLDrivers::StorageVersion().IntegerValue();
// maintain one-way compatibility starting from version 2+
- if (aFileVer < 2 || aFileVer > aCurrVer) {
+ if (!CheckDocumentVersion(aFileVer, aCurrVer)) {
+ myReaderStatus = PCDM_RS_NoVersion;
// file was written with another version
WriteMessage (aMethStr + "error: wrong file version: " +
aHeaderData->StorageVersion() + " while current is " +
BinLDrivers::StorageVersion());
- myReaderStatus = PCDM_RS_NoVersion;
return;
}
}
// Open the file stream
-#ifdef WNT
- ifstream anIS (aFileName.ToCString(), ios::in | ios::binary);
+#ifdef _WIN32
+ ifstream anIS ((const wchar_t*) theFileName.ToExtString(), ios::in | ios::binary);
#else
ifstream anIS (aFileName.ToCString());
#endif
{
BinMDataStd::SetDocumentVersion(theDocVersion);
}
+
+//=======================================================================
+//function : CheckDocumentVersion
+//purpose :
+//=======================================================================
+Standard_Boolean BinLDrivers_DocumentRetrievalDriver::CheckDocumentVersion(
+ const Standard_Integer theFileVersion,
+ const Standard_Integer theCurVersion)
+{
+ if (theFileVersion < 2 || theFileVersion > theCurVersion) {
+ // file was written with another version
+ return Standard_False;
+ }
+ return Standard_True;
+}
+
}
else {
// Open the file
- TCollection_AsciiString aFileName (theFileName,'?');
+ TCollection_AsciiString aFileName (theFileName);
// First pass: collect empty labels, assign IDs to the types
if (myDrivers.IsNull())
return;
}
-#if !defined(IRIX) // 10.10.2005
+#if defined(_WIN32)
+ ofstream anOS ((const wchar_t*) theFileName.ToExtString(), ios::in | ios::binary | ios::ate);
+#elif !defined(IRIX) // 10.10.2005
ofstream anOS (aFileName.ToCString(), ios::in | ios::binary | ios::ate);
#else
ofstream anOS (aFileName.ToCString(), ios::ate);
if (!DDF::GetDF(arg[1],DF)) return 1;
TDF_Label L;
DDF::AddLabel(DF, arg[2], L);
- TDataStd_Comment::Set(L,arg[3]);
+ TDataStd_Comment::Set(L,TCollection_ExtendedString(arg[3],Standard_True));
return 0;
}
di << "DDataStd_SetComment : Error" << "\n";
Handle(TDataStd_Comment) A;
if (!DDF::Find(DF,arg[2],TDataStd_Comment::GetID(),A)) return 1;
TCollection_AsciiString s(A->Get(),'?');
- di << s.ToCString();
+ di << A->Get().ToExtString();
return 0;
}
di << "DDataStd_GetComment : Error" << "\n";
#define TCL_USES_UTF8
#endif
-//
-// Auxiliary tool to convert strings in command arguments from UTF-8
-// (Tcl internal encoding since Tcl 8.1) to system local encoding,
-// normally extended Ascii as expected by OCC commands
-//
-class TclUTFToLocalStringSentry {
- public:
-
-#ifdef TCL_USES_UTF8
- TclUTFToLocalStringSentry (int argc, const char **argv) :
- nb(0),
- TclArgv(new Tcl_DString[argc]),
- Argv(new char*[argc])
- {
- for (; nb < argc; nb++ ) {
- Tcl_UtfToExternalDString ( NULL, argv[nb], -1, &TclArgv[nb] );
- Argv[nb] = Tcl_DStringValue ( &TclArgv[nb] );
- }
- }
-
- ~TclUTFToLocalStringSentry ()
- {
- delete[] Argv;
- while ( nb-- >0 ) Tcl_DStringFree ( &TclArgv[nb] );
- delete[] TclArgv;
- }
-#else
- TclUTFToLocalStringSentry (int, const char **argv) :
- nb(0),
- TclArgv(NULL),
- Argv((char**)argv)
- {}
-#endif
-
- const char **GetArgv () const { return (const char **)Argv; }
-
- private:
- int nb;
- Tcl_DString *TclArgv;
- char **Argv;
-};
-
// logging helpers
namespace {
void dumpArgs (Standard_OStream& os, int argc, const char *argv[])
// get exception if control-break has been pressed
OSD::ControlBreak();
- // OCC63: Convert strings from UTF-8 to local encoding, normally expected by OCC commands
- TclUTFToLocalStringSentry anArgs ( argc, (const char**)argv );
+ // OCC680: Transfer UTF-8 directly to OCC commands without locale usage
- Standard_Integer fres = aCallback->Invoke ( di, argc, anArgs.GetArgv() );
+ Standard_Integer fres = aCallback->Invoke ( di, argc, argv /*anArgs.GetArgv()*/ );
if (fres != 0)
code = TCL_ERROR;
}
SetName(aName);
if (OpenMode() == Storage_VSNone) {
+#ifdef _WIN32
+ TCollection_ExtendedString aWName(aName);
+ if (aMode == Storage_VSRead) {
+ myStream = _wfopen((const wchar_t*)aWName.ToExtString(),L"rb");
+ }
+ else if (aMode == Storage_VSWrite) {
+ myStream = _wfopen((const wchar_t*)aWName.ToExtString(),L"wb");
+ }
+ else if (aMode == Storage_VSReadWrite) {
+ myStream = _wfopen((const wchar_t*)aWName.ToExtString(),L"w+b");
+ }
+#else
if (aMode == Storage_VSRead) {
myStream = fopen(aName.ToCString(),"rb");
}
else if (aMode == Storage_VSReadWrite) {
myStream = fopen(aName.ToCString(),"w+b");
}
+#endif
if (myStream == 0L) {
result = Storage_VSOpenError;
if (OpenMode() == Storage_VSNone) {
-#if !defined(IRIX) && !defined(DECOSF1)
+#if defined(_WNT32)
+ TCollection_ExtendedString aWName(aName);
+ if (aMode == Storage_VSRead) {
+ myStream.open((const wchar_t*)aWName.ToExtString(),ios::in|ios::binary); // ios::nocreate is not portable
+ }
+ else if (aMode == Storage_VSWrite) {
+ myStream.open((const wchar_t*)aWName.ToExtString(),ios::out|ios::binary);
+ }
+ else if (aMode == Storage_VSReadWrite) {
+ myStream.open((const wchar_t*)aWName.ToExtString(),ios::in|ios::out|ios::binary);
+ }
+#elif !defined(IRIX) && !defined(DECOSF1)
if (aMode == Storage_VSRead) {
myStream.open(aName.ToCString(),ios::in|ios::binary); // ios::nocreate is not portable
}
SetName(aName);
if (OpenMode() == Storage_VSNone) {
+
+#ifdef _WIN32
+ TCollection_ExtendedString aWName(aName);
+ if (aMode == Storage_VSRead) {
+ myStream.open( (const wchar_t*) aWName.ToExtString(),ios::in); // ios::nocreate is not portable
+ }
+ else if (aMode == Storage_VSWrite) {
+ myStream.open( (const wchar_t*) aWName.ToExtString(),ios::out);
+ }
+ else if (aMode == Storage_VSReadWrite) {
+ myStream.open( (const wchar_t*) aWName.ToExtString(),ios::in|ios::out);
+#else
if (aMode == Storage_VSRead) {
myStream.open(aName.ToCString(),ios::in); // ios::nocreate is not portable
}
}
else if (aMode == Storage_VSReadWrite) {
myStream.open(aName.ToCString(),ios::in|ios::out);
+#endif
}
if (myStream.fail()) {
#include <LDOM_XmlReader.hxx>
#include <LDOM_BasicText.hxx>
#include <LDOM_CharReference.hxx>
+#include <TCollection_ExtendedString.hxx>
#include <fcntl.h>
#ifdef WNT
myError.Clear ();
// Open the file
+#ifdef _WIN32
+ TCollection_ExtendedString aFileNameW(aFileName, Standard_True);
+ int aFile = _wopen ((const wchar_t*) aFileNameW.ToExtString(), O_RDONLY);
+#else
int aFile = open (aFileName, O_RDONLY);
+#endif
if (aFile < 0) {
myError = "Fatal XML error: Cannot open XML file";
return Standard_True;
// print string according to format
char * sStringBuffer = new char [Max ((Standard_Integer)strlen(theString)+1, 1024)];
Sprintf (sStringBuffer, aFormat.ToCString(), theString);
- TCollection_ExtendedString aStr ( sStringBuffer );
+ TCollection_ExtendedString aStr ( sStringBuffer, Standard_True );
delete [] sStringBuffer;
sStringBuffer = 0;
if (theFileName == NULL || * theFileName == '\0') return Standard_False;
// Open the file
+#ifdef _WIN32
+ // file name is treated as UTF-8 string
+ TCollection_ExtendedString aFileNameW(theFileName, Standard_True);
+ FILE *anMsgFile = _wfopen ((const wchar_t*)aFileNameW.ToExtString(), L"rb");
+#else
FILE *anMsgFile = fopen (theFileName, "rb");
+#endif
if (!anMsgFile) return Standard_False;
// Read the file into memory
#include <OSD_Directory.hxx>
#include <OSD_Protection.hxx>
#include <Standard_ProgramError.hxx>
+#include <TCollection_ExtendedString.hxx>
#include <OSD_WNT_1.hxx>
Standard_ProgramError :: Raise (
TEXT( "OSD_Directory :: Build (): incorrect call - no directory name" )
);
-
- if ( Exists () || CreateDirectory ( dirName.ToCString (), NULL ) )
+ TCollection_ExtendedString dirNameW(dirName);
+ if ( Exists () || CreateDirectoryW ( (const wchar_t*) dirNameW.ToExtString (), NULL ) )
SetProtection ( Protect );
#include <windows.h>
#include <OSD_DirectoryIterator.ixx>
+#include <TCollection_ExtendedString.hxx>
-#define _FD ( ( PWIN32_FIND_DATA )myData )
+#define _FD ( ( PWIN32_FIND_DATAW )myData )
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
where.SystemName ( myPlace );
- if ( myPlace.Length () == 0 ) myPlace = TEXT( "." );
+ if ( myPlace.Length () == 0 ) myPlace = ".";
myMask = Mask;
myData = NULL;
if ( myHandle == INVALID_HANDLE_VALUE ) {
- TCollection_AsciiString wc = myPlace + TEXT( "/" ) + myMask;
+ TCollection_AsciiString wc = myPlace + "/" + myMask;
myData = HeapAlloc (
- GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS, sizeof ( WIN32_FIND_DATA )
+ GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS, sizeof ( WIN32_FIND_DATAW )
);
- myHandle = FindFirstFile (wc.ToCString (), (PWIN32_FIND_DATA)myData);
+ // make wchar_t string from UTF-8
+ TCollection_ExtendedString wcW(wc);
+ myHandle = FindFirstFileW ((const wchar_t*)wcW.ToExtString(), (PWIN32_FIND_DATAW)myData);
if ( myHandle == INVALID_HANDLE_VALUE )
do {
- if ( !FindNextFile ( ( HANDLE )myHandle, _FD ) ) {
+ if ( !FindNextFileW ( ( HANDLE )myHandle, _FD ) ) {
myFlag = Standard_False;
OSD_Directory OSD_DirectoryIterator :: Values () {
- TheIterator.SetPath ( OSD_Path ( _FD -> cFileName ) );
+ // make UTF-8 string
+ TCollection_AsciiString aFileName
+ (TCollection_ExtendedString( (Standard_ExtString) _FD -> cFileName) );
+ TheIterator.SetPath ( OSD_Path ( aFileName ) );
return TheIterator;
#define STRICT
#include <OSD_Error.hxx>
#include <OSD_ErrorList.hxx>
+#include <TCollection_ExtendedString.hxx>
#include <windows.h>
if ( fPrefix ) {
- lstrcpy ( buff, TEXT( "Error ( " ) );
+ lstrcpy ( buff, "Error ( " );
switch ( myCode ) {
case OSD_WDirectoryIterator:
- ptr = TEXT( "OSD_DirectoryIterator" );
+ ptr = "OSD_DirectoryIterator";
break;
case OSD_WDirectory:
- ptr = TEXT( "OSD_Directory" );
+ ptr = "OSD_Directory";
break;
case OSD_WFileIterator:
- ptr = TEXT( "OSD_FileIterator" );
+ ptr = "OSD_FileIterator";
break;
case OSD_WFile:
- ptr = TEXT( "OSD_File" );
+ ptr = "OSD_File";
break;
case OSD_WFileNode:
- ptr = TEXT( "OSD_FileNode" );
+ ptr = "OSD_FileNode";
break;
case OSD_WHost:
- ptr = TEXT( "OSD_Host" );
+ ptr = "OSD_Host";
break;
case OSD_WProcess:
- ptr = TEXT( "OSD_Environment" );
+ ptr = "OSD_Environment";
break;
case OSD_WEnvironmentIterator:
- ptr = TEXT( "OSD_EnvironmentIterator" );
+ ptr = "OSD_EnvironmentIterator";
break;
case OSD_WEnvironment:
- ptr = TEXT( "OSD_Environment" );
+ ptr = "OSD_Environment";
break;
case OSD_WDisk:
- ptr = TEXT( "OSD_Disk" );
+ ptr = "OSD_Disk";
break;
default:
- ptr = TEXT( "Unknown" );
+ ptr = "Unknown";
} // end switch
lstrcat ( buff, ptr );
- lstrcat ( buff, TEXT( " )" ) );
+ lstrcat ( buff, " )" );
( *errorStream ) << buff;
} // end if ( fPrefix . . . )
- ( *errorStream ) << TEXT( ": " ) << myMessage.ToCString () << endl << flush;
+ TCollection_ExtendedString aMessageW(myMessage);
+ ( *errorStream ) << L": " << (const wchar_t*)aMessageW.ToExtString () << endl << flush;
} // end OSD_Error :: Perror
#include <stdio.h>
#include <io.h>
#include <Standard_PCharacter.hxx>
+#include <TCollection_ExtendedString.hxx>
#ifndef _INC_TCHAR
# include <tchar.h>
#define OPEN_APPEND 2
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
-PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd ( const OSD_Protection&, BOOL, char* = NULL );
+PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd ( const OSD_Protection&, BOOL, wchar_t* = NULL );
BOOL __fastcall _osd_wnt_sd_to_protection (
PSECURITY_DESCRIPTOR, OSD_Protection&, BOOL
);
-BOOL __fastcall _osd_print (const Standard_PCharacter, Standard_CString );
+BOOL __fastcall _osd_print (const Standard_PCharacter, const wchar_t* );
static void __fastcall _test_raise ( HANDLE, Standard_CString );
static DWORDLONG __fastcall _get_line ( Standard_PCharacter&, DWORD );
if (myFileHandle != INVALID_HANDLE_VALUE)
- RAISE( TEXT( "OSD_File :: Build (): incorrect call - file already opened" ) );
+ RAISE( "OSD_File :: Build (): incorrect call - file already opened" );
myMode = Mode;
myPath.SystemName ( fName );
if ( fName.IsEmpty () )
- RAISE( TEXT( "OSD_File :: Build (): incorrent call - no filename given" ) );
+ RAISE( "OSD_File :: Build (): incorrent call - no filename given" );
myFileHandle = _open_file ( fName.ToCString (), Mode, OPEN_NEW );
if (myFileHandle != INVALID_HANDLE_VALUE)
- RAISE( TEXT( "OSD_File :: Open (): incorrect call - file already opened" ) );
+ RAISE( "OSD_File :: Open (): incorrect call - file already opened" );
myMode = Mode;
myPath.SystemName ( fName );
if ( fName.IsEmpty () )
- RAISE( TEXT( "OSD_File :: Open (): incorrent call - no filename given" ) );
+ RAISE( "OSD_File :: Open (): incorrent call - no filename given" );
myFileHandle = _open_file ( fName.ToCString (), Mode, OPEN_OLD );
if (myFileHandle != INVALID_HANDLE_VALUE)
- RAISE( TEXT( "OSD_File :: Append (): incorrect call - file already opened" ) );
+ RAISE( "OSD_File :: Append (): incorrect call - file already opened" );
myMode = Mode;
myPath.SystemName ( fName );
if ( fName.IsEmpty () )
- RAISE( TEXT( "OSD_File :: Append (): incorrent call - no filename given" ) );
+ RAISE( "OSD_File :: Append (): incorrent call - no filename given" );
myFileHandle = _open_file ( fName.ToCString (), Mode, OPEN_APPEND, &fNew );
Standard_Integer NbyteRead;
Standard_Address buff;
- TEST_RAISE( TEXT( "Read" ) );
+ TEST_RAISE( "Read" );
buff = ( Standard_Address )new Standard_Character[ Nbyte + 1 ];
Standard_ProgramError::Raise("OSD_File::Read : it is a directory");
}
- TEST_RAISE( TEXT( "ReadLine" ) );
+ TEST_RAISE( "ReadLine" );
if ( myIO & FLAG_PIPE && !( myIO & FLAG_READ_PIPE ) )
- RAISE( TEXT( "OSD_File :: ReadLine (): attempt to read from write only pipe" ) );
+ RAISE( "OSD_File :: ReadLine (): attempt to read from write only pipe" );
// +----> leave space for end-of-string
// | plus <CR><LF> sequence
} else
- RAISE( TEXT( "OSD_File :: ReadLine (): incorrect call - file is a directory" ) );
+ RAISE( "OSD_File :: ReadLine (): incorrect call - file is a directory" );
if ( !Failed () && !IsAtEnd () )
Standard_ProgramError::Raise("OSD_File::Read : it is a directory");
}
- TEST_RAISE( TEXT( "Read" ) );
+ TEST_RAISE( "Read" );
if ( myIO & FLAG_PIPE && !( myIO & FLAG_READ_PIPE ) )
- RAISE( TEXT( "OSD_File :: Read (): attempt to read from write only pipe" ) );
+ RAISE( "OSD_File :: Read (): attempt to read from write only pipe" );
if (!ReadFile (myFileHandle, Buffer, (DWORD)Nbyte, &dwBytesRead, NULL)) {
DWORD dwBytesWritten;
- TEST_RAISE( TEXT( "Write" ) );
+ TEST_RAISE( "Write" );
if ( myIO & FLAG_PIPE && myIO & FLAG_READ_PIPE )
- RAISE( TEXT( "OSD_File :: Write (): attempt to write to read only pipe" ) );
+ RAISE( "OSD_File :: Write (): attempt to write to read only pipe" );
if (!WriteFile (myFileHandle, Buffer, (DWORD)Nbyte, &dwBytesWritten, NULL) ||
dwBytesWritten != (DWORD)Nbyte)
DWORD dwMoveMethod = 0;
- TEST_RAISE( TEXT( "Seek" ) );
+ TEST_RAISE( "Seek" );
if ( myIO & FLAG_FILE || myIO & FLAG_DIRECTORY ) {
default:
- RAISE( TEXT( "OSD_File :: Seek (): invalid parameter" ) );
+ RAISE( "OSD_File :: Seek (): invalid parameter" );
} // end switch
void OSD_File :: Close () {
- TEST_RAISE( TEXT( "Close" ) );
+ TEST_RAISE( "Close" );
CloseHandle (myFileHandle);
Standard_Boolean OSD_File :: IsAtEnd () {
- TEST_RAISE( TEXT( "IsAtEnd" ) );
+ TEST_RAISE( "IsAtEnd" );
if (myIO & FLAG_EOF)
return Standard_True ;
if ( fName.IsEmpty () )
- RAISE( TEXT( "OSD_File :: KindOfFile (): incorrent call - no filename given" ) );
+ RAISE( "OSD_File :: KindOfFile (): incorrent call - no filename given" );
flags = _get_file_type (fName.ToCString(), INVALID_HANDLE_VALUE);
OSD_WNT_KEY regKey[ 2 ] = {
{ HKEY_LOCAL_MACHINE,
- TEXT( "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment" )
+ "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
},
{ HKEY_USERS,
- TEXT( ".DEFAULT\\Environment" )
+ ".DEFAULT\\Environment"
}
};
DWORD dwSize = 0;
if ( RegQueryValueEx (
- hKey, TEXT( "TEMP" ), NULL, &dwType, NULL, &dwSize
+ hKey, "TEMP", NULL, &dwType, NULL, &dwSize
) == ERROR_SUCCESS
) {
dwSize + sizeof ( TCHAR )
);
- RegQueryValueEx ( hKey, TEXT( "TEMP" ), NULL, &dwType, ( LPBYTE )kVal, &dwSize );
+ RegQueryValueEx ( hKey, "TEMP", NULL, &dwType, ( LPBYTE )kVal, &dwSize );
if ( dwType == REG_EXPAND_SZ )
} // end for
- if ( !fOK ) lstrcpy ( tmpPath, TEXT( "./" ) );
+ if ( !fOK ) lstrcpy ( tmpPath, "./" );
GetTempFileName ( tmpPath, "CSF", 0, tmpPath );
DWORD dwFlags;
OVERLAPPED ovlp;
- TEST_RAISE( TEXT( "SetLock" ) );
+ TEST_RAISE( "SetLock" );
ZeroMemory ( &ovlp, sizeof ( OVERLAPPED ) );
void OSD_File :: UnLock () {
- TEST_RAISE( TEXT( "Unlock" ) );
+ TEST_RAISE( "Unlock" );
if ( ImperativeFlag ) {
Standard_Boolean OSD_File :: IsLocked () {
- TEST_RAISE( TEXT( "IsLocked" ) );
+ TEST_RAISE( "IsLocked" );
return ImperativeFlag;
Standard_Integer retVal;
- TEST_RAISE( TEXT( "Size" ) );
+ TEST_RAISE( "Size" );
LARGE_INTEGER aSize;
aSize.QuadPart = 0;
if (myFileHandle != INVALID_HANDLE_VALUE)
- RAISE( TEXT( "OSD_File :: Print (): incorrect call - file opened" ) );
+ RAISE( "OSD_File :: Print (): incorrect call - file opened" );
TCollection_AsciiString pName, fName;
WhichPrinter.Name ( pName );
myPath.SystemName ( fName );
+ TCollection_ExtendedString fNameW(fName);
- if ( !_osd_print ( (Standard_PCharacter)pName.ToCString (), fName.ToCString () ) )
+ if ( !_osd_print ( (Standard_PCharacter)pName.ToCString (),
+ (const wchar_t*)fNameW.ToExtString () ) )
_osd_wnt_set_error ( myError, OSD_WFile );
#endif
PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd (
- const OSD_Protection& prot, BOOL fDir, char* fName
+ const OSD_Protection& prot, BOOL fDir, wchar_t* fName
) {
int i, j;
if (hFile == INVALID_HANDLE_VALUE) {
- _tcscpy ( buff, TEXT( "OSD_File :: " ) );
- _tcscat ( buff, str );
- _tcscat ( buff, TEXT( " (): wrong access" ) );
+ strcpy ( buff, "OSD_File :: " );
+ strcat ( buff, str );
+ strcat ( buff, " (): wrong access" );
Standard_ProgramError :: Raise ( buff );
while ( *ptr != 0 ) {
- if ( *ptr == TEXT( '\n' ) ) {
+ if ( *ptr == '\n' ) {
ptr++ ; // jump newline char.
*ptr = 0 ;
#endif
return retVal;
- } else if ( *ptr == TEXT( '\r' ) && ptr[ 1 ] == TEXT( '\n' ) ) {
+ } else if ( *ptr == '\r' && ptr[ 1 ] == '\n' ) {
*(ptr++) = '\n' ; // Substitue carriage return by newline.
*ptr = 0 ;
#endif
return retVal;
- } else if ( *ptr == TEXT( '\r' ) && ptr[ 1 ] == 0 ) {
+ } else if ( *ptr == '\r' && ptr[ 1 ] == 0 ) {
*ptr = '\n' ; // Substitue carriage return by newline
#ifdef VAC
default:
- RAISE( TEXT( "_get_access_mask (): incorrect parameter" ) );
+ RAISE( "_get_access_mask (): incorrect parameter" );
} // end switch
default:
- RAISE( TEXT( "_get_dir_access_mask (): incorrect parameter" ) );
+ RAISE( "_get_dir_access_mask (): incorrect parameter" );
} // end switch
default:
- RAISE( TEXT( "_open_file (): incorrect parameter" ) );
+ RAISE( "_open_file (): incorrect parameter" );
} // end switch
dwCreationDistribution = ( dwOptions != OPEN_NEW ) ? OPEN_EXISTING : CREATE_ALWAYS;
- retVal = CreateFile (
- fName, dwDesiredAccess,
+ // make wide character string from UTF-8
+ TCollection_ExtendedString fNameW(fName, Standard_True);
+ retVal = CreateFileW (
+ (const wchar_t*) fNameW.ToExtString(), dwDesiredAccess,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, dwCreationDistribution, FILE_ATTRIBUTE_NORMAL, NULL
);
dwCreationDistribution = CREATE_ALWAYS;
- retVal = CreateFile (
- fName, dwDesiredAccess,
+ retVal = CreateFileW (
+ (const wchar_t*) fNameW.ToExtString(), dwDesiredAccess,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, dwCreationDistribution, FILE_ATTRIBUTE_NORMAL, NULL
);
break;
case FILE_TYPE_DISK:
-
- if ( ( dwType = GetFileAttributes ( fName ) ) != 0xFFFFFFFF )
+ {
+ // make wide character string from UTF-8
+ TCollection_ExtendedString fNameW(fName, Standard_True);
+ dwType = GetFileAttributesW ( (const wchar_t*) fNameW.ToExtString() );
+ if ( dwType != 0xFFFFFFFF )
retVal = dwType & FILE_ATTRIBUTE_DIRECTORY ? FLAG_DIRECTORY : FLAG_FILE;
else
retVal = 0x80000000;
-
+ }
break;
case FILE_TYPE_CHAR:
#define __leave return fOK
#endif
-BOOL __fastcall _osd_print (const Standard_PCharacter pName, Standard_CString fName ) {
+BOOL __fastcall _osd_print (const Standard_PCharacter pName, const wchar_t* fName ) {
BOOL fOK, fJob;
HANDLE hPrinter = NULL;
} // end if
- if ( !AddJob (
+ if ( !AddJobW (
hPrinter, 1, jobInfo, MAX_PATH + sizeof ( DWORD ), &dwNeeded
)
) __leave;
fJob = TRUE;
- if ( !CopyFile (
- fName, ( ( ADDJOB_INFO_1* )jobInfo ) -> Path, FALSE
+ if ( !CopyFileW (
+ fName, (LPWSTR) ( ( ADDJOB_INFO_1* )jobInfo ) -> Path, FALSE
)
) __leave;
#include <windows.h>
#include <OSD_FileIterator.ixx>
+#include <TCollection_ExtendedString.hxx>
-#define _FD ( ( PWIN32_FIND_DATA )myData )
+#define _FD ( ( PWIN32_FIND_DATAW )myData )
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
where.SystemName ( myPlace );
- if ( myPlace.Length () == 0 ) myPlace = TEXT( "." );
+ if ( myPlace.Length () == 0 ) myPlace = ".";
myMask = Mask;
myData = NULL;
if ( myHandle == INVALID_HANDLE_VALUE ) {
- TCollection_AsciiString wc = myPlace + TEXT( "/" ) + myMask;
+ TCollection_AsciiString wc = myPlace + "/" + myMask;
myData = HeapAlloc (
- GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS, sizeof ( WIN32_FIND_DATA )
+ GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS, sizeof ( WIN32_FIND_DATAW )
);
- myHandle = FindFirstFile (wc.ToCString (), (PWIN32_FIND_DATA)myData);
+ // make wchar_t string from UTF-8
+ TCollection_ExtendedString wcW(wc);
+ myHandle = FindFirstFileW ((const wchar_t*)wcW.ToExtString(), (PWIN32_FIND_DATAW)myData);
if ( myHandle == INVALID_HANDLE_VALUE )
do {
- if ( !FindNextFile ( ( HANDLE )myHandle, _FD ) ) {
+ if ( !FindNextFileW ( ( HANDLE )myHandle, _FD ) ) {
myFlag = Standard_False;
OSD_File OSD_FileIterator :: Values () {
- TheIterator.SetPath ( OSD_Path ( _FD -> cFileName ) );
+ // make UTF-8 string
+ TCollection_AsciiString aFileName
+ (TCollection_ExtendedString( (Standard_ExtString) _FD -> cFileName) );
+ TheIterator.SetPath ( OSD_Path ( aFileName ) );
return TheIterator;
#include <OSD_Protection.hxx>
#include <Quantity_Date.hxx>
#include <Standard_ProgramError.hxx>
+#include <TCollection_ExtendedString.hxx>
#include <OSD_WNT_1.hxx>
#define TEST_RAISE( arg ) _test_raise ( fName, ( arg ) )
#define RAISE( arg ) Standard_ProgramError :: Raise ( ( arg ) )
-PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd ( const OSD_Protection&, BOOL, char* = NULL );
+PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd ( const OSD_Protection&, BOOL, wchar_t* = NULL );
BOOL __fastcall _osd_wnt_sd_to_protection (
PSECURITY_DESCRIPTOR pSD, OSD_Protection& prot, BOOL
);
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
-static BOOL __fastcall _get_file_time ( Standard_CString, LPSYSTEMTIME, BOOL );
+static BOOL __fastcall _get_file_time ( Standard_ExtString, LPSYSTEMTIME, BOOL );
static void __fastcall _test_raise ( TCollection_AsciiString, Standard_CString );
//=======================================================================
myPath.SystemName ( fName );
if ( fName.IsEmpty () ) return Standard_False;
- TEST_RAISE( TEXT( "Exists" ) );
+ TEST_RAISE( "Exists" );
- if ( GetFileAttributes ( fName.ToCString () ) == 0xFFFFFFFF ) {
+ // make wide character string from UTF-8
+ TCollection_ExtendedString fNameW(fName);
+ if ( GetFileAttributesW ( (const wchar_t*) fNameW.ToExtString () ) == 0xFFFFFFFF ) {
if ( GetLastError () != ERROR_FILE_NOT_FOUND )
TCollection_AsciiString fName;
myPath.SystemName ( fName );
+ TCollection_ExtendedString fNameW(fName);
- TEST_RAISE( TEXT( "Remove" ) );
+ TEST_RAISE( "Remove" );
switch (_get_file_type (fName.ToCString(), INVALID_HANDLE_VALUE)) {
case FLAG_FILE:
- if ( !DeleteFile ( fName.ToCString () ) )
+ if ( !DeleteFileW ( (const wchar_t*) fNameW.ToExtString () ) )
_osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
// LD : Suppression de l'appel a DeleteDirectory pour
// ne pas detruire un repertoire no vide.
- if ( !RemoveDirectory ( fName.ToCString () ) )
+ if ( !RemoveDirectoryW ( (const wchar_t*) fNameW.ToExtString () ) )
_osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
TCollection_AsciiString fNameDst;
myPath.SystemName ( fName );
+ TCollection_ExtendedString fNameW(fName);
- TEST_RAISE( TEXT( "Move" ) );
+ TEST_RAISE( "Move" );
NewPath.SystemName ( fNameDst );
+ TCollection_ExtendedString fNameDstW(fNameDst);
switch (_get_file_type (fName.ToCString (), INVALID_HANDLE_VALUE)) {
case FLAG_FILE:
- if (!MoveFileEx (fName.ToCString (), fNameDst.ToCString (),
- MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED
- )
+ if (!MoveFileExW ((const wchar_t*)fNameW.ToExtString (),
+ (const wchar_t*)fNameDstW.ToExtString (),
+ MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED
+ )
)
_osd_wnt_set_error ( myError, OSD_WFileNode,
case FLAG_DIRECTORY:
if ( !MoveDirectory (
- fName.ToCString (), fNameDst.ToCString ()
+ (const wchar_t*) fNameW.ToExtString (), (const wchar_t*) fNameDstW.ToExtString ()
)
)
TCollection_AsciiString fNameDst;
myPath.SystemName ( fName );
+ TCollection_ExtendedString fNameW(fName);
- TEST_RAISE( TEXT( "Copy" ) );
+ TEST_RAISE( "Copy" );
ToPath.SystemName ( fNameDst );
+ TCollection_ExtendedString fNameDstW(fNameDst);
switch (_get_file_type (fName.ToCString(), INVALID_HANDLE_VALUE)) {
case FLAG_FILE:
- if (!CopyFile (fName.ToCString (), fNameDst.ToCString (), FALSE ))
+ if (!CopyFileW ((const wchar_t*)fNameW.ToExtString (),
+ (const wchar_t*)fNameDstW.ToExtString (), FALSE ))
_osd_wnt_set_error (myError, OSD_WFileNode,
fName.ToCString (), fNameDst.ToCString ());
break;
case FLAG_DIRECTORY:
if ( !CopyDirectory (
- fName.ToCString (), fNameDst.ToCString ()
+ (const wchar_t*)fNameW.ToExtString (), (const wchar_t*)fNameDstW.ToExtString ()
)
)
PSECURITY_DESCRIPTOR pSD;
myPath.SystemName ( fName );
+ TCollection_ExtendedString fNameW(fName);
- TEST_RAISE( TEXT( "Protection" ) );
+ TEST_RAISE( "Protection" );
if ( ( pSD = GetFileSecurityEx (
- fName.ToCString (), DACL_SECURITY_INFORMATION |
+ (const wchar_t*) fNameW.ToExtString (), DACL_SECURITY_INFORMATION |
OWNER_SECURITY_INFORMATION
)
) == NULL ||
PSECURITY_DESCRIPTOR pSD;
myPath.SystemName ( fName );
+ TCollection_ExtendedString fNameW(fName);
- TEST_RAISE( TEXT( "SetProtection" ) );
+ TEST_RAISE( "SetProtection" );
pSD = _osd_wnt_protection_to_sd (
Prot,
_get_file_type (fName.ToCString(), INVALID_HANDLE_VALUE) ==
FLAG_DIRECTORY,
- (char *)fName.ToCString ()
+ (wchar_t *)fNameW.ToExtString ()
);
- if ( pSD == NULL || !SetFileSecurity (
- fName.ToCString (), DACL_SECURITY_INFORMATION, pSD
+ if ( pSD == NULL || !SetFileSecurityW (
+ (const wchar_t*) fNameW.ToExtString (), DACL_SECURITY_INFORMATION, pSD
)
)
TCollection_AsciiString fName;
myPath.SystemName ( fName );
+ TCollection_ExtendedString fNameW(fName);
- TEST_RAISE( TEXT( "AccessMoment" ) );
+ TEST_RAISE( "AccessMoment" );
// if ( _get_file_time ( fName.ToCString (), &stAccessMoment, TRUE ) )
- if ( _get_file_time ( fName.ToCString (), &stAccessSystemMoment, TRUE ) )
+ if ( _get_file_time ( fNameW.ToExtString (), &stAccessSystemMoment, TRUE ) )
//POP
{
SYSTEMTIME * aSysTime = &stAccessMoment;
TCollection_AsciiString fName;
myPath.SystemName ( fName );
+ TCollection_ExtendedString fNameW(fName);
- TEST_RAISE( TEXT( "CreationMoment" ) );
+ TEST_RAISE( "CreationMoment" );
// if ( _get_file_time ( fName.ToCString (), &stCreationMoment, FALSE ) )
- if ( _get_file_time ( fName.ToCString (), &stCreationSystemMoment, TRUE ) )
+ if ( _get_file_time ( fNameW.ToExtString (), &stCreationSystemMoment, TRUE ) )
//POP
{
SYSTEMTIME * aSysTime = &stCreationMoment;
PSECURITY_DESCRIPTOR pSD;
myPath.SystemName ( fName );
+ TCollection_ExtendedString fNameW(fName);
- TEST_RAISE( TEXT( "UserId" ) );
+ TEST_RAISE( "UserId" );
if ( ( pSD = GetFileSecurityEx (
- fName.ToCString (),
+ (const wchar_t*) fNameW.ToExtString (),
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION
)
) != NULL &&
PSECURITY_DESCRIPTOR pSD;
myPath.SystemName ( fName );
+ TCollection_ExtendedString fNameW(fName);
- TEST_RAISE( TEXT( "GroupId" ) );
+ TEST_RAISE( "GroupId" );
if ( ( pSD = GetFileSecurityEx (
- fName.ToCString (),
+ (const wchar_t*) fNameW.ToExtString (),
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION
)
) != NULL
#endif
static BOOL __fastcall _get_file_time (
- Standard_CString fName, LPSYSTEMTIME lpSysTime, BOOL fAccess
+ Standard_ExtString fName, LPSYSTEMTIME lpSysTime, BOOL fAccess
) {
BOOL retVal = FALSE;
__try {
- if ( ( hFile = CreateFile (
- fName, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL
- )
+ if ( ( hFile = CreateFileW ((const wchar_t*) fName, 0, 0,
+ NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)
) == INVALID_HANDLE_VALUE
) __leave;
if ( fName.IsEmpty () ) {
- _tcscpy ( buff, TEXT( "OSD_FileNode :: " ) );
- _tcscat ( buff, str );
- _tcscat ( buff, TEXT( " (): wrong access" ) );
+ strcpy ( buff, "OSD_FileNode :: " );
+ strcat ( buff, str );
+ strcat ( buff, " (): wrong access" );
Standard_ProgramError :: Raise ( buff );
#include <windows.h>
#include <stdlib.h>
-#include <tchar.h>
#define TEST_RAISE( type, arg ) _test_raise ( ( type ), ( arg ) )
memset(__ext, 0,_MAX_EXT);
Standard_Character chr;
- TEST_RAISE( aSysType, TEXT( "OSD_Path" ) );
+ TEST_RAISE( aSysType, "OSD_Path" );
_splitpath ( aDependentName.ToCString (), __drive, __dir, __fname, __ext );
{
TCollection_AsciiString dir = __dir;
- len = dir.UsefullLength ();
+ len = dir.Length ();
}
for ( i = j = 0; i < len; ++i, ++j ) {
chr = __dir[i];
- if ( chr == TEXT( '\\' ) || chr == TEXT( '/' ) )
+ if ( chr == '\\' || chr == '/' )
- __trek[j] = TEXT( '|' );
+ __trek[j] = '|';
- else if ( chr == TEXT( '.' )&& (i+1) < len && __dir[i+1] == TEXT( '.' ) ) {
+ else if ( chr == '.'&& (i+1) < len && __dir[i+1] == '.' ) {
- __trek[j] = TEXT( '^' );
+ __trek[j] = '^';
++i;
} else
myName = aName;
myExtension = anExtension;
- if ( myExtension.UsefullLength () && myExtension.Value ( 1 ) != TEXT( '.' ) )
+ if ( myExtension.Length () && myExtension.Value ( 1 ) != '.' )
- myExtension.Insert ( 1, TEXT( '.' ) );
+ myExtension.Insert ( 1, '.' );
_remove_dup ( myTrek );
memset(trek,0,_MAX_PATH);
- TEST_RAISE( aType, TEXT( "SystemName" ) );
+ TEST_RAISE( aType, "SystemName" );
- for ( i = j = 1; i <= myTrek.UsefullLength () && j <= _MAX_PATH; ++i, ++j ) {
+ for ( i = j = 1; i <= myTrek.Length () && j <= _MAX_PATH; ++i, ++j ) {
chr = myTrek.Value ( i );
- if ( chr == TEXT( '|' ) ) {
+ if ( chr == '|' ) {
- trek[j-1] = TEXT( '/' );
+ trek[j-1] = '/';
- } else if ( chr == TEXT( '^' ) && j <= _MAX_PATH - 1 ) {
+ } else if ( chr == '^' && j <= _MAX_PATH - 1 ) {
- strcpy(&(trek[(j++) - 1]),TEXT( ".." ));
+ strcpy(&(trek[(j++) - 1]),"..");
} else
fullPath = myDisk + TCollection_AsciiString(trek);
- if ( trek[0] ) fullPath += TEXT( "/" );
+ if ( trek[0] ) fullPath += "/";
fullPath += ( myName + myExtension );
- if ( fullPath.UsefullLength () > 0 )
+ if ( fullPath.Length () > 0 )
FullName = fullPath;
const OSD_SysType aSysType
) const {
- TEST_RAISE( aSysType, TEXT( "IsValid" ) );
+ TEST_RAISE( aSysType, "IsValid" );
return Standard_True;
void OSD_Path :: UpTrek () {
- Standard_Integer pos = myTrek.SearchFromEnd ( TEXT( "|" ) );
+ Standard_Integer pos = myTrek.SearchFromEnd ( "|" );
if ( pos == -1 )
else if ( pos > 1 ) {
- while ( myTrek.Value ( pos ) == TEXT( '|' ) && pos != 1 ) --pos;
+ while ( myTrek.Value ( pos ) == '|' && pos != 1 ) --pos;
} // end if
void OSD_Path :: DownTrek ( const TCollection_AsciiString& aName ) {
- Standard_Integer pos = myTrek.UsefullLength ();
+ Standard_Integer pos = myTrek.Length ();
- if ( aName.Value ( 1 ) != TEXT( '|' ) &&
+ if ( aName.Value ( 1 ) != '|' &&
pos &&
- myTrek.Value ( pos ) != TEXT( '|' )
+ myTrek.Value ( pos ) != '|'
)
- myTrek += TEXT( "|" );
+ myTrek += "|";
myTrek += aName;
Standard_Integer i = 1;
Standard_Integer retVal = 0;
- if ( myTrek.IsEmpty () || myTrek.UsefullLength () == 1 && myTrek.Value ( 1 ) == TEXT( '|' ) )
+ if ( myTrek.IsEmpty () || myTrek.Length () == 1 && myTrek.Value ( 1 ) == '|' )
return retVal;
for (;;) {
- if ( myTrek.Token ( TEXT( "|" ), i++ ).IsEmpty () )
+ if ( myTrek.Token ( "|", i++ ).IsEmpty () )
break;
return;
- if ( myTrek.Value ( 1 ) != TEXT( '|' ) ) {
+ if ( myTrek.Value ( 1 ) != '|' ) {
flag = Standard_True;
- myTrek.Insert ( 1, TEXT( '|' ) );
+ myTrek.Insert ( 1, '|' );
} // end if
i = myTrek.Location (
- thewhere, TEXT( '|' ),
- 1, myTrek.UsefullLength ()
+ thewhere, '|',
+ 1, myTrek.Length ()
);
if ( i ) {
j = myTrek.Location (
- thewhere + 1, TEXT( '|' ),
- 1, myTrek.UsefullLength ()
+ thewhere + 1, '|',
+ 1, myTrek.Length ()
);
if ( j == 0 )
- j = myTrek.UsefullLength () + 1;
+ j = myTrek.Length () + 1;
myTrek.Remove ( i, j - i );
Standard_Boolean flag = Standard_False;
TCollection_AsciiString tmp;
- if ( myTrek.Value ( 1 ) != TEXT( '|' ) ) {
+ if ( myTrek.Value ( 1 ) != '|' ) {
flag = Standard_True;
- myTrek.Insert ( 1, TEXT( '|' ) );
+ myTrek.Insert ( 1, '|' );
} // end if
- myTrek += TEXT( '|' );
+ myTrek += '|';
tmp = aName;
- if ( tmp.Value ( 1 ) != TEXT( '|' ) )
+ if ( tmp.Value ( 1 ) != '|' )
- tmp.Insert ( 1, TEXT( '|' ) );
+ tmp.Insert ( 1, '|' );
- if ( tmp.Value ( tmp.UsefullLength () ) != TEXT( '|' ) )
+ if ( tmp.Value ( tmp.Length () ) != '|' )
- tmp += TEXT( '|' );
+ tmp += '|';
i = myTrek.Search ( tmp );
if ( i != -1 )
- myTrek.Remove ( i + 1, tmp.UsefullLength () - 1 );
+ myTrek.Remove ( i + 1, tmp.Length () - 1 );
if ( flag )
myTrek.Remove ( 1 );
- if ( myTrek.Value ( myTrek.UsefullLength () ) == TEXT( '|' ) )
+ if ( myTrek.Value ( myTrek.Length () ) == '|' )
- myTrek.Trunc ( myTrek.UsefullLength () - 1 );
+ myTrek.Trunc ( myTrek.Length () - 1 );
} // end OSD_Path :: RemoveATrek ( 2 )
TCollection_AsciiString retVal;
TCollection_AsciiString trek = myTrek;
- if ( trek.Value ( 1 ) != TEXT( '|' ) )
+ if ( trek.Value ( 1 ) != '|' )
- trek.Insert ( 1, TEXT( '|' ) );
+ trek.Insert ( 1, '|' );
- retVal = trek.Token ( TEXT( "|" ), thewhere );
+ retVal = trek.Token ( "|", thewhere );
return retVal;
TCollection_AsciiString tmp = aName;
Standard_Boolean flag = Standard_False;
- if ( myTrek.Value ( 1 ) != TEXT( '|' ) ) {
+ if ( myTrek.Value ( 1 ) != '|' ) {
flag = Standard_True;
- myTrek.Insert ( 1, TEXT( '|' ) );
+ myTrek.Insert ( 1, '|' );
} // end if
- myTrek += TEXT( '|' );
+ myTrek += '|';
pos = myTrek.Location (
- thewhere, TEXT( '|' ),
- 1, myTrek.UsefullLength ()
+ thewhere, '|',
+ 1, myTrek.Length ()
);
if ( pos ) {
- if ( tmp.Value ( tmp.UsefullLength () ) != TEXT( '|' ) )
+ if ( tmp.Value ( tmp.Length () ) != '|' )
- tmp += TEXT( '|' );
+ tmp += '|';
myTrek.Insert ( pos + 1, tmp );
myTrek.Remove ( 1 );
- if ( myTrek.Value ( myTrek.UsefullLength () ) == TEXT( '|' ) )
+ if ( myTrek.Value ( myTrek.Length () ) == '|' )
- myTrek.Trunc ( myTrek.UsefullLength () - 1 );
+ myTrek.Trunc ( myTrek.Length () - 1 );
_remove_dup ( myTrek );
if ( type != OSD_Default && type != OSD_WindowsNT ) {
- _tcscpy ( buff, TEXT( "OSD_Path :: " ) );
- _tcscat ( buff, str );
- _tcscat ( buff, TEXT( " (): unknown system type" ) );
+ strcpy ( buff, "OSD_Path :: " );
+ strcat ( buff, str );
+ strcat ( buff, " (): unknown system type" );
Standard_ProgramError :: Raise ( buff );
static void __fastcall _remove_dup ( TCollection_AsciiString& str ) {
- Standard_Integer pos = 1, orgLen, len = str.UsefullLength ();
+ Standard_Integer pos = 1, orgLen, len = str.Length ();
orgLen = len;
while ( pos <= len ) {
- if ( str.Value ( pos ) == TEXT( '|' ) && pos != len &&
- str.Value ( pos + 1 ) == TEXT( '|' ) && pos != 1
+ if ( str.Value ( pos ) == '|' && pos != len &&
+ str.Value ( pos + 1 ) == '|' && pos != 1
) {
++pos;
- while ( pos <= len && str.Value ( pos ) == TEXT( '|' ) ) str.Remove ( pos ), --len;
+ while ( pos <= len && str.Value ( pos ) == '|' ) str.Remove ( pos ), --len;
} else
} // end while
- if ( orgLen > 1 && len > 0 && str.Value ( len ) == TEXT( '|' ) ) str.Remove ( len );
+ if ( orgLen > 1 && len > 0 && str.Value ( len ) == '|' ) str.Remove ( len );
pos = 1;
- orgLen = len = str.UsefullLength ();
+ orgLen = len = str.Length ();
while ( pos <= len ) {
- if ( str.Value ( pos ) == TEXT( '^' ) && pos != len && str.Value ( pos + 1 ) == TEXT( '^' ) ) {
+ if ( str.Value ( pos ) == '^' && pos != len && str.Value ( pos + 1 ) == '^' ) {
++pos;
- while ( pos <= len && str.Value ( pos ) == TEXT( '^' ) ) str.Remove ( pos ), --len;
+ while ( pos <= len && str.Value ( pos ) == '^' ) str.Remove ( pos ), --len;
} else
} // end while
-// if ( orgLen > 1 && len > 0 && str.Value ( len ) == TEXT( '^' ) ) str.Remove ( len );
+// if ( orgLen > 1 && len > 0 && str.Value ( len ) == '^' ) str.Remove ( len );
} // end _remove_dup
#include <OSD_Path.hxx>
#include <Quantity_Date.hxx>
+#include <Standard_PExtCharacter.hxx>
+#include <TCollection_ExtendedString.hxx>
#include <OSD_WNT_1.hxx>
#include <LMCONS.H> /// pour UNLEN ( see MSDN about GetUserName() )
void OSD_Process :: TerminalType ( TCollection_AsciiString& Name ) {
- Name = TEXT( "WIN32 console" );
+ Name = "WIN32 console";
} // end OSD_Process :: TerminalType
OSD_Path anCurrentDirectory;
DWORD dwSize = PATHLEN + 1;
- Standard_PCharacter pBuff = new char[dwSize];
+ Standard_WideChar* pBuff = new wchar_t[dwSize];
- if ( GetCurrentDirectory(dwSize, pBuff) > 0 )
- anCurrentDirectory = OSD_Path ( pBuff );
+ if ( GetCurrentDirectoryW(dwSize, (wchar_t*)pBuff) > 0 )
+ {
+ // conversion to UTF-8 is performed inside
+ TCollection_AsciiString aPath(TCollection_ExtendedString((Standard_ExtString)pBuff));
+ anCurrentDirectory = OSD_Path ( aPath );
+ }
else
_osd_wnt_set_error ( myError, OSD_WProcess );
void OSD_Process :: SetCurrentDirectory ( const OSD_Path& where ) {
-#ifdef UNICODE
-# define SetCurrentDirectory SetCurrentDirectoryW
-#else
-# define SetCurrentDirectory SetCurrentDirectoryA
-#endif // UNICODE
-
TCollection_AsciiString path;
where.SystemName ( path );
+ TCollection_ExtendedString pathW(path);
- if ( !::SetCurrentDirectory ( path.ToCString () ) )
+ if ( !::SetCurrentDirectoryW ( (const wchar_t*) pathW.ToExtString () ) )
_osd_wnt_set_error ( myError, OSD_WProcess );
/***/
#include <OSD_WNT_1.hxx>
-#include <tchar.h>
+#include <wchar.h>
#include <stdlib.h>
/***/
static void Init ( void );
#define __leave return retVal
#endif
-PSECURITY_DESCRIPTOR GetFileSecurityEx ( LPCTSTR fileName, SECURITY_INFORMATION si ) {
+PSECURITY_DESCRIPTOR GetFileSecurityEx ( LPCWSTR fileName, SECURITY_INFORMATION si ) {
DWORD errVal;
DWORD dwSize;
dwSize = dwSizeNeeded;
errVal = ERROR_SUCCESS;
- if ( !GetFileSecurity (
+ if ( !GetFileSecurityW (
fileName, si,
retVal, dwSize, &dwSizeNeeded
)
#define __leave return retVal
#endif
-BOOL LookupAccountSidEx ( PSID pSID, LPTSTR* name, LPTSTR* domain ) {
+BOOL LookupAccountSidEx ( PSID pSID, LPWSTR* name, LPWSTR* domain ) {
DWORD errVal;
DWORD dwSizeName = 0;
errVal = ERROR_SUCCESS;
- if ( !LookupAccountSid (
+ if ( !LookupAccountSidW (
NULL, pSID, *name, &dwSizeName, *domain, &dwSizeDomain, &eUse
)
) {
if ( ( errVal = GetLastError () ) != ERROR_INSUFFICIENT_BUFFER ) __leave;
- if ( ( *name = ( LPTSTR )HeapAlloc ( hHeap, 0, dwSizeName ) ) == NULL ||
- ( *domain = ( LPTSTR )HeapAlloc ( hHeap, 0, dwSizeDomain ) ) == NULL
+ if ( ( *name = ( LPWSTR )HeapAlloc ( hHeap, 0, dwSizeName ) ) == NULL ||
+ ( *domain = ( LPWSTR )HeapAlloc ( hHeap, 0, dwSizeDomain ) ) == NULL
) __leave;
} /* end if */
/* 'LookupAccountSidEx' function */
/******************************************************************************/
/***/
-void FreeAccountNames ( LPTSTR lpszName, LPTSTR lpszDomain ) {
+void FreeAccountNames ( LPWSTR lpszName, LPWSTR lpszDomain ) {
HeapFree ( hHeap, 0, ( PVOID )lpszDomain );
HeapFree ( hHeap, 0, ( PVOID )lpszName );
} /* end FreeAce */
-#define WILD_CARD TEXT( "/*.*" )
+#define WILD_CARD L"/*.*"
#define WILD_CARD_LEN ( sizeof ( WILD_CARD ) )
/***/
/* Returns : TRUE on success, FALSE otherwise */
/******************************************************************************/
/***/
-BOOL MoveDirectory ( LPCTSTR oldDir, LPCTSTR newDir ) {
+BOOL MoveDirectory ( LPCWSTR oldDir, LPCWSTR newDir ) {
- PWIN32_FIND_DATA pFD;
- LPTSTR pName;
- LPTSTR pFullNameSrc;
- LPTSTR pFullNameDst;
- LPTSTR driveSrc, driveDst;
- LPTSTR pathSrc, pathDst;
- HANDLE hFindFile;
- BOOL fFind;
- BOOL retVal = FALSE;
- DIR_RESPONSE response;
- DWORD level;
+ PWIN32_FIND_DATAW pFD;
+ LPWSTR pName;
+ LPWSTR pFullNameSrc;
+ LPWSTR pFullNameDst;
+ LPWSTR driveSrc, driveDst;
+ LPWSTR pathSrc, pathDst;
+ HANDLE hFindFile;
+ BOOL fFind;
+ BOOL retVal = FALSE;
+ DIR_RESPONSE response;
+ DWORD level;
if ( ( level = ( DWORD )TlsGetValue ( dwLevel ) ) == NULL ) {
fFind = FALSE;
driveSrc = driveDst = pathSrc = pathDst = NULL;
- if ( ( driveSrc = ( LPTSTR )HeapAlloc ( hHeap, 0, _MAX_DRIVE ) ) != NULL &&
- ( driveDst = ( LPTSTR )HeapAlloc ( hHeap, 0, _MAX_DRIVE ) ) != NULL &&
- ( pathSrc = ( LPTSTR )HeapAlloc ( hHeap, 0, _MAX_DIR ) ) != NULL &&
- ( pathDst = ( LPTSTR )HeapAlloc ( hHeap, 0, _MAX_DIR ) ) != NULL
+ if ( ( driveSrc = ( LPWSTR )HeapAlloc ( hHeap, 0, _MAX_DRIVE * sizeof(WCHAR) ) ) != NULL &&
+ ( driveDst = ( LPWSTR )HeapAlloc ( hHeap, 0, _MAX_DRIVE * sizeof(WCHAR) ) ) != NULL &&
+ ( pathSrc = ( LPWSTR )HeapAlloc ( hHeap, 0, _MAX_DIR * sizeof(WCHAR) ) ) != NULL &&
+ ( pathDst = ( LPWSTR )HeapAlloc ( hHeap, 0, _MAX_DIR * sizeof(WCHAR) ) ) != NULL
) {
- _tsplitpath ( oldDir, driveSrc, pathSrc, NULL, NULL );
- _tsplitpath ( newDir, driveDst, pathDst, NULL, NULL );
+ _wsplitpath ( oldDir, driveSrc, pathSrc, NULL, NULL );
+ _wsplitpath ( newDir, driveDst, pathDst, NULL, NULL );
- if ( _tcscmp ( driveSrc, driveDst ) == 0 &&
- _tcscmp ( pathSrc, pathDst ) == 0
+ if ( wcscmp ( driveSrc, driveDst ) == 0 &&
+ wcscmp ( pathSrc, pathDst ) == 0
) {
retry:
- retVal = MoveFileEx (
+ retVal = MoveFileExW (
oldDir, newDir, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED
);
fFind = TRUE;
hFindFile = INVALID_HANDLE_VALUE;
retVal = FALSE;
- retVal = CreateDirectory ( newDir, NULL );
+ retVal = CreateDirectoryW ( newDir, NULL );
if ( retVal || ( !retVal && GetLastError () == ERROR_ALREADY_EXISTS ) ) {
- if ( ( pFD = ( PWIN32_FIND_DATA )HeapAlloc (
- hHeap, 0, sizeof ( WIN32_FIND_DATA )
+ if ( ( pFD = ( PWIN32_FIND_DATAW )HeapAlloc (
+ hHeap, 0, sizeof ( WIN32_FIND_DATAW )
)
) != NULL &&
- ( pName = ( LPTSTR )HeapAlloc (
- hHeap, 0, lstrlen ( oldDir ) + WILD_CARD_LEN +
- sizeof ( TEXT( '\x00' ) )
+ ( pName = ( LPWSTR )HeapAlloc (
+ hHeap, 0, lstrlenW ( oldDir ) + WILD_CARD_LEN +
+ sizeof ( L'\x00' )
)
) != NULL
) {
- lstrcpy ( pName, oldDir );
- lstrcat ( pName, WILD_CARD );
+ lstrcpyW ( pName, oldDir );
+ lstrcatW ( pName, WILD_CARD );
retVal = TRUE;
- fFind = ( hFindFile = FindFirstFile ( pName, pFD ) ) != INVALID_HANDLE_VALUE;
+ fFind = ( hFindFile = FindFirstFileW ( pName, pFD ) ) != INVALID_HANDLE_VALUE;
while ( fFind ) {
- if ( pFD -> cFileName[ 0 ] != TEXT( '.' ) ||
- pFD -> cFileName[ 0 ] != TEXT( '.' ) &&
- pFD -> cFileName[ 1 ] != TEXT( '.' )
+ if ( pFD -> cFileName[ 0 ] != L'.' ||
+ pFD -> cFileName[ 0 ] != L'.' &&
+ pFD -> cFileName[ 1 ] != L'.'
) {
- if ( ( pFullNameSrc = ( LPTSTR )HeapAlloc (
+ if ( ( pFullNameSrc = ( LPWSTR )HeapAlloc (
hHeap, 0,
- lstrlen ( oldDir ) + lstrlen ( pFD -> cFileName ) +
- sizeof ( TEXT( '/' ) ) + sizeof ( TEXT( '\x00' ) )
+ lstrlenW ( oldDir ) + lstrlenW ( pFD -> cFileName ) +
+ sizeof ( L'/' ) + sizeof ( L'\x00' )
)
) == NULL ||
- ( pFullNameDst = ( LPTSTR )HeapAlloc (
+ ( pFullNameDst = ( LPWSTR )HeapAlloc (
hHeap, 0,
- lstrlen ( newDir ) + lstrlen ( pFD -> cFileName ) +
- sizeof ( TEXT( '/' ) ) + sizeof ( TEXT( '\x00' ) )
+ lstrlenW ( newDir ) + lstrlenW ( pFD -> cFileName ) +
+ sizeof ( L'/' ) + sizeof ( L'\x00' )
)
) == NULL
) break;
- lstrcpy ( pFullNameSrc, oldDir );
- lstrcat ( pFullNameSrc, TEXT( "/" ) );
- lstrcat ( pFullNameSrc, pFD -> cFileName );
+ lstrcpyW ( pFullNameSrc, oldDir );
+ lstrcatW ( pFullNameSrc, L"/" );
+ lstrcatW ( pFullNameSrc, pFD -> cFileName );
- lstrcpy ( pFullNameDst, newDir );
- lstrcat ( pFullNameDst, TEXT( "/" ) );
- lstrcat ( pFullNameDst, pFD -> cFileName );
+ lstrcpyW ( pFullNameDst, newDir );
+ lstrcatW ( pFullNameDst, L"/" );
+ lstrcatW ( pFullNameDst, pFD -> cFileName );
if ( pFD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) {
} else {
retry_1:
- retVal = MoveFileEx (pFullNameSrc, pFullNameDst,
- MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED);
+ retVal = MoveFileExW (pFullNameSrc, pFullNameDst,
+ MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED);
if (! retVal) {
if ( _response_dir_proc != NULL ) {
} /* end if */
- fFind = FindNextFile ( hFindFile, pFD );
+ fFind = FindNextFileW ( hFindFile, pFD );
} /* end while */
if ( retVal ) {
retry_2:
- retVal = RemoveDirectory ( oldDir );
+ retVal = RemoveDirectoryW ( oldDir );
if ( !retVal ) {
/* Returns : TRUE on success, FALSE otherwise */
/******************************************************************************/
/***/
-BOOL CopyDirectory ( LPCTSTR dirSrc, LPCTSTR dirDst ) {
+BOOL CopyDirectory ( LPCWSTR dirSrc, LPCWSTR dirDst ) {
- PWIN32_FIND_DATA pFD = NULL;
- LPTSTR pName = NULL;
- LPTSTR pFullNameSrc = NULL;
- LPTSTR pFullNameDst = NULL;
- HANDLE hFindFile = INVALID_HANDLE_VALUE;
- BOOL fFind;
- BOOL retVal = FALSE;
- DIR_RESPONSE response;
+ PWIN32_FIND_DATAW pFD = NULL;
+ LPWSTR pName = NULL;
+ LPWSTR pFullNameSrc = NULL;
+ LPWSTR pFullNameDst = NULL;
+ HANDLE hFindFile = INVALID_HANDLE_VALUE;
+ BOOL fFind;
+ BOOL retVal = FALSE;
+ DIR_RESPONSE response;
- retVal = CreateDirectory ( dirDst, NULL );
+ retVal = CreateDirectoryW ( dirDst, NULL );
if ( retVal || ( !retVal && GetLastError () == ERROR_ALREADY_EXISTS ) ) {
- if ( ( pFD = ( PWIN32_FIND_DATA )HeapAlloc (
- hHeap, 0, sizeof ( WIN32_FIND_DATA )
+ if ( ( pFD = ( PWIN32_FIND_DATAW )HeapAlloc (
+ hHeap, 0, sizeof ( WIN32_FIND_DATAW )
)
) != NULL &&
- ( pName = ( LPTSTR )HeapAlloc (
- hHeap, 0, lstrlen ( dirSrc ) + WILD_CARD_LEN +
- sizeof ( TEXT( '\x00' ) )
+ ( pName = ( LPWSTR )HeapAlloc (
+ hHeap, 0, lstrlenW ( dirSrc ) + WILD_CARD_LEN +
+ sizeof ( L'\x00' )
)
) != NULL
) {
- lstrcpy ( pName, dirSrc );
- lstrcat ( pName, WILD_CARD );
+ lstrcpyW ( pName, dirSrc );
+ lstrcatW ( pName, WILD_CARD );
retVal = TRUE;
- fFind = ( hFindFile = FindFirstFile ( pName, pFD ) ) != INVALID_HANDLE_VALUE;
+ fFind = ( hFindFile = FindFirstFileW ( pName, pFD ) ) != INVALID_HANDLE_VALUE;
while ( fFind ) {
- if ( pFD -> cFileName[ 0 ] != TEXT( '.' ) ||
- pFD -> cFileName[ 0 ] != TEXT( '.' ) &&
- pFD -> cFileName[ 1 ] != TEXT( '.' )
+ if ( pFD -> cFileName[ 0 ] != L'.' ||
+ pFD -> cFileName[ 0 ] != L'.' &&
+ pFD -> cFileName[ 1 ] != L'.'
) {
- if ( ( pFullNameSrc = ( LPTSTR )HeapAlloc (
+ if ( ( pFullNameSrc = ( LPWSTR )HeapAlloc (
hHeap, 0,
- lstrlen ( dirSrc ) + lstrlen ( pFD -> cFileName ) +
- sizeof ( TEXT( '/' ) ) + sizeof ( TEXT( '\x00' ) )
+ lstrlenW ( dirSrc ) + lstrlenW ( pFD -> cFileName ) +
+ sizeof ( L'/' ) + sizeof ( L'\x00' )
)
) == NULL ||
- ( pFullNameDst = ( LPTSTR )HeapAlloc (
+ ( pFullNameDst = ( LPWSTR )HeapAlloc (
hHeap, 0,
- lstrlen ( dirDst ) + lstrlen ( pFD -> cFileName ) +
- sizeof ( TEXT( '/' ) ) + sizeof ( TEXT( '\x00' ) )
+ lstrlenW ( dirDst ) + lstrlenW ( pFD -> cFileName ) +
+ sizeof ( L'/' ) + sizeof ( L'\x00' )
)
) == NULL
) break;
- lstrcpy ( pFullNameSrc, dirSrc );
- lstrcat ( pFullNameSrc, TEXT( "/" ) );
- lstrcat ( pFullNameSrc, pFD -> cFileName );
+ lstrcpyW ( pFullNameSrc, dirSrc );
+ lstrcatW ( pFullNameSrc, L"/" );
+ lstrcatW ( pFullNameSrc, pFD -> cFileName );
- lstrcpy ( pFullNameDst, dirDst );
- lstrcat ( pFullNameDst, TEXT( "/" ) );
- lstrcat ( pFullNameDst, pFD -> cFileName );
+ lstrcpyW ( pFullNameDst, dirDst );
+ lstrcatW ( pFullNameDst, L"/" );
+ lstrcatW ( pFullNameDst, pFD -> cFileName );
if ( pFD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) {
} else {
retry:
- retVal = CopyFile ( pFullNameSrc, pFullNameDst, FALSE );
+ retVal = CopyFileW ( pFullNameSrc, pFullNameDst, FALSE );
if ( ! retVal ) {
if ( _response_dir_proc != NULL ) {
} /* end if */
- fFind = FindNextFile ( hFindFile, pFD );
+ fFind = FindNextFileW ( hFindFile, pFD );
} /* end while */
# include <windows.h>
# endif /* _INC_WINDOWS */
-# ifndef _INC_TCHAR
-# include <tchar.h>
-# endif /* _INC_TCHAR */
-
# ifndef OSDAPI
# if !defined(HAVE_NO_DLL)
# ifdef __OSD_DLL
typedef struct _MB_DESC {
MB_ITEMTYPE itemType;
- _TINT itemId;
- _TCHAR* buttonLabel;
+ int itemId;
+ char* buttonLabel;
} MB_DESC, *LPMB_DESC;
} FILE_ACE, *PFILE_ACE;
-typedef void ( *MOVE_DIR_PROC ) ( LPCTSTR, LPCTSTR );
-typedef void ( *COPY_DIR_PROC ) ( LPCTSTR, LPCTSTR );
-typedef void ( *DELETE_DIR_PROC ) ( LPCTSTR );
+typedef void ( *MOVE_DIR_PROC ) ( LPCWSTR, LPCWSTR );
+typedef void ( *COPY_DIR_PROC ) ( LPCWSTR, LPCWSTR );
+typedef void ( *DELETE_DIR_PROC ) ( LPCWSTR );
-typedef DIR_RESPONSE ( *RESPONSE_DIR_PROC ) ( LPCTSTR );
+typedef DIR_RESPONSE ( *RESPONSE_DIR_PROC ) ( LPCWSTR );
#define GET_SID( pACE ) ( ( PSID )( ( ( PBYTE )pACE ) + \
sizeof ( ACE_HEADER ) + \
LPVOID OSDAPI GetTokenInformationEx ( HANDLE, TOKEN_INFORMATION_CLASS );
void OSDAPI FreeTokenInformation ( LPVOID );
-PSECURITY_DESCRIPTOR OSDAPI GetFileSecurityEx ( LPCTSTR, SECURITY_INFORMATION );
+PSECURITY_DESCRIPTOR OSDAPI GetFileSecurityEx ( LPCWSTR, SECURITY_INFORMATION );
void OSDAPI FreeFileSecurity ( PSECURITY_DESCRIPTOR );
-BOOL OSDAPI LookupAccountSidEx ( PSID, LPTSTR*, LPTSTR* );
-void OSDAPI FreeAccountNames ( LPTSTR, LPTSTR );
+BOOL OSDAPI LookupAccountSidEx ( PSID, LPWSTR*, LPWSTR* );
+void OSDAPI FreeAccountNames ( LPWSTR, LPWSTR );
PSID OSDAPI GetSecurityDescriptorOwnerEx ( PSECURITY_DESCRIPTOR );
PSID OSDAPI GetSecurityDescriptorGroupEx ( PSECURITY_DESCRIPTOR );
PVOID OSDAPI AllocAccessAllowedAce ( DWORD, BYTE, PSID );
void OSDAPI FreeAce ( PVOID );
-BOOL OSDAPI MoveDirectory ( LPCTSTR, LPCTSTR );
-BOOL OSDAPI CopyDirectory ( LPCTSTR, LPCTSTR );
+BOOL OSDAPI MoveDirectory ( LPCWSTR, LPCWSTR );
+BOOL OSDAPI CopyDirectory ( LPCWSTR, LPCWSTR );
void OSDAPI SetMoveDirectoryProc ( MOVE_DIR_PROC );
void OSDAPI SetCopyDirectoryProc ( COPY_DIR_PROC );
// used to forbid simultaneous execution of setting / executing handlers
static Standard_Mutex THE_SIGNAL_MUTEX;
-static LONG __fastcall _osd_raise ( DWORD, LPTSTR );
+static LONG __fastcall _osd_raise ( DWORD, LPSTR );
static BOOL WINAPI _osd_ctrl_break_handler ( DWORD );
static LONG _osd_debug ( void );
#if !defined(__CYGWIN32__) && !defined(__MINGW32__)
Standard_Mutex::Sentry aSentry (THE_SIGNAL_MUTEX); // lock the mutex to prevent simultaneous handling
- static TCHAR buffer[ 2048 ];
+ static char buffer[ 2048 ];
int flterr = 0;
buffer[0] = '\0' ;
case EXCEPTION_FLT_DENORMAL_OPERAND:
// cout << "CallHandler : EXCEPTION_FLT_DENORMAL_OPERAND:" << endl ;
- lstrcpy ( buffer, TEXT( "FLT DENORMAL OPERAND" ) );
+ lstrcpyA ( buffer, "FLT DENORMAL OPERAND" );
flterr = 1 ;
break ;
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
// cout << "CallHandler : EXCEPTION_FLT_DIVIDE_BY_ZERO:" << endl ;
- lstrcpy ( buffer, TEXT( "FLT DIVIDE BY ZERO" ) );
+ lstrcpyA ( buffer, "FLT DIVIDE BY ZERO" );
flterr = 1 ;
break ;
case EXCEPTION_FLT_INEXACT_RESULT:
// cout << "CallHandler : EXCEPTION_FLT_INEXACT_RESULT:" << endl ;
- lstrcpy ( buffer, TEXT( "FLT INEXACT RESULT" ) );
+ lstrcpyA ( buffer, "FLT INEXACT RESULT" );
flterr = 1 ;
break ;
case EXCEPTION_FLT_INVALID_OPERATION:
// cout << "CallHandler : EXCEPTION_FLT_INVALID_OPERATION:" << endl ;
- lstrcpy ( buffer, TEXT( "FLT INVALID OPERATION" ) );
+ lstrcpyA ( buffer, "FLT INVALID OPERATION" );
flterr = 1 ;
break ;
case EXCEPTION_FLT_OVERFLOW:
// cout << "CallHandler : EXCEPTION_FLT_OVERFLOW:" << endl ;
- lstrcpy ( buffer, TEXT( "FLT OVERFLOW" ) );
+ lstrcpyA ( buffer, "FLT OVERFLOW" );
flterr = 1 ;
break ;
case EXCEPTION_FLT_STACK_CHECK:
// cout << "CallHandler : EXCEPTION_FLT_STACK_CHECK:" << endl ;
- lstrcpy ( buffer, TEXT( "FLT STACK CHECK" ) );
+ lstrcpyA ( buffer, "FLT STACK CHECK" );
flterr = 1 ;
break ;
case EXCEPTION_FLT_UNDERFLOW:
// cout << "CallHandler : EXCEPTION_FLT_UNDERFLOW:" << endl ;
- lstrcpy ( buffer, TEXT( "FLT UNDERFLOW" ) );
+ lstrcpyA ( buffer, "FLT UNDERFLOW" );
flterr = 1 ;
break ;
case STATUS_FLOAT_MULTIPLE_TRAPS:
// cout << "CallHandler : EXCEPTION_FLT_UNDERFLOW:" << endl ;
- lstrcpy ( buffer, TEXT( "FLT MULTIPLE TRAPS (possible overflow in conversion of double to integer)" ) );
+ lstrcpyA ( buffer, "FLT MULTIPLE TRAPS (possible overflow in conversion of double to integer)" );
flterr = 1 ;
break ;
case STATUS_FLOAT_MULTIPLE_FAULTS:
// cout << "CallHandler : EXCEPTION_FLT_UNDERFLOW:" << endl ;
- lstrcpy ( buffer, TEXT( "FLT MULTIPLE FAULTS" ) );
+ lstrcpyA ( buffer, "FLT MULTIPLE FAULTS" );
flterr = 1 ;
break ;
case STATUS_NO_MEMORY:
// cout << "CallHandler : STATUS_NO_MEMORY:" << endl ;
OSD_Exception_STATUS_NO_MEMORY ::
- Raise ( TEXT( "MEMORY ALLOCATION ERROR ( no room in the process heap )" ) );
+ Raise ( "MEMORY ALLOCATION ERROR ( no room in the process heap )" );
case EXCEPTION_ACCESS_VIOLATION:
// cout << "CallHandler : EXCEPTION_ACCESS_VIOLATION:" << endl ;
- wsprintf ( buffer, TEXT( "%s%s%s0x%.8p%s%s%s" ), TEXT( "ACCESS VIOLATION" ),
- fMsgBox ? "\n" : " ", TEXT( "at address " ),
+ wsprintf ( buffer, "%s%s%s0x%.8p%s%s%s", "ACCESS VIOLATION",
+ fMsgBox ? "\n" : " ", "at address ",
ExceptionInformation1 ,
- TEXT( " during '" ),
- ExceptionInformation0 ? TEXT( "WRITE" ) : TEXT( "READ" ),
- TEXT( "' operation" ));
+ " during '",
+ ExceptionInformation0 ? "WRITE" : "READ",
+ "' operation");
break;
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
// cout << "CallHandler : EXCEPTION_ARRAY_BOUNDS_EXCEEDED:" << endl ;
- lstrcpy ( buffer, TEXT( "ARRAY BOUNDS EXCEEDED" ) );
+ lstrcpyA ( buffer, "ARRAY BOUNDS EXCEEDED" );
break;
case EXCEPTION_DATATYPE_MISALIGNMENT:
// cout << "CallHandler : EXCEPTION_DATATYPE_MISALIGNMENT:" << endl ;
- lstrcpy ( buffer, TEXT( "DATATYPE MISALIGNMENT" ) );
+ lstrcpyA ( buffer, "DATATYPE MISALIGNMENT" );
break;
case EXCEPTION_ILLEGAL_INSTRUCTION:
// cout << "CallHandler : EXCEPTION_ILLEGAL_INSTRUCTION:" << endl ;
- lstrcpy ( buffer, TEXT( "ILLEGAL INSTRUCTION" ) );
+ lstrcpyA ( buffer, "ILLEGAL INSTRUCTION" );
break;
case EXCEPTION_IN_PAGE_ERROR:
// cout << "CallHandler : EXCEPTION_IN_PAGE_ERROR:" << endl ;
- lstrcpy ( buffer, TEXT( "IN_PAGE ERROR" ) );
+ lstrcpyA ( buffer, "IN_PAGE ERROR" );
break;
case EXCEPTION_INT_DIVIDE_BY_ZERO:
// cout << "CallHandler : EXCEPTION_INT_DIVIDE_BY_ZERO:" << endl ;
- lstrcpy ( buffer, TEXT( "INTEGER DIVISION BY ZERO" ) );
+ lstrcpyA ( buffer, "INTEGER DIVISION BY ZERO" );
break;
case EXCEPTION_INT_OVERFLOW:
// cout << "CallHandler : EXCEPTION_INT_OVERFLOW:" << endl ;
- lstrcpy ( buffer, TEXT( "INTEGER OVERFLOW" ) );
+ lstrcpyA ( buffer, "INTEGER OVERFLOW" );
break;
case EXCEPTION_INVALID_DISPOSITION:
// cout << "CallHandler : EXCEPTION_INVALID_DISPOSITION:" << endl ;
- lstrcpy ( buffer, TEXT( "INVALID DISPOSITION" ) );
+ lstrcpyA ( buffer, "INVALID DISPOSITION" );
break;
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
// cout << "CallHandler : EXCEPTION_NONCONTINUABLE_EXCEPTION:" << endl ;
- lstrcpy ( buffer, TEXT( "NONCONTINUABLE EXCEPTION" ) );
+ lstrcpyA ( buffer, "NONCONTINUABLE EXCEPTION" );
break;
case EXCEPTION_PRIV_INSTRUCTION:
// cout << "CallHandler : EXCEPTION_PRIV_INSTRUCTION:" << endl ;
- lstrcpy ( buffer, TEXT( "PRIVELEGED INSTRUCTION ENCOUNTERED" ) );
+ lstrcpyA ( buffer, "PRIVELEGED INSTRUCTION ENCOUNTERED" );
break;
case EXCEPTION_STACK_OVERFLOW:
#if defined( _MSC_VER ) && ( _MSC_VER >= 1300 )
// try recovering from stack overflow: available in MS VC++ 7.0
if (!_resetstkoflw())
- lstrcpy ( buffer, TEXT( "Unrecoverable STACK OVERFLOW" ) );
+ lstrcpyA ( buffer, "Unrecoverable STACK OVERFLOW" );
else
#endif
- lstrcpy ( buffer, TEXT( "STACK OVERFLOW" ) );
+ lstrcpyA ( buffer, "STACK OVERFLOW" );
break;
default:
- wsprintf( buffer, TEXT("unknown exception code 0x%x, params 0x%p 0x%p"),
+ wsprintf( buffer, "unknown exception code 0x%x, params 0x%p 0x%p",
dwExceptionCode, ExceptionInformation1, ExceptionInformation0 );
} // end switch
// provide message to the user with possibility to stop
- int idx = lstrlen ( buffer );
+ int idx = lstrlenA ( buffer );
if ( idx && fMsgBox && dwExceptionCode != EXCEPTION_NONCONTINUABLE_EXCEPTION ) {
// reset FP operations before message box, otherwise it may fail to show up
_fpreset();
//==== _osd_raise
//============================================================================
-static LONG __fastcall _osd_raise ( DWORD dwCode, LPTSTR msg )
+static LONG __fastcall _osd_raise ( DWORD dwCode, LPSTR msg )
{
- if (msg[0] == TEXT('\x03')) ++msg;
+ if (msg[0] == '\x03') ++msg;
switch (dwCode)
{
// commercial license or contractual agreement.
#include <PCDM_ReadWriter.ixx>
-#include <UTL.hxx>
#include <PCDM_ReadWriter_1.hxx>
#include <Storage_Schema.hxx>
#include <Standard_ErrorHandler.hxx>
PCDM_BaseDriverPointer theFileDriver;
- TCollection_AsciiString theFileName (UTL::CString(aFileName));
+ // conversion to UTF-8 is done inside
+ TCollection_AsciiString theFileName (aFileName);
if (PCDM::FileDriverType (theFileName, theFileDriver) == PCDM_TOFD_Unknown)
return ::TryXmlDriverType (theFileName);
for (Standard_Integer i =1; !found && i<= refUserInfo.Length() ; i++) {
if(refUserInfo(i).Search(FILE_FORMAT) != -1) {
found=Standard_True;
- theFormat=UTL::ExtendedString(refUserInfo(i).Token(" ",2));
+ theFormat=TCollection_ExtendedString(refUserInfo(i).Token(" ",2).ToCString(),
+ Standard_True);
}
}
if(!found) theFormat=s->ReadTypeSection(*theFileDriver)->Types()->Value(1);
}
static TCollection_AsciiString GetDirFromFile(const TCollection_ExtendedString& aFileName) {
- TCollection_AsciiString theCFile=UTL::CString(aFileName);
+ TCollection_AsciiString theCFile(aFileName);
TCollection_AsciiString theDirectory;
Standard_Integer i=theCFile.SearchFromEnd("/");
#ifdef WNT
ligne += TCollection_ExtendedString(it.Document()->Modifications());
ligne += " ";
- TCollection_AsciiString thePath=UTL::CString(it.Document()->MetaData()->FileName());
+ TCollection_AsciiString thePath(it.Document()->MetaData()->FileName());
TCollection_AsciiString theRelativePath;
if(!theAbsoluteDirectory.IsEmpty()) {
theRelativePath=OSD_Path::RelativePath(theAbsoluteDirectory,thePath);
if(!theRelativePath.IsEmpty()) thePath=theRelativePath;
}
- ligne += UTL::ExtendedString(thePath);
+ ligne += TCollection_ExtendedString(thePath);
UTL::AddToUserInfo(aData,ligne);
}
aData->AddToUserInfo(END_REF);
static Standard_Integer i ;
PCDM_BaseDriverPointer theFileDriver;
- if(PCDM::FileDriverType(TCollection_AsciiString(UTL::CString(aFileName)), theFileDriver) == PCDM_TOFD_Unknown) return theReferencesCounter;
+ TCollection_AsciiString aFileNameU(aFileName);
+ if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown)
+ return theReferencesCounter;
static Standard_Boolean theFileIsOpen ;
theFileIsOpen=Standard_False;
theFileName=theRest.Split(pos2);
theDocumentVersion=UTL::IntegerValue(theRest);
- TCollection_AsciiString thePath=UTL::CString(theFileName);
+ TCollection_AsciiString thePath(theFileName);
TCollection_AsciiString theAbsolutePath;
if(!theAbsoluteDirectory.IsEmpty()) {
theAbsolutePath=AbsolutePath(theAbsoluteDirectory,thePath);
aMsg = aMsg.Cat("reference found; ReferenceIdentifier: ").Cat(theReferenceIdentifier).Cat("; File:").Cat(thePath).Cat(", version:").Cat(theDocumentVersion).Cat("\0");
theMsgDriver->Write(aMsg.ToExtString());
}
- theReferences.Append(PCDM_Reference (theReferenceIdentifier,UTL::ExtendedString(thePath),theDocumentVersion));
+ TCollection_ExtendedString aPathW(thePath);
+ theReferences.Append(PCDM_Reference (theReferenceIdentifier,aPathW,theDocumentVersion));
}
}
static Standard_Integer i ;
PCDM_BaseDriverPointer theFileDriver;
- if(PCDM::FileDriverType(TCollection_AsciiString(UTL::CString(aFileName)), theFileDriver) == PCDM_TOFD_Unknown) return;
+ TCollection_AsciiString aFileNameU(aFileName);
+ if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown)
+ return;
PCDM_ReadWriter::Open(*theFileDriver,aFileName,Storage_VSRead);
Handle(Storage_Schema) s = new Storage_Schema;
}
if(debut != 0) {
for (i=debut+1 ; i<fin; i++) {
- theUserInfo.Append(UTL::ExtendedString(refUserInfo(i)));
+ TCollection_ExtendedString aInfoW(refUserInfo(i));
+ theUserInfo.Append(aInfoW);
}
}
theFileDriver->Close();
theVersion=-1;
PCDM_BaseDriverPointer theFileDriver;
- if(PCDM::FileDriverType(TCollection_AsciiString(UTL::CString(aFileName)), theFileDriver) == PCDM_TOFD_Unknown) return theVersion;
+ TCollection_AsciiString aFileNameU(aFileName);
+ if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown)
+ return theVersion;
static Standard_Boolean theFileIsOpen ;
theFileIsOpen =Standard_False;
#include <PCDM_ReadWriter.hxx>
#include <Resource_Manager.hxx>
#include <Standard_ErrorHandler.hxx>
-#include <UTL.hxx>
#include <PCDM.hxx>
#include <Storage_HSeqOfRoot.hxx>
#include <locale.h>
void PCDM_RetrievalDriver::RaiseIfUnknownTypes(const Handle(Storage_Schema)& aSchema, const TCollection_ExtendedString& aFileName) {
PCDM_BaseDriverPointer theFileDriver;
- if(PCDM::FileDriverType(TCollection_AsciiString(UTL::CString(aFileName)), theFileDriver) == PCDM_TOFD_Unknown) return;
+ TCollection_AsciiString aFileNameU(aFileName);
+ if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown)
+ return;
PCDM_ReadWriter::Open(*theFileDriver,aFileName,Storage_VSRead);
}
PCDM_BaseDriverPointer theFileDriver;
- if(PCDM::FileDriverType(TCollection_AsciiString(UTL::CString(theFileName)), theFileDriver) == PCDM_TOFD_Unknown) {
+ TCollection_AsciiString aFileNameU(theFileName);
+ if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown) {
myReaderStatus = PCDM_RS_UnknownFileDriver;
return;
}
checkread->Clear();
recfile_modeprint ( (modepr > 0 ? modepr-1 : 0) );
+#ifdef _WIN32
+ TCollection_ExtendedString aFileNameW(ficnom, Standard_True);
+ FILE* newin = stepread_setinput((char*)aFileNameW.ToExtString());
+#else
FILE* newin = stepread_setinput(ficnom);
+#endif
if (!newin) return -1;
#ifdef CHRONOMESURE
Standard_Integer n ;
*/
/**
*/
-# include <stdlib.h>
-# include <stdio.h>
-# include <string.h>
-# include "recfile.ph"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "recfile.ph"
/* StepFile_Error.c
{
FILE* newin ;
if (strlen(nomfic) == 0) return stepin ;
+#ifdef _WIN32
+ // file name is treated as UTF-8 string
+ // nomfic is prepared UTF-8 string
+ newin = _wfopen((const wchar_t*)nomfic, L"r") ;
+#else
newin = fopen(nomfic,"r") ;
+#endif
if (newin == NULL) {
return NULL ;
} else {
---Purpose: Creation by converting an extended string to an ascii string.
-- If replaceNonAscii is non-null charecter, it will be used
-- in place of any non-ascii character found in the source string.
- -- Otherwise, raises OutOfRange exception if at least one character
- -- in the source string is not in the "Ascii range".
+ -- Otherwise, creates UTF-8 unicode string.
returns AsciiString from TCollection
raises OutOfRange from Standard;
mystring[mylength] = '\0';
}
else {
- Standard_SStream amsg;
- amsg << "It's not an ascii string : " ;
- astring.Print(amsg);
- Standard_OutOfRange::Raise(amsg);
+ // create UTF-8 string
+ mylength = astring.LengthOfCString();
+ mystring = Allocate(mylength+1);
+ astring.ToUTF8CString(mystring);
}
}
Create( astring : CString; isMultiByte : Boolean = Standard_False)
returns ExtendedString from TCollection
raises NullObject;
- ---Purpose: Creation by converting a CString to an extended string.
+ ---Purpose: Creation by converting a CString to an extended
+ -- string. If <isMultiByte> is true then the string is
+ -- treated as having UTF-8 coding. If it is not a UTF-8
+ -- then <isMultiByte> is ignored and each character is
+ -- copied to ExtCharacter.
+
Create( astring : ExtString)
returns ExtendedString from TCollection
Create( astring : AsciiString from TCollection)
returns ExtendedString from TCollection;
- ---Purpose: Creation by converting a normal Ascii string to an extended string.
+ ---Purpose: Creation by converting an Ascii string to an extended
+ -- string. The string is treated as having UTF-8 coding.
+ -- If it is not a UTF-8 then each character is copied to ExtCharacter.
AssignCat (me : out ; other : ExtendedString from TCollection)
is static;
inline Standard_ExtCharacter ConvertToUnicode2B (unsigned char *p)
{
// *p, *(p+1)
+ // little endian
union {
struct {
- unsigned char h;
unsigned char l;
+ unsigned char h;
} hl;
Standard_ExtCharacter chr;
} EL;
inline Standard_ExtCharacter ConvertToUnicode3B (unsigned char *p)
{
// *p, *(p+1), *(p+2) =>0 , 1, 2
+ // little endian
union {
struct {
- unsigned char h;
unsigned char l;
+ unsigned char h;
} hl;
Standard_ExtCharacter chr;
} EL;
mystring = Allocate( (mylength+1)*2 );
if(!ConvertToUnicode (astring))
{
-#ifdef DEB
- cout <<"UTF8 decoding failure..." <<endl;
-#endif
+ mylength = (int)strlen( astring );
+ mystring = Reallocate(mystring, (mylength+1)*2);
+ for (int i = 0 ; i < mylength ; i++)
+ mystring[i] = ToExtCharacter(astring[i]);
+ mystring[mylength] = '\0';
}
}
}
TCollection_ExtendedString::TCollection_ExtendedString
(const TCollection_AsciiString& astring)
{
- mylength = astring.Length();
+ mylength = nbSymbols(astring.ToCString());
mystring = Allocate((mylength+1)*2);
- Standard_CString aCString = astring.ToCString() ;
- for (Standard_Integer i = 0; i <= mylength ; i++)
- mystring[i] = ToExtCharacter( aCString[i] );
+ if(!ConvertToUnicode (astring.ToCString()))
+ {
+ mylength = astring.Length();
+ mystring = Reallocate(mystring, (mylength+1)*2);
+ Standard_CString aCString = astring.ToCString();
+ for (Standard_Integer i = 0; i <= mylength ; i++)
+ mystring[i] = ToExtCharacter( aCString[i] );
+ }
}
// ----------------------------------------------------------------------------
#include <OSD_File.hxx>
#include <OSD_Protection.hxx>
#include <OSD_SingleProtection.hxx>
-#define MaxChar 10000
-
-
-static Standard_Character longtc[MaxChar];
-static Standard_PCharacter aLongCString = longtc;
-static TCollection_ExtendedString outExtendedString;
-
-static TCollection_AsciiString ASCII(const TCollection_ExtendedString& anXString) {
- Resource_Unicode::ConvertUnicodeToFormat(anXString,aLongCString,MaxChar);
- return TCollection_AsciiString(aLongCString);
-}
-
-
-static TCollection_ExtendedString UNICODE(const TCollection_AsciiString& aCString) {
- Resource_Unicode::ConvertFormatToUnicode(aCString.ToCString(),outExtendedString);
- return outExtendedString;
-}
TCollection_ExtendedString UTL::xgetenv(const Standard_CString aCString) {
TCollection_ExtendedString x;
OSD_Environment theEnv(aCString);
TCollection_AsciiString theValue=theEnv.Value();
- if( ! theValue.IsEmpty()) x=UNICODE(theValue);
+ if( ! theValue.IsEmpty())
+ x = TCollection_ExtendedString(theValue);
return x;
}
-TCollection_ExtendedString UTL::Extension(const TCollection_ExtendedString& aFileName) {
- OSD_Path p = OSD_Path(ASCII(aFileName));
-
- TCollection_AsciiString theExtension=p.Extension();
-
- TCollection_AsciiString theGoodExtension=theExtension;;
- if(TCollection_AsciiString(theExtension.Value(1))==".")
- theGoodExtension=theExtension.Split(1);
-
- return UNICODE(theGoodExtension);
+TCollection_ExtendedString UTL::Extension(const TCollection_ExtendedString& aFileName)
+{
+ TCollection_AsciiString aFileNameU(aFileName);
+ OSD_Path p = OSD_Path(aFileNameU);
+ TCollection_AsciiString theExtension = p.Extension();
+ if (theExtension.Value(1) == '.')
+ theExtension.Remove(1, 1);
+ return TCollection_ExtendedString(theExtension);
}
-Storage_Error UTL::OpenFile(Storage_BaseDriver& aDriver, const TCollection_ExtendedString& aFileName, const Storage_OpenMode aMode) {
- return aDriver.Open(ASCII(aFileName),aMode);
+
+Storage_Error UTL::OpenFile(Storage_BaseDriver& aDriver,
+ const TCollection_ExtendedString& aFileName,
+ const Storage_OpenMode aMode)
+{
+ return aDriver.Open(TCollection_AsciiString(aFileName),aMode);
}
-void UTL::AddToUserInfo(const Handle(Storage_Data)& aData, const TCollection_ExtendedString& anInfo) {
- aData->AddToUserInfo(ASCII(anInfo));
+void UTL::AddToUserInfo(const Handle(Storage_Data)& aData,
+ const TCollection_ExtendedString& anInfo)
+{
+ aData->AddToUserInfo(TCollection_AsciiString(anInfo));
}
-OSD_Path UTL::Path(const TCollection_ExtendedString& aFileName) {
-// cout << "Path : " << aFileName << endl;
-// TCollection_AsciiString theAciiString=ASCII(aFileName);
-// OSD_Path p = OSD_Path(theAciiString);
- OSD_Path p = OSD_Path(ASCII(aFileName));
+OSD_Path UTL::Path(const TCollection_ExtendedString& aFileName)
+{
+ OSD_Path p = OSD_Path(TCollection_AsciiString(aFileName));
return p;
}
-TCollection_ExtendedString UTL::Disk(const OSD_Path& aPath) {
- return UNICODE(aPath.Disk());
+
+TCollection_ExtendedString UTL::Disk(const OSD_Path& aPath)
+{
+ return TCollection_ExtendedString(aPath.Disk());
}
-TCollection_ExtendedString UTL::Trek(const OSD_Path& aPath) {
- return UNICODE(aPath.Trek());
+
+TCollection_ExtendedString UTL::Trek(const OSD_Path& aPath)
+{
+ return TCollection_ExtendedString(aPath.Trek());
}
-TCollection_ExtendedString UTL::Name(const OSD_Path& aPath) {
- return UNICODE(aPath.Name());
+
+TCollection_ExtendedString UTL::Name(const OSD_Path& aPath)
+{
+ return TCollection_ExtendedString(aPath.Name());
}
-TCollection_ExtendedString UTL::Extension(const OSD_Path& aPath) {
- return UNICODE(aPath.Extension());
+
+TCollection_ExtendedString UTL::Extension(const OSD_Path& aPath)
+{
+ return TCollection_ExtendedString(aPath.Extension());
}
-OSD_FileIterator UTL::FileIterator(const OSD_Path& aPath, const TCollection_ExtendedString& aMask) {
- OSD_FileIterator it = OSD_FileIterator(aPath,ASCII(aMask));
+
+OSD_FileIterator UTL::FileIterator(const OSD_Path& aPath, const TCollection_ExtendedString& aMask)
+{
+ OSD_FileIterator it = OSD_FileIterator(aPath,TCollection_AsciiString(aMask));
return it;
}
-TCollection_ExtendedString UTL::LocalHost() {
+
+TCollection_ExtendedString UTL::LocalHost()
+{
OSD_Host h;
- return UNICODE(h.HostName());
+ return TCollection_ExtendedString(h.HostName());
}
-TCollection_ExtendedString UTL::ExtendedString(const TCollection_AsciiString& anAsciiString) {
- return UNICODE(anAsciiString);
+
+TCollection_ExtendedString UTL::ExtendedString(const TCollection_AsciiString& anAsciiString)
+{
+ return TCollection_ExtendedString(anAsciiString);
}
-Standard_GUID UTL::GUID(const TCollection_ExtendedString& anXString) {
+
+Standard_GUID UTL::GUID(const TCollection_ExtendedString& anXString)
+{
return Standard_GUID(TCollection_AsciiString(anXString,'?').ToCString());
}
-Standard_Boolean UTL::Find(const Handle(Resource_Manager)& aResourceManager, const TCollection_ExtendedString& aResourceName) {
- return aResourceManager->Find(ASCII(aResourceName).ToCString());
-}
-TCollection_ExtendedString UTL::Value(const Handle(Resource_Manager)& aResourceManager, const TCollection_ExtendedString& aResourceName) {
- return UNICODE(aResourceManager->Value(ASCII(aResourceName).ToCString()));
+
+Standard_Boolean UTL::Find(const Handle(Resource_Manager)& aResourceManager,
+ const TCollection_ExtendedString& aResourceName)
+{
+ return aResourceManager->Find(TCollection_AsciiString(aResourceName).ToCString());
+}
+
+TCollection_ExtendedString UTL::Value(const Handle(Resource_Manager)& aResourceManager,
+ const TCollection_ExtendedString& aResourceName)
+{
+ TCollection_AsciiString aResourceNameU(aResourceName);
+ return TCollection_ExtendedString(aResourceManager->Value(aResourceNameU.ToCString()),
+ Standard_True);
}
-Standard_Integer UTL::IntegerValue(const TCollection_ExtendedString& anExtendedString) {
- TCollection_AsciiString a=ASCII(anExtendedString);
+Standard_Integer UTL::IntegerValue(const TCollection_ExtendedString& anExtendedString)
+{
+ TCollection_AsciiString a(anExtendedString);
return a.IntegerValue();
}
-Standard_CString UTL::CString(const TCollection_ExtendedString& anExtendedString) {
+
+Standard_CString UTL::CString(const TCollection_ExtendedString& anExtendedString)
+{
static TCollection_AsciiString theValue;
- theValue=ASCII(anExtendedString);
+ theValue = TCollection_AsciiString(anExtendedString);
return theValue.ToCString();
}
-Standard_Boolean UTL::IsReadOnly(const TCollection_ExtendedString& aFileName) {
+Standard_Boolean UTL::IsReadOnly(const TCollection_ExtendedString& aFileName)
+{
switch (OSD_File(UTL::Path(aFileName)).Protection().User()) {
case OSD_W:
case OSD_RW:
const Standard_Boolean isMultibyte = (argc < 16)? Standard_False : (Draw::Atoi(argv[15]) != 0);
// Read text string
- TCollection_ExtendedString name;
- if (isMultibyte)
- {
- const char *str = argv[1];
- while ( *str || *(str+1)=='\x0A' || *(str+1)=='\x0B' || *(str+1)=='\x0C' || *(str+1)=='\x0D'
- || *(str+1)=='\x07' || *(str+1)=='\x08' || *(str+1)=='\x09' )
- {
- unsigned short c1 = *str++;
- unsigned short c2 = *str++;
- if (!c2) break;
- name += (Standard_ExtCharacter)((c1 << 8) | c2);
- }
- }
- else
- {
- name += argv[1];
- }
+ TCollection_ExtendedString name(argv[1],isMultibyte);
if (name.Length())
{
set BugNumber OCC22796
vfont add [locate_data_file bug22149_mona.ttf] Mona
-vdrawtext "\x30\x42\x00\x09\x30\x79\x00\x0A\x30\x6F" 0 0 0 255 255 255 0 0 0 1 50 0 Mona 1
+set s [encoding convertfrom unicode "\x42\x30\x09\x00\x79\x30\x0A\x00\x6F\x30\x42\x26"]
+#vdrawtext "\x30\x42\x00\x09\x30\x79\x00\x0A\x30\x6F" 0 0 0 255 255 255 0 0 0 1 50 0 Mona 1
+vdrawtext $s 0 0 0 255 255 255 0 0 0 1 50 0 Mona 1
set only_screen 1