Changeset 652 for trunk/ab5.0


Ignore:
Timestamp:
Nov 3, 2008, 10:23:32 PM (16 years ago)
Author:
イグトランス (egtra)
Message:

文字列変換関数系統の1つ、GetStrNTを削除(非公開化)。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/system/string.sbp

    r497 r652  
    2828    Function GetWCStr(mbsSrc As PSTR, len As SIZE_T, ByRef wcsDst As PWSTR) As SIZE_T
    2929        Dim lenWCS = MultiByteToWideChar(CP_THREAD_ACP, 0, mbsSrc, (len As DWord) As Long, 0, 0)
    30         wcsDst = _System_AllocForConvertedString(SizeOf (WCHAR) * (lenWCS + 1)) As PWSTR
     30        wcsDst = _System_AllocForConvertedString(SizeOf (WCHAR) * lenWCS) As PWSTR
    3131        GetWCStr = MultiByteToWideChar(CP_THREAD_ACP, 0, mbsSrc, (len As DWord) As Long, wcsDst, lenWCS)
    32         wcsDst[GetWCStr] = 0
    3332    End Function
    3433
     
    4039    Function GetMBStr(wcsSrc As PWSTR, len As SIZE_T, ByRef mbsDst As PSTR) As SIZE_T
    4140        Dim lenMBS = WideCharToMultiByte(CP_THREAD_ACP, 0, wcsSrc, (len As DWord) As Long, 0, 0, 0, 0)
    42         mbsDst = _System_AllocForConvertedString(SizeOf (SByte) * (lenMBS + 1)) As PSTR
     41        mbsDst = _System_AllocForConvertedString(SizeOf (CHAR) * lenMBS) As PSTR
    4342        GetMBStr = WideCharToMultiByte(CP_THREAD_ACP, 0, wcsSrc, (wcsSrc As DWord) As Long, mbsDst, lenMBS, 0, 0) As SIZE_T
    44         mbsDst[GetMBStr] = 0
    4543    End Function
    4644
     
    4947        GetMBStr = len
    5048    End Function
     49
     50    ' ToTCStrの補助
     51    Sub GetStrNT(mbszSrc As PSTR, ByRef mbszDst As PSTR)
     52        mbszDst = mbszSrc
     53    End Sub
     54
     55    Sub GetStrNT(mbszSrc As PSTR, ByRef wcszDst As PWSTR)
     56        GetStr(mbszSrc, wcszDst)
     57    End Sub
     58
     59    Sub GetStrNT(wcszSrc As PWSTR, ByRef mbszDst As PSTR)
     60        GetStr(wcszSrc, mbszDst)
     61    End Sub
     62
     63    Sub GetStrNT(wcszSrc As PWSTR, ByRef wcszDst As PWSTR)
     64        wcszDst = wcszSrc
     65    End Sub
     66
    5167End Namespace
    5268
     
    5571入力引数: wcsz, wcs + len, mbsz, mbs + len, str
    5672出力関数: wcs(z)出力GetStr, mbs(z)出力GetStr,
    57           wcs(z)出力GetStrNT, mbs(z)出力GetStrNT,
    5873          GetWCStr, GetMBStr, GetTCStr,
    5974          ToWCStr, ToMBStr, ToTCStr,
    60 で、5 * 10 = 50通り。
     75で、5 * 8 = 40通り。
    6176*/
    6277
     
    6681        Return 0
    6782    Else
    68         Return Detail.GetWCStr(mbszSrc, lstrlenA(mbszSrc) As SIZE_T, wcsDst)
     83        Return Detail.GetWCStr(mbszSrc, (lstrlenA(mbszSrc) + 1) As SIZE_T, wcsDst)
    6984    End If
    7085End Function
     
    85100    Else
    86101        wcsDst = wcszSrc
    87         Return lstrlenW(wcszSrc) As SIZE_T
     102        Return lstrlenW(wcszSrc) As SIZE_T + 1
    88103    End If
    89104End Function
     
    104119        Return 0
    105120    Else
    106         Return Detail.GetMBStr(wcszSrc, lstrlenW(wcszSrc) As SIZE_T, mbsDst)
     121        Return Detail.GetMBStr(wcszSrc, (lstrlenW(wcszSrc) + 1) As SIZE_T, mbsDst)
    107122    End If
    108123End Function
     
    123138    Else
    124139        mbsDst = mbszSrc
    125         Return lstrlenA(mbszSrc) As SIZE_T
     140        Return lstrlenA(mbszSrc) As SIZE_T + 1
    126141    End If
    127142End Function
     
    155170End Function
    156171
    157 Sub GetStrNT(mbszSrc As PSTR, ByRef mbszDst As PSTR)
    158     mbszDst = mbszSrc
    159 End Sub
    160 
    161 Sub GetStrNT(mbsSrc As PSTR, len As SIZE_T, ByRef mbszDst As PSTR)
    162     mbszDst = mbsSrc
    163 End Sub
    164 
    165 Sub GetStrNT(mbszSrc As PSTR, ByRef wcszDst As PWSTR)
    166     GetStr(mbszSrc, wcszDst)
    167 End Sub
    168 
    169 Sub GetStrNT(mbsSrc As PSTR, len As SIZE_T, ByRef wcszDst As PWSTR)
    170     GetStr(mbsSrc, len, wcszDst)
    171 End Sub
    172 
    173 Sub GetStrNT(wcszSrc As PWSTR, ByRef mbszDst As PSTR)
    174     GetStr(wcszSrc, mbszDst)
    175 End Sub
    176 
    177 Sub GetStrNT(wcsSrc As PWSTR, len As SIZE_T, ByRef mbszDst As PSTR)
    178     GetStr(wcsSrc, len, mbszDst)
    179 End Sub
    180 
    181 Sub GetStrNT(wcszSrc As PWSTR, ByRef wcszDst As PWSTR)
    182     wcszDst = wcszSrc
    183 End Sub
    184 
    185 Sub GetStrNT(wcsSrc As PWSTR, len As SIZE_T, ByRef wcszDst As PWSTR)
    186     wcszDst = wcsSrc
    187 End Sub
    188 
    189 Sub GetStrNT(strSrc As String, ByRef mbszDst As PSTR)
    190     GetStr(strSrc, mbszDst)
    191 End Sub
    192 
    193 Sub GetStrNT(strSrc As String, ByRef wcszDst As PWSTR)
    194     GetStr(strSrc, wcszDst)
    195 End Sub
    196 
    197172Function GetWCStr(mbszSrc As PSTR, ByRef wcsDst As PWSTR) As SIZE_T
    198173    Return GetStr(mbszSrc, wcsDst)
     
    256231
    257232Function ToWCStr(mbsz As PSTR) As PWSTR
    258     GetStrNT(mbsz, ToWCStr)
     233    Detail.GetStrNT(mbsz, ToWCStr)
    259234End Function
    260235
    261236Function ToWCStr(mbs As PSTR, len As SIZE_T) As PWSTR
    262     GetStrNT(mbs, len, ToWCStr)
     237    GetStr(mbs, len, ToWCStr)
    263238End Function
    264239
     
    272247
    273248Function ToWCStr(s As String) As PWSTR
    274     GetStrNT(s, ToWCStr)
     249    GetStr(s, ToWCStr)
    275250End Function
    276251
     
    284259
    285260Function ToMBStr(wcsz As PWSTR) As PSTR
    286     GetStrNT(wcsz, ToMBStr)
     261    Detail.GetStrNT(wcsz, ToMBStr)
    287262End Function
    288263
    289264Function ToMBStr(wcs As PWSTR, len As SIZE_T) As PSTR
    290     GetStrNT(wcs, len, ToMBStr)
     265    GetStr(wcs, len, ToMBStr)
    291266End Function
    292267
    293268Function ToMBStr(s As String) As PSTR
    294     GetStrNT(s, ToMBStr)
     269    GetStr(s, ToMBStr)
    295270End Function
    296271
    297272Function ToTCStr(mbsz As PSTR) As PCTSTR
    298     GetStrNT(mbsz, ToTCStr)
     273    Detail.GetStrNT(mbsz, ToTCStr)
    299274End Function
    300275
    301276Function ToTCStr(mbs As PSTR, len As SIZE_T) As PCTSTR
    302     GetStrNT(mbs, len, ToTCStr)
     277    GetStr(mbs, len, ToTCStr)
    303278End Function
    304279
    305280Function ToTCStr(wcsz As PWSTR) As PCTSTR
    306     GetStrNT(wcsz, ToTCStr)
     281    Detail.GetStrNT(wcsz, ToTCStr)
    307282End Function
    308283
    309284Function ToTCStr(wcs As PWSTR, len As SIZE_T) As PCTSTR
    310     GetStrNT(wcs, len, ToTCStr)
     285    GetStr(wcs, len, ToTCStr)
    311286End Function
    312287
    313288Function ToTCStr(s As String) As PCTSTR
    314     GetStrNT(s, ToTCStr)
     289    Return StrPtr(s)
    315290End Function
    316291
Note: See TracChangeset for help on using the changeset viewer.