Index: trunk/ab5.0/ablib/src/system/string.sbp
===================================================================
--- trunk/ab5.0/ablib/src/system/string.sbp	(revision 599)
+++ trunk/ab5.0/ablib/src/system/string.sbp	(revision 652)
@@ -28,7 +28,6 @@
 	Function GetWCStr(mbsSrc As PSTR, len As SIZE_T, ByRef wcsDst As PWSTR) As SIZE_T
 		Dim lenWCS = MultiByteToWideChar(CP_THREAD_ACP, 0, mbsSrc, (len As DWord) As Long, 0, 0)
-		wcsDst = _System_AllocForConvertedString(SizeOf (WCHAR) * (lenWCS + 1)) As PWSTR
+		wcsDst = _System_AllocForConvertedString(SizeOf (WCHAR) * lenWCS) As PWSTR
 		GetWCStr = MultiByteToWideChar(CP_THREAD_ACP, 0, mbsSrc, (len As DWord) As Long, wcsDst, lenWCS)
-		wcsDst[GetWCStr] = 0
 	End Function
 
@@ -40,7 +39,6 @@
 	Function GetMBStr(wcsSrc As PWSTR, len As SIZE_T, ByRef mbsDst As PSTR) As SIZE_T
 		Dim lenMBS = WideCharToMultiByte(CP_THREAD_ACP, 0, wcsSrc, (len As DWord) As Long, 0, 0, 0, 0)
-		mbsDst = _System_AllocForConvertedString(SizeOf (SByte) * (lenMBS + 1)) As PSTR
+		mbsDst = _System_AllocForConvertedString(SizeOf (CHAR) * lenMBS) As PSTR
 		GetMBStr = WideCharToMultiByte(CP_THREAD_ACP, 0, wcsSrc, (wcsSrc As DWord) As Long, mbsDst, lenMBS, 0, 0) As SIZE_T
-		mbsDst[GetMBStr] = 0
 	End Function
 
@@ -49,4 +47,22 @@
 		GetMBStr = len
 	End Function
+
+	' ToTCStrの補助
+	Sub GetStrNT(mbszSrc As PSTR, ByRef mbszDst As PSTR)
+		mbszDst = mbszSrc
+	End Sub
+
+	Sub GetStrNT(mbszSrc As PSTR, ByRef wcszDst As PWSTR)
+		GetStr(mbszSrc, wcszDst)
+	End Sub
+
+	Sub GetStrNT(wcszSrc As PWSTR, ByRef mbszDst As PSTR)
+		GetStr(wcszSrc, mbszDst)
+	End Sub
+
+	Sub GetStrNT(wcszSrc As PWSTR, ByRef wcszDst As PWSTR)
+		wcszDst = wcszSrc
+	End Sub
+
 End Namespace
 
@@ -55,8 +71,7 @@
 入力引数: wcsz, wcs + len, mbsz, mbs + len, str
 出力関数: wcs(z)出力GetStr, mbs(z)出力GetStr,
-          wcs(z)出力GetStrNT, mbs(z)出力GetStrNT,
           GetWCStr, GetMBStr, GetTCStr,
           ToWCStr, ToMBStr, ToTCStr,
-で、5 * 10 = 50通り。
+で、5 * 8 = 40通り。
 */
 
@@ -66,5 +81,5 @@
 		Return 0
 	Else
-		Return Detail.GetWCStr(mbszSrc, lstrlenA(mbszSrc) As SIZE_T, wcsDst)
+		Return Detail.GetWCStr(mbszSrc, (lstrlenA(mbszSrc) + 1) As SIZE_T, wcsDst)
 	End If
 End Function
@@ -85,5 +100,5 @@
 	Else
 		wcsDst = wcszSrc
-		Return lstrlenW(wcszSrc) As SIZE_T
+		Return lstrlenW(wcszSrc) As SIZE_T + 1
 	End If
 End Function
@@ -104,5 +119,5 @@
 		Return 0
 	Else
-		Return Detail.GetMBStr(wcszSrc, lstrlenW(wcszSrc) As SIZE_T, mbsDst)
+		Return Detail.GetMBStr(wcszSrc, (lstrlenW(wcszSrc) + 1) As SIZE_T, mbsDst)
 	End If
 End Function
@@ -123,5 +138,5 @@
 	Else
 		mbsDst = mbszSrc
-		Return lstrlenA(mbszSrc) As SIZE_T
+		Return lstrlenA(mbszSrc) As SIZE_T + 1
 	End If
 End Function
@@ -155,44 +170,4 @@
 End Function
 
-Sub GetStrNT(mbszSrc As PSTR, ByRef mbszDst As PSTR)
-	mbszDst = mbszSrc
-End Sub
-
-Sub GetStrNT(mbsSrc As PSTR, len As SIZE_T, ByRef mbszDst As PSTR)
-	mbszDst = mbsSrc
-End Sub
-
-Sub GetStrNT(mbszSrc As PSTR, ByRef wcszDst As PWSTR)
-	GetStr(mbszSrc, wcszDst)
-End Sub
-
-Sub GetStrNT(mbsSrc As PSTR, len As SIZE_T, ByRef wcszDst As PWSTR)
-	GetStr(mbsSrc, len, wcszDst)
-End Sub
-
-Sub GetStrNT(wcszSrc As PWSTR, ByRef mbszDst As PSTR)
-	GetStr(wcszSrc, mbszDst)
-End Sub
-
-Sub GetStrNT(wcsSrc As PWSTR, len As SIZE_T, ByRef mbszDst As PSTR)
-	GetStr(wcsSrc, len, mbszDst)
-End Sub
-
-Sub GetStrNT(wcszSrc As PWSTR, ByRef wcszDst As PWSTR)
-	wcszDst = wcszSrc
-End Sub
-
-Sub GetStrNT(wcsSrc As PWSTR, len As SIZE_T, ByRef wcszDst As PWSTR)
-	wcszDst = wcsSrc
-End Sub
-
-Sub GetStrNT(strSrc As String, ByRef mbszDst As PSTR)
-	GetStr(strSrc, mbszDst)
-End Sub
-
-Sub GetStrNT(strSrc As String, ByRef wcszDst As PWSTR)
-	GetStr(strSrc, wcszDst)
-End Sub
-
 Function GetWCStr(mbszSrc As PSTR, ByRef wcsDst As PWSTR) As SIZE_T
 	Return GetStr(mbszSrc, wcsDst)
@@ -256,9 +231,9 @@
 
 Function ToWCStr(mbsz As PSTR) As PWSTR
-	GetStrNT(mbsz, ToWCStr)
+	Detail.GetStrNT(mbsz, ToWCStr)
 End Function
 
 Function ToWCStr(mbs As PSTR, len As SIZE_T) As PWSTR
-	GetStrNT(mbs, len, ToWCStr)
+	GetStr(mbs, len, ToWCStr)
 End Function
 
@@ -272,5 +247,5 @@
 
 Function ToWCStr(s As String) As PWSTR
-	GetStrNT(s, ToWCStr)
+	GetStr(s, ToWCStr)
 End Function
 
@@ -284,33 +259,33 @@
 
 Function ToMBStr(wcsz As PWSTR) As PSTR
-	GetStrNT(wcsz, ToMBStr)
+	Detail.GetStrNT(wcsz, ToMBStr)
 End Function
 
 Function ToMBStr(wcs As PWSTR, len As SIZE_T) As PSTR
-	GetStrNT(wcs, len, ToMBStr)
+	GetStr(wcs, len, ToMBStr)
 End Function
 
 Function ToMBStr(s As String) As PSTR
-	GetStrNT(s, ToMBStr)
+	GetStr(s, ToMBStr)
 End Function
 
 Function ToTCStr(mbsz As PSTR) As PCTSTR
-	GetStrNT(mbsz, ToTCStr)
+	Detail.GetStrNT(mbsz, ToTCStr)
 End Function
 
 Function ToTCStr(mbs As PSTR, len As SIZE_T) As PCTSTR
-	GetStrNT(mbs, len, ToTCStr)
+	GetStr(mbs, len, ToTCStr)
 End Function
 
 Function ToTCStr(wcsz As PWSTR) As PCTSTR
-	GetStrNT(wcsz, ToTCStr)
+	Detail.GetStrNT(wcsz, ToTCStr)
 End Function
 
 Function ToTCStr(wcs As PWSTR, len As SIZE_T) As PCTSTR
-	GetStrNT(wcs, len, ToTCStr)
+	GetStr(wcs, len, ToTCStr)
 End Function
 
 Function ToTCStr(s As String) As PCTSTR
-	GetStrNT(s, ToTCStr)
+	Return StrPtr(s)
 End Function
 
