コード例 #1
0
        public static int stbi_zlib_decode_noheader_buffer(sbyte *obuffer, int olen, sbyte *ibuffer, int ilen)
        {
            var a = new StbiZbuf();

            a.zbuffer     = (byte *)ibuffer;
            a.zbuffer_end = (byte *)ibuffer + ilen;
            if (stbi__do_zlib(&a, obuffer, olen, 0, 0) != 0)
            {
                return((int)(a.zout - a.zout_start));
            }
            return(-1);
        }
コード例 #2
0
        public static sbyte *stbi_zlib_decode_noheader_malloc(sbyte *buffer, int len, int *outlen)
        {
            var a = new StbiZbuf();
            var p = (sbyte *)stbi__malloc((ulong)16384);

            if (p == null)
            {
                return(null);
            }
            a.zbuffer     = (byte *)buffer;
            a.zbuffer_end = (byte *)buffer + len;
            if (stbi__do_zlib(&a, p, 16384, 1, 0) != 0)
            {
                if (outlen != null)
                {
                    *outlen = (int)(a.zout - a.zout_start);
                }
                return(a.zout_start);
            }

            CRuntime.Free(a.zout_start);
            return(null);
        }
コード例 #3
0
        public static sbyte *stbi_zlib_decode_malloc_guesssize(sbyte *buffer, int len, int initialSize, int *outlen)
        {
            var a = new StbiZbuf();
            var p = (sbyte *)stbi__malloc((ulong)initialSize);

            if (p == null)
            {
                return(null);
            }
            a.zbuffer     = (byte *)buffer;
            a.zbuffer_end = (byte *)buffer + len;
            if (stbi__do_zlib(&a, p, initialSize, 1, 1) != 0)
            {
                if (outlen != null)
                {
                    *outlen = (int)(a.zout - a.zout_start);
                }
                return(a.zout_start);
            }

            CRuntime.Free(a.zout_start);
            return(null);
        }