Skip to content

Commit

Permalink
1674114380
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleh Kulykov committed Jan 19, 2023
1 parent 3305f88 commit ee2666a
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 7 deletions.
4 changes: 2 additions & 2 deletions node/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ try { \


#define NPLZMA_THROW_ARG_TYPE_ERROR_RET(ISOLATE, PROP) \
static const char * ecsutf8 = "Unsupported argument type or its value for '" PROP "' property/method."; \
static const char * ecsutf8 = "Unsupported argument type or value for '" PROP "' property/method."; \
ISOLATE->ThrowException(Exception::TypeError(String::NewFromUtf8(ISOLATE, ecsutf8).ToLocalChecked())); \
return; \


#define NPLZMA_THROW_ARG1_TYPE_ERROR_RET(ISOLATE, FORMT, ARG1) \
static const char * ecsutf8Format = "Unsupported argument type or it's value for '" FORMT "' property/method."; \
static const char * ecsutf8Format = "Unsupported argument type or value for '" FORMT "' property/method."; \
char ecsutf8[128] = { 0 }; \
snprintf(ecsutf8, 128, ecsutf8Format, ARG1); \
ISOLATE->ThrowException(Exception::TypeError(String::NewFromUtf8(ISOLATE, ecsutf8).ToLocalChecked())); \
Expand Down
5 changes: 2 additions & 3 deletions objc/PLzmaSDKDecoder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ - (PLzmaSDKSize) count {

- (nonnull NSArray<PLzmaSDKItem *> *) items {
PLZMASDKOBJC_TRY
const auto itemsArray = _decoder->items();
auto itemsArray = _decoder->items();
if (itemsArray) {
const plzma_size_t itemsCount = itemsArray->count();
NSMutableArray * items = [[NSMutableArray alloc] initWithCapacity:itemsCount];
for (plzma_size_t itemIndex = 0; itemIndex < itemsCount; itemIndex++) {
auto item = itemsArray->at(itemIndex);
[items addObject:[[PLzmaSDKItem alloc] initWithItemM:&item]];
[items addObject:[[PLzmaSDKItem alloc] initWithItemM:&itemsArray->at(itemIndex)]];
}
return items;
}
Expand Down
39 changes: 39 additions & 0 deletions objc/PLzmaSDKGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,42 @@ typedef NS_ENUM(uint8_t, PLzmaSDKMultiStreamPartNameFormat) {
/// "File"."Extension"."002". The maximum number of parts is 999.
PLzmaSDKMultiStreamPartNameFormatNameExt00x = 1
};


/// The full version string of the library generated on build time.
///
/// Contains version<major, minor, patch> with optional automatic build number,
/// library type, build date/time, os, compiler, environment, usage, features, etc. and original LZMA SDK version.
FOUNDATION_EXPORT NSString * const PLzmaSDKVersion(void);


/// Get the current size in bytes of the stream's read block per single read request.
FOUNDATION_EXPORT PLzmaSDKSize PLzmaSDKGetStreamReadSize(void);


/// Set the current size in bytes of the stream's read block per single read request.
FOUNDATION_EXPORT void PLzmaSDKSetStreamReadSize(const PLzmaSDKSize size);


/// Get the current size in bytes of the stream's write block per single write request.
FOUNDATION_EXPORT PLzmaSDKSize PLzmaSDKGetStreamWriteSize(void);


/// Set the current size in bytes of the stream's write block per single write request.
FOUNDATION_EXPORT void PLzmaSDKSetStreamWriteSize(const PLzmaSDKSize size);


/// Get the current size in bytes of the decoder's internal buffer for holding decoded data.
FOUNDATION_EXPORT PLzmaSDKSize PLzmaSDKGetDecoderReadSize(void);


/// Set the current size in bytes of the decoder's internal buffer for holding decoded data.
FOUNDATION_EXPORT void PLzmaSDKSetDecoderReadSize(const PLzmaSDKSize size);


/// Get the current size in bytes of the decoder's internal buffer for holding decoded data.
FOUNDATION_EXPORT PLzmaSDKSize PLzmaSDKGetDecoderWriteSize(void);


/// Set the current size in bytes of the decoder's internal buffer for holding decoded data.
FOUNDATION_EXPORT void PLzmaSDKSetDecoderWriteSize(const PLzmaSDKSize size);
36 changes: 36 additions & 0 deletions objc/PLzmaSDKGlobal.mm
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,39 @@

return [[NSException alloc] initWithName:PLzmaSDKGenericExceptionName reason:reason userInfo:userInfo];
}

NSString * const PLzmaSDKVersion(void) {
return [NSString stringWithUTF8String:plzma_version()];
}

PLzmaSDKSize PLzmaSDKGetStreamReadSize(void) {
return plzma_stream_read_size();
}

void PLzmaSDKSetStreamReadSize(const PLzmaSDKSize size) {
plzma_set_stream_read_size(size);
}

PLzmaSDKSize PLzmaSDKGetStreamWriteSize(void) {
return plzma_stream_write_size();
}

void PLzmaSDKSetStreamWriteSize(const PLzmaSDKSize size) {
plzma_set_stream_write_size(size);
}

PLzmaSDKSize PLzmaSDKGetDecoderReadSize(void) {
return plzma_decoder_read_size();
}

void PLzmaSDKSetDecoderReadSize(const PLzmaSDKSize size) {
plzma_set_decoder_read_size(size);
}

PLzmaSDKSize PLzmaSDKGetDecoderWriteSize(void) {
return plzma_decoder_write_size();
}

void PLzmaSDKSetDecoderWriteSize(const PLzmaSDKSize size) {
plzma_set_decoder_write_size(size);
}
1 change: 1 addition & 0 deletions objc/PLzmaSDKProgressDelegate.inl
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ public:

static std::shared_ptr<PLzmaSDKProgressDelegate> create(void * LIBPLZMA_NULLABLE decoder);
};

4 changes: 2 additions & 2 deletions src/plzma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const char * LIBPLZMA_NONNULL plzma_version(void) {
#if defined(LIBPLZMA_HAVE_STD)
" : std"
#endif

#if defined(RTTI_ENABLED)
" : rtti"
#elif defined(LIBPLZMA_NO_CPP_RTTI)
Expand All @@ -235,7 +235,7 @@ const char * LIBPLZMA_NONNULL plzma_version(void) {
" : " __TIME__
#endif
#endif

#if defined(_MSC_FULL_VER)
" : " LIBPLZMA_TOSTRING(_MSC_FULL_VER)
#elif defined(_MSC_VER)
Expand Down

0 comments on commit ee2666a

Please sign in to comment.