commit 2025-09-02 14:24 fix bug in Replace() in ZCppMain/ZtCStringEx.H
This commit is contained in:
@ -166,7 +166,7 @@ namespace ZNsMain
|
||||
(
|
||||
VPC_ThisStart + VL_DestStart,
|
||||
VPC_ThisStart + VL_MoveStart,
|
||||
VL_MoveStart - VL_DestStart
|
||||
VL_ThisSize - VL_MoveStart
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
@ -282,6 +282,20 @@ namespace ZNsMain
|
||||
###########################################################################*/
|
||||
|
||||
|
||||
ZCStringStd& Replace /*####################################################*/
|
||||
(
|
||||
TypeCPChar APC_Search, TypeCPChar APC_Replace, TypeLength AL_Offset=0
|
||||
)
|
||||
/*#########################################################################*/
|
||||
{
|
||||
return Replace(APC_Search, APC_Replace, ZftLength(APC_Search), ZftLength(APC_Replace), AL_Offset);
|
||||
}/*
|
||||
ZCStringStd& Replace /*######################################################
|
||||
(
|
||||
TypeCPChar APC_Search, TypeCPChar APC_Replace, TypeLength AL_Offset=0
|
||||
)
|
||||
###########################################################################*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCStringStd : public std::string*/
|
||||
|
@ -407,11 +407,11 @@ namespace ZNsMain
|
||||
VPC_MoveStart = VPC_ThisStart + VL_MoveStart ;
|
||||
VPC_DestStart = VPC_ThisStart + VL_DestStart ;
|
||||
|
||||
::memmove /*::::::::::::::::::::::::::::::::::::::*/
|
||||
::memmove /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_DestStart, VPC_MoveStart, VL_MemMoveSize
|
||||
VPC_DestStart, VPC_MoveStart, VL_MemMoveSize*sizeof(TypeChar)
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
if(VL_MoveStart>VL_DestStart)*/
|
||||
|
||||
@ -420,7 +420,11 @@ namespace ZNsMain
|
||||
VL_DestStart = VL_SearchedPos+ AL_Searched -
|
||||
( AL_Searched-AL_Replace ) * i ;
|
||||
|
||||
::memcpy(VPC_RepalcePos, APC_Replace, AL_Replace);
|
||||
::memcpy /*:::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_RepalcePos, APC_Replace, AL_Replace*sizeof(TypeChar)
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
|
||||
AR_CPosList.ItNext(VH_IterEasyID);
|
||||
}/*
|
||||
@ -428,13 +432,13 @@ namespace ZNsMain
|
||||
|
||||
if(VL_DestStart<VL_MoveStart && VL_DestStart<VL_ThisSize)
|
||||
{
|
||||
::memmove /*::::::::::::::::::::::::::::::*/
|
||||
::memmove /*::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_ThisStart + VL_DestStart,
|
||||
VPC_ThisStart + VL_MoveStart,
|
||||
VL_MoveStart - VL_DestStart
|
||||
(VL_ThisSize - VL_MoveStart)*sizeof(TypeChar)
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::*/
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
if(VL_DestStart<VL_MoveStart && VL_DestStart<VL_ThisSize)*/
|
||||
|
||||
@ -467,11 +471,11 @@ namespace ZNsMain
|
||||
VL_MemCopySize =
|
||||
VL_SearchedPos - VL_SearchedPre ;
|
||||
|
||||
::memcpy /*:::::::::::::::::::::::::::::::::::::::*/
|
||||
::memcpy /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_DestStart, VPC_CopyStart, VL_MemCopySize
|
||||
VPC_DestStart, VPC_CopyStart, VL_MemCopySize*sizeof(TypeChar)
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
if(VL_SearchedPos>VL_SearchedPre)*/
|
||||
|
||||
@ -480,7 +484,11 @@ namespace ZNsMain
|
||||
( AL_Replace-AL_Searched ) * (i-1) ;
|
||||
VPC_RepalcePos = VPC_OutStart + VL_DestStart ;
|
||||
|
||||
::memcpy(VPC_RepalcePos, APC_Replace, AL_Replace) ;
|
||||
::memcpy /*:::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_RepalcePos, APC_Replace, AL_Replace*sizeof(TypeChar)
|
||||
) ;
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
|
||||
AR_CPosList.ItNext(VH_IterEasyID);
|
||||
}/*
|
||||
@ -494,11 +502,11 @@ namespace ZNsMain
|
||||
VPC_CopyStart = VPC_ThisStart+ VL_SearchedPre;
|
||||
VL_MemCopySize = VL_ThisSize - VL_SearchedPre;
|
||||
|
||||
::memcpy /*:::::::::::::::::::::::::::::::::::::::*/
|
||||
::memcpy /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_DestStart, VPC_CopyStart, VL_MemCopySize
|
||||
VPC_DestStart, VPC_CopyStart, VL_MemCopySize*sizeof(TypeChar)
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
if(VL_SearchedPre<VL_ThisSize)*/
|
||||
|
||||
|
Reference in New Issue
Block a user