Ticket #7453: storage-cleanup.diff
File storage-cleanup.diff, 32.4 KB (added by , 14 years ago) |
---|
-
src/kits/storage/Entry.cpp
643 643 - "error code" - Failure 644 644 */ 645 645 status_t 646 BEntry::GetName(char *buffer) const646 BEntry::GetName(char* buffer) const 647 647 { 648 648 status_t result = B_ERROR; 649 649 … … 681 681 682 682 */ 683 683 status_t 684 BEntry::Rename(const char *path, bool clobber)684 BEntry::Rename(const char* path, bool clobber) 685 685 { 686 686 // check parameter and initialization 687 687 if (path == NULL) … … 780 780 \c false - The BEntry objects refer to different entries 781 781 */ 782 782 bool 783 BEntry::operator==(const BEntry &item) const783 BEntry::operator==(const BEntry& item) const 784 784 { 785 785 // First check statuses 786 786 if (this->InitCheck() != B_OK && item.InitCheck() != B_OK) { … … 951 951 // if no directory was given, we need to open the current dir 952 952 // now 953 953 if (dirFD < 0) { 954 char *cwd = getcwd(tmpPath, B_PATH_NAME_LENGTH);954 char* cwd = getcwd(tmpPath, B_PATH_NAME_LENGTH); 955 955 if (!cwd) 956 956 return B_ERROR; 957 957 dirFD = _kern_open_dir(-1, cwd); -
src/kits/storage/FindDirectory.cpp
25 25 - another error code 26 26 */ 27 27 status_t 28 find_directory(directory_which which, BPath *path, bool createIt,29 BVolume *volume)28 find_directory(directory_which which, BPath* path, bool createIt, 29 BVolume* volume) 30 30 { 31 31 if (path == NULL) 32 32 return B_BAD_VALUE; -
src/kits/storage/FileDescriptorIO.cpp
28 28 29 29 30 30 ssize_t 31 BFileDescriptorIO::Read(void *buffer, size_t size)31 BFileDescriptorIO::Read(void* buffer, size_t size) 32 32 { 33 33 ssize_t bytesRead = read(fFD, buffer, size); 34 34 return bytesRead >= 0 ? bytesRead : errno; … … 36 36 37 37 38 38 ssize_t 39 BFileDescriptorIO::Write(const void *buffer, size_t size)39 BFileDescriptorIO::Write(const void* buffer, size_t size) 40 40 { 41 41 ssize_t bytesWritten = write(fFD, buffer, size); 42 42 return bytesWritten >= 0 ? bytesWritten : errno; … … 44 44 45 45 46 46 ssize_t 47 BFileDescriptorIO::ReadAt(off_t position, void *buffer, size_t size)47 BFileDescriptorIO::ReadAt(off_t position, void* buffer, size_t size) 48 48 { 49 49 ssize_t bytesRead = pread(fFD, buffer, size, position); 50 50 return bytesRead >= 0 ? bytesRead : errno; … … 52 52 53 53 54 54 ssize_t 55 BFileDescriptorIO::WriteAt(off_t position, const void *buffer, size_t size)55 BFileDescriptorIO::WriteAt(off_t position, const void* buffer, size_t size) 56 56 { 57 57 ssize_t bytesWritten = pwrite(fFD, buffer, size, position); 58 58 return bytesWritten >= 0 ? bytesWritten : errno; -
src/kits/storage/disk_device/DiskDeviceTypes.cpp
14 14 15 15 // Device Types 16 16 17 const char *kDeviceTypeFloppyDisk = FLOPPY_DEVICE_NAME;18 const char *kDeviceTypeHardDisk = HARD_DISK_DEVICE_NAME;19 const char *kDeviceTypeOptical = OPTICAL_DEVICE_NAME;17 const char* kDeviceTypeFloppyDisk = FLOPPY_DEVICE_NAME; 18 const char* kDeviceTypeHardDisk = HARD_DISK_DEVICE_NAME; 19 const char* kDeviceTypeOptical = OPTICAL_DEVICE_NAME; 20 20 21 21 // Partition types 22 22 23 const char *kPartitionTypeUnrecognized = UNRECOGNIZED_PARTITION_NAME;23 const char* kPartitionTypeUnrecognized = UNRECOGNIZED_PARTITION_NAME; 24 24 25 const char *kPartitionTypeMultisession = MULTISESSION_PARTITION_NAME;26 const char *kPartitionTypeAudioSession = AUDIO_SESSION_PARTITION_NAME;27 const char *kPartitionTypeDataSession = DATA_SESSION_PARTITION_NAME;25 const char* kPartitionTypeMultisession = MULTISESSION_PARTITION_NAME; 26 const char* kPartitionTypeAudioSession = AUDIO_SESSION_PARTITION_NAME; 27 const char* kPartitionTypeDataSession = DATA_SESSION_PARTITION_NAME; 28 28 29 const char *kPartitionTypeAmiga = AMIGA_PARTITION_NAME;30 const char *kPartitionTypeApple = APPLE_PARTITION_NAME;31 const char *kPartitionTypeEFI = EFI_PARTITION_NAME;32 const char *kPartitionTypeIntel = INTEL_PARTITION_NAME;33 const char *kPartitionTypeIntelExtended = INTEL_EXTENDED_PARTITION_NAME;34 const char *kPartitionTypeVMDK = VMDK_PARTITION_NAME;29 const char* kPartitionTypeAmiga = AMIGA_PARTITION_NAME; 30 const char* kPartitionTypeApple = APPLE_PARTITION_NAME; 31 const char* kPartitionTypeEFI = EFI_PARTITION_NAME; 32 const char* kPartitionTypeIntel = INTEL_PARTITION_NAME; 33 const char* kPartitionTypeIntelExtended = INTEL_EXTENDED_PARTITION_NAME; 34 const char* kPartitionTypeVMDK = VMDK_PARTITION_NAME; 35 35 36 const char *kPartitionTypeAmigaFFS = AMIGA_FFS_NAME;37 const char *kPartitionTypeBFS = BFS_NAME;38 const char *kPartitionTypeBTRFS = BTRFS_NAME;39 const char *kPartitionTypeEXFAT = EXFAT_FS_NAME;40 const char *kPartitionTypeEXT2 = EXT2_FS_NAME;41 const char *kPartitionTypeEXT3 = EXT3_FS_NAME;42 const char *kPartitionTypeFAT12 = FAT12_FS_NAME;43 const char *kPartitionTypeFAT32 = FAT32_FS_NAME;44 const char *kPartitionTypeHFS = HFS_NAME;45 const char *kPartitionTypeHFSPlus = HFS_PLUS_NAME;46 const char *kPartitionTypeISO9660 = ISO9660_FS_NAME;47 const char *kPartitionTypeReiser = REISER_FS_NAME;48 const char *kPartitionTypeUDF = UDF_FS_NAME;36 const char* kPartitionTypeAmigaFFS = AMIGA_FFS_NAME; 37 const char* kPartitionTypeBFS = BFS_NAME; 38 const char* kPartitionTypeBTRFS = BTRFS_NAME; 39 const char* kPartitionTypeEXFAT = EXFAT_FS_NAME; 40 const char* kPartitionTypeEXT2 = EXT2_FS_NAME; 41 const char* kPartitionTypeEXT3 = EXT3_FS_NAME; 42 const char* kPartitionTypeFAT12 = FAT12_FS_NAME; 43 const char* kPartitionTypeFAT32 = FAT32_FS_NAME; 44 const char* kPartitionTypeHFS = HFS_NAME; 45 const char* kPartitionTypeHFSPlus = HFS_PLUS_NAME; 46 const char* kPartitionTypeISO9660 = ISO9660_FS_NAME; 47 const char* kPartitionTypeReiser = REISER_FS_NAME; 48 const char* kPartitionTypeUDF = UDF_FS_NAME; -
src/kits/storage/disk_device/PartitionDelegate.cpp
21 21 22 22 // constructor 23 23 BPartition::Delegate::Delegate(BPartition* partition) 24 : fPartition(partition), 25 fMutablePartition(this), 26 fDiskSystem(NULL), 27 fPartitionHandle(NULL) 24 : 25 fPartition(partition), 26 fMutablePartition(this), 27 fDiskSystem(NULL), 28 fPartitionHandle(NULL) 28 29 { 29 30 } 30 31 … … 359 360 360 361 // GetNextSupportedChildType 361 362 status_t 362 BPartition::Delegate::GetNextSupportedChildType(Delegate* child, int32 *cookie,363 BString* type) const363 BPartition::Delegate::GetNextSupportedChildType(Delegate* child, 364 int32* cookie, BString* type) const 364 365 { 365 366 TRACE("%p->BPartition::Delegate::GetNextSupportedChildType(child: %p, " 366 367 "cookie: %ld)\n", this, child, *cookie); … … 377 378 378 379 // IsSubSystem 379 380 bool 380 BPartition::Delegate::IsSubSystem(Delegate* child, const char* diskSystem) const 381 BPartition::Delegate::IsSubSystem(Delegate* child, 382 const char* diskSystem) const 381 383 { 382 384 // get the disk system add-on 383 385 DiskSystemAddOnManager* manager = DiskSystemAddOnManager::Default(); -
src/kits/storage/disk_device/DiskDeviceJob.cpp
11 11 // constructor 12 12 DiskDeviceJob::DiskDeviceJob(PartitionReference* partition, 13 13 PartitionReference* child) 14 : fPartition(partition), 15 fChild(child) 14 : 15 fPartition(partition), 16 fChild(child) 16 17 { 17 18 if (fPartition) 18 19 fPartition->AcquireReference(); -
src/kits/storage/disk_device/DiskSystemAddOn.cpp
14 14 15 15 // constructor 16 16 BDiskSystemAddOn::BDiskSystemAddOn(const char* name, uint32 flags) 17 : fName(name), 18 fFlags(flags) 17 : 18 fName(name), 19 fFlags(flags) 19 20 { 20 21 } 21 22 … … 98 99 99 100 // constructor 100 101 BPartitionHandle::BPartitionHandle(BMutablePartition* partition) 101 : fPartition(partition) 102 : 103 fPartition(partition) 102 104 { 103 105 } 104 106 -
src/kits/storage/disk_device/PartitionDelegate.h
75 75 B_PARAMETER_EDITOR_TYPE type, 76 76 BPartitionParameterEditor** editor) const; 77 77 status_t GetNextSupportedChildType(Delegate* child, 78 int32 *cookie, BString* type) const;78 int32* cookie, BString* type) const; 79 79 bool IsSubSystem(Delegate* child, 80 80 const char* diskSystem) const; 81 81 -
src/kits/storage/disk_device/DiskDevice.cpp
47 47 /*! \brief Creates an uninitialized BDiskDevice object. 48 48 */ 49 49 BDiskDevice::BDiskDevice() 50 : fDeviceData(NULL) 50 : 51 fDeviceData(NULL) 51 52 { 52 53 } 53 54 … … 223 224 return false; 224 225 225 226 struct IsModifiedVisitor : public BDiskDeviceVisitor { 226 virtual bool Visit(BDiskDevice *device)227 virtual bool Visit(BDiskDevice* device) 227 228 { 228 229 return Visit(device, 0); 229 230 } 230 231 231 virtual bool Visit(BPartition *partition, int32 level)232 virtual bool Visit(BPartition* partition, int32 level) 232 233 { 233 234 return partition->_IsModified(); 234 235 } -
src/kits/storage/disk_device/DiskScannerAddOn.cpp
15 15 { 16 16 } 17 17 18 18 19 // destructor 19 20 /*! \brief Frees all resources associated with this object. 20 21 */ … … 71 72 { 72 73 } 73 74 75 74 76 // destructor 75 77 /*! \brief Frees all resources associated with this object. 76 78 */ … … 128 130 { 129 131 } 130 132 133 131 134 // destructor 132 135 /*! \brief Frees all resources associated with this object. 133 136 */ … … 135 138 { 136 139 } 137 140 141 138 142 /*! \brief Returns a view containing the controls needed for editing the 139 143 parameters. 140 144 … … 155 159 return NULL; 156 160 } 157 161 162 158 163 // EditingDone 159 164 /*! \brief Called when the user finishes editing the parameters. 160 165 … … 174 179 return true; 175 180 } 176 181 182 177 183 /*! \brief Returns the edited parameters. 178 184 179 185 To be overridden by derived classes. -
src/kits/storage/disk_device/jobs/RepairJob.cpp
12 12 13 13 // constructor 14 14 RepairJob::RepairJob(PartitionReference* partition, bool checkOnly) 15 : DiskDeviceJob(partition), 16 fCheckOnly(checkOnly) 15 : 16 DiskDeviceJob(partition), 17 fCheckOnly(checkOnly) 17 18 { 18 19 } 19 20 -
src/kits/storage/disk_device/jobs/ResizeJob.cpp
14 14 // constructor 15 15 ResizeJob::ResizeJob(PartitionReference* partition, PartitionReference* child, 16 16 off_t size, off_t contentSize) 17 : DiskDeviceJob(partition, child), 18 fSize(size), 19 fContentSize(contentSize) 17 : 18 DiskDeviceJob(partition, child), 19 fSize(size), 20 fContentSize(contentSize) 20 21 { 21 22 } 22 23 -
src/kits/storage/disk_device/PartitioningInfo.cpp
28 28 29 29 // constructor 30 30 BPartitioningInfo::BPartitioningInfo() 31 : fPartitionID(-1), 32 fSpaces(NULL), 33 fCount(0), 34 fCapacity(0) 31 : 32 fPartitionID(-1), 33 fSpaces(NULL), 34 fCount(0), 35 fCapacity(0) 35 36 { 36 37 } 37 38 … … 188 189 189 190 // GetPartitionableSpaceAt 190 191 status_t 191 BPartitioningInfo::GetPartitionableSpaceAt(int32 index, off_t *offset,192 BPartitioningInfo::GetPartitionableSpaceAt(int32 index, off_t* offset, 192 193 off_t *size) const 193 194 { 194 195 if (!fSpaces) -
src/kits/storage/AddOnMonitorHandler.cpp
213 213 214 214 215 215 void 216 AddOnMonitorHandler::EntryMoved(const char *name, const char *fromName,216 AddOnMonitorHandler::EntryMoved(const char* name, const char* fromName, 217 217 ino_t fromDirectory, ino_t toDirectory, dev_t device, ino_t node, 218 218 dev_t nodeDevice) 219 219 { -
src/kits/storage/AddOnImage.h
15 15 AddOnImage(); 16 16 ~AddOnImage(); 17 17 18 status_t Load(const char *path);18 status_t Load(const char* path); 19 19 void Unload(); 20 20 21 21 void SetID(image_id id); -
src/kits/storage/FileIO.cpp
26 26 27 27 28 28 ssize_t 29 BFileIO::Read(void *buffer, size_t size)29 BFileIO::Read(void* buffer, size_t size) 30 30 { 31 31 errno = B_OK; 32 32 ssize_t bytesRead = fread(buffer, 1, size, fFile); … … 35 35 36 36 37 37 ssize_t 38 BFileIO::Write(const void *buffer, size_t size)38 BFileIO::Write(const void* buffer, size_t size) 39 39 { 40 40 errno = B_OK; 41 41 ssize_t bytesRead = fwrite(buffer, 1, size, fFile); … … 44 44 45 45 46 46 ssize_t 47 BFileIO::ReadAt(off_t position, void *buffer, size_t size)47 BFileIO::ReadAt(off_t position, void* buffer, size_t size) 48 48 { 49 49 // save the old position and seek to the requested one 50 50 off_t oldPosition = _Seek(position, SEEK_SET); … … 62 62 63 63 64 64 ssize_t 65 BFileIO::WriteAt(off_t position, const void *buffer, size_t size)65 BFileIO::WriteAt(off_t position, const void* buffer, size_t size) 66 66 { 67 67 // save the old position and seek to the requested one 68 68 off_t oldPosition = _Seek(position, SEEK_SET); -
src/kits/storage/File.cpp
34 34 /*! If \a file is uninitialized, the newly constructed BFile will be, too. 35 35 \param file the BFile object to be copied 36 36 */ 37 BFile::BFile(const BFile &file)37 BFile::BFile(const BFile& file) 38 38 : 39 39 fMode(0) 40 40 { … … 48 48 \param openMode the mode in which the file should be opened 49 49 \see SetTo() for values for \a openMode 50 50 */ 51 BFile::BFile(const entry_ref *ref, uint32 openMode)51 BFile::BFile(const entry_ref* ref, uint32 openMode) 52 52 : 53 53 fMode(0) 54 54 { … … 62 62 \param openMode the mode in which the file should be opened 63 63 \see SetTo() for values for \a openMode 64 64 */ 65 BFile::BFile(const BEntry *entry, uint32 openMode)65 BFile::BFile(const BEntry* entry, uint32 openMode) 66 66 : 67 67 fMode(0) 68 68 { … … 76 76 \param openMode the mode in which the file should be opened 77 77 \see SetTo() for values for \a openMode 78 78 */ 79 BFile::BFile(const char *path, uint32 openMode)79 BFile::BFile(const char* path, uint32 openMode) 80 80 : 81 81 fMode(0) 82 82 { … … 93 93 \param openMode the mode in which the file should be opened 94 94 \see SetTo() for values for \a openMode 95 95 */ 96 BFile::BFile(const BDirectory *dir, const char *path, uint32 openMode)96 BFile::BFile(const BDirectory *dir, const char* path, uint32 openMode) 97 97 : 98 98 fMode(0) 99 99 { … … 143 143 - \c B_NO_MORE_FDS: The application has run out of file descriptors. 144 144 */ 145 145 status_t 146 BFile::SetTo(const entry_ref *ref, uint32 openMode)146 BFile::SetTo(const entry_ref* ref, uint32 openMode) 147 147 { 148 148 Unset(); 149 149 … … 188 188 to reimplement! 189 189 */ 190 190 status_t 191 BFile::SetTo(const BEntry *entry, uint32 openMode)191 BFile::SetTo(const BEntry* entry, uint32 openMode) 192 192 { 193 193 Unset(); 194 194 … … 229 229 - \c B_NO_MORE_FDS: The application has run out of file descriptors. 230 230 */ 231 231 status_t 232 BFile::SetTo(const char *path, uint32 openMode)232 BFile::SetTo(const char* path, uint32 openMode) 233 233 { 234 234 Unset(); 235 235 … … 271 271 to reimplement! 272 272 */ 273 273 status_t 274 BFile::SetTo(const BDirectory *dir, const char *path, uint32 openMode)274 BFile::SetTo(const BDirectory* dir, const char* path, uint32 openMode) 275 275 { 276 276 Unset(); 277 277 … … 326 326 \return the number of bytes actually read or an error code 327 327 */ 328 328 ssize_t 329 BFile::Read(void *buffer, size_t size)329 BFile::Read(void* buffer, size_t size) 330 330 { 331 331 if (InitCheck() != B_OK) 332 332 return InitCheck(); … … 343 343 \return the number of bytes actually read or an error code 344 344 */ 345 345 ssize_t 346 BFile::ReadAt(off_t location, void *buffer, size_t size)346 BFile::ReadAt(off_t location, void* buffer, size_t size) 347 347 { 348 348 if (InitCheck() != B_OK) 349 349 return InitCheck(); … … 360 360 \return the number of bytes actually written or an error code 361 361 */ 362 362 ssize_t 363 BFile::Write(const void *buffer, size_t size)363 BFile::Write(const void* buffer, size_t size) 364 364 { 365 365 if (InitCheck() != B_OK) 366 366 return InitCheck(); … … 377 377 \return the number of bytes actually written or an error code 378 378 */ 379 379 ssize_t 380 BFile::WriteAt(off_t location, const void *buffer, size_t size)380 BFile::WriteAt(off_t location, const void* buffer, size_t size) 381 381 { 382 382 if (InitCheck() != B_OK) 383 383 return InitCheck(); -
src/kits/storage/AddOnImage.cpp
5 5 6 6 #include "AddOnImage.h" 7 7 8 8 9 // constructor 9 10 AddOnImage::AddOnImage() 10 11 : fID(-1) 11 12 { 12 13 } 13 14 15 14 16 // destructor 15 17 AddOnImage::~AddOnImage() 16 18 { 17 19 Unload(); 18 20 } 19 21 22 20 23 // Load 21 24 status_t 22 AddOnImage::Load(const char *path)25 AddOnImage::Load(const char* path) 23 26 { 24 27 Unload(); 25 28 status_t error = (path ? B_OK : B_BAD_VALUE); … … 33 36 return error; 34 37 } 35 38 39 36 40 // Unload 37 41 void 38 42 AddOnImage::Unload() … … 43 47 } 44 48 } 45 49 50 46 51 // SetID 47 52 void 48 53 AddOnImage::SetID(image_id id) … … 51 56 if (id >= 0) 52 57 fID = id; 53 58 } 54 -
src/kits/storage/AppFileInfo.cpp
26 26 using namespace std; 27 27 28 28 // attributes 29 static const char *kTypeAttribute = "BEOS:TYPE";30 static const char *kSignatureAttribute = "BEOS:APP_SIG";31 static const char *kAppFlagsAttribute = "BEOS:APP_FLAGS";32 static const char *kSupportedTypesAttribute = "BEOS:FILE_TYPES";33 static const char *kVersionInfoAttribute = "BEOS:APP_VERSION";34 static const char *kMiniIconAttribute = "BEOS:M:";35 static const char *kLargeIconAttribute = "BEOS:L:";36 static const char *kIconAttribute = "BEOS:";37 static const char *kStandardIconType = "STD_ICON";38 static const char *kIconType = "ICON";39 static const char *kCatalogEntryAttribute = "SYS:NAME";29 static const char* kTypeAttribute = "BEOS:TYPE"; 30 static const char* kSignatureAttribute = "BEOS:APP_SIG"; 31 static const char* kAppFlagsAttribute = "BEOS:APP_FLAGS"; 32 static const char* kSupportedTypesAttribute = "BEOS:FILE_TYPES"; 33 static const char* kVersionInfoAttribute = "BEOS:APP_VERSION"; 34 static const char* kMiniIconAttribute = "BEOS:M:"; 35 static const char* kLargeIconAttribute = "BEOS:L:"; 36 static const char* kIconAttribute = "BEOS:"; 37 static const char* kStandardIconType = "STD_ICON"; 38 static const char* kIconType = "ICON"; 39 static const char* kCatalogEntryAttribute = "SYS:NAME"; 40 40 41 41 // resource IDs 42 42 static const int32 kTypeResourceID = 2; … … 75 75 /*! \brief Creates an uninitialized BAppFileInfo object. 76 76 */ 77 77 BAppFileInfo::BAppFileInfo() 78 : fResources(NULL), 78 : 79 fResources(NULL), 79 80 fWhere(B_USE_BOTH_LOCATIONS) 80 81 { 81 82 } 82 83 84 83 85 // constructor 84 86 /*! \brief Creates an BAppFileInfo object and initializes it to the supplied 85 87 file. … … 90 92 91 93 \param file The file the object shall be initialized to. 92 94 */ 93 BAppFileInfo::BAppFileInfo(BFile *file) 94 : fResources(NULL), 95 BAppFileInfo::BAppFileInfo(BFile* file) 96 : 97 fResources(NULL), 95 98 fWhere(B_USE_BOTH_LOCATIONS) 96 99 { 97 100 SetTo(file); 98 101 } 99 102 103 100 104 // destructor 101 105 /*! \brief Frees all resources associated with this object. 102 106 … … 107 111 delete fResources; 108 112 } 109 113 114 110 115 // SetTo 111 116 /*! \brief Initializes the BAppFileInfo to the supplied file. 112 117 … … 174 179 return error; 175 180 } 176 181 182 177 183 // GetType 178 184 /*! \brief Gets the file's MIME type. 179 185 … … 213 219 return error; 214 220 } 215 221 222 216 223 // SetType 217 224 /*! \brief Sets the file's MIME type. 218 225 … … 228 235 - other error codes 229 236 */ 230 237 status_t 231 BAppFileInfo::SetType(const char *type)238 BAppFileInfo::SetType(const char* type) 232 239 { 233 240 // check initialization 234 241 status_t error = B_OK; … … 251 258 return error; 252 259 } 253 260 261 254 262 // GetSignature 255 263 /*! \brief Gets the file's application signature. 256 264 … … 268 276 - other error codes 269 277 */ 270 278 status_t 271 BAppFileInfo::GetSignature(char *signature) const279 BAppFileInfo::GetSignature(char* signature) const 272 280 { 273 281 // check param and initialization 274 282 status_t error = (signature ? B_OK : B_BAD_VALUE); … … 278 286 size_t read = 0; 279 287 if (error == B_OK) { 280 288 error = _ReadData(kSignatureAttribute, kSignatureResourceID, 281 B_MIME_STRING_TYPE, signature, B_MIME_TYPE_LENGTH,282 read);289 B_MIME_STRING_TYPE, signature, 290 B_MIME_TYPE_LENGTH, read); 283 291 } 284 292 // check the read data -- null terminate the string 285 293 if (error == B_OK && signature[read - 1] != '\0') { … … 291 299 return error; 292 300 } 293 301 302 294 303 // SetSignature 295 304 /*! \brief Sets the file's application signature. 296 305 … … 306 315 - other error codes 307 316 */ 308 317 status_t 309 BAppFileInfo::SetSignature(const char *signature)318 BAppFileInfo::SetSignature(const char* signature) 310 319 { 311 320 // check initialization 312 321 status_t error = B_OK; … … 388 397 - other error codes 389 398 */ 390 399 status_t 391 BAppFileInfo::SetCatalogEntry(const char *catalogEntry)400 BAppFileInfo::SetCatalogEntry(const char* catalogEntry) 392 401 { 393 402 if (InitCheck() != B_OK) 394 403 return B_NO_INIT; … … 420 429 - other error codes 421 430 */ 422 431 status_t 423 BAppFileInfo::GetAppFlags(uint32 *flags) const432 BAppFileInfo::GetAppFlags(uint32* flags) const 424 433 { 425 434 // check param and initialization 426 435 status_t error = (flags ? B_OK : B_BAD_VALUE); … … 439 448 return error; 440 449 } 441 450 451 442 452 // SetAppFlags 443 453 /*! \brief Sets the file's application flags. 444 454 \param flags The application flags to be assigned to the file. … … 462 472 return error; 463 473 } 464 474 475 465 476 // RemoveAppFlags 466 477 /*! \brief Removes the file's application flags. 467 478 \return … … 483 494 return error; 484 495 } 485 496 497 486 498 // GetSupportedTypes 487 499 /*! \brief Gets the MIME types supported by the application. 488 500 … … 501 513 - other error codes 502 514 */ 503 515 status_t 504 BAppFileInfo::GetSupportedTypes(BMessage *types) const516 BAppFileInfo::GetSupportedTypes(BMessage* types) const 505 517 { 506 518 // check param and initialization 507 519 status_t error = (types ? B_OK : B_BAD_VALUE); … … 522 534 return error; 523 535 } 524 536 537 525 538 // SetSupportedTypes 526 539 /*! \brief Sets the MIME types supported by the application. 527 540 … … 549 562 - other error codes 550 563 */ 551 564 status_t 552 BAppFileInfo::SetSupportedTypes(const BMessage *types, bool syncAll)565 BAppFileInfo::SetSupportedTypes(const BMessage* types, bool syncAll) 553 566 { 554 567 // check initialization 555 568 status_t error = B_OK; … … 562 575 error = B_OK; 563 576 if (types) { 564 577 // check param -- supported types must be valid 565 const char *type;578 const char* type; 566 579 for (int32 i = 0; 567 580 error == B_OK && types->FindString("types", i, &type) == B_OK; 568 581 i++) { … … 577 590 error = size; 578 591 } 579 592 // allocate a buffer for the flattened data 580 char *buffer = NULL;593 char* buffer = NULL; 581 594 if (error == B_OK) { 582 595 buffer = new(nothrow) char[size]; 583 596 if (!buffer) … … 603 616 return error; 604 617 } 605 618 619 606 620 // SetSupportedTypes 607 621 /*! \brief Sets the MIME types supported by the application. 608 622 … … 617 631 - other error codes 618 632 */ 619 633 status_t 620 BAppFileInfo::SetSupportedTypes(const BMessage *types)634 BAppFileInfo::SetSupportedTypes(const BMessage* types) 621 635 { 622 636 return SetSupportedTypes(types, false); 623 637 } 624 638 639 625 640 // IsSupportedType 626 641 /*! \brief Returns whether the application supports the supplied MIME type. 627 642 … … 633 648 the application, \c false otherwise. 634 649 */ 635 650 bool 636 BAppFileInfo::IsSupportedType(const char *type) const651 BAppFileInfo::IsSupportedType(const char* type) const 637 652 { 638 653 status_t error = (type ? B_OK : B_BAD_VALUE); 639 654 // get the supported types … … 647 662 // iterate through the supported types 648 663 bool found = false; 649 664 if (error == B_OK) { 650 const char *supportedType;665 const char* supportedType; 651 666 for (int32 i = 0; 652 667 !found && types.FindString("types", i, &supportedType) == B_OK; 653 668 i++) { … … 658 673 return found; 659 674 } 660 675 676 661 677 // Supports 662 678 /*! \brief Returns whether the application supports the supplied MIME type 663 679 explicitly. … … 671 687 supported by the application, \c false otherwise. 672 688 */ 673 689 bool 674 BAppFileInfo::Supports(BMimeType *type) const690 BAppFileInfo::Supports(BMimeType* type) const 675 691 { 676 692 status_t error = (type && type->InitCheck() == B_OK ? B_OK : B_BAD_VALUE); 677 693 // get the supported types … … 681 697 // iterate through the supported types 682 698 bool found = false; 683 699 if (error == B_OK) { 684 const char *supportedType;700 const char* supportedType; 685 701 for (int32 i = 0; 686 702 !found && types.FindString("types", i, &supportedType) == B_OK; 687 703 i++) { … … 691 707 return found; 692 708 } 693 709 710 694 711 // GetIcon 695 712 /*! \brief Gets the file's icon. 696 713 \param icon A pointer to a pre-allocated BBitmap of the correct dimension … … 706 723 - other error codes 707 724 */ 708 725 status_t 709 BAppFileInfo::GetIcon(BBitmap *icon, icon_size which) const726 BAppFileInfo::GetIcon(BBitmap* icon, icon_size which) const 710 727 { 711 728 return GetIconForType(NULL, icon, which); 712 729 } 713 730 731 714 732 // GetIcon 715 733 /*! \brief Gets the file's icon. 716 734 \param data The pointer in which the flat icon data will be returned. … … 727 745 return GetIconForType(NULL, data, size); 728 746 } 729 747 748 730 749 // SetIcon 731 750 /*! \brief Sets the file's icon. 732 751 … … 744 763 - other error codes 745 764 */ 746 765 status_t 747 BAppFileInfo::SetIcon(const BBitmap *icon, icon_size which)766 BAppFileInfo::SetIcon(const BBitmap* icon, icon_size which) 748 767 { 749 768 return SetIconForType(NULL, icon, which); 750 769 } 751 770 771 752 772 // SetIcon 753 773 /*! \brief Sets the file's icon. 754 774 … … 769 789 return SetIconForType(NULL, data, size); 770 790 } 771 791 792 772 793 // GetVersionInfo 773 794 /*! \brief Gets the file's version info. 774 795 \param info A pointer to a pre-allocated version_info structure into which … … 784 805 - other error codes 785 806 */ 786 807 status_t 787 BAppFileInfo::GetVersionInfo(version_info *info, version_kind kind) const808 BAppFileInfo::GetVersionInfo(version_info* info, version_kind kind) const 788 809 { 789 810 // check params and initialization 790 811 if (!info) … … 829 850 return B_OK; 830 851 } 831 852 853 832 854 // SetVersionInfo 833 855 /*! \brief Sets the file's version info. 834 856 … … 845 867 - other error codes 846 868 */ 847 869 status_t 848 BAppFileInfo::SetVersionInfo(const version_info *info, version_kind kind)870 BAppFileInfo::SetVersionInfo(const version_info* info, version_kind kind) 849 871 { 850 872 // check initialization 851 873 status_t error = B_OK; … … 897 919 return error; 898 920 } 899 921 922 900 923 // GetIconForType 901 924 /*! \brief Gets the icon the application provides for a given MIME type. 902 925 … … 1039 1062 return error; 1040 1063 } 1041 1064 1065 1042 1066 // GetIconForType 1043 1067 /*! \brief Gets the icon the application provides for a given MIME type. 1044 1068 … … 1056 1080 - other error codes 1057 1081 */ 1058 1082 status_t 1059 BAppFileInfo::GetIconForType(const char *type, uint8** data,1083 BAppFileInfo::GetIconForType(const char* type, uint8** data, 1060 1084 size_t* size) const 1061 1085 { 1062 1086 if (InitCheck() != B_OK) … … 1089 1113 return B_OK; 1090 1114 } 1091 1115 1116 1092 1117 // SetIconForType 1093 1118 /*! \brief Sets the icon the application provides for a given MIME type. 1094 1119 … … 1113 1138 - other error codes 1114 1139 */ 1115 1140 status_t 1116 BAppFileInfo::SetIconForType(const char *type, const BBitmap *icon,1141 BAppFileInfo::SetIconForType(const char* type, const BBitmap* icon, 1117 1142 icon_size which) 1118 1143 { 1119 1144 status_t error = B_OK; … … 1154 1179 } else 1155 1180 attributeString += kStandardIconType; 1156 1181 } 1157 const char *attribute = attributeString.String();1182 const char* attribute = attributeString.String(); 1158 1183 // check parameter and initialization 1159 1184 if (error == B_OK && icon 1160 1185 && (icon->InitCheck() != B_OK || icon->Bounds() != bounds)) { … … 1193 1218 return error; 1194 1219 } 1195 1220 1221 1196 1222 // SetIconForType 1197 1223 /*! \brief Sets the icon the application provides for a given MIME type. 1198 1224 … … 1234 1260 } else 1235 1261 attributeString += kIconType; 1236 1262 1237 const char *attribute = attributeString.String();1263 const char* attribute = attributeString.String(); 1238 1264 1239 1265 status_t error; 1240 1266 // write/remove the attribute … … 1254 1280 return error; 1255 1281 } 1256 1282 1283 1257 1284 // SetInfoLocation 1258 1285 /*! \brief Specifies the location where the meta data shall be stored. 1259 1286 … … 1286 1313 return (fWhere & B_USE_ATTRIBUTES) != 0; 1287 1314 } 1288 1315 1316 1289 1317 // IsUsingResources 1290 1318 /*! \brief Returns whether the object stores the meta data (also) in the 1291 1319 file's resources. … … 1298 1326 return (fWhere & B_USE_RESOURCES) != 0; 1299 1327 } 1300 1328 1329 1301 1330 // FBC 1302 1331 void BAppFileInfo::_ReservedAppFileInfo1() {} 1303 1332 void BAppFileInfo::_ReservedAppFileInfo2() {} 1304 1333 void BAppFileInfo::_ReservedAppFileInfo3() {} 1305 1334 1335 1306 1336 // = 1307 1337 /*! \brief Privatized assignment operator to prevent usage. 1308 1338 */ … … 1312 1342 return *this; 1313 1343 } 1314 1344 1345 1315 1346 // copy constructor 1316 1347 /*! \brief Privatized copy constructor to prevent usage. 1317 1348 */ … … 1319 1350 { 1320 1351 } 1321 1352 1353 1322 1354 // GetMetaMime 1323 1355 /*! \brief Initializes a BMimeType to the file's signature. 1324 1356 … … 1335 1367 - other error codes 1336 1368 */ 1337 1369 status_t 1338 BAppFileInfo::GetMetaMime(BMimeType *meta) const1370 BAppFileInfo::GetMetaMime(BMimeType* meta) const 1339 1371 { 1340 1372 char signature[B_MIME_TYPE_LENGTH]; 1341 1373 status_t error = GetSignature(signature); … … 1348 1380 return error; 1349 1381 } 1350 1382 1383 1351 1384 // _ReadData 1352 1385 /*! \brief Reads data from an attribute or resource. 1353 1386 … … 1371 1404 - error code 1372 1405 */ 1373 1406 status_t 1374 BAppFileInfo::_ReadData(const char *name, int32 id, type_code type,1375 void *buffer, size_t bufferSize,1376 size_t &bytesRead, void **allocatedBuffer) const1407 BAppFileInfo::_ReadData(const char* name, int32 id, type_code type, 1408 void* buffer, size_t bufferSize, 1409 size_t &bytesRead, void** allocatedBuffer) const 1377 1410 { 1378 1411 status_t error = B_OK; 1379 1412 … … 1443 1476 error = B_BAD_VALUE; 1444 1477 1445 1478 // load resource 1446 const void *resourceData = NULL;1479 const void* resourceData = NULL; 1447 1480 if (error == B_OK) { 1448 1481 resourceData = fResources->LoadResource(type, name, &bytesRead); 1449 1482 if (resourceData && sizeFound == bytesRead) … … 1465 1498 return error; 1466 1499 } 1467 1500 1501 1468 1502 // _WriteData 1469 1503 /*! \brief Writes data to an attribute or resource. 1470 1504 … … 1486 1520 - error code 1487 1521 */ 1488 1522 status_t 1489 BAppFileInfo::_WriteData(const char *name, int32 id, type_code type,1490 const void *buffer, size_t bufferSize, bool findID)1523 BAppFileInfo::_WriteData(const char* name, int32 id, type_code type, 1524 const void* buffer, size_t bufferSize, bool findID) 1491 1525 { 1492 1526 if (!IsUsingAttributes() && !IsUsingResources()) 1493 1527 return B_NO_INIT; … … 1535 1569 - error code 1536 1570 */ 1537 1571 status_t 1538 BAppFileInfo::_RemoveData(const char *name, type_code type)1572 BAppFileInfo::_RemoveData(const char* name, type_code type) 1539 1573 { 1540 1574 if (!IsUsingAttributes() && !IsUsingResources()) 1541 1575 return B_NO_INIT; -
src/kits/storage/EntryList.cpp
9 9 10 10 #include <EntryList.h> 11 11 12 12 13 // constructor 13 14 //! Creates a BEntryList. 14 15 /*! Does nothing at this time. … … 17 18 { 18 19 } 19 20 21 20 22 // destructor 21 23 //! Frees all resources associated with this BEntryList. 22 24 /*! Does nothing at this time. … … 25 27 { 26 28 } 27 29 30 28 31 // GetNextEntry 29 32 /*! \fn status_t BEntryList::GetNextEntry(BEntry *entry, bool traverse) 30 33 \brief Returns the BEntryList's next entry as a BEntry. … … 104 107 void BEntryList::_ReservedEntryList6() {} 105 108 void BEntryList::_ReservedEntryList7() {} 106 109 void BEntryList::_ReservedEntryList8() {} 107 108 109 110