rawbytestring
* DoDirSeparators() and GetDirs() marked as "rtlproc" so they can accept
non-rawbytestring arguments as their var-parameters
git-svn-id: branches/cpstrrtl@25306 -
o these routines are now generic wrappers in filutil.inc, and call
the platform-dependent internalfindfirst/next/close routines
o on unix, the fnmatch routine got proper support for UTF-8 matching
(e.g., it won't match a partial UTF-8 code point to a "?" wildcard)
o for NativeNT, a similar (untested) UTF-16 version has been added
+ test for the above
* rawbytestring/unicodestring versions of fileage
git-svn-id: branches/cpstrrtl@25302 -
+ codepage support for textrec/filerec and the above routines
* textrec/filerec now store the filename by default using widechar. It is
possible to switch back to ansichars using the FPC_ANSI_TEXTFILEREC define.
In that case, from now on the filename will always be stored in
DefaultFileSystemEncoding
* fixed potential buffer overflows and non-null-terminated file names in
textrec/filerec
+ dodirseparators(pwidechar), changed the dodirseparators(pchar/pwidechar)
parameters into var-parameters and gave those routines an extra parameter
that indicates whether the p(wide)char can be changed in place if
necessary or whether a copy must be made first (avoids us having to make
all strings always unique everywhere, because they might be changed on
some platforms via a pchar)
* do_open/do_erase/do_rename got extra boolean parameters indicating whether
the passed pchars point to data that can be freely changed (to pass on to
dodirseparators() if applicable)
* objects.pp: force assign(pchar) to be called, because
assign(array[0..255]) cannot choose between pchar and rawbytestring
versions (and removing the pchar version means that assign(pchar) will
be mapped to assign(shortstring) in {$h-})
* fixed up some routines in other units that depend on the format of
the textrec/filerec.name field
git-svn-id: branches/cpstrrtl@25137 -
so declarations can also depend on it and similar defines (not yet the
case)
+ added SYSUTILS_HAS_ANSISTR_ENVVAR_IMPL/SYSUTILS_HAS_UNICODESTR_ENVVAR_IMPL
to indicate whether the platform-dependent part of the unit provides
an ansistring/unicodestring interface to get environment variables
+ Windows version of getenvironmentvariable(unicodestring)
+ generic ansistring/unicodestring versions of GetEnvironmentVariable()
in case the platform doesn't provide them
* result of GetEnvironmentString() is ansistring/unicodestring depending
on the state of the FPC_RTL_UNICODE define
git-svn-id: branches/cpstrrtl@25116 -
CreateDir and RemoveDir, and implemented a generic one (based on the OS/2
version) in the shared sysutils code (so that the filesystem code page
support for the system unit routines can be reused)
* include both ansistring and unicodestring versions of the above routines,
and of ForceDirectories. Exception: GetCurrentDir, which cannot be
overloaded based on function result and whose return type currently
dependends on the FPC_UNICODE_RTL define
git-svn-id: branches/cpstrrtl@25113 -
* changed all mappings from CP_ACP to DefaultSystemCodePage to calls to the
new TranslatePlaceholderCP() routine (which also handles CP_OEMCP)
* removed unnecessary CP_ACP adaptations in fpc_AnsiStr_Concat_multi()
for JVM target (now handled in the ansistring to unicodestring conversion
routine)
git-svn-id: branches/cpstrrtl@25091 -
be an array of widechar now)
* fixed restoring of original path in do_getdir() (pass contents of
unicodestring to SetCurrentDirectoryW(), not its address)
git-svn-id: branches/cpstrrtl@25088 -
* renamed platform-specific pchar versions of those rouines to do_*() and
changed them to either rawbytestring or unicodestring depending on the
FPCRTL_FILESYSTEM_SINGLE_BYTE_API/FPCRTL_FILESYSTEM_TWO_BYTE_API setting
* implemented generic shortstring versions of those routines on top of either
rawbytestring or unicodestring depending on the API-kind (in case of the
embedded target, if ansistring are not supported they will map directly
to shortstring routines instead)
* all platform-specific *dir() routines with rawbytestring parameters now
receive their parameters in DefaultFileSystemCodePage
- removed no longer required ansistring variants from the objpas unit
- removed no longer required FPC_SYS_MKDIR etc aliases
* factored out empty string and inoutres<>0 checks from platform-specific
*dir() routines to generic ones
o platform-specific notes:
o amiga/morphos: check new pathconv(rawbytestring) function
o macos TODO: convert PathArgToFSSpec (and the routines it calls) to
rawbytestring
o nativent: added SysUnicodeStringToNtStr() function
o wii: convert dirio callbacks to use rawbytestring to avoid conversion
+ test for unicode mk/ch/rm/getdir()
git-svn-id: branches/cpstrrtl@25048 -
"widechar in set" compiles, but results in a runtime conversion of
the widechar into an ansistring and then getting the first character
of that ansistring, which is horribly slow -- and Delphi-incompatible,
but introduced a long time ago because of bug #7758)
* replaced all "in" operations in sysutils fina.inc with CharInSet for
the same reason
* replaced all "string" declarations in finah.inc/fina.inc with "PathStr"
and "pchar" with "PathPChar", and include them twice in sysutilh.inc/
sysutils.inc, once with PathStr=UnicodeString/PathPChar=PWideChar and
once with PathStr=AnsiString/PathPChar=PAnsiChar (not rawbytestring
because there are several routines with var-parameters and then the
string type has to match exactly; the "rtlproc" modifier could circumvent
this, but should be used sparingly, and additionally the routine's
internals would then first also have to be reviewed to ensure that at
no point they start mixing in strings with the defaultsystemcodepage
(e.g. directory separators) without first adjusting their codepage)
* call GetShortPathNameA or GetShortPathNameW in ExtractShortPathName on
Windows depending on whether we are parsing the RawByteString/UnicodeString
version of fina.inc
+ ExpandUNCFileName(unicode) version for Windows, let its
ExpandUNCFileName(ansistring) call the unicode version (avoid data loss
due to ansi conversion) and convert the result to
DefaultRTLFileSystemCodePage (to have no more data loss than what's
specified by the user)
git-svn-id: branches/cpstrrtl@24999 -
getdir(rawbytestring):rawbytestring so it can accept strings in any
encoding and cleanly return results in DefaultRTLFileSystemCodePage
+ getdir(unicodestring):unicodestring
* renamed the getdir implementation of all platforms except for embedded-
without-ansistring-support to do_getdir(), and depending on the
FPCRTL_FILESYSTEM_SINGLE_BYTE_API/FPCRTL_FILESYSTEM_TWO_BYTE_API define
changed its shortstring parameter to ansistring or unicodestring. The
do_getdir(rawbytestring) routine should just set the code page of the
return value to DefaultFileSystemCodePage without conversion (not
DefaultRTLFileSystemCodePage with conversion, that conversion is performed
in getdir if necessary; this avoids double conversions in case
getdir(unicodestring) is called)
+ generic getdir(shortstring) for platforms supporting either ansistrings or widestrings
o platform maintainers:
o OS/2: adjust code to supports paths > 255 characters if those are supported
o Wii: adjust used callback to use rawbytestring to support paths > 255 characters and
avoid shortstring->rawbytestring conversion overhead
o Windows: GetCurrentDirectoryW is now always used (to prevent data loss)
git-svn-id: branches/cpstrrtl@24993 -
o resolved conflict in updated morphos sysutils unit
o moved code that had been added to the now deleted sysunix.inc to the
unix-specific block of the fpwidestring unit's init code
git-svn-id: branches/cpstrrtl@24913 -
* Fixed TRegistry.OpenKeyReadOnly and TRegistry.KeyExists methods so they preserve KEY_WOW64_xxKEY bits passed into TRegistry constructor. Based on patch from Maciej Kaczkowski, resolves#23695, #23188
git-svn-id: trunk@24824 -
- tbitmapheader is not a redef, from redef -> struct
- some -A types had char types that were $ifdef unicode dependent. Fixed.
- some -A types had char types in numeric form (bchar), where Delphi
uses Pascal char types (ansichar)
git-svn-id: trunk@24449 -
Also adjusted all Windows (Win32/64/CE) units to define a "UNICODE" if "FPC_OS_UNICODE" is defined (except the Jedi units).
Also the common RTL units that checked for UNICODE now check for FPC_OS_UNICODE.
git-svn-id: trunk@24420 -
Note: The only RTL where this could lead to problems is for BeOS with the old threading implementation as this does not use "BeginThread" at all (the newer implementation does).
rtl/objpas/classes/classes.inc, TThread.Destroy:
* call "CloseThread" if the thread handle is valid (mimics the logic of the Windows RTL)
rtl/win/tthread.inc, TThread.SysDestroy:
* remove the call to "CloseHandle"; this is done by "CloseThread" afterwards
git-svn-id: trunk@24313 -