This returns the description of a numerical error code in English. This is also the documentation of all the error codes. */
| 5896 | the documentation of all the error codes. |
| 5897 | */ |
| 5898 | const char* lodepng_error_text(unsigned code) |
| 5899 | { |
| 5900 | switch(code) |
| 5901 | { |
| 5902 | case 0: return "no error, everything went ok"; |
| 5903 | case 1: return "nothing done yet"; /*the Encoder/Decoder has done nothing yet, error checking makes no sense yet*/ |
| 5904 | case 10: return "end of input memory reached without huffman end code"; /*while huffman decoding*/ |
| 5905 | case 11: return "error in code tree made it jump outside of huffman tree"; /*while huffman decoding*/ |
| 5906 | case 13: return "problem while processing dynamic deflate block"; |
| 5907 | case 14: return "problem while processing dynamic deflate block"; |
| 5908 | case 15: return "problem while processing dynamic deflate block"; |
| 5909 | case 16: return "unexisting code while processing dynamic deflate block"; |
| 5910 | case 17: return "end of out buffer memory reached while inflating"; |
| 5911 | case 18: return "invalid distance code while inflating"; |
| 5912 | case 19: return "end of out buffer memory reached while inflating"; |
| 5913 | case 20: return "invalid deflate block BTYPE encountered while decoding"; |
| 5914 | case 21: return "NLEN is not ones complement of LEN in a deflate block"; |
| 5915 | /*end of out buffer memory reached while inflating: |
| 5916 | This can happen if the inflated deflate data is longer than the amount of bytes required to fill up |
| 5917 | all the pixels of the image, given the color depth and image dimensions. Something that doesn't |
| 5918 | happen in a normal, well encoded, PNG image.*/ |
| 5919 | case 22: return "end of out buffer memory reached while inflating"; |
| 5920 | case 23: return "end of in buffer memory reached while inflating"; |
| 5921 | case 24: return "invalid FCHECK in zlib header"; |
| 5922 | case 25: return "invalid compression method in zlib header"; |
| 5923 | case 26: return "FDICT encountered in zlib header while it's not used for PNG"; |
| 5924 | case 27: return "PNG file is smaller than a PNG header"; |
| 5925 | /*Checks the magic file header, the first 8 bytes of the PNG file*/ |
| 5926 | case 28: return "incorrect PNG signature, it's no PNG or corrupted"; |
| 5927 | case 29: return "first chunk is not the header chunk"; |
| 5928 | case 30: return "chunk length too large, chunk broken off at end of file"; |
| 5929 | case 31: return "illegal PNG color type or bpp"; |
| 5930 | case 32: return "illegal PNG compression method"; |
| 5931 | case 33: return "illegal PNG filter method"; |
| 5932 | case 34: return "illegal PNG interlace method"; |
| 5933 | case 35: return "chunk length of a chunk is too large or the chunk too small"; |
| 5934 | case 36: return "illegal PNG filter type encountered"; |
| 5935 | case 37: return "illegal bit depth for this color type given"; |
| 5936 | case 38: return "the palette is too big"; /*more than 256 colors*/ |
| 5937 | case 39: return "more palette alpha values given in tRNS chunk than there are colors in the palette"; |
| 5938 | case 40: return "tRNS chunk has wrong size for greyscale image"; |
| 5939 | case 41: return "tRNS chunk has wrong size for RGB image"; |
| 5940 | case 42: return "tRNS chunk appeared while it was not allowed for this color type"; |
| 5941 | case 43: return "bKGD chunk has wrong size for palette image"; |
| 5942 | case 44: return "bKGD chunk has wrong size for greyscale image"; |
| 5943 | case 45: return "bKGD chunk has wrong size for RGB image"; |
| 5944 | case 48: return "empty input buffer given to decoder. Maybe caused by non-existing file?"; |
| 5945 | case 49: return "jumped past memory while generating dynamic huffman tree"; |
| 5946 | case 50: return "jumped past memory while generating dynamic huffman tree"; |
| 5947 | case 51: return "jumped past memory while inflating huffman block"; |
| 5948 | case 52: return "jumped past memory while inflating"; |
| 5949 | case 53: return "size of zlib data too small"; |
| 5950 | case 54: return "repeat symbol in tree while there was no value symbol yet"; |
| 5951 | /*jumped past tree while generating huffman tree, this could be when the |
| 5952 | tree will have more leaves than symbols after generating it out of the |
| 5953 | given lenghts. They call this an oversubscribed dynamic bit lengths tree in zlib.*/ |
| 5954 | case 55: return "jumped past tree while generating huffman tree"; |
| 5955 | case 56: return "given output image colortype or bitdepth not supported for color conversion"; |