Note that there are some explanatory texts on larger screens.

plurals
  1. POJPEG support with ijg - getting access violation
    primarykey
    data
    text
    <p>I was recently trying to update <a href="http://kentb.blogspot.com/2008/12/kentis.html" rel="nofollow noreferrer">my game</a> to store graphics in compressed formats (JPEG and PNG).</p> <p>Whilst I ended up settling on a different library, my initial attempt was to incorporate <a href="http://www.ijg.org/" rel="nofollow noreferrer">ijg</a> to do JPEG decompression. However, I was unable to get even the simplest console application to work and am wondering if anyone might be able to shed some light on the reasons why.</p> <p>Here is my code, which is linked to the <em>jpeg.lib</em> that is part of the ijg packages:</p> <pre><code>#include "stdafx.h" #include &lt;stdio.h&gt; #include &lt;assert.h&gt; #include &lt;jpeglib.h&gt; int _tmain(int argc, _TCHAR* argv[]) { struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; JSAMPARRAY buffer; int row_stride; //initialize error handling cinfo.err = jpeg_std_error(&amp;jerr); //initialize the decompression jpeg_create_decompress(&amp;cinfo); FILE* infile; errno_t err = fopen_s(&amp;infile, "..\\Sample.jpg", "rb"); assert(err == 0); //specify the input jpeg_stdio_src(&amp;cinfo, infile); //read headers (void) jpeg_read_header(&amp;cinfo, TRUE); return 0; } </code></pre> <p>The problem is that the call to <code>jpeg_read_header()</code> fails with an access violation:</p> <blockquote> <p>Unhandled exception at 0x7c91b1fa (ntdll.dll) in JPEGTest.exe: 0xC0000005: Access violation writing location 0x00000010.</p> </blockquote> <p>Does anyone have any ideas what I might be doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload