Ignore:
Timestamp:
Nov 20, 2007, 12:04:07 AM (16 years ago)
Author:
イグトランス (egtra)
Message:

例外クラスの実装。ExceptionTestでSystem.Exceptionを使用するようにした。
StringBuilderでコメント化されていた例外を投げる処理を有効にした(除OutOfMemory)。
Str$の実装にSPrintfなどを使用するようにした。
毎回Object.ReferenceEquals(xxx, Nothing)と打つのが面倒なので、IsNothingを導入。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/system/string.sbp

    r383 r385  
    99
    1010Function StrPtr(s As String) As *StrChar
    11     StrPtr = s.StrPtr
     11    If ActiveBasic.IsNothing(s) Then
     12        StrPtr = s.StrPtr
     13    End If
    1214End Function
    1315'StringBuilder版はClasses/System/Text/StringBuilder.abに定義されている
     
    3941Function GetStr(psz As PSTR, len As SIZE_T, ByRef wcs As PWSTR) As SIZE_T
    4042    If psz = 0 Then Return 0
    41     Dim lenWCS = MultiByteToWideChar(CP_THREAD_ACP, 0, psz, len As Long, 0, 0)
     43    Dim lenWCS = MultiByteToWideChar(CP_THREAD_ACP, 0, psz, (len As DWord) As Long, 0, 0)
    4244    wcs = _System_AllocForConvertedString(SizeOf (WCHAR) * (lenWCS + 1)) As PWSTR
    43     GetStr = MultiByteToWideChar(CP_THREAD_ACP, 0, psz, len As Long, wcs, lenWCS)
     45    GetStr = MultiByteToWideChar(CP_THREAD_ACP, 0, psz, (len As DWord) As Long, wcs, lenWCS)
    4446    wcs[GetStr] = 0
    4547End Function
     
    7375Function GetStr(psz As PWSTR, len As SIZE_T, ByRef mbs As PSTR) As SIZE_T
    7476    If psz = 0 Then Return 0
    75     Dim lenMBS = WideCharToMultiByte(CP_THREAD_ACP, 0, psz, len As Long, 0, 0, 0, 0)
     77    Dim lenMBS = WideCharToMultiByte(CP_THREAD_ACP, 0, psz, (len As DWord) As Long, 0, 0, 0, 0)
    7678    mbs = _System_AllocForConvertedString(SizeOf (SByte) * (lenMBS + 1)) As PSTR
    77     GetStr = WideCharToMultiByte(CP_THREAD_ACP, 0, psz, len As Long, mbs, lenMBS, 0, 0) As SIZE_T
     79    GetStr = WideCharToMultiByte(CP_THREAD_ACP, 0, psz, (len As DWord) As Long, mbs, lenMBS, 0, 0) As SIZE_T
    7880    mbs[GetStr] = 0
    7981End Function
Note: See TracChangeset for help on using the changeset viewer.