diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 65e9b66ada..20041da86f 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -722,6 +722,10 @@ namespace vcpkg "command:\n" "{command_line}\n" "failed with the following results:"); + DECLARE_MESSAGE(ComparingUtf8Decoders, + (), + "", + "Comparing Utf8Decoders with different provenance; this is always an error"); DECLARE_MESSAGE(CompressFolderFailed, (msg::path), "", "Failed to compress folder \"{path}\":"); DECLARE_MESSAGE(ComputingInstallPlan, (), "", "Computing installation plan..."); DECLARE_MESSAGE(ConflictingFiles, @@ -730,6 +734,7 @@ namespace vcpkg "The following files are already installed in {path} and are in conflict with {spec}"); DECLARE_MESSAGE(ConflictingValuesForOption, (msg::option), "", "conflicting values specified for '--{option}'."); DECLARE_MESSAGE(ConstraintViolation, (), "", "Found a constraint violation:"); + DECLARE_MESSAGE(ContinueCodeUnitInStart, (), "", "found continue code unit in start position"); DECLARE_MESSAGE(ControlAndManifestFilesPresent, (msg::path), "", @@ -792,6 +797,7 @@ namespace vcpkg DECLARE_MESSAGE(EmailVcpkgTeam, (msg::url), "", "Send an email to {url} with any feedback."); DECLARE_MESSAGE(EmptyArg, (msg::option), "", "The option --{option} must be passed a non-empty argument."); DECLARE_MESSAGE(EmptyLicenseExpression, (), "", "SPDX license expression was empty."); + DECLARE_MESSAGE(EndOfStringInCodeUnit, (), "", "found end of string in middle of code point"); DECLARE_MESSAGE(EnvStrFailedToExtract, (), "", "could not expand the environment string:"); DECLARE_MESSAGE(ErrorDetectingCompilerInfo, (msg::path), @@ -862,6 +868,10 @@ namespace vcpkg DECLARE_MESSAGE(ExceededRecursionDepth, (), "", "Recursion depth exceeded."); DECLARE_MESSAGE(ExcludedPackage, (msg::spec), "", "Excluded {spec}"); DECLARE_MESSAGE(ExcludedPackages, (), "", "The following packages are excluded:"); + DECLARE_MESSAGE(ExpectedAtMostOneSetOfTags, + (msg::count, msg::old_value, msg::new_value, msg::value), + "{old_value} is a left tag and {new_value} is the right tag. {value} is the input.", + "Found {count} sets of {old_value}.*{new_value} but expected at most 1, in block:\n{value}"); DECLARE_MESSAGE( ExpectedCascadeFailure, (msg::expected, msg::actual), @@ -873,6 +883,10 @@ namespace vcpkg "{expected} is a locale-invariant delimiter; for example, the ':' or '=' in 'zlib:x64-windows=skip'", "expected '{expected}' here"); DECLARE_MESSAGE(ExpectedFailOrSkip, (), "", "expected 'fail', 'skip', or 'pass' here"); + DECLARE_MESSAGE(ExpectedOneSetOfTags, + (msg::count, msg::old_value, msg::new_value, msg::value), + "{old_value} is a left tag and {new_value} is the right tag. {value} is the input.", + "Found {count} sets of {old_value}.*{new_value} but expected exactly 1, in block:\n{value}"); DECLARE_MESSAGE(ExpectedPortName, (), "", "expected a port name here"); DECLARE_MESSAGE(ExpectedStatusField, (), "", "Expected 'status' field in status paragraph"); DECLARE_MESSAGE(ExpectedTripletName, (), "", "expected a triplet name here"); @@ -1024,6 +1038,7 @@ namespace vcpkg (msg::command_name, msg::expected, msg::actual), "'{expected}' is the required number of arguments. '{actual}' is the number of arguments provided.", "'{command_name}' requires '{expected}' arguments, but '{actual}' were provided."); + DECLARE_MESSAGE(IncrementedUtf8Decoder, (), "", "Incremented Utf8Decoder at the end of the string"); DECLARE_MESSAGE(InfoSetEnvVar, (msg::env_var), "In this context 'editor' means IDE", @@ -1123,6 +1138,8 @@ namespace vcpkg "invalid argument: binary config '{binary_source}' requires a SAS token without a " "preceeding '?' as the second argument"); DECLARE_MESSAGE(InvalidBuildInfo, (msg::error_msg), "", "Invalid BUILD_INFO file for package: {error_msg}"); + DECLARE_MESSAGE(InvalidCodePoint, (), "", "Invalid code point passed to utf8_encoded_code_point_count"); + DECLARE_MESSAGE(InvalidCodeUnit, (), "", "invalid code unit"); DECLARE_MESSAGE(InvalidCommandArgSort, (), "", @@ -1311,6 +1328,7 @@ namespace vcpkg DECLARE_MESSAGE(NewVersionCannotBeEmpty, (), "", "--version cannot be empty."); DECLARE_MESSAGE(NoArgumentsForOption, (msg::option), "", "The option --{option} does not accept an argument."); DECLARE_MESSAGE(NoCachedPackages, (), "", "No packages are cached."); + DECLARE_MESSAGE(NoError, (), "", "no error"); DECLARE_MESSAGE(NoInstalledPackages, (), "The name 'search' is the name of a command that is not localized.", @@ -1351,6 +1369,10 @@ namespace vcpkg (msg::vendor), "", "Packing {vendor} failed. Use --debug for more information."); + DECLARE_MESSAGE(PairedSurrogatesAreInvalid, + (), + "", + "trailing surrogate following leading surrogate (paired surrogates are invalid)"); DECLARE_MESSAGE(ParseControlErrorInfoInvalidFields, (), "", "The following fields were not expected:"); DECLARE_MESSAGE(ParseControlErrorInfoMissingFields, (), "", "The following fields were missing:"); DECLARE_MESSAGE(ParseControlErrorInfoTypesEntry, @@ -1471,6 +1493,7 @@ namespace vcpkg (msg::env_var), "", "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); + DECLARE_MESSAGE(StartCodeUnitInContinue, (), "", "found start code unit in continue position"); DECLARE_MESSAGE(StoredBinaryCache, (msg::path), "", "Stored binary cache: \"{path}\""); DECLARE_MESSAGE(StoreOptionMissingSha, (), "", "--store option is invalid without a sha512"); DECLARE_MESSAGE(SuggestGitPull, (), "", "The result may be outdated. Run `git pull` to get the latest results."); @@ -1569,6 +1592,7 @@ namespace vcpkg (msg::value), "'{value}' is the short option given", "short options are not supported: '{value}'"); + DECLARE_MESSAGE(UnsupportedSyntaxInCDATA, (), "", "]]> is not supported in CDATA block"); DECLARE_MESSAGE(UnsupportedSystemName, (msg::system_name), "", @@ -1642,6 +1666,7 @@ namespace vcpkg "'--' at the beginning must be preserved", "-- Using community triplet {triplet}. This triplet configuration is not guaranteed to succeed."); DECLARE_MESSAGE(UsingManifestAt, (msg::path), "", "Using manifest file at {path}."); + DECLARE_MESSAGE(Utf8ConversionFailed, (), "", "Failed to convert to UTF-8"); DECLARE_MESSAGE(VcpkgCeIsExperimental, (), "", diff --git a/locales/messages.en.json b/locales/messages.en.json index 1786988818..6ac97db1ca 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -85,11 +85,13 @@ "ClearingContents": "Clearing contents of {path}", "CmakeTargetsExcluded": "note: {count} additional targets are not displayed.", "CommandFailed": "command:\n{command_line}\nfailed with the following results:", + "ComparingUtf8Decoders": "Comparing Utf8Decoders with different provenance; this is always an error", "CompressFolderFailed": "Failed to compress folder \"{path}\":", "ComputingInstallPlan": "Computing installation plan...", "ConflictingFiles": "The following files are already installed in {path} and are in conflict with {spec}", "ConflictingValuesForOption": "conflicting values specified for '--{option}'.", "ConstraintViolation": "Found a constraint violation:", + "ContinueCodeUnitInStart": "found continue code unit in start position", "ControlAndManifestFilesPresent": "Both a manifest file and a CONTROL file exist in port directory: {path}", "CopyrightIsDir": "`{path}` being a directory is deprecated.", "CorruptedDatabase": "Database corrupted.", @@ -118,6 +120,7 @@ "EmailVcpkgTeam": "Send an email to {url} with any feedback.", "EmptyArg": "The option --{option} must be passed a non-empty argument.", "EmptyLicenseExpression": "SPDX license expression was empty.", + "EndOfStringInCodeUnit": "found end of string in middle of code point", "EnvStrFailedToExtract": "could not expand the environment string:", "ErrorDetectingCompilerInfo": "while detecting compiler information:\nThe log file content at \"{path}\" is:", "ErrorIndividualPackagesUnsupported": "In manifest mode, `vcpkg install` does not support individual package arguments.\nTo install additional packages, edit vcpkg.json and then run `vcpkg install` without any package arguments.", @@ -143,9 +146,11 @@ "ExceededRecursionDepth": "Recursion depth exceeded.", "ExcludedPackage": "Excluded {spec}", "ExcludedPackages": "The following packages are excluded:", + "ExpectedAtMostOneSetOfTags": "Found {count} sets of {old_value}.*{new_value} but expected at most 1, in block:\n{value}", "ExpectedCascadeFailure": "Expected {expected} cascade failure, but there were {actual} cascade failures.", "ExpectedCharacterHere": "expected '{expected}' here", "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", + "ExpectedOneSetOfTags": "Found {count} sets of {old_value}.*{new_value} but expected exactly 1, in block:\n{value}", "ExpectedPortName": "expected a port name here", "ExpectedStatusField": "Expected 'status' field in status paragraph", "ExpectedTripletName": "expected a triplet name here", @@ -225,6 +230,7 @@ "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", "ImproperShaLength": "SHA512's must be 128 hex characters: {value}", "IncorrectNumberOfArgs": "'{command_name}' requires '{expected}' arguments, but '{actual}' were provided.", + "IncrementedUtf8Decoder": "Incremented Utf8Decoder at the end of the string", "InfoSetEnvVar": "You can also set the environment variable '{env_var}' to your editor of choice.", "InitRegistryFailedNoRepo": "Could not create a registry at {path} because this is not a git repository root.\nUse `git init {command_line}` to create a git repository in this folder.", "InstallFailed": "failed: {path}: {error_msg}", @@ -258,6 +264,8 @@ "InvalidArgumentRequiresTwoOrThreeArguments": "invalid argument: binary config '{binary_source}' requires 2 or 3 arguments", "InvalidArgumentRequiresValidToken": "invalid argument: binary config '{binary_source}' requires a SAS token without a preceeding '?' as the second argument", "InvalidBuildInfo": "Invalid BUILD_INFO file for package: {error_msg}", + "InvalidCodePoint": "Invalid code point passed to utf8_encoded_code_point_count", + "InvalidCodeUnit": "invalid code unit", "InvalidCommandArgSort": "Value of --sort must be one of 'lexicographical', 'topological', 'reverse'.", "InvalidCommitId": "Invalid commit id {value}", "InvalidFileType": "failed: {path} cannot handle file type", @@ -317,6 +325,7 @@ "NewVersionCannotBeEmpty": "--version cannot be empty.", "NoArgumentsForOption": "The option --{option} does not accept an argument.", "NoCachedPackages": "No packages are cached.", + "NoError": "no error", "NoInstalledPackages": "No packages are installed. Did you mean `search`?", "NoLocalizationForMessages": "No localized messages for the following: ", "NoOutdatedPackages": "There are no outdated packages.", @@ -339,6 +348,7 @@ "PackagesToRebuildSuggestRecurse": "If you are sure you want to rebuild the above packages, run the command with the --recurse option.", "PackagesToRemove": "The following packages will be removed:", "PackingVendorFailed": "Packing {vendor} failed. Use --debug for more information.", + "PairedSurrogatesAreInvalid": "trailing surrogate following leading surrogate (paired surrogates are invalid)", "ParseControlErrorInfoInvalidFields": "The following fields were not expected:", "ParseControlErrorInfoMissingFields": "The following fields were missing:", "ParseControlErrorInfoTypesEntry": "{value} was expected to be {expected}", @@ -378,6 +388,7 @@ "SpecifyDirectoriesWhenSearching": "Specify directories to be used when searching for ports.\n(also: '{env_var}')", "SpecifyHostArch": "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", "SpecifyTargetArch": "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", + "StartCodeUnitInContinue": "found start code unit in continue position", "StoreOptionMissingSha": "--store option is invalid without a sha512", "StoredBinaryCache": "Stored binary cache: \"{path}\"", "SuggestGitPull": "The result may be outdated. Run `git pull` to get the latest results.", @@ -410,6 +421,7 @@ "UnsupportedPortDependency": "- dependency {value} is not supported.", "UnsupportedPortFeature": "{spec} is only supported on '{supports_expression}'", "UnsupportedShortOptions": "short options are not supported: '{value}'", + "UnsupportedSyntaxInCDATA": "]]> is not supported in CDATA block", "UnsupportedSystemName": "Could not map VCPKG_CMAKE_SYSTEM_NAME '{system_name}' to a vcvarsall platform. Supported system names are '', 'Windows' and 'WindowsStore'.", "UnsupportedToolchain": "in triplet {triplet}: Unable to find a valid toolchain for requested target architecture {arch}.\nThe selected Visual Studio instance is at: {path}\nThe available toolchain combinations are: {list}", "UpdateBaselineAddBaselineNoManifest": "the --{option} switch was passed, but there is no manifest file to add a `builtin-baseline` field to.", @@ -430,6 +442,7 @@ "UserWideIntegrationRemoved": "User-wide integration was removed.", "UsingCommunityTriplet": "-- Using community triplet {triplet}. This triplet configuration is not guaranteed to succeed.", "UsingManifestAt": "Using manifest file at {path}.", + "Utf8ConversionFailed": "Failed to convert to UTF-8", "VSExaminedInstances": "The following Visual Studio instances were considered:", "VSExaminedPaths": "The following paths were examined for Visual Studio instances:", "VSNoInstances": "Could not locate a complete Visual Studio instance", diff --git a/locales/messages.json b/locales/messages.json index 7dd1b637b6..e25f61694c 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -149,6 +149,7 @@ "_CmakeTargetsExcluded.comment": "An example of {count} is 42.", "CommandFailed": "command:\n{command_line}\nfailed with the following results:", "_CommandFailed.comment": "An example of {command_line} is vcpkg install zlib.", + "ComparingUtf8Decoders": "Comparing Utf8Decoders with different provenance; this is always an error", "CompressFolderFailed": "Failed to compress folder \"{path}\":", "_CompressFolderFailed.comment": "An example of {path} is /foo/bar.", "ComputingInstallPlan": "Computing installation plan...", @@ -157,6 +158,7 @@ "ConflictingValuesForOption": "conflicting values specified for '--{option}'.", "_ConflictingValuesForOption.comment": "An example of {option} is editable.", "ConstraintViolation": "Found a constraint violation:", + "ContinueCodeUnitInStart": "found continue code unit in start position", "ControlAndManifestFilesPresent": "Both a manifest file and a CONTROL file exist in port directory: {path}", "_ControlAndManifestFilesPresent.comment": "An example of {path} is /foo/bar.", "CopyrightIsDir": "`{path}` being a directory is deprecated.", @@ -208,6 +210,7 @@ "EmptyArg": "The option --{option} must be passed a non-empty argument.", "_EmptyArg.comment": "An example of {option} is editable.", "EmptyLicenseExpression": "SPDX license expression was empty.", + "EndOfStringInCodeUnit": "found end of string in middle of code point", "EnvStrFailedToExtract": "could not expand the environment string:", "ErrorDetectingCompilerInfo": "while detecting compiler information:\nThe log file content at \"{path}\" is:", "_ErrorDetectingCompilerInfo.comment": "An example of {path} is /foo/bar.", @@ -248,11 +251,15 @@ "ExcludedPackage": "Excluded {spec}", "_ExcludedPackage.comment": "An example of {spec} is zlib:x64-windows.", "ExcludedPackages": "The following packages are excluded:", + "ExpectedAtMostOneSetOfTags": "Found {count} sets of {old_value}.*{new_value} but expected at most 1, in block:\n{value}", + "_ExpectedAtMostOneSetOfTags.comment": "{old_value} is a left tag and {new_value} is the right tag. {value} is the input. An example of {count} is 42.", "ExpectedCascadeFailure": "Expected {expected} cascade failure, but there were {actual} cascade failures.", "_ExpectedCascadeFailure.comment": "{expected} is the expected number of cascade failures and {actual} is the actual number of cascade failures.", "ExpectedCharacterHere": "expected '{expected}' here", "_ExpectedCharacterHere.comment": "{expected} is a locale-invariant delimiter; for example, the ':' or '=' in 'zlib:x64-windows=skip'", "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", + "ExpectedOneSetOfTags": "Found {count} sets of {old_value}.*{new_value} but expected exactly 1, in block:\n{value}", + "_ExpectedOneSetOfTags.comment": "{old_value} is a left tag and {new_value} is the right tag. {value} is the input. An example of {count} is 42.", "ExpectedPortName": "expected a port name here", "ExpectedStatusField": "Expected 'status' field in status paragraph", "ExpectedTripletName": "expected a triplet name here", @@ -367,6 +374,7 @@ "_ImproperShaLength.comment": "{value} is a sha.", "IncorrectNumberOfArgs": "'{command_name}' requires '{expected}' arguments, but '{actual}' were provided.", "_IncorrectNumberOfArgs.comment": "'{expected}' is the required number of arguments. '{actual}' is the number of arguments provided. An example of {command_name} is install.", + "IncrementedUtf8Decoder": "Incremented Utf8Decoder at the end of the string", "InfoSetEnvVar": "You can also set the environment variable '{env_var}' to your editor of choice.", "_InfoSetEnvVar.comment": "In this context 'editor' means IDE An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "InitRegistryFailedNoRepo": "Could not create a registry at {path} because this is not a git repository root.\nUse `git init {command_line}` to create a git repository in this folder.", @@ -424,6 +432,8 @@ "_InvalidArgumentRequiresValidToken.comment": "An example of {binary_source} is azblob.", "InvalidBuildInfo": "Invalid BUILD_INFO file for package: {error_msg}", "_InvalidBuildInfo.comment": "An example of {error_msg} is File Not Found.", + "InvalidCodePoint": "Invalid code point passed to utf8_encoded_code_point_count", + "InvalidCodeUnit": "invalid code unit", "InvalidCommandArgSort": "Value of --sort must be one of 'lexicographical', 'topological', 'reverse'.", "InvalidCommitId": "Invalid commit id {value}", "_InvalidCommitId.comment": "'{value}' is a commit id.", @@ -519,6 +529,7 @@ "NoArgumentsForOption": "The option --{option} does not accept an argument.", "_NoArgumentsForOption.comment": "An example of {option} is editable.", "NoCachedPackages": "No packages are cached.", + "NoError": "no error", "NoInstalledPackages": "No packages are installed. Did you mean `search`?", "_NoInstalledPackages.comment": "The name 'search' is the name of a command that is not localized.", "NoLocalizationForMessages": "No localized messages for the following: ", @@ -552,6 +563,7 @@ "PackagesToRemove": "The following packages will be removed:", "PackingVendorFailed": "Packing {vendor} failed. Use --debug for more information.", "_PackingVendorFailed.comment": "An example of {vendor} is Azure.", + "PairedSurrogatesAreInvalid": "trailing surrogate following leading surrogate (paired surrogates are invalid)", "ParseControlErrorInfoInvalidFields": "The following fields were not expected:", "ParseControlErrorInfoMissingFields": "The following fields were missing:", "ParseControlErrorInfoTypesEntry": "{value} was expected to be {expected}", @@ -620,6 +632,7 @@ "_SpecifyHostArch.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "SpecifyTargetArch": "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", "_SpecifyTargetArch.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", + "StartCodeUnitInContinue": "found start code unit in continue position", "StoreOptionMissingSha": "--store option is invalid without a sha512", "StoredBinaryCache": "Stored binary cache: \"{path}\"", "_StoredBinaryCache.comment": "An example of {path} is /foo/bar.", @@ -675,6 +688,7 @@ "_UnsupportedPortFeature.comment": "An example of {spec} is zlib:x64-windows. An example of {supports_expression} is windows & !static.", "UnsupportedShortOptions": "short options are not supported: '{value}'", "_UnsupportedShortOptions.comment": "'{value}' is the short option given", + "UnsupportedSyntaxInCDATA": "]]> is not supported in CDATA block", "UnsupportedSystemName": "Could not map VCPKG_CMAKE_SYSTEM_NAME '{system_name}' to a vcvarsall platform. Supported system names are '', 'Windows' and 'WindowsStore'.", "_UnsupportedSystemName.comment": "An example of {system_name} is Darwin.", "UnsupportedToolchain": "in triplet {triplet}: Unable to find a valid toolchain for requested target architecture {arch}.\nThe selected Visual Studio instance is at: {path}\nThe available toolchain combinations are: {list}", @@ -710,6 +724,7 @@ "_UsingCommunityTriplet.comment": "'--' at the beginning must be preserved An example of {triplet} is x64-windows.", "UsingManifestAt": "Using manifest file at {path}.", "_UsingManifestAt.comment": "An example of {path} is /foo/bar.", + "Utf8ConversionFailed": "Failed to convert to UTF-8", "VSExaminedInstances": "The following Visual Studio instances were considered:", "VSExaminedPaths": "The following paths were examined for Visual Studio instances:", "VSNoInstances": "Could not locate a complete Visual Studio instance", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index d5f9c19d7b..4f39bafb4f 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -467,11 +467,13 @@ namespace vcpkg REGISTER_MESSAGE(CMakeTargetsUsageHeuristicMessage); REGISTER_MESSAGE(CMakeToolChainFile); REGISTER_MESSAGE(CommandFailed); + REGISTER_MESSAGE(ComparingUtf8Decoders); REGISTER_MESSAGE(CompressFolderFailed); REGISTER_MESSAGE(ComputingInstallPlan); REGISTER_MESSAGE(ConflictingFiles); REGISTER_MESSAGE(ConflictingValuesForOption); REGISTER_MESSAGE(ConstraintViolation); + REGISTER_MESSAGE(ContinueCodeUnitInStart); REGISTER_MESSAGE(ControlAndManifestFilesPresent); REGISTER_MESSAGE(CopyrightIsDir); REGISTER_MESSAGE(CorruptedDatabase); @@ -499,6 +501,7 @@ namespace vcpkg REGISTER_MESSAGE(EmailVcpkgTeam); REGISTER_MESSAGE(EmptyArg); REGISTER_MESSAGE(EmptyLicenseExpression); + REGISTER_MESSAGE(EndOfStringInCodeUnit); REGISTER_MESSAGE(EnvStrFailedToExtract); REGISTER_MESSAGE(ErrorDetectingCompilerInfo); REGISTER_MESSAGE(ErrorIndividualPackagesUnsupported); @@ -523,9 +526,11 @@ namespace vcpkg REGISTER_MESSAGE(ExceededRecursionDepth); REGISTER_MESSAGE(ExcludedPackage); REGISTER_MESSAGE(ExcludedPackages); + REGISTER_MESSAGE(ExpectedAtMostOneSetOfTags); REGISTER_MESSAGE(ExpectedCascadeFailure); REGISTER_MESSAGE(ExpectedCharacterHere); REGISTER_MESSAGE(ExpectedFailOrSkip); + REGISTER_MESSAGE(ExpectedOneSetOfTags); REGISTER_MESSAGE(ExpectedPortName); REGISTER_MESSAGE(ExpectedStatusField); REGISTER_MESSAGE(ExpectedTripletName); @@ -603,6 +608,7 @@ namespace vcpkg REGISTER_MESSAGE(IllegalPlatformSpec); REGISTER_MESSAGE(ImproperShaLength); REGISTER_MESSAGE(IncorrectNumberOfArgs); + REGISTER_MESSAGE(IncrementedUtf8Decoder); REGISTER_MESSAGE(InfoSetEnvVar); REGISTER_MESSAGE(InitRegistryFailedNoRepo); REGISTER_MESSAGE(InstalledBy); @@ -634,6 +640,8 @@ namespace vcpkg REGISTER_MESSAGE(InvalidArgumentRequiresTwoOrThreeArguments); REGISTER_MESSAGE(InvalidArgumentRequiresValidToken); REGISTER_MESSAGE(InvalidBuildInfo); + REGISTER_MESSAGE(InvalidCodePoint); + REGISTER_MESSAGE(InvalidCodeUnit); REGISTER_MESSAGE(InvalidCommandArgSort); REGISTER_MESSAGE(InvalidCommitId); REGISTER_MESSAGE(InvalidFilename); @@ -692,6 +700,7 @@ namespace vcpkg REGISTER_MESSAGE(NewVersionCannotBeEmpty); REGISTER_MESSAGE(NoArgumentsForOption); REGISTER_MESSAGE(NoCachedPackages); + REGISTER_MESSAGE(NoError); REGISTER_MESSAGE(NoInstalledPackages); REGISTER_MESSAGE(NoLocalizationForMessages); REGISTER_MESSAGE(NoOutdatedPackages); @@ -713,6 +722,7 @@ namespace vcpkg REGISTER_MESSAGE(PackagesToRebuildSuggestRecurse); REGISTER_MESSAGE(PackagesToRemove); REGISTER_MESSAGE(PackingVendorFailed); + REGISTER_MESSAGE(PairedSurrogatesAreInvalid); REGISTER_MESSAGE(ParseControlErrorInfoInvalidFields); REGISTER_MESSAGE(ParseControlErrorInfoMissingFields); REGISTER_MESSAGE(ParseControlErrorInfoTypesEntry); @@ -751,6 +761,7 @@ namespace vcpkg REGISTER_MESSAGE(SpecifyDirectoriesWhenSearching); REGISTER_MESSAGE(SpecifyHostArch); REGISTER_MESSAGE(SpecifyTargetArch); + REGISTER_MESSAGE(StartCodeUnitInContinue); REGISTER_MESSAGE(StoredBinaryCache); REGISTER_MESSAGE(StoreOptionMissingSha); REGISTER_MESSAGE(SuggestGitPull); @@ -783,6 +794,7 @@ namespace vcpkg REGISTER_MESSAGE(UnsupportedPortDependency); REGISTER_MESSAGE(UnsupportedPortFeature); REGISTER_MESSAGE(UnsupportedShortOptions); + REGISTER_MESSAGE(UnsupportedSyntaxInCDATA); REGISTER_MESSAGE(UnsupportedSystemName); REGISTER_MESSAGE(UnsupportedToolchain); REGISTER_MESSAGE(UpdateBaselineAddBaselineNoManifest); @@ -803,6 +815,7 @@ namespace vcpkg REGISTER_MESSAGE(UserWideIntegrationRemoved); REGISTER_MESSAGE(UsingCommunityTriplet); REGISTER_MESSAGE(UsingManifestAt); + REGISTER_MESSAGE(Utf8ConversionFailed); REGISTER_MESSAGE(VcpkgCeIsExperimental); REGISTER_MESSAGE(VcpkgCommitTableHeader); REGISTER_MESSAGE(VcpkgCompletion); diff --git a/src/vcpkg/base/strings.cpp b/src/vcpkg/base/strings.cpp index 779a180280..3da693aad5 100644 --- a/src/vcpkg/base/strings.cpp +++ b/src/vcpkg/base/strings.cpp @@ -156,10 +156,11 @@ void Strings::to_utf8(std::string& output, const wchar_t* w, size_t size_in_char if (size <= 0) { unsigned long last_error = ::GetLastError(); - Checks::exit_with_message(VCPKG_LINE_INFO, - "Failed to convert to UTF-8. %08lX %s", - last_error, - std::system_category().message(static_cast(last_error))); + Checks::msg_exit_with_message(VCPKG_LINE_INFO, + msg::format(msgUtf8ConversionFailed) + .append_raw(std::system_category().message(static_cast(last_error))) + .append_raw("\n") + .append_raw(std::system_category().message(static_cast(last_error)))); } output.resize(size); @@ -352,26 +353,26 @@ std::vector Strings::find_all_enclosed(StringView input, StringView StringView Strings::find_exactly_one_enclosed(StringView input, StringView left_tag, StringView right_tag) { std::vector result = find_all_enclosed(input, left_tag, right_tag); - Checks::check_maybe_upgrade(VCPKG_LINE_INFO, - result.size() == 1, - "Found %d sets of %s.*%s but expected exactly 1, in block:\n%s", - result.size(), - left_tag, - right_tag, - input); + Checks::msg_check_maybe_upgrade(VCPKG_LINE_INFO, + result.size() == 1, + msgExpectedOneSetOfTags, + msg::count = result.size(), + msg::old_value = left_tag, + msg::new_value = right_tag, + msg::value = input); return result.front(); } Optional Strings::find_at_most_one_enclosed(StringView input, StringView left_tag, StringView right_tag) { std::vector result = find_all_enclosed(input, left_tag, right_tag); - Checks::check_maybe_upgrade(VCPKG_LINE_INFO, - result.size() <= 1, - "Found %d sets of %s.*%s but expected at most 1, in block:\n%s", - result.size(), - left_tag, - right_tag, - input); + Checks::msg_check_maybe_upgrade(VCPKG_LINE_INFO, + result.size() <= 1, + msgExpectedAtMostOneSetOfTags, + msg::count = result.size(), + msg::old_value = left_tag, + msg::new_value = right_tag, + msg::value = input); if (result.empty()) { diff --git a/src/vcpkg/base/unicode.cpp b/src/vcpkg/base/unicode.cpp index b0f772d449..bd01d90194 100644 --- a/src/vcpkg/base/unicode.cpp +++ b/src/vcpkg/base/unicode.cpp @@ -53,8 +53,9 @@ namespace vcpkg::Unicode } else { - vcpkg::Checks::exit_with_message( - VCPKG_LINE_INFO, "Invalid code point passed to utf8_encoded_code_point_count (%x)", code_point); + vcpkg::Checks::msg_exit_with_message( + VCPKG_LINE_INFO, + msg::format(msgInvalidCodePoint).append_raw(fmt::format("({:x})", static_cast(code_point)))); } } @@ -190,15 +191,15 @@ namespace vcpkg::Unicode { switch (static_cast(condition)) { - case utf8_errc::NoError: return "no error"; - case utf8_errc::InvalidCodeUnit: return "invalid code unit"; - case utf8_errc::InvalidCodePoint: return "invalid code point (>0x10FFFF)"; - case utf8_errc::PairedSurrogates: - return "trailing surrogate following leading surrogate (paired surrogates are invalid)"; - case utf8_errc::UnexpectedContinue: return "found continue code unit in start position"; - case utf8_errc::UnexpectedStart: return "found start code unit in continue position"; - case utf8_errc::UnexpectedEof: return "found end of string in middle of code point"; - default: return "error code out of range"; + case utf8_errc::NoError: return msg::format(msgNoError).extract_data(); + case utf8_errc::InvalidCodeUnit: return msg::format(msgInvalidCodeUnit).extract_data(); + case utf8_errc::InvalidCodePoint: + return msg::format(msgInvalidCodePoint).append_raw(" (>0x10FFFF)").extract_data(); + case utf8_errc::PairedSurrogates: return msg::format(msgPairedSurrogatesAreInvalid).extract_data(); + case utf8_errc::UnexpectedContinue: return msg::format(msgContinueCodeUnitInStart).extract_data(); + case utf8_errc::UnexpectedStart: return msg::format(msgStartCodeUnitInContinue).extract_data(); + case utf8_errc::UnexpectedEof: return msg::format(msgEndOfStringInCodeUnit).extract_data(); + default: Checks::unreachable(VCPKG_LINE_INFO); } } }; @@ -224,7 +225,7 @@ namespace vcpkg::Unicode { if (is_eof()) { - vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, "Incremented Utf8Decoder at the end of the string"); + vcpkg::Checks::msg_exit_with_message(VCPKG_LINE_INFO, msgIncrementedUtf8Decoder); } if (next_ == last_) @@ -274,8 +275,7 @@ namespace vcpkg::Unicode { if (lhs.last_ != rhs.last_) { - Checks::exit_with_message(VCPKG_LINE_INFO, - "Comparing Utf8Decoders with different provenance; this is always an error"); + Checks::msg_exit_with_message(VCPKG_LINE_INFO, msgComparingUtf8Decoders); } return lhs.next_ == rhs.next_; diff --git a/src/vcpkg/base/xmlserializer.cpp b/src/vcpkg/base/xmlserializer.cpp index 128a7be39e..19c706d3b5 100644 --- a/src/vcpkg/base/xmlserializer.cpp +++ b/src/vcpkg/base/xmlserializer.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -93,8 +94,7 @@ namespace vcpkg XmlSerializer& XmlSerializer::cdata(StringView sv) { emit_pending_indent(); - Checks::check_exit( - VCPKG_LINE_INFO, Strings::search(sv, "]]>") == sv.end(), "]]> is not supported in a CDATA block"); + Checks::msg_check_exit(VCPKG_LINE_INFO, Strings::search(sv, "]]>") == sv.end(), msgUnsupportedSyntaxInCDATA); buf.append("");