Lines Matching refs:error

184 #define ERROR_BREAK(code) CERROR_BREAK(error, code)
194 unsigned error = call;\
195 if(error) return error;\
588 unsigned error = LodePNGBitReader_init(&reader, data, size);
589 if(error) return 0;
812 unsigned error = 0; in HuffmanTree_makeFromLengths2() local
818 if(!tree->codes || !blcount || !nextcode) error = 83; /*alloc fail*/ in HuffmanTree_makeFromLengths2()
820 if(!error) { in HuffmanTree_makeFromLengths2()
841 if(!error) error = HuffmanTree_makeTable(tree); in HuffmanTree_makeFromLengths2()
842 return error; in HuffmanTree_makeFromLengths2()
968 unsigned error = 0; in lodepng_huffman_code_lengths() local
1013 …if(!lists.memory || !lists.freelist || !lists.chains0 || !lists.chains1) error = 83; /*alloc fail*/ in lodepng_huffman_code_lengths()
1015 if(!error) { in lodepng_huffman_code_lengths()
1041 return error; in lodepng_huffman_code_lengths()
1047 unsigned error = 0; in HuffmanTree_makeFromFrequencies() local
1054 error = lodepng_huffman_code_lengths(tree->lengths, frequencies, numcodes, maxbitlen); in HuffmanTree_makeFromFrequencies()
1055 if(!error) error = HuffmanTree_makeFromLengths2(tree); in HuffmanTree_makeFromFrequencies()
1056 return error; in HuffmanTree_makeFromFrequencies()
1062 unsigned i, error = 0; in generateFixedLitLenTree() local
1072 error = HuffmanTree_makeFromLengths(tree, bitlen, NUM_DEFLATE_CODE_SYMBOLS, 15); in generateFixedLitLenTree()
1075 return error; in generateFixedLitLenTree()
1080 unsigned i, error = 0; in generateFixedDistanceTree() local
1086 error = HuffmanTree_makeFromLengths(tree, bitlen, NUM_DISTANCE_SYMBOLS, 15); in generateFixedDistanceTree()
1089 return error; in generateFixedDistanceTree()
1123 unsigned error = generateFixedLitLenTree(tree_ll); in getTreeInflateFixed() local
1124 if(error) return error; in getTreeInflateFixed()
1132 unsigned error = 0; in getTreeInflateDynamic() local
1156 while(!error) { in getTreeInflateDynamic()
1169 error = HuffmanTree_makeFromLengths(&tree_cl, bitlen_cl, NUM_CODE_LENGTH_CODES, 7); in getTreeInflateDynamic()
1170 if(error) break; in getTreeInflateDynamic()
1241 if(error) break; in getTreeInflateDynamic()
1246 error = HuffmanTree_makeFromLengths(tree_ll, bitlen_ll, NUM_DEFLATE_CODE_SYMBOLS, 15); in getTreeInflateDynamic()
1247 if(error) break; in getTreeInflateDynamic()
1248 error = HuffmanTree_makeFromLengths(tree_d, bitlen_d, NUM_DISTANCE_SYMBOLS, 15); in getTreeInflateDynamic()
1258 return error; in getTreeInflateDynamic()
1264 unsigned error = 0; in inflateHuffmanBlock() local
1271 if(btype == 1) error = getTreeInflateFixed(&tree_ll, &tree_d); in inflateHuffmanBlock()
1272 else /*if(btype == 2)*/ error = getTreeInflateDynamic(&tree_ll, &tree_d, reader); in inflateHuffmanBlock()
1274 while(!error) /*decode all symbols until end reached, breaks at end code*/ { in inflateHuffmanBlock()
1352 return error; in inflateHuffmanBlock()
1359 unsigned LEN, NLEN, error = 0; in inflateNoCompression() local
1384 return error; in inflateNoCompression()
1392 unsigned error = LodePNGBitReader_init(&reader, in, insize); in lodepng_inflatev() local
1394 if(error) return error; in lodepng_inflatev()
1403 else if(BTYPE == 0) error = inflateNoCompression(out, &reader, settings); /*no compression*/ in lodepng_inflatev()
1404 …else error = inflateHuffmanBlock(out, &reader, BTYPE, settings->max_output_size); /*compression, B… in lodepng_inflatev()
1405 if(!error && settings->max_output_size && out->size > settings->max_output_size) error = 109; in lodepng_inflatev()
1406 if(error) break; in lodepng_inflatev()
1409 return error; in lodepng_inflatev()
1416 unsigned error = lodepng_inflatev(&v, in, insize, settings); in lodepng_inflate() local
1419 return error; in lodepng_inflate()
1425 unsigned error = settings->custom_inflate(&out->data, &out->size, in, insize, settings); in inflatev() local
1427 if(error) { in inflatev()
1429 error = 110; in inflatev()
1431 if(settings->max_output_size && out->size > settings->max_output_size) error = 109; in inflatev()
1433 return error; in inflatev()
1596 unsigned i, error = 0; in encodeLZ77() local
1738 return error; in encodeLZ77()
1809 unsigned error = 0; in deflateDynamic() local
1857 if(!frequencies_ll || !frequencies_d || !frequencies_cl) error = 83; /*alloc fail*/ in deflateDynamic()
1861 while(!error) { in deflateDynamic()
1867 error = encodeLZ77(&lz77_encoded, hash, data, datapos, dataend, settings->windowsize, in deflateDynamic()
1869 if(error) break; in deflateDynamic()
1888 error = HuffmanTree_makeFromFrequencies(&tree_ll, frequencies_ll, 257, 286, 15); in deflateDynamic()
1889 if(error) break; in deflateDynamic()
1891 error = HuffmanTree_makeFromFrequencies(&tree_d, frequencies_d, 2, 30, 15); in deflateDynamic()
1892 if(error) break; in deflateDynamic()
1951 error = HuffmanTree_makeFromFrequencies(&tree_cl, frequencies_cl, in deflateDynamic()
1953 if(error) break; in deflateDynamic()
2025 return error; in deflateDynamic()
2036 unsigned error = 0; in deflateFixed() local
2042 error = generateFixedLitLenTree(&tree_ll); in deflateFixed()
2043 if(!error) error = generateFixedDistanceTree(&tree_d); in deflateFixed()
2045 if(!error) { in deflateFixed()
2053 error = encodeLZ77(&lz77_encoded, hash, data, datapos, dataend, settings->windowsize, in deflateFixed()
2055 if(!error) writeLZ77data(writer, &lz77_encoded, &tree_ll, &tree_d); in deflateFixed()
2063 if(!error) writeBitsReversed(writer,tree_ll.codes[256], tree_ll.lengths[256]); in deflateFixed()
2070 return error; in deflateFixed()
2075 unsigned error = 0; in lodepng_deflatev() local
2095 error = hash_init(&hash, settings->windowsize); in lodepng_deflatev()
2097 if(!error) { in lodepng_deflatev()
2098 for(i = 0; i != numdeflateblocks && !error; ++i) { in lodepng_deflatev()
2104 … if(settings->btype == 1) error = deflateFixed(&writer, &hash, in, start, end, settings, final); in lodepng_deflatev()
2105 …else if(settings->btype == 2) error = deflateDynamic(&writer, &hash, in, start, end, settings, fin… in lodepng_deflatev()
2111 return error; in lodepng_deflatev()
2118 unsigned error = lodepng_deflatev(&v, in, insize, settings); in lodepng_deflate() local
2121 return error; in lodepng_deflate()
2128 unsigned error = settings->custom_deflate(out, outsize, in, insize, settings); in deflate() local
2130 return error ? 111 : 0; in deflate()
2176 unsigned error = 0; in lodepng_zlib_decompressv() local
2202 error = inflatev(out, in + 2, insize - 2, settings); in lodepng_zlib_decompressv()
2203 if(error) return error; in lodepng_zlib_decompressv()
2218 unsigned error = lodepng_zlib_decompressv(&v, in, insize, settings); in lodepng_zlib_decompress() local
2221 return error; in lodepng_zlib_decompress()
2227 unsigned error; in zlib_decompress() local
2229 error = settings->custom_zlib(out, outsize, in, insize, settings); in zlib_decompress()
2230 if(error) { in zlib_decompress()
2232 error = 110; in zlib_decompress()
2234 if(settings->max_output_size && *outsize > settings->max_output_size) error = 109; in zlib_decompress()
2243 error = lodepng_zlib_decompressv(&v, in, insize, settings); in zlib_decompress()
2247 return error; in zlib_decompress()
2257 unsigned error; in lodepng_zlib_compress() local
2261 error = deflate(&deflatedata, &deflatesize, in, insize, settings); in lodepng_zlib_compress()
2265 if(!error) { in lodepng_zlib_compress()
2268 if(!*out) error = 83; /*alloc fail*/ in lodepng_zlib_compress()
2271 if(!error) { in lodepng_zlib_compress()
2288 return error; in lodepng_zlib_compress()
2295 unsigned error = settings->custom_zlib(out, outsize, in, insize, settings); in zlib_compress() local
2297 return error ? 111 : 0; in zlib_compress()
2626 unsigned error = lodepng_chunk_createv(&v, length, type, data); in lodepng_chunk_create() local
2629 return error; in lodepng_chunk_create()
3533 unsigned error = 0; in lodepng_convert() local
3568 error = color_tree_add(&tree, p[0], p[1], p[2], p[3], (unsigned)i); in lodepng_convert()
3569 if(error) break; in lodepng_convert()
3573 if(!error) { in lodepng_convert()
3588 error = rgba8ToPixel(out, i, mode_out, &tree, r, g, b, a); in lodepng_convert()
3589 if(error) break; in lodepng_convert()
3598 return error; in lodepng_convert()
3701 unsigned error = 0; in lodepng_compute_color_stats() local
3731 error = color_tree_add(&tree, color[0], color[1], color[2], color[3], i); in lodepng_compute_color_stats()
3732 if(error) goto cleanup; in lodepng_compute_color_stats()
3836 error = color_tree_add(&tree, r, g, b, a, stats->numcolors); in lodepng_compute_color_stats()
3837 if(error) goto cleanup; in lodepng_compute_color_stats()
3875 return error; in lodepng_compute_color_stats()
3884 unsigned error = 0; in lodepng_color_stats_add() local
3892 error = lodepng_compute_color_stats(stats, image, 1, 1, &mode); in lodepng_color_stats_add()
3894 return error; in lodepng_color_stats_add()
3908 unsigned error = 0; in auto_choose_color() local
3941 error = lodepng_palette_add(mode_out, p[i * 4 + 0], p[i * 4 + 1], p[i * 4 + 2], p[i * 4 + 3]); in auto_choose_color()
3942 if(error) break; in auto_choose_color()
3967 return error; in auto_choose_color()
4045 CERROR_RETURN_ERROR(state->error, 48); /*error: the given data is empty*/ in lodepng_inspect()
4048 …CERROR_RETURN_ERROR(state->error, 27); /*error: the data length is smaller than the length of a PN… in lodepng_inspect()
4058 …CERROR_RETURN_ERROR(state->error, 28); /*error: the first 8 bytes are not the correct PNG signatur… in lodepng_inspect()
4061 CERROR_RETURN_ERROR(state->error, 94); /*error: header size must be 13 bytes*/ in lodepng_inspect()
4064 CERROR_RETURN_ERROR(state->error, 29); /*error: it doesn't start with a IHDR chunk!*/ in lodepng_inspect()
4082 if(width == 0 || height == 0) CERROR_RETURN_ERROR(state->error, 93); in lodepng_inspect()
4084 state->error = checkColorValidity(info->color.colortype, info->color.bitdepth); in lodepng_inspect()
4085 if(state->error) return state->error; in lodepng_inspect()
4087 if(info->compression_method != 0) CERROR_RETURN_ERROR(state->error, 32); in lodepng_inspect()
4089 if(info->filter_method != 0) CERROR_RETURN_ERROR(state->error, 33); in lodepng_inspect()
4091 if(info->interlace_method > 1) CERROR_RETURN_ERROR(state->error, 34); in lodepng_inspect()
4097 CERROR_RETURN_ERROR(state->error, 57); /*invalid CRC*/ in lodepng_inspect()
4101 return state->error; in lodepng_inspect()
4435 unsigned error = 0; in readChunk_tEXt() local
4438 while(!error) /*not really a while loop, only used to break on error*/ { in readChunk_tEXt()
4445 if(length < 1 || length > 79) CERROR_BREAK(error, 89); /*keyword too short or long*/ in readChunk_tEXt()
4448 if(!key) CERROR_BREAK(error, 83); /*alloc fail*/ in readChunk_tEXt()
4457 if(!str) CERROR_BREAK(error, 83); /*alloc fail*/ in readChunk_tEXt()
4462 error = lodepng_add_text(info, key, str); in readChunk_tEXt()
4470 return error; in readChunk_tEXt()
4476 unsigned error = 0; in readChunk_zTXt() local
4486 while(!error) /*not really a while loop, only used to break on error*/ { in readChunk_zTXt()
4488 if(length + 2 >= chunkLength) CERROR_BREAK(error, 75); /*no null termination, corrupt?*/ in readChunk_zTXt()
4489 if(length < 1 || length > 79) CERROR_BREAK(error, 89); /*keyword too short or long*/ in readChunk_zTXt()
4492 if(!key) CERROR_BREAK(error, 83); /*alloc fail*/ in readChunk_zTXt()
4497 … if(data[length + 1] != 0) CERROR_BREAK(error, 72); /*the 0 byte indicating compression must be 0*/ in readChunk_zTXt()
4500 if(string2_begin > chunkLength) CERROR_BREAK(error, 75); /*no null termination, corrupt?*/ in readChunk_zTXt()
4505 error = zlib_decompress(&str, &size, 0, &data[string2_begin], in readChunk_zTXt()
4508 if(error && size > zlibsettings.max_output_size) error = 112; in readChunk_zTXt()
4509 if(error) break; in readChunk_zTXt()
4510 error = lodepng_add_text_sized(info, key, (char*)str, size); in readChunk_zTXt()
4517 return error; in readChunk_zTXt()
4523 unsigned error = 0; in readChunk_iTXt() local
4532 while(!error) /*not really a while loop, only used to break on error*/ { in readChunk_iTXt()
4535 if(chunkLength < 5) CERROR_BREAK(error, 30); /*iTXt chunk too short*/ in readChunk_iTXt()
4539 if(length + 3 >= chunkLength) CERROR_BREAK(error, 75); /*no null termination char, corrupt?*/ in readChunk_iTXt()
4540 if(length < 1 || length > 79) CERROR_BREAK(error, 89); /*keyword too short or long*/ in readChunk_iTXt()
4543 if(!key) CERROR_BREAK(error, 83); /*alloc fail*/ in readChunk_iTXt()
4550 … if(data[length + 2] != 0) CERROR_BREAK(error, 72); /*the 0 byte indicating compression must be 0*/ in readChunk_iTXt()
4561 if(!langtag) CERROR_BREAK(error, 83); /*alloc fail*/ in readChunk_iTXt()
4572 if(!transkey) CERROR_BREAK(error, 83); /*alloc fail*/ in readChunk_iTXt()
4587 error = zlib_decompress(&str, &size, 0, &data[begin], in readChunk_iTXt()
4590 if(error && size > zlibsettings.max_output_size) error = 112; in readChunk_iTXt()
4591 if(!error) error = lodepng_add_itext_sized(info, key, langtag, transkey, (char*)str, size); in readChunk_iTXt()
4594 error = lodepng_add_itext_sized(info, key, langtag, transkey, (char*)(data + begin), length); in readChunk_iTXt()
4604 return error; in readChunk_iTXt()
4668 unsigned error = 0; in readChunk_iCCP() local
4696 error = zlib_decompress(&info->iccp_profile, &size, 0, in readChunk_iCCP()
4700 if(error && size > zlibsettings.max_output_size) error = 113; in readChunk_iCCP()
4702 if(!error && !info->iccp_profile_size) error = 100; /*invalid ICC profile size*/ in readChunk_iCCP()
4703 return error; in readChunk_iCCP()
4713 unsigned error = 0; in lodepng_inspect_chunk() local
4722 error = readChunk_PLTE(&state->info_png.color, data, chunkLength); in lodepng_inspect_chunk()
4724 error = readChunk_tRNS(&state->info_png.color, data, chunkLength); in lodepng_inspect_chunk()
4727 error = readChunk_bKGD(&state->info_png, data, chunkLength); in lodepng_inspect_chunk()
4729 error = readChunk_tEXt(&state->info_png, data, chunkLength); in lodepng_inspect_chunk()
4731 error = readChunk_zTXt(&state->info_png, &state->decoder, data, chunkLength); in lodepng_inspect_chunk()
4733 error = readChunk_iTXt(&state->info_png, &state->decoder, data, chunkLength); in lodepng_inspect_chunk()
4735 error = readChunk_tIME(&state->info_png, data, chunkLength); in lodepng_inspect_chunk()
4737 error = readChunk_pHYs(&state->info_png, data, chunkLength); in lodepng_inspect_chunk()
4739 error = readChunk_gAMA(&state->info_png, data, chunkLength); in lodepng_inspect_chunk()
4741 error = readChunk_cHRM(&state->info_png, data, chunkLength); in lodepng_inspect_chunk()
4743 error = readChunk_sRGB(&state->info_png, data, chunkLength); in lodepng_inspect_chunk()
4745 error = readChunk_iCCP(&state->info_png, &state->decoder, data, chunkLength); in lodepng_inspect_chunk()
4752 if(!error && !unhandled && !state->decoder.ignore_crc) { in lodepng_inspect_chunk()
4756 return error; in lodepng_inspect_chunk()
4782 …state->error = lodepng_inspect(w, h, state, in, insize); /*reads header and resets other parameter… in decodeGeneric()
4783 if(state->error) return; in decodeGeneric()
4786 CERROR_RETURN(state->error, 92); /*overflow possible due to amount of pixels*/ in decodeGeneric()
4791 if(!idat) CERROR_RETURN(state->error, 83); /*alloc fail*/ in decodeGeneric()
4797 while(!IEND && !state->error) { in decodeGeneric()
4804 CERROR_BREAK(state->error, 30); in decodeGeneric()
4812 CERROR_BREAK(state->error, 63); in decodeGeneric()
4816 … CERROR_BREAK(state->error, 64); /*error: size of the in buffer too small to contain next chunk*/ in decodeGeneric()
4826 if(lodepng_addofl(idatsize, chunkLength, &newsize)) CERROR_BREAK(state->error, 95); in decodeGeneric()
4827 if(newsize > insize) CERROR_BREAK(state->error, 95); in decodeGeneric()
4838 state->error = readChunk_PLTE(&state->info_png.color, data, chunkLength); in decodeGeneric()
4839 if(state->error) break; in decodeGeneric()
4847 state->error = readChunk_tRNS(&state->info_png.color, data, chunkLength); in decodeGeneric()
4848 if(state->error) break; in decodeGeneric()
4852 state->error = readChunk_bKGD(&state->info_png, data, chunkLength); in decodeGeneric()
4853 if(state->error) break; in decodeGeneric()
4857 state->error = readChunk_tEXt(&state->info_png, data, chunkLength); in decodeGeneric()
4858 if(state->error) break; in decodeGeneric()
4863 state->error = readChunk_zTXt(&state->info_png, &state->decoder, data, chunkLength); in decodeGeneric()
4864 if(state->error) break; in decodeGeneric()
4869 state->error = readChunk_iTXt(&state->info_png, &state->decoder, data, chunkLength); in decodeGeneric()
4870 if(state->error) break; in decodeGeneric()
4873 state->error = readChunk_tIME(&state->info_png, data, chunkLength); in decodeGeneric()
4874 if(state->error) break; in decodeGeneric()
4876 state->error = readChunk_pHYs(&state->info_png, data, chunkLength); in decodeGeneric()
4877 if(state->error) break; in decodeGeneric()
4879 state->error = readChunk_gAMA(&state->info_png, data, chunkLength); in decodeGeneric()
4880 if(state->error) break; in decodeGeneric()
4882 state->error = readChunk_cHRM(&state->info_png, data, chunkLength); in decodeGeneric()
4883 if(state->error) break; in decodeGeneric()
4885 state->error = readChunk_sRGB(&state->info_png, data, chunkLength); in decodeGeneric()
4886 if(state->error) break; in decodeGeneric()
4888 state->error = readChunk_iCCP(&state->info_png, &state->decoder, data, chunkLength); in decodeGeneric()
4889 if(state->error) break; in decodeGeneric()
4894 CERROR_BREAK(state->error, 69); in decodeGeneric()
4900 state->error = lodepng_chunk_append(&state->info_png.unknown_chunks_data[critical_pos - 1], in decodeGeneric()
4902 if(state->error) break; in decodeGeneric()
4908 if(lodepng_chunk_check_crc(chunk)) CERROR_BREAK(state->error, 57); /*invalid CRC*/ in decodeGeneric()
4914 …if(!state->error && state->info_png.color.colortype == LCT_PALETTE && !state->info_png.color.palet… in decodeGeneric()
4915 state->error = 106; /* error: PNG file must have PLTE chunk if color type is palette */ in decodeGeneric()
4918 if(!state->error) { in decodeGeneric()
4937 …state->error = zlib_decompress(&scanlines, &scanlines_size, expected_size, idat, idatsize, &state-… in decodeGeneric()
4939 …if(!state->error && scanlines_size != expected_size) state->error = 91; /*decompressed size doesn'… in decodeGeneric()
4942 if(!state->error) { in decodeGeneric()
4945 if(!*out) state->error = 83; /*alloc fail*/ in decodeGeneric()
4947 if(!state->error) { in decodeGeneric()
4949 state->error = postProcessScanlines(*out, scanlines, *w, *h, &state->info_png); in decodeGeneric()
4959 if(state->error) return state->error; in lodepng_decode()
4965 state->error = lodepng_color_mode_copy(&state->info_raw, &state->info_png.color); in lodepng_decode()
4966 if(state->error) return state->error; in lodepng_decode()
4982 state->error = 83; /*alloc fail*/ in lodepng_decode()
4984 else state->error = lodepng_convert(*out, data, &state->info_raw, in lodepng_decode()
4988 return state->error; in lodepng_decode()
4993 unsigned error; in lodepng_decode_memory() local
5003 error = lodepng_decode(out, w, h, &state, in, insize); in lodepng_decode_memory()
5005 return error; in lodepng_decode_memory()
5021 unsigned error; in lodepng_decode_file() local
5025 error = lodepng_load_file(&buffer, &buffersize, filename); in lodepng_decode_file()
5026 if(!error) error = lodepng_decode_memory(out, w, h, buffer, buffersize, colortype, bitdepth); in lodepng_decode_file()
5028 return error; in lodepng_decode_file()
5067 state->error = 1; in lodepng_state_init()
5080 dest->error = lodepng_color_mode_copy(&dest->info_raw, &source->info_raw); if(dest->error) return; in lodepng_state_copy()
5081 dest->error = lodepng_info_copy(&dest->info_png, &source->info_png); if(dest->error) return; in lodepng_state_copy()
5177 unsigned error = 0; in addChunk_IDAT() local
5181 error = zlib_compress(&zlib, &zlibsize, data, datasize, zlibsettings); in addChunk_IDAT()
5182 if(!error) { in addChunk_IDAT()
5183 error = lodepng_chunk_createv(out, zlibsize, "IDAT", zlib); in addChunk_IDAT()
5186 return error; in addChunk_IDAT()
5210 unsigned error = 0; in addChunk_zTXt() local
5218 error = zlib_compress(&compressed, &compressedsize, in addChunk_zTXt()
5220 if(!error) { in addChunk_zTXt()
5222 error = lodepng_chunk_init(&chunk, out, size, "zTXt"); in addChunk_zTXt()
5224 if(!error) { in addChunk_zTXt()
5233 return error; in addChunk_zTXt()
5238 unsigned error = 0; in addChunk_iTXt() local
5248 error = zlib_compress(&compressed, &compressedsize, in addChunk_iTXt()
5251 if(!error) { in addChunk_iTXt()
5253 error = lodepng_chunk_init(&chunk, out, size, "iTXt"); in addChunk_iTXt()
5255 if(!error) { in addChunk_iTXt()
5277 return error; in addChunk_iTXt()
5355 unsigned error = 0; in addChunk_iCCP() local
5362 error = zlib_compress(&compressed, &compressedsize, in addChunk_iCCP()
5364 if(!error) { in addChunk_iCCP()
5366 error = lodepng_chunk_init(&chunk, out, size, "iCCP"); in addChunk_iCCP()
5368 if(!error) { in addChunk_iCCP()
5377 return error; in addChunk_iCCP()
5463 unsigned error = 0; in filter() local
5501 if(!attempt[type]) error = 83; /*alloc fail*/ in filter()
5504 if(!error) { in filter()
5548 if(!attempt[type]) error = 83; /*alloc fail*/ in filter()
5551 if(!error) { in filter()
5610 if(!attempt[type]) error = 83; /*alloc fail*/ in filter()
5612 if(!error) { in filter()
5638 return error; in filter()
5721 unsigned error = 0; in preProcessScanlines() local
5726 if(!(*out) && (*outsize)) error = 83; /*alloc fail*/ in preProcessScanlines()
5728 if(!error) { in preProcessScanlines()
5732 if(!padded) error = 83; /*alloc fail*/ in preProcessScanlines()
5733 if(!error) { in preProcessScanlines()
5735 error = filter(*out, padded, w, h, &info_png->color, settings); in preProcessScanlines()
5740 error = filter(*out, in, w, h, &info_png->color, settings); in preProcessScanlines()
5752 if(!(*out)) error = 83; /*alloc fail*/ in preProcessScanlines()
5755 if(!adam7 && passstart[7]) error = 83; /*alloc fail*/ in preProcessScanlines()
5757 if(!error && adam7) { in preProcessScanlines()
5767 error = filter(&(*out)[filter_passstart[i]], padded, in preProcessScanlines()
5771 error = filter(&(*out)[filter_passstart[i]], &adam7[padded_passstart[i]], in preProcessScanlines()
5775 if(error) break; in preProcessScanlines()
5782 return error; in preProcessScanlines()
5831 state->error = 0; in lodepng_encode()
5836 state->error = 68; /*invalid palette size, it is only allowed to be 1-256*/ in lodepng_encode()
5840 state->error = 61; /*error: invalid btype*/ in lodepng_encode()
5844 state->error = 71; /*error: invalid interlace mode*/ in lodepng_encode()
5847 state->error = checkColorValidity(info_png->color.colortype, info_png->color.bitdepth); in lodepng_encode()
5848 if(state->error) goto cleanup; /*error: invalid color type given*/ in lodepng_encode()
5849 state->error = checkColorValidity(state->info_raw.colortype, state->info_raw.bitdepth); in lodepng_encode()
5850 if(state->error) goto cleanup; /*error: invalid color type given*/ in lodepng_encode()
5870 state->error = lodepng_compute_color_stats(&stats, image, w, h, &state->info_raw); in lodepng_encode()
5871 if(state->error) goto cleanup; in lodepng_encode()
5878 state->error = lodepng_color_stats_add(&stats, r, g, b, 65535); in lodepng_encode()
5879 if(state->error) goto cleanup; in lodepng_encode()
5882 state->error = auto_choose_color(&info.color, &state->info_raw, &stats); in lodepng_encode()
5883 if(state->error) goto cleanup; in lodepng_encode()
5889 state->error = 104; in lodepng_encode()
5901 state->error = 100; /* Disallowed profile color type for PNG */ in lodepng_encode()
5907 state->error = state->encoder.auto_convert ? 102 : 101; in lodepng_encode()
5917 if(!converted && size) state->error = 83; /*alloc fail*/ in lodepng_encode()
5918 if(!state->error) { in lodepng_encode()
5919 state->error = lodepng_convert(converted, image, &info.color, &state->info_raw, w, h); in lodepng_encode()
5921 if(!state->error) { in lodepng_encode()
5922 state->error = preProcessScanlines(&data, &datasize, converted, w, h, &info, &state->encoder); in lodepng_encode()
5925 if(state->error) goto cleanup; in lodepng_encode()
5927 state->error = preProcessScanlines(&data, &datasize, image, w, h, &info, &state->encoder); in lodepng_encode()
5928 if(state->error) goto cleanup; in lodepng_encode()
5936 state->error = writeSignature(&outv); in lodepng_encode()
5937 if(state->error) goto cleanup; in lodepng_encode()
5939 …state->error = addChunk_IHDR(&outv, w, h, info.color.colortype, info.color.bitdepth, info.interlac… in lodepng_encode()
5940 if(state->error) goto cleanup; in lodepng_encode()
5944 … state->error = addUnknownChunks(&outv, info.unknown_chunks_data[0], info.unknown_chunks_size[0]); in lodepng_encode()
5945 if(state->error) goto cleanup; in lodepng_encode()
5949 state->error = addChunk_iCCP(&outv, &info, &state->encoder.zlibsettings); in lodepng_encode()
5950 if(state->error) goto cleanup; in lodepng_encode()
5953 state->error = addChunk_sRGB(&outv, &info); in lodepng_encode()
5954 if(state->error) goto cleanup; in lodepng_encode()
5957 state->error = addChunk_gAMA(&outv, &info); in lodepng_encode()
5958 if(state->error) goto cleanup; in lodepng_encode()
5961 state->error = addChunk_cHRM(&outv, &info); in lodepng_encode()
5962 if(state->error) goto cleanup; in lodepng_encode()
5967 state->error = addChunk_PLTE(&outv, &info.color); in lodepng_encode()
5968 if(state->error) goto cleanup; in lodepng_encode()
5972 state->error = addChunk_PLTE(&outv, &info.color); in lodepng_encode()
5973 if(state->error) goto cleanup; in lodepng_encode()
5976 state->error = addChunk_tRNS(&outv, &info.color); in lodepng_encode()
5977 if(state->error) goto cleanup; in lodepng_encode()
5981 state->error = addChunk_bKGD(&outv, &info); in lodepng_encode()
5982 if(state->error) goto cleanup; in lodepng_encode()
5986 state->error = addChunk_pHYs(&outv, &info); in lodepng_encode()
5987 if(state->error) goto cleanup; in lodepng_encode()
5992 … state->error = addUnknownChunks(&outv, info.unknown_chunks_data[1], info.unknown_chunks_size[1]); in lodepng_encode()
5993 if(state->error) goto cleanup; in lodepng_encode()
5997 state->error = addChunk_IDAT(&outv, data, datasize, &state->encoder.zlibsettings); in lodepng_encode()
5998 if(state->error) goto cleanup; in lodepng_encode()
6002 state->error = addChunk_tIME(&outv, &info.time); in lodepng_encode()
6003 if(state->error) goto cleanup; in lodepng_encode()
6008 state->error = 66; /*text chunk too large*/ in lodepng_encode()
6012 state->error = 67; /*text chunk too small*/ in lodepng_encode()
6016 …state->error = addChunk_zTXt(&outv, info.text_keys[i], info.text_strings[i], &state->encoder.zlibs… in lodepng_encode()
6017 if(state->error) goto cleanup; in lodepng_encode()
6019 state->error = addChunk_tEXt(&outv, info.text_keys[i], info.text_strings[i]); in lodepng_encode()
6020 if(state->error) goto cleanup; in lodepng_encode()
6036 …state->error = addChunk_tEXt(&outv, "LodePNG", LODEPNG_VERSION_STRING); /*it's shorter as tEXt tha… in lodepng_encode()
6037 if(state->error) goto cleanup; in lodepng_encode()
6043 state->error = 66; /*text chunk too large*/ in lodepng_encode()
6047 state->error = 67; /*text chunk too small*/ in lodepng_encode()
6050 state->error = addChunk_iTXt( in lodepng_encode()
6054 if(state->error) goto cleanup; in lodepng_encode()
6059 … state->error = addUnknownChunks(&outv, info.unknown_chunks_data[2], info.unknown_chunks_size[2]); in lodepng_encode()
6060 if(state->error) goto cleanup; in lodepng_encode()
6063 state->error = addChunk_IEND(&outv); in lodepng_encode()
6064 if(state->error) goto cleanup; in lodepng_encode()
6075 return state->error; in lodepng_encode()
6080 unsigned error; in lodepng_encode_memory() local
6088 error = state.error; in lodepng_encode_memory()
6090 return error; in lodepng_encode_memory()
6106 unsigned error = lodepng_encode_memory(&buffer, &buffersize, image, w, h, colortype, bitdepth); in lodepng_encode_file() local
6107 if(!error) error = lodepng_save_file(buffer, buffersize, filename); in lodepng_encode_file()
6109 return error; in lodepng_encode_file()
6298 unsigned error = zlib_decompress(&buffer, &buffersize, 0, in, insize, &settings); in decompress() local
6303 return error; in decompress()
6317 unsigned error = zlib_compress(&buffer, &buffersize, in, insize, &settings); in compress() local
6322 return error; in compress()
6358 unsigned error = lodepng_decode_memory(&buffer, &w, &h, in, insize, colortype, bitdepth); in decode() local
6359 if(buffer && !error) { in decode()
6367 return error; in decode()
6379 unsigned error = lodepng_decode(&buffer, &w, &h, &state, in, insize); in decode() local
6380 if(buffer && !error) { in decode()
6385 return error; in decode()
6400 unsigned error = load_file(buffer, filename); in decode() local
6401 if(error) return error; in decode()
6412 unsigned error = lodepng_encode_memory(&buffer, &buffersize, in, w, h, colortype, bitdepth); in encode() local
6417 return error; in encode()
6432 unsigned error = lodepng_encode(&buffer, &buffersize, in, w, h, &state); in encode() local
6437 return error; in encode()
6452 unsigned error = encode(buffer, in, w, h, colortype, bitdepth); in encode() local
6453 if(!error) error = save_file(buffer, filename); in encode()
6454 return error; in encode()