hrev48351 adds 1 changeset to branch 'master' old head: b0ee8bf20a8d9716350ab754c663a5bb4c460bbf new head: 1e4a6aa2e53f86f4c177034089e8a406ec8039bc overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=1e4a6aa+%5Eb0ee8bf ---------------------------------------------------------------------------- 1e4a6aa: DiskProbe: style fixes... [ Adrien Destugues <pulkomandy@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev48351 Commit: 1e4a6aa2e53f86f4c177034089e8a406ec8039bc URL: http://cgit.haiku-os.org/haiku/commit/?id=1e4a6aa Author: Adrien Destugues <pulkomandy@xxxxxxxxx> Date: Thu Nov 20 14:08:09 2014 UTC ---------------------------------------------------------------------------- 1 file changed, 32 insertions(+), 19 deletions(-) src/apps/diskprobe/DataEditor.cpp | 51 ++++++++++++++++++++++------------- ---------------------------------------------------------------------------- diff --git a/src/apps/diskprobe/DataEditor.cpp b/src/apps/diskprobe/DataEditor.cpp index 59f4641..d537785 100644 --- a/src/apps/diskprobe/DataEditor.cpp +++ b/src/apps/diskprobe/DataEditor.cpp @@ -296,13 +296,15 @@ ReplaceChange::Merge(DataChange *_change) if (change == NULL) return false; - if (change->fOffset + change->fSize == fOffset + fSize && change->fSize == 1) { + if (change->fOffset + change->fSize == fOffset + fSize + && change->fSize == 1) { // this is a special case - the new change changed the last byte of // the old change: we do this since the same byte is changed twice // in hex mode editing. fNewData[fSize - 1] = change->fNewData[0]; #ifdef TRACE_DATA_EDITOR - printf("Merge one byte %p (offset = %Ld, size = %lu):\n", this, fOffset, fSize); + printf("Merge one byte %p (offset = %Ld, size = %lu):\n", this, fOffset, + fSize); dump_block(fOldData, fSize, "old:"); dump_block(fNewData, fSize, "new:"); #endif @@ -368,31 +370,35 @@ ReplaceChange::GetRange(off_t /*fileSize*/, off_t &_offset, off_t &_size) DataEditor::DataEditor() - : BLocker("data view") - , fAttribute(NULL) + : + BLocker("data view"), + fAttribute(NULL) { } DataEditor::DataEditor(entry_ref &ref, const char *attribute) - : BLocker("data view") - , fAttribute(NULL) + : + BLocker("data view"), + fAttribute(NULL) { SetTo(ref, attribute); } DataEditor::DataEditor(BEntry &entry, const char *attribute) - : BLocker("data view") - , fAttribute(NULL) + : + BLocker("data view"), + fAttribute(NULL) { SetTo(entry, attribute); } DataEditor::DataEditor(const DataEditor &editor) - : BLocker("data view") - , fAttribute(NULL) + : + BLocker("data view"), + fAttribute(NULL) { } @@ -622,12 +628,14 @@ DataEditor::ApplyChanges() if (fLastChange == NULL && fFirstChange == NULL) return; - int32 firstIndex = fFirstChange != NULL ? fChanges.IndexOf(fFirstChange) + 1 : 0; + int32 firstIndex = fFirstChange != NULL ? fChanges.IndexOf(fFirstChange) + 1 + : 0; int32 lastIndex = fChanges.IndexOf(fLastChange); if (fChangesFromSaved >= 0) { // ascend changes - TRACE(("ApplyChanges(): ascend from %ld to %ld\n", firstIndex, lastIndex)); + TRACE(("ApplyChanges(): ascend from %ld to %ld\n", firstIndex, + lastIndex)); for (int32 i = firstIndex; i <= lastIndex; i++) { DataChange *change = fChanges.ItemAt(i); @@ -635,7 +643,8 @@ DataEditor::ApplyChanges() } } else { // descend changes - TRACE(("ApplyChanges(): descend from %ld to %ld\n", firstIndex - 1, lastIndex)); + TRACE(("ApplyChanges(): descend from %ld to %ld\n", firstIndex - 1, + lastIndex)); for (int32 i = firstIndex - 1; i > lastIndex; i--) { DataChange *change = fChanges.ItemAt(i); @@ -657,7 +666,8 @@ DataEditor::Save() // Do we need to ascend or descend the list of changes? - int32 firstIndex = fFirstChange != NULL ? fChanges.IndexOf(fFirstChange) + 1 : 0; + int32 firstIndex = fFirstChange != NULL ? fChanges.IndexOf(fFirstChange) + 1 + : 0; int32 lastIndex = fChanges.IndexOf(fLastChange); if (fChangesFromSaved < 0 && firstIndex != lastIndex) { // swap indices @@ -719,9 +729,10 @@ DataEditor::Save() size = fSize - fRealViewOffset; ssize_t bytesWritten; - if (IsAttribute()) - bytesWritten = fFile.WriteAttr(fAttribute, fType, fRealViewOffset, fView, size); - else + if (IsAttribute()) { + bytesWritten = fFile.WriteAttr(fAttribute, fType, fRealViewOffset, + fView, size); + } else bytesWritten = fFile.WriteAt(fRealViewOffset, fView, size); if (bytesWritten < B_OK) @@ -948,7 +959,8 @@ DataEditor::Update() ssize_t bytesRead; if (IsAttribute()) { BNode node(&fAttributeRef); - bytesRead = node.ReadAttr(fAttribute, fType, fRealViewOffset, fView, fRealViewSize); + bytesRead = node.ReadAttr(fAttribute, fType, fRealViewOffset, fView, + fRealViewSize); } else bytesRead = fFile.ReadAt(fRealViewOffset, fView, fRealViewSize); @@ -1125,7 +1137,8 @@ DataEditor::Find(off_t startPosition, const uint8 *data, size_t dataSize, if (matchLastOffset != 0) { // we had a partial match in the previous block, let's // check if it is a whole match - if (!compareFunc(fView, data + matchLastOffset, dataSize - matchLastOffset)) { + if (!compareFunc(fView, data + matchLastOffset, + dataSize - matchLastOffset)) { matchLastOffset = 0; break; }