@@ -86,20 +86,20 @@ JNIEXPORT void JNICALL Java_com_github_luben_zstd_ZstdDictDecompress_free
8686JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_Zstd_decompressFastDict0
8787 (JNIEnv * env , jclass obj , jbyteArray dst , jint dst_offset , jbyteArray src , jint src_offset , jint src_length , jobject dict )
8888{
89- if (NULL == dict ) return ZSTD_error_dictionary_wrong ;
89+ if (NULL == dict ) return ZSTD_ERROR ( dictionary_wrong ) ;
9090 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 ) ;
9797
9898 size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
9999 jsize dst_size = (* env )-> GetArrayLength (env , dst );
100100 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 ) ;
103103 dst_size -= dst_offset ;
104104 void * dst_buff = (* env )-> GetPrimitiveArrayCritical (env , dst , NULL );
105105 if (dst_buff == NULL ) goto E1 ;
@@ -120,21 +120,21 @@ E1: return size;
120120 */
121121JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_Zstd_compressFastDict0
122122 (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 ) ;
124124 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 ) ;
131131
132132
133133 size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
134134 jsize dst_size = (* env )-> GetArrayLength (env , dst );
135135 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 ) ;
138138 dst_size -= dst_offset ;
139139 void * dst_buff = (* env )-> GetPrimitiveArrayCritical (env , dst , NULL );
140140 if (dst_buff == NULL ) goto E1 ;
@@ -154,14 +154,14 @@ E1: return size;
154154 */
155155JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_Zstd_compressDirectByteBufferFastDict0
156156 (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 ) ;
158158 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 ) ;
165165 size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
166166 char * dst_buff = (char * )(* env )-> GetDirectBufferAddress (env , dst );
167167 char * src_buff = (char * )(* env )-> GetDirectBufferAddress (env , src );
@@ -178,14 +178,14 @@ JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_Zstd_compressDirectByteBuffer
178178JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_Zstd_decompressDirectByteBufferFastDict0
179179 (JNIEnv * env , jclass obj , jobject dst , jint dst_offset , jint dst_size , jobject src , jint src_offset , jint src_size , jobject dict )
180180{
181- if (NULL == dict ) return ZSTD_error_dictionary_wrong ;
181+ if (NULL == dict ) return ZSTD_ERROR ( dictionary_wrong ) ;
182182 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 ) ;
189189
190190 size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
191191 char * dst_buff = (char * )(* env )-> GetDirectBufferAddress (env , dst );
@@ -294,7 +294,7 @@ JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdCompressCtx_loadCDictFast
294294 return ZSTD_CCtx_refCDict (cctx , NULL );
295295 }
296296 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 ) ;
298298 return ZSTD_CCtx_refCDict (cctx , cdict );
299299}
300300
@@ -326,11 +326,11 @@ JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdCompressCtx_loadCDict0
326326 */
327327JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdCompressCtx_compressDirectByteBuffer0
328328 (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 ) ;
334334
335335 jsize dst_cap = (* env )-> GetDirectBufferCapacity (env , dst );
336336 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
357357 (JNIEnv * env , jclass jctx , jbyteArray dst , jint dst_offset , jint dst_size , jbyteArray src , jint src_offset , jint src_size ) {
358358 size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
359359
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 ) ;
363363
364364 if (src_offset + src_size > (* env )-> GetArrayLength (env , src )) return ERROR (srcSize_wrong );
365365 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
425425 return ZSTD_DCtx_refDDict (dctx , NULL );
426426 }
427427 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 ) ;
429429 return ZSTD_DCtx_refDDict (dctx , ddict );
430430}
431431
@@ -459,11 +459,11 @@ JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdDecompressCtx_loadDDict0
459459JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_ZstdDecompressCtx_decompressDirectByteBuffer0
460460(JNIEnv * env , jclass jctx , jobject dst , jint dst_offset , jint dst_size , jobject src , jint src_offset , jint src_size )
461461{
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 ) ;
467467
468468 jsize dst_cap = (* env )-> GetDirectBufferCapacity (env , dst );
469469 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
490490 (JNIEnv * env , jclass jctx , jbyteArray dst , jint dst_offset , jint dst_size , jbyteArray src , jint src_offset , jint src_size ) {
491491 size_t size = (size_t )(0 - ZSTD_error_memory_allocation );
492492
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 ) ;
496496
497497 if (src_offset + src_size > (* env )-> GetArrayLength (env , src )) return ERROR (srcSize_wrong );
498498 if (dst_offset + dst_size > (* env )-> GetArrayLength (env , dst )) return ERROR (dstSize_tooSmall );
0 commit comments