| 1074 | /************************************************************************/ |
| 1075 | |
| 1076 | int CPLStringList::FindSortedInsertionPoint(const char *pszLine) |
| 1077 | |
| 1078 | { |
| 1079 | CPLAssert(IsSorted()); |
| 1080 | |
| 1081 | int iStart = 0; |
| 1082 | int iEnd = nCount - 1; |
| 1083 | |
| 1084 | while (iStart <= iEnd) |
| 1085 | { |
| 1086 | const int iMiddle = (iEnd + iStart) / 2; |
| 1087 | const char *pszMiddle = papszList[iMiddle]; |
| 1088 | |
| 1089 | if (CPLCompareKeyValueString(pszLine, pszMiddle) < 0) |
| 1090 | iEnd = iMiddle - 1; |
| 1091 | else |
| 1092 | iStart = iMiddle + 1; |
| 1093 | } |
| 1094 | |
| 1095 | iEnd++; |
| 1096 | CPLAssert(iEnd >= 0 && iEnd <= nCount); |
| 1097 | CPLAssert(iEnd == 0 || |
| 1098 | CPLCompareKeyValueString(pszLine, papszList[iEnd - 1]) >= 0); |
| 1099 | CPLAssert(iEnd == nCount || |
| 1100 | CPLCompareKeyValueString(pszLine, papszList[iEnd]) <= 0); |
| 1101 | |
| 1102 | return iEnd; |
| 1103 | } |
| 1104 | |
| 1105 | namespace cpl |
| 1106 | { |
nothing calls this directly
no test coverage detected