Skip to content

Commit

Permalink
2/[thrift][compression] Fix OSS build failure
Browse files Browse the repository at this point in the history
Summary: OSS builds were failing due to a potential misuse of fmt::format where the values passed could not be converted to strings. The misuses are fixed and OSS build succeeds.

Reviewed By: vitaut, kaczmarekmhl

Differential Revision: D65567528

fbshipit-source-id: 493dda68b3d01d218ae032c635b69db67737df99
  • Loading branch information
Cameron Evans authored and facebook-github-bot committed Nov 8, 2024
1 parent 9dcc7af commit afaaa0a
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

#include <folly/Utility.h>
#include <folly/compression/Compression.h>

#include <thrift/lib/cpp/TApplicationException.h>
Expand All @@ -39,7 +40,7 @@ CompressionAlgorithm fromZlibConfig(
fmt::format(
"Unknown {} enum value: {}",
TEnumTraits<ZlibCompressionLevelPreset>::typeName(),
zlibConfig.levelPreset().value()));
folly::to_underlying(zlibConfig.levelPreset().value())));
}

CompressionAlgorithm fromZstdConfig(
Expand All @@ -59,7 +60,7 @@ CompressionAlgorithm fromZstdConfig(
fmt::format(
"Unknown {} enum value: {}",
TEnumTraits<ZstdCompressionLevelPreset>::typeName(),
zstdConfig.levelPreset().value()));
folly::to_underlying(zstdConfig.levelPreset().value())));
}

CompressionAlgorithm fromLz4Config(const Lz4CompressionCodecConfig& lz4Config) {
Expand All @@ -78,7 +79,7 @@ CompressionAlgorithm fromLz4Config(const Lz4CompressionCodecConfig& lz4Config) {
fmt::format(
"Unknown {} enum value: {}",
TEnumTraits<Lz4CompressionLevelPreset>::typeName(),
lz4Config.levelPreset().value()));
folly::to_underlying(lz4Config.levelPreset().value())));
}

CompressionAlgorithm CompressionAlgorithmSelector::fromCodecConfig(
Expand All @@ -99,7 +100,8 @@ CompressionAlgorithm CompressionAlgorithmSelector::fromCodecConfig(
throw TApplicationException(
TApplicationException::PROTOCOL_ERROR,
fmt::format(
"Unknown CodecConfig::Type value: {}", codecConfig.getType()));
"Unknown CodecConfig::Type enum value: {}",
folly::to_underlying(codecConfig.getType())));
}

std::pair<folly::io::CodecType, int>
Expand Down Expand Up @@ -170,6 +172,6 @@ CompressionAlgorithmSelector::toCodecTypeAndLevel(
fmt::format(
"Unknown {} enum value: {}",
TEnumTraits<CompressionAlgorithm>::typeName(),
compressionAlgorithm));
folly::to_underlying(compressionAlgorithm)));
}
} // namespace apache::thrift::rocket

0 comments on commit afaaa0a

Please sign in to comment.