{"record":{"id":"af3aded6b23351c2","repo":"DrKLO/Telegram","slug":"s-sorry-arithmetic-coding-not-supported-af3ade","errorCode":null,"errorMessage":"%s: sorry, arithmetic coding not supported\n","messagePattern":"(.+?): sorry, arithmetic coding not supported\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/mozjpeg/jpegtran.c","lineNumber":188,"sourceCode":"      /* Not a switch, must be a file name argument */\n      if (argn <= last_file_arg_seen) {\n        outfilename = NULL;     /* -outfile applies to just one input file */\n        continue;               /* ignore this name if previously processed */\n      }\n      break;                    /* else done parsing switches */\n    }\n    arg++;                      /* advance past switch marker character */\n\n    if (keymatch(arg, \"arithmetic\", 1)) {\n      /* Use arithmetic coding. */\n#ifdef C_ARITH_CODING_SUPPORTED\n      cinfo->arith_code = TRUE;\n\n      /* No table optimization required for AC */\n      cinfo->optimize_coding = FALSE;\n      prefer_smallest = FALSE;\n#else\n      fprintf(stderr, \"%s: sorry, arithmetic coding not supported\\n\",\n              progname);\n      exit(EXIT_FAILURE);\n#endif\n\n    } else if (keymatch(arg, \"copy\", 2)) {\n      /* Select which extra markers to copy. */\n      if (++argn >= argc)       /* advance to next argument */\n        usage();\n      if (keymatch(argv[argn], \"none\", 1)) {\n        copyoption = JCOPYOPT_NONE;\n      } else if (keymatch(argv[argn], \"comments\", 1)) {\n        copyoption = JCOPYOPT_COMMENTS;\n      } else if (keymatch(argv[argn], \"all\", 1)) {\n        copyoption = JCOPYOPT_ALL;\n      } else\n        usage();\n\n    } else if (keymatch(arg, \"crop\", 2)) {","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/jpegtran.c#L170-L206","documentation":"The -arithmetic flag was given to jpegtran but the encoder was built without C_ARITH_CODING_SUPPORTED. Arithmetic coding is a compile-time option in libjpeg/mozjpeg; when absent, the flag is rejected at parse time with exit(EXIT_FAILURE).","triggerScenarios":"Passing -arithmetic (or -a) to a jpegtran that was compiled with arithmetic coding disabled. Common in distributions that ship only Huffman coding for licensing or size reasons.","commonSituations":"Default upstream libjpeg-turbo builds historically leave arithmetic coding enabled, but custom/minified builds or older libjpeg releases omit it; copying a command from a tutorial onto such a build fails immediately.","solutions":["Drop the -arithmetic flag and use the default Huffman coding.","Rebuild libjpeg-turbo/mozjpeg with -DC_ARITH_CODING_SUPPORTED=1 (enable in CMake/Make config).","Verify the feature at build time: #ifdef C_ARITH_CODING_SUPPORTED in a probe before relying on it.","Document the build variant so callers know whether arithmetic coding is available."],"exampleFix":"# before\n./jpegtran -arithmetic in.jpg > out.jpg\n# after: either drop the flag\n./jpegtran in.jpg > out.jpg\n# or rebuild: cmake -DCMAKE_C_FLAGS=-DC_ARITH_CODING_SUPPORTED=1 ...","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"#ifndef C_ARITH_CODING_SUPPORTED\n#error \"arithmetic coding unavailable; do not pass -arithmetic\"\n#endif","tryCatchPattern":null,"preventionTips":["Guard -arithmetic usage behind a build-time feature probe.","Default to Huffman coding for portability across builds.","Rebuild with C_ARITH_CODING_SUPPORTED if arithmetic is required."],"tags":["jpegtran","arithmetic-coding","build-config","compile-time","mozjpeg"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}