@@ -86,20 +86,20 @@ JNIEXPORT void JNICALL Java_com_github_luben_zstd_ZstdDictDecompress_free
86
86
JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_Zstd_decompressFastDict0
87
87
(JNIEnv * env , jclass obj , jbyteArray dst , jint dst_offset , jbyteArray src , jint src_offset , jint src_length , jobject dict )
88
88
{
89
- if (NULL == dict ) return ZSTD_error_dictionary_wrong ;
89
+ if (NULL == dict ) return ZSTD_ERROR ( dictionary_wrong ) ;
90
90
ZSTD_DDict * ddict = (ZSTD_DDict * )(intptr_t )(* env )-> GetLongField (env , dict , decompress_dict );
91
- if (NULL == ddict ) return ZSTD_error_dictionary_wrong ;
92
- if (NULL == dst ) return ZSTD_error_dstSize_tooSmall ;
93
- if (NULL == src ) return ZSTD_error_srcSize_wrong ;
94
- if (0 > dst_offset ) return ZSTD_error_dstSize_tooSmall ;
95
- if (0 > src_offset ) return ZSTD_error_srcSize_wrong ;
96
- if (0 > src_length ) return ZSTD_error_srcSize_wrong ;
91
+ if (NULL == ddict ) return ZSTD_ERROR ( dictionary_wrong ) ;
92
+ if (NULL == dst ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
93
+ if (NULL == src ) return ZSTD_ERROR ( srcSize_wrong ) ;
94
+ if (0 > dst_offset ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
95
+ if (0 > src_offset ) return ZSTD_ERROR ( srcSize_wrong ) ;
96
+ if (0 > src_length ) return ZSTD_ERROR ( srcSize_wrong ) ;
97
97
98
98
size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
99
99
jsize dst_size = (* env )-> GetArrayLength (env , dst );
100
100
jsize src_size = (* env )-> GetArrayLength (env , src );
101
- if (dst_offset > dst_size ) return ZSTD_error_dstSize_tooSmall ;
102
- if (src_size < (src_offset + src_length )) return ZSTD_error_srcSize_wrong ;
101
+ if (dst_offset > dst_size ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
102
+ if (src_size < (src_offset + src_length )) return ZSTD_ERROR ( srcSize_wrong ) ;
103
103
dst_size -= dst_offset ;
104
104
void * dst_buff = (* env )-> GetPrimitiveArrayCritical (env , dst , NULL );
105
105
if (dst_buff == NULL ) goto E1 ;
@@ -120,21 +120,21 @@ E1: return size;
120
120
*/
121
121
JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_Zstd_compressFastDict0
122
122
(JNIEnv * env , jclass obj , jbyteArray dst , jint dst_offset , jbyteArray src , jint src_offset , jint src_length , jobject dict ) {
123
- if (NULL == dict ) return ZSTD_error_dictionary_wrong ;
123
+ if (NULL == dict ) return ZSTD_ERROR ( dictionary_wrong ) ;
124
124
ZSTD_CDict * cdict = (ZSTD_CDict * )(intptr_t )(* env )-> GetLongField (env , dict , compress_dict );
125
- if (NULL == cdict ) return ZSTD_error_dictionary_wrong ;
126
- if (NULL == dst ) return ZSTD_error_dstSize_tooSmall ;
127
- if (NULL == src ) return ZSTD_error_srcSize_wrong ;
128
- if (0 > dst_offset ) return ZSTD_error_dstSize_tooSmall ;
129
- if (0 > src_offset ) return ZSTD_error_srcSize_wrong ;
130
- if (0 > src_length ) return ZSTD_error_srcSize_wrong ;
125
+ if (NULL == cdict ) return ZSTD_ERROR ( dictionary_wrong ) ;
126
+ if (NULL == dst ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
127
+ if (NULL == src ) return ZSTD_ERROR ( srcSize_wrong ) ;
128
+ if (0 > dst_offset ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
129
+ if (0 > src_offset ) return ZSTD_ERROR ( srcSize_wrong ) ;
130
+ if (0 > src_length ) return ZSTD_ERROR ( srcSize_wrong ) ;
131
131
132
132
133
133
size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
134
134
jsize dst_size = (* env )-> GetArrayLength (env , dst );
135
135
jsize src_size = (* env )-> GetArrayLength (env , src );
136
- if (dst_offset > dst_size ) return ZSTD_error_dstSize_tooSmall ;
137
- if (src_size < (src_offset + src_length )) return ZSTD_error_srcSize_wrong ;
136
+ if (dst_offset > dst_size ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
137
+ if (src_size < (src_offset + src_length )) return ZSTD_ERROR ( srcSize_wrong ) ;
138
138
dst_size -= dst_offset ;
139
139
void * dst_buff = (* env )-> GetPrimitiveArrayCritical (env , dst , NULL );
140
140
if (dst_buff == NULL ) goto E1 ;
@@ -154,14 +154,14 @@ E1: return size;
154
154
*/
155
155
JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_Zstd_compressDirectByteBufferFastDict0
156
156
(JNIEnv * env , jclass obj , jobject dst , jint dst_offset , jint dst_size , jobject src , jint src_offset , jint src_size , jobject dict ) {
157
- if (NULL == dict ) return ZSTD_error_dictionary_wrong ;
157
+ if (NULL == dict ) return ZSTD_ERROR ( dictionary_wrong ) ;
158
158
ZSTD_CDict * cdict = (ZSTD_CDict * )(intptr_t )(* env )-> GetLongField (env , dict , compress_dict );
159
- if (NULL == cdict ) return ZSTD_error_dictionary_wrong ;
160
- if (NULL == dst ) return ZSTD_error_dstSize_tooSmall ;
161
- if (NULL == src ) return ZSTD_error_srcSize_wrong ;
162
- if (0 > dst_offset ) return ZSTD_error_dstSize_tooSmall ;
163
- if (0 > src_offset ) return ZSTD_error_srcSize_wrong ;
164
- if (0 > src_size ) return ZSTD_error_srcSize_wrong ;
159
+ if (NULL == cdict ) return ZSTD_ERROR ( dictionary_wrong ) ;
160
+ if (NULL == dst ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
161
+ if (NULL == src ) return ZSTD_ERROR ( srcSize_wrong ) ;
162
+ if (0 > dst_offset ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
163
+ if (0 > src_offset ) return ZSTD_ERROR ( srcSize_wrong ) ;
164
+ if (0 > src_size ) return ZSTD_ERROR ( srcSize_wrong ) ;
165
165
size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
166
166
char * dst_buff = (char * )(* env )-> GetDirectBufferAddress (env , dst );
167
167
char * src_buff = (char * )(* env )-> GetDirectBufferAddress (env , src );
@@ -178,14 +178,14 @@ JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_Zstd_compressDirectByteBuffer
178
178
JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_Zstd_decompressDirectByteBufferFastDict0
179
179
(JNIEnv * env , jclass obj , jobject dst , jint dst_offset , jint dst_size , jobject src , jint src_offset , jint src_size , jobject dict )
180
180
{
181
- if (NULL == dict ) return ZSTD_error_dictionary_wrong ;
181
+ if (NULL == dict ) return ZSTD_ERROR ( dictionary_wrong ) ;
182
182
ZSTD_DDict * ddict = (ZSTD_DDict * )(intptr_t )(* env )-> GetLongField (env , dict , decompress_dict );
183
- if (NULL == ddict ) return ZSTD_error_dictionary_wrong ;
184
- if (NULL == dst ) return ZSTD_error_dstSize_tooSmall ;
185
- if (NULL == src ) return ZSTD_error_srcSize_wrong ;
186
- if (0 > dst_offset ) return ZSTD_error_dstSize_tooSmall ;
187
- if (0 > src_offset ) return ZSTD_error_srcSize_wrong ;
188
- if (0 > src_size ) return ZSTD_error_srcSize_wrong ;
183
+ if (NULL == ddict ) return ZSTD_ERROR ( dictionary_wrong ) ;
184
+ if (NULL == dst ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
185
+ if (NULL == src ) return ZSTD_ERROR ( srcSize_wrong ) ;
186
+ if (0 > dst_offset ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
187
+ if (0 > src_offset ) return ZSTD_ERROR ( srcSize_wrong ) ;
188
+ if (0 > src_size ) return ZSTD_ERROR ( srcSize_wrong ) ;
189
189
190
190
size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
191
191
char * dst_buff = (char * )(* env )-> GetDirectBufferAddress (env , dst );
@@ -294,7 +294,7 @@ JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdCompressCtx_loadCDictFast
294
294
return ZSTD_CCtx_refCDict (cctx , NULL );
295
295
}
296
296
ZSTD_CDict * cdict = (ZSTD_CDict * )(intptr_t )(* env )-> GetLongField (env , dict , compress_dict );
297
- if (NULL == cdict ) return ZSTD_error_dictionary_wrong ;
297
+ if (NULL == cdict ) return ZSTD_ERROR ( dictionary_wrong ) ;
298
298
return ZSTD_CCtx_refCDict (cctx , cdict );
299
299
}
300
300
@@ -326,11 +326,11 @@ JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdCompressCtx_loadCDict0
326
326
*/
327
327
JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdCompressCtx_compressDirectByteBuffer0
328
328
(JNIEnv * env , jclass jctx , jobject dst , jint dst_offset , jint dst_size , jobject src , jint src_offset , jint src_size ) {
329
- if (NULL == dst ) return ZSTD_error_dstSize_tooSmall ;
330
- if (NULL == src ) return ZSTD_error_srcSize_wrong ;
331
- if (0 > dst_offset ) return ZSTD_error_dstSize_tooSmall ;
332
- if (0 > src_offset ) return ZSTD_error_srcSize_wrong ;
333
- if (0 > src_size ) return ZSTD_error_srcSize_wrong ;
329
+ if (NULL == dst ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
330
+ if (NULL == src ) return ZSTD_ERROR ( srcSize_wrong ) ;
331
+ if (0 > dst_offset ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
332
+ if (0 > src_offset ) return ZSTD_ERROR ( srcSize_wrong ) ;
333
+ if (0 > src_size ) return ZSTD_ERROR ( srcSize_wrong ) ;
334
334
335
335
jsize dst_cap = (* env )-> GetDirectBufferCapacity (env , dst );
336
336
if (dst_offset + dst_size > dst_cap ) return ERROR (dstSize_tooSmall );
@@ -357,9 +357,9 @@ JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdCompressCtx_compressByteA
357
357
(JNIEnv * env , jclass jctx , jbyteArray dst , jint dst_offset , jint dst_size , jbyteArray src , jint src_offset , jint src_size ) {
358
358
size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
359
359
360
- if (0 > dst_offset ) return ZSTD_error_dstSize_tooSmall ;
361
- if (0 > src_offset ) return ZSTD_error_srcSize_wrong ;
362
- if (0 > src_size ) return ZSTD_error_srcSize_wrong ;
360
+ if (0 > dst_offset ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
361
+ if (0 > src_offset ) return ZSTD_ERROR ( srcSize_wrong ) ;
362
+ if (0 > src_size ) return ZSTD_ERROR ( srcSize_wrong ) ;
363
363
364
364
if (src_offset + src_size > (* env )-> GetArrayLength (env , src )) return ERROR (srcSize_wrong );
365
365
if (dst_offset + dst_size > (* env )-> GetArrayLength (env , dst )) return ERROR (dstSize_tooSmall );
@@ -425,7 +425,7 @@ JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdDecompressCtx_loadDDictFa
425
425
return ZSTD_DCtx_refDDict (dctx , NULL );
426
426
}
427
427
ZSTD_DDict * ddict = (ZSTD_DDict * )(intptr_t )(* env )-> GetLongField (env , dict , decompress_dict );
428
- if (NULL == ddict ) return ZSTD_error_dictionary_wrong ;
428
+ if (NULL == ddict ) return ZSTD_ERROR ( dictionary_wrong ) ;
429
429
return ZSTD_DCtx_refDDict (dctx , ddict );
430
430
}
431
431
@@ -459,11 +459,11 @@ JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdDecompressCtx_loadDDict0
459
459
JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdDecompressCtx_decompressDirectByteBuffer0
460
460
(JNIEnv * env , jclass jctx , jobject dst , jint dst_offset , jint dst_size , jobject src , jint src_offset , jint src_size )
461
461
{
462
- if (NULL == dst ) return ZSTD_error_dstSize_tooSmall ;
463
- if (NULL == src ) return ZSTD_error_srcSize_wrong ;
464
- if (0 > dst_offset ) return ZSTD_error_dstSize_tooSmall ;
465
- if (0 > src_offset ) return ZSTD_error_srcSize_wrong ;
466
- if (0 > src_size ) return ZSTD_error_srcSize_wrong ;
462
+ if (NULL == dst ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
463
+ if (NULL == src ) return ZSTD_ERROR ( srcSize_wrong ) ;
464
+ if (0 > dst_offset ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
465
+ if (0 > src_offset ) return ZSTD_ERROR ( srcSize_wrong ) ;
466
+ if (0 > src_size ) return ZSTD_ERROR ( srcSize_wrong ) ;
467
467
468
468
jsize dst_cap = (* env )-> GetDirectBufferCapacity (env , dst );
469
469
if (dst_offset + dst_size > dst_cap ) return ERROR (dstSize_tooSmall );
@@ -490,9 +490,9 @@ JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdDecompressCtx_decompressB
490
490
(JNIEnv * env , jclass jctx , jbyteArray dst , jint dst_offset , jint dst_size , jbyteArray src , jint src_offset , jint src_size ) {
491
491
size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
492
492
493
- if (0 > dst_offset ) return ZSTD_error_dstSize_tooSmall ;
494
- if (0 > src_offset ) return ZSTD_error_srcSize_wrong ;
495
- if (0 > src_size ) return ZSTD_error_srcSize_wrong ;
493
+ if (0 > dst_offset ) return ZSTD_ERROR ( dstSize_tooSmall ) ;
494
+ if (0 > src_offset ) return ZSTD_ERROR ( srcSize_wrong ) ;
495
+ if (0 > src_size ) return ZSTD_ERROR ( srcSize_wrong ) ;
496
496
497
497
if (src_offset + src_size > (* env )-> GetArrayLength (env , src )) return ERROR (srcSize_wrong );
498
498
if (dst_offset + dst_size > (* env )-> GetArrayLength (env , dst )) return ERROR (dstSize_tooSmall );
0 commit comments