ImageFunctionsView::FunctionsTableModel:
* Fixed typo in SetImageDebugInfo() setting the wrong source file function start indices. * Fixed incorrect return values in _CompareSourceFileNames(). * Fixed several instances of ignoring the source file's function start index. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31323 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
da30b4bf83
commit
ebf36c3bec
@ -95,7 +95,7 @@ public:
|
|||||||
for (int32 i = 1; i < functionCount; i++) {
|
for (int32 i = 1; i < functionCount; i++) {
|
||||||
if (_CompareSourceFileNames(functions[i - 1]->SourceFileName(),
|
if (_CompareSourceFileNames(functions[i - 1]->SourceFileName(),
|
||||||
functions[i]->SourceFileName()) != 0) {
|
functions[i]->SourceFileName()) != 0) {
|
||||||
fSourceFileIndices[sourceFileIndex++] = 1;
|
fSourceFileIndices[sourceFileIndex++] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,14 +123,7 @@ public:
|
|||||||
if (parent >= fSourceFileIndices
|
if (parent >= fSourceFileIndices
|
||||||
&& parent < fSourceFileIndices + fSourceFileCount) {
|
&& parent < fSourceFileIndices + fSourceFileCount) {
|
||||||
int32 sourceIndex = (int32*)parent - fSourceFileIndices;
|
int32 sourceIndex = (int32*)parent - fSourceFileIndices;
|
||||||
int32 count;
|
return _CountSourceFileFunctions(sourceIndex);
|
||||||
if (sourceIndex + 1 < fSourceFileCount) {
|
|
||||||
count = fSourceFileIndices[sourceIndex + 1]
|
|
||||||
- fSourceFileIndices[sourceIndex];
|
|
||||||
} else
|
|
||||||
count = fFunctionCount - fSourceFileIndices[sourceIndex];
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -146,14 +139,10 @@ public:
|
|||||||
if (parent >= fSourceFileIndices
|
if (parent >= fSourceFileIndices
|
||||||
&& parent < fSourceFileIndices + fSourceFileCount) {
|
&& parent < fSourceFileIndices + fSourceFileCount) {
|
||||||
int32 sourceIndex = (int32*)parent - fSourceFileIndices;
|
int32 sourceIndex = (int32*)parent - fSourceFileIndices;
|
||||||
int32 count;
|
int32 count = _CountSourceFileFunctions(sourceIndex);
|
||||||
if (sourceIndex + 1 < fSourceFileCount) {
|
int32 firstFunctionIndex = fSourceFileIndices[sourceIndex];
|
||||||
count = fSourceFileIndices[sourceIndex + 1]
|
return index >= 0 && index < count
|
||||||
- fSourceFileIndices[sourceIndex];
|
? fFunctions[firstFunctionIndex + index] : NULL;
|
||||||
} else
|
|
||||||
count = fFunctionCount - fSourceFileIndices[sourceIndex];
|
|
||||||
|
|
||||||
return index >= 0 && index < count ? fFunctions[index] : NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -199,7 +188,7 @@ public:
|
|||||||
|
|
||||||
_path.Clear();
|
_path.Clear();
|
||||||
return _path.AddComponent(sourceIndex)
|
return _path.AddComponent(sourceIndex)
|
||||||
&& _path.AddComponent(index);
|
&& _path.AddComponent(index - fSourceFileIndices[sourceIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetObjectForPath(const TreeTablePath& path, const char*& _sourceFile,
|
bool GetObjectForPath(const TreeTablePath& path, const char*& _sourceFile,
|
||||||
@ -220,8 +209,8 @@ public:
|
|||||||
|
|
||||||
if (componentCount == 2) {
|
if (componentCount == 2) {
|
||||||
int32 index = path.ComponentAt(1);
|
int32 index = path.ComponentAt(1);
|
||||||
if (index >= 0 && index < fFunctionCount)
|
if (index >= 0 && index < _CountSourceFileFunctions(sourceIndex))
|
||||||
_function = fFunctions[index];
|
_function = fFunctions[fSourceFileIndices[sourceIndex] + index];
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -233,15 +222,25 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int32 _CountSourceFileFunctions(int32 sourceIndex) const
|
||||||
|
{
|
||||||
|
if (sourceIndex < 0 || sourceIndex >= fSourceFileCount)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int32 nextFunctionIndex = sourceIndex + 1 < fSourceFileCount
|
||||||
|
? fSourceFileIndices[sourceIndex + 1] : fFunctionCount;
|
||||||
|
return nextFunctionIndex - fSourceFileIndices[sourceIndex];
|
||||||
|
}
|
||||||
|
|
||||||
static int _CompareSourceFileNames(const char* a, const char* b)
|
static int _CompareSourceFileNames(const char* a, const char* b)
|
||||||
{
|
{
|
||||||
if (a == b)
|
if (a == b)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (a == NULL)
|
if (a == NULL)
|
||||||
return false;
|
return 1;
|
||||||
if (b == NULL)
|
if (b == NULL)
|
||||||
return true;
|
return -1;
|
||||||
|
|
||||||
return strcmp(a, b);
|
return strcmp(a, b);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user