From 1a3be0addda7879feb257fcaca56405ae1cf85e8 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 19 Oct 2021 11:29:26 -0400 Subject: [PATCH] Replace usages of B_FILE_NOT_FOUND in non-BeOS-API code. B_FILE_NOT_FOUND was deprecated in BeOS R5 in favor of B_ENTRY_NOT_FOUND, but it remained in Haiku and was never removed even conditionally, so we have accumulated a number of usages of it. This commit changes all the usages of it in new code, applications, or anything else that BeOS applications will otherwise never see, and so should be relatively safe. --- src/add-ons/kernel/file_systems/nfs4/NFS4Server.cpp | 8 ++++---- src/add-ons/kernel/file_systems/nfs4/ReplyBuilder.cpp | 2 +- .../kernel/file_systems/nfs4/ReplyInterpreter.cpp | 2 +- src/add-ons/tracker/zipomatic/ZipperThread.cpp | 2 +- src/apps/haikudepot/server/AbstractServerProcess.cpp | 4 ++-- src/bin/hey.cpp | 10 +++++----- src/kits/package/manager/RepositoryBuilder.cpp | 2 +- src/preferences/mail/AutoConfigView.cpp | 2 +- src/system/boot/platform/atari_m68k/toscalls.cpp | 1 - 9 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/add-ons/kernel/file_systems/nfs4/NFS4Server.cpp b/src/add-ons/kernel/file_systems/nfs4/NFS4Server.cpp index 726cbad354..296e2107ac 100644 --- a/src/add-ons/kernel/file_systems/nfs4/NFS4Server.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/NFS4Server.cpp @@ -341,8 +341,8 @@ NFS4Server::CallbackRecall(RequestInterpreter* request, ReplyBuilder* reply) locker.Unlock(); if (delegation == NULL) { - reply->Recall(B_FILE_NOT_FOUND); - return B_FILE_NOT_FOUND; + reply->Recall(B_ENTRY_NOT_FOUND); + return B_ENTRY_NOT_FOUND; } DelegationRecallArgs* args = new(std::nothrow) DelegationRecallArgs; @@ -383,8 +383,8 @@ NFS4Server::CallbackGetAttr(RequestInterpreter* request, ReplyBuilder* reply) locker.Unlock(); if (delegation == NULL) { - reply->GetAttr(B_FILE_NOT_FOUND, 0, 0, 0); - return B_FILE_NOT_FOUND; + reply->GetAttr(B_ENTRY_NOT_FOUND, 0, 0, 0); + return B_ENTRY_NOT_FOUND; } struct stat st; diff --git a/src/add-ons/kernel/file_systems/nfs4/ReplyBuilder.cpp b/src/add-ons/kernel/file_systems/nfs4/ReplyBuilder.cpp index 9dc3d30948..5c3114e59d 100644 --- a/src/add-ons/kernel/file_systems/nfs4/ReplyBuilder.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/ReplyBuilder.cpp @@ -114,7 +114,7 @@ ReplyBuilder::_HaikuErrorToNFS4(status_t error) { switch (error) { case B_OK: return NFS4_OK; - case B_FILE_NOT_FOUND: return NFS4ERR_BADHANDLE; + case B_ENTRY_NOT_FOUND: return NFS4ERR_BADHANDLE; case B_NOT_SUPPORTED: return NFS4ERR_OP_ILLEGAL; default: return NFS4ERR_RESOURCE; } diff --git a/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp b/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp index 051b8b2bf3..ae8b0bcbd7 100644 --- a/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp @@ -946,7 +946,7 @@ ReplyInterpreter::_NFS4ErrorToHaiku(uint32 x) case NFS4ERR_STALE: case NFS4ERR_FHEXPIRED: - return B_FILE_NOT_FOUND; + return B_ENTRY_NOT_FOUND; // ... default: return B_ERROR; } diff --git a/src/add-ons/tracker/zipomatic/ZipperThread.cpp b/src/add-ons/tracker/zipomatic/ZipperThread.cpp index bacfc5c911..e2cb04ee5c 100644 --- a/src/add-ons/tracker/zipomatic/ZipperThread.cpp +++ b/src/add-ons/tracker/zipomatic/ZipperThread.cpp @@ -418,7 +418,7 @@ ZipperThread::_SelectInTracker(int32 tryNumber) BEntry entry(&fOutputEntryRef); if (!entry.Exists()) - return B_FILE_NOT_FOUND; + return B_ENTRY_NOT_FOUND; entry.GetParent(&entry); entry.GetRef(&parentRef); diff --git a/src/apps/haikudepot/server/AbstractServerProcess.cpp b/src/apps/haikudepot/server/AbstractServerProcess.cpp index 80ea1a906b..cb788d4744 100644 --- a/src/apps/haikudepot/server/AbstractServerProcess.cpp +++ b/src/apps/haikudepot/server/AbstractServerProcess.cpp @@ -108,7 +108,7 @@ AbstractServerProcess::IfModifiedSinceHeaderValue(BString& headerValue, if (ENOENT != errno) return B_ERROR; - return B_FILE_NOT_FOUND; + return B_ENTRY_NOT_FOUND; } if (s.st_size == 0) @@ -193,7 +193,7 @@ AbstractServerProcess::ParseJsonFromFileWithListener( if (file == NULL) { HDERROR("[%s] unable to find the meta data file at [%s]", Name(), path.Path()); - return B_FILE_NOT_FOUND; + return B_ENTRY_NOT_FOUND; } BFileIO rawInput(file, true); // takes ownership diff --git a/src/bin/hey.cpp b/src/bin/hey.cpp index 9c3d1b0c3a..7a49b4a863 100644 --- a/src/bin/hey.cpp +++ b/src/bin/hey.cpp @@ -594,7 +594,7 @@ Hey(BMessenger* target, char* argv[], int32* argx, int32 argc, BMessage* reply) (*argx)++; result = add_data(&the_message, argv, argx); if (result != B_OK) { - if (result == B_FILE_NOT_FOUND) { + if (result == B_ENTRY_NOT_FOUND) { if (!silent) fprintf(stderr, "File not found!\n"); } else if (!silent) @@ -635,7 +635,7 @@ add_with(BMessage *to_message, char *argv[], int32 *argx, int32 argc) do { result = add_data(to_message, argv, argx); if (result != B_OK) { - if (result == B_FILE_NOT_FOUND) { + if (result == B_ENTRY_NOT_FOUND) { if (!silent) fprintf(stderr, "File not found!\n"); } else { @@ -946,13 +946,13 @@ add_data(BMessage *to_message, char *argv[], int32 *argx) valuestring[strlen(valuestring) - 1] = 0; if (get_ref_for_path(valuestring + 5, &file_ref) != B_OK) - return B_FILE_NOT_FOUND; + return B_ENTRY_NOT_FOUND; // check if the ref is valid BEntry entry; if (entry.SetTo(&file_ref) != B_OK) - return B_FILE_NOT_FOUND; - //if(!entry.Exists()) return B_FILE_NOT_FOUND; + return B_ENTRY_NOT_FOUND; + //if(!entry.Exists()) return B_ENTRY_NOT_FOUND; // add both ways, refsreceived needs it as "refs" while scripting needs "data" to_message->AddRef("refs", &file_ref); diff --git a/src/kits/package/manager/RepositoryBuilder.cpp b/src/kits/package/manager/RepositoryBuilder.cpp index fe9bbe395d..7977072345 100644 --- a/src/kits/package/manager/RepositoryBuilder.cpp +++ b/src/kits/package/manager/RepositoryBuilder.cpp @@ -146,7 +146,7 @@ BRepositoryBuilder::AddPackage(const char* path, BSolverPackage** _package) BEntry entry(path, true); if (!entry.Exists()) { - DIE_DETAILS(errorListener.Errors(), B_FILE_NOT_FOUND, + DIE_DETAILS(errorListener.Errors(), B_ENTRY_NOT_FOUND, "the package data file does not exist at \"%s\"", path); } diff --git a/src/preferences/mail/AutoConfigView.cpp b/src/preferences/mail/AutoConfigView.cpp index 1fb74208e2..3251bf8263 100644 --- a/src/preferences/mail/AutoConfigView.cpp +++ b/src/preferences/mail/AutoConfigView.cpp @@ -214,7 +214,7 @@ AutoConfigView::_GetSMTPAddOnRef(entry_ref *ref) return B_OK; } - return B_FILE_NOT_FOUND; + return B_ENTRY_NOT_FOUND; } diff --git a/src/system/boot/platform/atari_m68k/toscalls.cpp b/src/system/boot/platform/atari_m68k/toscalls.cpp index 0b3517879a..70b3c95680 100644 --- a/src/system/boot/platform/atari_m68k/toscalls.cpp +++ b/src/system/boot/platform/atari_m68k/toscalls.cpp @@ -71,7 +71,6 @@ toserror(int32 err) case -32: /* EINVFN - Invalid function */ return B_BAD_VALUE; case -33: /* EFILNF - File not found */ - return B_FILE_NOT_FOUND; case -34: /* EPTHNF - Path not found */ return B_ENTRY_NOT_FOUND; case -35: /* ENHNDL - No more handles */