w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

jbig.c
Go to the documentation of this file.
1 /*
2  * Portable Free JBIG image compression library
3  *
4  * Markus Kuhn -- mkuhn@acm.org
5  *
6  * $Id: jbig.c,v 1.12 2000-04-08 11:42:18+01 mgk25 Rel $
7  *
8  * This module implements a portable standard C encoder and decoder
9  * using the JBIG lossless bi-level image compression algorithm as
10  * specified in International Standard ISO 11544:1993 or equivalently
11  * as specified in ITU-T Recommendation T.82. See the file jbig.doc
12  * for usage instructions and application examples.
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  *
28  * If you want to use this program under different license conditions,
29  * then contact the author for an arrangement.
30  *
31  * It is possible that certain products which can be built using this
32  * software module might form inventions protected by patent rights in
33  * some countries (e.g., by patents about arithmetic coding algorithms
34  * owned by IBM and AT&T in the USA). Provision of this software by the
35  * author does NOT include any licences for any patents. In those
36  * countries where a patent licence is required for certain applications
37  * of this software module, you will have to obtain such a licence
38  * yourself.
39  */
40 
41 #ifdef DEBUG
42 #include <stdio.h>
43 #else
44 #define NDEBUG
45 #endif
46 
47 #include <stdlib.h>
48 #include <assert.h>
49 
50 #include "jbig.h"
51 
52 
53 /* optional export of arithmetic coder functions for test purposes */
54 #ifdef TEST_CODEC
55 #define ARITH
56 #define ARITH_INL
57 #else
58 #define ARITH static
59 #ifdef __GNUC__
60 #define ARITH_INL static __inline__
61 #else
62 #define ARITH_INL static
63 #endif
64 #endif
65 
66 #define MX_MAX 23 /* maximal supported mx offset for
67  * adaptive template in the encoder */
68 
69 #define TPB2CX 0x195 /* contexts for TP special pixels */
70 #define TPB3CX 0x0e5
71 #define TPDCX 0xc3f
72 
73 /* marker codes */
74 #define MARKER_STUFF 0x00
75 #define MARKER_RESERVE 0x01
76 #define MARKER_SDNORM 0x02
77 #define MARKER_SDRST 0x03
78 #define MARKER_ABORT 0x04
79 #define MARKER_NEWLEN 0x05
80 #define MARKER_ATMOVE 0x06
81 #define MARKER_COMMENT 0x07
82 #define MARKER_ESC 0xff
83 
84 /* loop array indices */
85 #define STRIPE 0
86 #define LAYER 1
87 #define PLANE 2
88 
89 /* special jbg_buf pointers (instead of NULL) */
90 #define SDE_DONE ((struct jbg_buf *) -1)
91 #define SDE_TODO ((struct jbg_buf *) 0)
92 
93 /* object code version id */
94 
95 const char jbg_version[] =
96 " JBIG-KIT " JBG_VERSION " -- Markus Kuhn -- "
97 "$Id: jbig.c,v 1.12 2000-04-08 11:42:18+01 mgk25 Rel $ ";
98 
99 /*
100  * the following array specifies for each combination of the 3
101  * ordering bits, which ii[] variable represents which dimension
102  * of s->sde.
103  */
104 static const int index[8][3] = {
105  { 2, 1, 0 }, /* no ordering bit set */
106  { -1, -1, -1}, /* SMID -> illegal combination */
107  { 2, 0, 1 }, /* ILEAVE */
108  { 1, 0, 2 }, /* SMID + ILEAVE */
109  { 0, 2, 1 }, /* SEQ */
110  { 1, 2, 0 }, /* SEQ + SMID */
111  { 0, 1, 2 }, /* SEQ + ILEAVE */
112  { -1, -1, -1 } /* SEQ + SMID + ILEAVE -> illegal combination */
113 };
114 
115 
116 /*
117  * Array [language][message] with text string error messages that correspond
118  * to return values from public functions in this library.
119  */
120 #define NEMSG 9 /* number of error codes */
121 #define NEMSG_LANG 3 /* number of supported languages */
122 static const char *errmsg[NEMSG_LANG][NEMSG] = {
123  /* English (JBG_EN) */
124  {
125  "Everything is ok", /* JBG_EOK */
126  "Reached specified maximum size", /* JBG_EOK_INTR */
127  "Unexpected end of data", /* JBG_EAGAIN */
128  "Not enough memory available", /* JBG_ENOMEM */
129  "ABORT marker found", /* JBG_EABORT */
130  "Unknown marker segment encountered", /* JBG_EMARKER */
131  "Incremental BIE does not fit to previous one", /* JBG_ENOCONT */
132  "Invalid data encountered", /* JBG_EINVAL */
133  "Unimplemented features used" /* JBG_EIMPL */
134  },
135  /* German (JBG_DE_8859_1) */
136  {
137  "Kein Problem aufgetreten", /* JBG_EOK */
138  "Angegebene maximale Bildgr\366\337e erreicht", /* JBG_EOK_INTR */
139  "Unerwartetes Ende der Daten", /* JBG_EAGAIN */
140  "Nicht gen\374gend Speicher vorhanden", /* JBG_ENOMEM */
141  "Es wurde eine Abbruch-Sequenz gefunden", /* JBG_EABORT */
142  "Eine unbekannte Markierungssequenz wurde gefunden", /* JBG_EMARKER */
143  "Neue Daten passen nicht zu vorangegangenen Daten", /* JBG_ENOCONT */
144  "Es wurden ung\374ltige Daten gefunden", /* JBG_EINVAL */
145  "Noch nicht implementierte Optionen wurden benutzt" /* JBG_EIMPL */
146  },
147  /* German (JBG_DE_UTF_8) */
148  {
149  "Kein Problem aufgetreten", /* JBG_EOK */
150  "Angegebene maximale Bildgr\303\266\303\237e erreicht", /* JBG_EOK_INTR */
151  "Unerwartetes Ende der Daten", /* JBG_EAGAIN */
152  "Nicht gen\303\274gend Speicher vorhanden", /* JBG_ENOMEM */
153  "Es wurde eine Abbruch-Sequenz gefunden", /* JBG_EABORT */
154  "Eine unbekannte Markierungssequenz wurde gefunden", /* JBG_EMARKER */
155  "Neue Daten passen nicht zu vorangegangenen Daten", /* JBG_ENOCONT */
156  "Es wurden ung\303\274ltige Daten gefunden", /* JBG_EINVAL */
157  "Noch nicht implementierte Optionen wurden benutzt" /* JBG_EIMPL */
158  }
159 };
160 
161 
162 
163 /*
164  * The following three functions are the only places in this code, were
165  * C library memory management functions are called. The whole JBIG
166  * library has been designed in order to allow multi-threaded
167  * execution. no static or global variables are used, so all fuctions
168  * are fully reentrant. However if you want to use this multi-thread
169  * capability and your malloc, realloc and free are not reentrant,
170  * then simply add the necessary semaphores or mutex primitives below.
171  */
172 
173 static void *checked_malloc(size_t size)
174 {
175  void *p;
176 
177  p = malloc(size);
178  /* Full manual exception handling is ugly here for performance
179  * reasons. If an adequate handling of lack of memory is required,
180  * then use C++ and throw a C++ exception here. */
181  if (!p)
182  abort();
183 
184 #if 0
185  fprintf(stderr, "%p = malloc(%ld)\n", p, (long) size);
186 #endif
187 
188  return p;
189 }
190 
191 
192 static void *checked_realloc(void *ptr, size_t size)
193 {
194  void *p;
195 
196  p = realloc(ptr, size);
197  /* Full manual exception handling is ugly here for performance
198  * reasons. If an adequate handling of lack of memory is required,
199  * then use C++ and throw a C++ exception here. */
200  if (!p)
201  abort();
202 
203 #if 0
204  fprintf(stderr, "%p = realloc(%p, %ld)\n", p, ptr, (long) size);
205 #endif
206 
207  return p;
208 }
209 
210 
211 static void checked_free(void *ptr)
212 {
213  free(ptr);
214 
215 #if 0
216  fprintf(stderr, "free(%p)\n", ptr);
217 #endif
218 
219 }
220 
221 
222 
223 /*
224  * The next functions implement the arithmedic encoder and decoder
225  * required for JBIG. The same algorithm is also used in the arithmetic
226  * variant of JPEG.
227  */
228 
229 #ifdef DEBUG
230 static long encoded_pixels = 0;
231 #endif
232 
233 ARITH void arith_encode_init(struct jbg_arenc_state *s, int reuse_st)
234 {
235  int i;
236 
237  if (!reuse_st)
238  for (i = 0; i < 4096; s->st[i++] = 0);
239  s->c = 0;
240  s->a = 0x10000L;
241  s->sc = 0;
242  s->ct = 11;
243  s->buffer = -1; /* empty */
244 
245  return;
246 }
247 
248 
250 {
251  unsigned long temp;
252 
253 #ifdef DEBUG
254  fprintf(stderr, " encoded pixels = %ld, a = %05lx, c = %08lx\n",
255  encoded_pixels, s->a, s->c);
256 #endif
257 
258  /* find the s->c in the coding interval with the largest
259  * number of trailing zero bits */
260  if ((temp = (s->a - 1 + s->c) & 0xffff0000L) < s->c)
261  s->c = temp + 0x8000;
262  else
263  s->c = temp;
264  /* send remaining bytes to output */
265  s->c <<= s->ct;
266  if (s->c & 0xf8000000L) {
267  /* one final overflow has to be handled */
268  if (s->buffer >= 0) {
269  s->byte_out(s->buffer + 1, s->file);
270  if (s->buffer + 1 == MARKER_ESC)
271  s->byte_out(MARKER_STUFF, s->file);
272  }
273  /* output 0x00 bytes only when more non-0x00 will follow */
274  if (s->c & 0x7fff800L)
275  for (; s->sc; --s->sc)
276  s->byte_out(0x00, s->file);
277  } else {
278  if (s->buffer >= 0)
279  s->byte_out(s->buffer, s->file);
280  /* T.82 figure 30 says buffer+1 for the above line! Typo? */
281  for (; s->sc; --s->sc) {
282  s->byte_out(0xff, s->file);
283  s->byte_out(MARKER_STUFF, s->file);
284  }
285  }
286  /* output final bytes only if they are not 0x00 */
287  if (s->c & 0x7fff800L) {
288  s->byte_out((s->c >> 19) & 0xff, s->file);
289  if (((s->c >> 19) & 0xff) == MARKER_ESC)
290  s->byte_out(MARKER_STUFF, s->file);
291  if (s->c & 0x7f800L) {
292  s->byte_out((s->c >> 11) & 0xff, s->file);
293  if (((s->c >> 11) & 0xff) == MARKER_ESC)
294  s->byte_out(MARKER_STUFF, s->file);
295  }
296  }
297 
298  return;
299 }
300 
301 
302 ARITH_INL void arith_encode(struct jbg_arenc_state *s, int cx, int pix)
303 {
304  extern short jbg_lsz[];
305  extern unsigned char jbg_nmps[], jbg_nlps[];
306  register unsigned lsz, ss;
307  register unsigned char *st;
308  long temp;
309 
310 #ifdef DEBUG
311  ++encoded_pixels;
312 #endif
313 
314  assert(cx >= 0 && cx < 4096);
315  st = s->st + cx;
316  ss = *st & 0x7f;
317  assert(ss < 113);
318  lsz = jbg_lsz[ss];
319 
320 #if 0
321  fprintf(stderr, "pix = %d, cx = %d, mps = %d, st = %3d, lsz = 0x%04x, "
322  "a = 0x%05lx, c = 0x%08lx, ct = %2d, buf = 0x%02x\n",
323  pix, cx, !!(s->st[cx] & 0x80), ss, lsz, s->a, s->c, s->ct,
324  s->buffer);
325 #endif
326 
327  if (((pix << 7) ^ s->st[cx]) & 0x80) {
328  /* encode the less probable symbol */
329  if ((s->a -= lsz) >= lsz) {
330  /* If the interval size (lsz) for the less probable symbol (LPS)
331  * is larger than the interval size for the MPS, then exchange
332  * the two symbols for coding efficiency, otherwise code the LPS
333  * as usual: */
334  s->c += s->a;
335  s->a = lsz;
336  }
337  /* Check whether MPS/LPS exchange is necessary
338  * and chose next probability estimator status */
339  *st &= 0x80;
340  *st ^= jbg_nlps[ss];
341  } else {
342  /* encode the more probable symbol */
343  if ((s->a -= lsz) & 0xffff8000L)
344  return; /* A >= 0x8000 -> ready, no renormalization required */
345  if (s->a < lsz) {
346  /* If the interval size (lsz) for the less probable symbol (LPS)
347  * is larger than the interval size for the MPS, then exchange
348  * the two symbols for coding efficiency: */
349  s->c += s->a;
350  s->a = lsz;
351  }
352  /* chose next probability estimator status */
353  *st &= 0x80;
354  *st |= jbg_nmps[ss];
355  }
356 
357  /* renormalization of coding interval */
358  do {
359  s->a <<= 1;
360  s->c <<= 1;
361  --s->ct;
362  if (s->ct == 0) {
363  /* another byte is ready for output */
364  temp = s->c >> 19;
365  if (temp & 0xffffff00L) {
366  /* handle overflow over all buffered 0xff bytes */
367  if (s->buffer >= 0) {
368  ++s->buffer;
369  s->byte_out(s->buffer, s->file);
370  if (s->buffer == MARKER_ESC)
371  s->byte_out(MARKER_STUFF, s->file);
372  }
373  for (; s->sc; --s->sc)
374  s->byte_out(0x00, s->file);
375  s->buffer = temp & 0xff; /* new output byte, might overflow later */
376  assert(s->buffer != 0xff);
377  /* can s->buffer really never become 0xff here? */
378  } else if (temp == 0xff) {
379  /* buffer 0xff byte (which might overflow later) */
380  ++s->sc;
381  } else {
382  /* output all buffered 0xff bytes, they will not overflow any more */
383  if (s->buffer >= 0)
384  s->byte_out(s->buffer, s->file);
385  for (; s->sc; --s->sc) {
386  s->byte_out(0xff, s->file);
387  s->byte_out(MARKER_STUFF, s->file);
388  }
389  s->buffer = temp; /* buffer new output byte (can still overflow) */
390  }
391  s->c &= 0x7ffffL;
392  s->ct = 8;
393  }
394  } while (s->a < 0x8000);
395 
396  return;
397 }
398 
399 
400 ARITH void arith_decode_init(struct jbg_ardec_state *s, int reuse_st)
401 {
402  int i;
403 
404  if (!reuse_st)
405  for (i = 0; i < 4096; s->st[i++] = 0);
406  s->c = 0;
407  s->a = 1;
408  s->ct = 0;
409  s->result = JBG_OK;
410  s->startup = 1;
411  return;
412 }
413 
414 
416 {
417  extern short jbg_lsz[];
418  extern unsigned char jbg_nmps[], jbg_nlps[];
419  register unsigned lsz, ss;
420  register unsigned char *st;
421  int pix;
422 
423  /* renormalization */
424  while (s->a < 0x8000 || s->startup) {
425  if (s->ct < 1 && s->result != JBG_READY) {
426  /* first we have to move a new byte into s->c */
427  if (s->pscd_ptr >= s->pscd_end) {
428  s->result = JBG_MORE;
429  return -1;
430  }
431  if (*s->pscd_ptr == 0xff)
432  if (s->pscd_ptr + 1 >= s->pscd_end) {
433  s->result = JBG_MARKER;
434  return -1;
435  } else {
436  if (*(s->pscd_ptr + 1) == MARKER_STUFF) {
437  s->c |= 0xffL << (8 - s->ct);
438  s->ct += 8;
439  s->pscd_ptr += 2;
440  s->result = JBG_OK;
441  } else
442  s->result = JBG_READY;
443  }
444  else {
445  s->c |= (long)*(s->pscd_ptr++) << (8 - s->ct);
446  s->ct += 8;
447  s->result = JBG_OK;
448  }
449  }
450  s->c <<= 1;
451  s->a <<= 1;
452  --s->ct;
453  if (s->a == 0x10000L)
454  s->startup = 0;
455  }
456 
457  st = s->st + cx;
458  ss = *st & 0x7f;
459  assert(ss < 113);
460  lsz = jbg_lsz[ss];
461 
462 #if 0
463  fprintf(stderr, "cx = %d, mps = %d, st = %3d, lsz = 0x%04x, a = 0x%05lx, "
464  "c = 0x%08lx, ct = %2d\n",
465  cx, !!(s->st[cx] & 0x80), ss, lsz, s->a, s->c, s->ct);
466 #endif
467 
468  if ((s->c >> 16) < (s->a -= lsz))
469  if (s->a & 0xffff8000L)
470  return *st >> 7;
471  else {
472  /* MPS_EXCHANGE */
473  if (s->a < lsz) {
474  pix = 1 - (*st >> 7);
475  /* Check whether MPS/LPS exchange is necessary
476  * and chose next probability estimator status */
477  *st &= 0x80;
478  *st ^= jbg_nlps[ss];
479  } else {
480  pix = *st >> 7;
481  *st &= 0x80;
482  *st |= jbg_nmps[ss];
483  }
484  }
485  else {
486  /* LPS_EXCHANGE */
487  if (s->a < lsz) {
488  s->c -= s->a << 16;
489  s->a = lsz;
490  pix = *st >> 7;
491  *st &= 0x80;
492  *st |= jbg_nmps[ss];
493  } else {
494  s->c -= s->a << 16;
495  s->a = lsz;
496  pix = 1 - (*st >> 7);
497  /* Check whether MPS/LPS exchange is necessary
498  * and chose next probability estimator status */
499  *st &= 0x80;
500  *st ^= jbg_nlps[ss];
501  }
502  }
503 
504  return pix;
505 }
506 
507 
508 
509 /*
510  * Memory management for buffers which are used for temporarily
511  * storing SDEs by the encoder.
512  *
513  * The following functions manage a set of struct jbg_buf storage
514  * containers were each can keep JBG_BUFSIZE bytes. The jbg_buf
515  * containers can be linked to form linear double-chained lists for
516  * which a number of operations are provided. Blocks which are
517  * tempoarily not used any more are returned to a freelist which each
518  * encoder keeps. Only the destructor of the encoder actually returns
519  * the block via checked_free() to the stdlib memory management.
520  */
521 
522 
523 /*
524  * Allocate a new buffer block and initialize it. Try to get it from
525  * the free_list, and if it is empty, call checked_malloc().
526  */
527 static struct jbg_buf *jbg_buf_init(struct jbg_buf **free_list)
528 {
529  struct jbg_buf *new_block;
530 
531  /* Test whether a block from the free list is available */
532  if (*free_list) {
533  new_block = *free_list;
534  *free_list = new_block->next;
535  } else {
536  /* request a new memory block */
537  new_block = (struct jbg_buf *) checked_malloc(sizeof(struct jbg_buf));
538  }
539  new_block->len = 0;
540  new_block->next = NULL;
541  new_block->previous = NULL;
542  new_block->last = new_block;
543  new_block->free_list = free_list;
544 
545  return new_block;
546 }
547 
548 
549 /*
550  * Return an entire free_list to the memory management of stdlib.
551  * This is only done by jbg_enc_free().
552  */
553 static void jbg_buf_free(struct jbg_buf **free_list)
554 {
555  struct jbg_buf *tmp;
556 
557  while (*free_list) {
558  tmp = (*free_list)->next;
560  *free_list = tmp;
561  }
562 
563  return;
564 }
565 
566 
567 /*
568  * Append a single byte to a single list that starts with the block
569  * *(struct jbg_buf *) head. The type of *head is void here in order to
570  * keep the interface of the arithmetic encoder gereric, which uses this
571  * function as a call-back function in order to deliver single bytes
572  * for a PSCD.
573  */
574 static void jbg_buf_write(int b, void *head)
575 {
576  struct jbg_buf *now;
577 
578  now = ((struct jbg_buf *) head)->last;
579  if (now->len < JBG_BUFSIZE - 1) {
580  now->d[now->len++] = b;
581  return;
582  }
583  now->next = jbg_buf_init(((struct jbg_buf *) head)->free_list);
584  now->next->previous = now;
585  now->next->d[now->next->len++] = b;
586  ((struct jbg_buf *) head)->last = now->next;
587 
588  return;
589 }
590 
591 
592 /*
593  * Remove any trailing zero bytes from the end of a linked jbg_buf list,
594  * however make sure that no zero byte is removed which directly
595  * follows a 0xff byte (i.e., keep MARKER_ESC MARKER_STUFF sequences
596  * intact). This function is used to remove any redundant final zero
597  * bytes from a PSCD.
598  */
599 static void jbg_buf_remove_zeros(struct jbg_buf *head)
600 {
601  struct jbg_buf *last;
602 
603  while (1) {
604  /* remove trailing 0x00 in last block of list until this block is empty */
605  last = head->last;
606  while (last->len && last->d[last->len - 1] == 0)
607  last->len--;
608  /* if block became really empty, remove it in case it is not the
609  * only remaining block and then loop to next block */
610  if (last->previous && !last->len) {
611  head->last->next = *head->free_list;
612  *head->free_list = head->last;
613  head->last = last->previous;
614  head->last->next = NULL;
615  } else
616  break;
617  }
618 
619  /*
620  * If the final non-zero byte is 0xff (MARKER_ESC), then we just have
621  * removed a MARKER_STUFF and we will append it again now in order
622  * to preserve PSCD status of byte stream.
623  */
624  if (head->last->len && head->last->d[head->last->len - 1] == MARKER_ESC)
626 
627  return;
628 }
629 
630 
631 /*
632  * The jbg_buf list which starts with block *new_prefix is concatenated
633  * with the list which starts with block **start and *start will then point
634  * to the first block of the new list.
635  */
636 static void jbg_buf_prefix(struct jbg_buf *new_prefix, struct jbg_buf **start)
637 {
638  new_prefix->last->next = *start;
639  new_prefix->last->next->previous = new_prefix->last;
640  new_prefix->last = new_prefix->last->next->last;
641  *start = new_prefix;
642 
643  return;
644 }
645 
646 
647 /*
648  * Send the contents of a jbg_buf list that starts with block **head to
649  * the call back function data_out and return the blocks of the jbg_buf
650  * list to the freelist from which these jbg_buf blocks have been taken.
651  * After the call, *head == NULL.
652  */
653 static void jbg_buf_output(struct jbg_buf **head,
654  void (*data_out)(unsigned char *start,
655  size_t len, void *file),
656  void *file)
657 {
658  struct jbg_buf *tmp;
659 
660  while (*head) {
661  data_out((*head)->d, (*head)->len, file);
662  tmp = (*head)->next;
663  (*head)->next = *(*head)->free_list;
664  *(*head)->free_list = *head;
665  *head = tmp;
666  }
667 
668  return;
669 }
670 
671 
672 /*
673  * Calculate y = ceil(x/2) applied n times. This function is used to
674  * determine the number of pixels per row or column after n resolution
675  * reductions. E.g. X[d-1] = jbg_ceil_half(X[d], 1) and X[0] =
676  * jbg_ceil_half(X[d], d) as defined in clause 6.2.3 of T.82.
677  */
678 unsigned long jbg_ceil_half(unsigned long x, int n)
679 {
680  unsigned long mask;
681 
682  mask = (1UL << n) - 1; /* the lowest n bits are 1 here */
683  return (x >> n) + ((mask & x) != 0);
684 }
685 
686 
687 /*
688  * Initialize the status struct for the encoder.
689  */
690 void jbg_enc_init(struct jbg_enc_state *s, unsigned long x, unsigned long y,
691  int planes, unsigned char **p,
692  void (*data_out)(unsigned char *start, size_t len,
693  void *file),
694  void *file)
695 {
696  unsigned long l, lx;
697  int i;
698  size_t bufsize;
699 
700  extern char jbg_resred[], jbg_dptable[];
701 
702  s->xd = x;
703  s->yd = y;
704  s->planes = planes;
705  s->data_out = data_out;
706  s->file = file;
707 
708  s->d = 0;
709  s->dl = 0;
710  s->dh = s->d;
711  s->l0 = jbg_ceil_half(s->yd, s->d) / 35; /* 35 stripes/image */
712  while ((s->l0 << s->d) > 128) /* but <= 128 lines/stripe */
713  --s->l0;
714  if (s->l0 < 2) s->l0 = 2;
715  s->mx = 8;
716  s->my = 0;
717  s->order = JBG_ILEAVE | JBG_SMID;
718  s->options = JBG_TPBON | JBG_TPDON | JBG_DPON;
719  s->dppriv = jbg_dptable;
720  s->res_tab = jbg_resred;
721 
722  s->highres = checked_malloc(planes * sizeof(int));
723  s->lhp[0] = p;
724  s->lhp[1] = checked_malloc(planes * sizeof(unsigned char *));
725  bufsize = ((jbg_ceil_half(x, 1) + 7) / 8) * jbg_ceil_half(y, 1);
726  for (i = 0; i < planes; i++) {
727  s->highres[i] = 0;
728  s->lhp[1][i] = checked_malloc(sizeof(unsigned char) * bufsize);
729  }
730 
731  s->free_list = NULL;
732  s->s = (struct jbg_arenc_state *)
733  checked_malloc(s->planes * sizeof(struct jbg_arenc_state));
734  s->tx = (int *) checked_malloc(s->planes * sizeof(int));
735  lx = jbg_ceil_half(x, 1);
736  s->tp = (char *) checked_malloc(lx * sizeof(char));
737  for (l = 0; l < lx; s->tp[l++] = 2);
738  s->sde = NULL;
739 
740  return;
741 }
742 
743 
744 /*
745  * This function selects the number of differential layers based on
746  * the maximum size requested for the lowest resolution layer. If
747  * possible, a number of differential layers is selected, which will
748  * keep the size of the lowest resolution layer below or equal to the
749  * given width x and height y. However not more than 6 differential
750  * resolution layers will be used. In addition, a reasonable value for
751  * l0 (height of one stripe in the lowest resolution layer) is
752  * selected, which obeys the recommended limitations for l0 in annex A
753  * and C of the JBIG standard. The selected number of resolution layers
754  * is returned.
755  */
756 int jbg_enc_lrlmax(struct jbg_enc_state *s, unsigned long x,
757  unsigned long y)
758 {
759  for (s->d = 0; s->d < 6; s->d++)
760  if (jbg_ceil_half(s->xd, s->d) <= x && jbg_ceil_half(s->yd, s->d) <= y)
761  break;
762  s->dl = 0;
763  s->dh = s->d;
764 
765  s->l0 = jbg_ceil_half(s->yd, s->d) / 35; /* 35 stripes/image */
766  while ((s->l0 << s->d) > 128) /* but <= 128 lines/stripe */
767  --s->l0;
768  if (s->l0 < 2) s->l0 = 2;
769 
770  return s->d;
771 }
772 
773 
774 /*
775  * As an alternative to jbg_enc_lrlmax(), the following function allows
776  * to specify the number of layers directly. The stripe height and layer
777  * range is also adjusted automatically here.
778  */
779 void jbg_enc_layers(struct jbg_enc_state *s, int d)
780 {
781  if (d < 0 || d > 255)
782  return;
783  s->d = d;
784  s->dl = 0;
785  s->dh = s->d;
786 
787  s->l0 = jbg_ceil_half(s->yd, s->d) / 35; /* 35 stripes/image */
788  while ((s->l0 << s->d) > 128) /* but <= 128 lines/stripe */
789  --s->l0;
790  if (s->l0 < 2) s->l0 = 2;
791 
792  return;
793 }
794 
795 
796 /*
797  * Specify the highest and lowest resolution layers which will be
798  * written to the output file. Call this function not before
799  * jbg_enc_layers() or jbg_enc_lrlmax(), because these two functions
800  * reset the lowest and highest resolution layer to default values.
801  * Negative values are ignored. The total number of layers is returned.
802  */
803 int jbg_enc_lrange(struct jbg_enc_state *s, int dl, int dh)
804 {
805  if (dl >= 0 && dl <= s->d) s->dl = dl;
806  if (dh >= s->dl && dh <= s->d) s->dh = dh;
807 
808  return s->d;
809 }
810 
811 
812 /*
813  * The following function allows to specify the bits describing the
814  * options of the format as well as the maximum AT movement window and
815  * the number of layer 0 lines per stripes.
816  */
817 void jbg_enc_options(struct jbg_enc_state *s, int order, int options,
818  long l0, int mx, int my)
819 {
820  if (order >= 0 && order <= 0x0f) s->order = order;
821  if (options >= 0) s->options = options;
822  if (l0 >= 0) s->l0 = l0;
823  if (mx >= 0 && my < 128) s->mx = mx;
824  if (my >= 0 && my < 256) s->my = my;
825 
826  return;
827 }
828 
829 
830 /*
831  * This function actually does all the tricky work involved in producing
832  * a SDE, which is stored in the appropriate s->sde[][][] element
833  * for later output in the correct order.
834  */
835 static void encode_sde(struct jbg_enc_state *s,
836  long stripe, int layer, int plane)
837 {
838  unsigned char *hp, *lp1, *lp2, *p0, *p1, *q1, *q2;
839  unsigned long hl, ll, hx, hy, lx, ly, hbpl, lbpl;
840  unsigned long line_h0 = 0, line_h1 = 0;
841  unsigned long line_h2, line_h3, line_l1, line_l2, line_l3;
842  struct jbg_arenc_state *se;
843  unsigned long i, j, y;
844  unsigned t;
845  int ltp, ltp_old, cx;
846  unsigned long c_all, c[MX_MAX + 1], cmin, cmax, clmin, clmax;
847  int tmax, at_determined;
848  int new_tx;
849  long new_tx_line = -1;
850  struct jbg_buf *new_jbg_buf;
851 
852 #ifdef DEBUG
853  static long tp_lines, tp_exceptions, tp_pixels, dp_pixels;
854  static long encoded_pixels;
855 #endif
856 
857  /* return immediately if this stripe has already been encoded */
858  if (s->sde[stripe][layer][plane] != SDE_TODO)
859  return;
860 
861 #ifdef DEBUG
862  if (stripe == 0)
863  tp_lines = tp_exceptions = tp_pixels = dp_pixels = encoded_pixels = 0;
864  fprintf(stderr, "encode_sde: s/d/p = %2ld/%2d/%2d\n",
865  stripe, layer, plane);
866 #endif
867 
868  /* number of lines per stripe in highres image */
869  hl = s->l0 << layer;
870  /* number of lines per stripe in lowres image */
871  ll = hl >> 1;
872  /* current line number in highres image */
873  y = stripe * hl;
874  /* number of pixels in highres image */
875  hx = jbg_ceil_half(s->xd, s->d - layer);
876  hy = jbg_ceil_half(s->yd, s->d - layer);
877  /* number of pixels in lowres image */
878  lx = jbg_ceil_half(hx, 1);
879  ly = jbg_ceil_half(hy, 1);
880  /* bytes per line in highres and lowres image */
881  hbpl = (hx + 7) / 8;
882  lbpl = (lx + 7) / 8;
883  /* pointer to first image byte of highres stripe */
884  hp = s->lhp[s->highres[plane]][plane] + stripe * hl * hbpl;
885  lp2 = s->lhp[1 - s->highres[plane]][plane] + stripe * ll * lbpl;
886  lp1 = lp2 + lbpl;
887 
888  /* initialize arithmetic encoder */
889  se = s->s + plane;
890  arith_encode_init(se, stripe != 0);
891  s->sde[stripe][layer][plane] = jbg_buf_init(&s->free_list);
892  se->byte_out = jbg_buf_write;
893  se->file = s->sde[stripe][layer][plane];
894 
895  /* initialize adaptive template movement algorithm */
896  c_all = 0;
897  for (t = 0; t <= s->mx; t++)
898  c[t] = 0;
899  if (stripe == 0)
900  s->tx[plane] = 0;
901  new_tx = -1;
902  at_determined = 0; /* we haven't yet decided the template move */
903  if (s->mx == 0)
904  at_determined = 1;
905 
906  /* initialize typical prediction */
907  ltp = 0;
908  if (stripe == 0)
909  ltp_old = 0;
910  else {
911  ltp_old = 1;
912  p1 = hp - hbpl;
913  if (y > 1) {
914  q1 = p1 - hbpl;
915  while (p1 < hp && (ltp_old = (*p1++ == *q1++)) != 0);
916  } else
917  while (p1 < hp && (ltp_old = (*p1++ == 0)) != 0);
918  }
919 
920  if (layer == 0) {
921 
922  /*
923  * Encode lowest resolution layer
924  */
925 
926  for (i = 0; i < hl && y < hy; i++, y++) {
927 
928  /* check whether it is worth to perform an ATMOVE */
929  if (!at_determined && c_all > 2048) {
930  cmin = clmin = 0xffffffffL;
931  cmax = clmax = 0;
932  tmax = 0;
933  for (t = (s->options & JBG_LRLTWO) ? 5 : 3; t <= s->mx; t++) {
934  if (c[t] > cmax) cmax = c[t];
935  if (c[t] < cmin) cmin = c[t];
936  if (c[t] > c[tmax]) tmax = t;
937  }
938  clmin = (c[0] < cmin) ? c[0] : cmin;
939  clmax = (c[0] > cmax) ? c[0] : cmax;
940  if (c_all - cmax < (c_all >> 3) &&
941  cmax - c[s->tx[plane]] > c_all - cmax &&
942  cmax - c[s->tx[plane]] > (c_all >> 4) &&
943  /* ^ T.82 says here < !!! Typo ? */
944  cmax - (c_all - c[s->tx[plane]]) > c_all - cmax &&
945  cmax - (c_all - c[s->tx[plane]]) > (c_all >> 4) &&
946  cmax - cmin > (c_all >> 2) &&
947  (s->tx[plane] || clmax - clmin > (c_all >> 3))) {
948  /* we have decided to perform an ATMOVE */
949  new_tx = tmax;
950  if (!(s->options & JBG_DELAY_AT)) {
951  new_tx_line = i;
952  s->tx[plane] = new_tx;
953  }
954  }
955  at_determined = 1;
956  }
957 
958  /* typical prediction */
959  if (s->options & JBG_TPBON) {
960  ltp = 1;
961  p1 = hp;
962  if (y > 0) {
963  q1 = hp - hbpl;
964  while (q1 < hp && (ltp = (*p1++ == *q1++)) != 0);
965  } else
966  while (p1 < hp + hbpl && (ltp = (*p1++ == 0)) != 0);
967  arith_encode(se, (s->options & JBG_LRLTWO) ? TPB2CX : TPB3CX,
968  ltp == ltp_old);
969 #ifdef DEBUG
970  tp_lines += ltp;
971 #endif
972  ltp_old = ltp;
973  if (ltp) {
974  /* skip next line */
975  hp += hbpl;
976  continue;
977  }
978  }
979 
980  /*
981  * Layout of the variables line_h1, line_h2, line_h3, which contain
982  * as bits the neighbour pixels of the currently coded pixel X:
983  *
984  * 76543210765432107654321076543210 line_h3
985  * 76543210765432107654321076543210 line_h2
986  * 76543210765432107654321X76543210 line_h1
987  */
988 
989  line_h1 = line_h2 = line_h3 = 0;
990  if (y > 0) line_h2 = (long)*(hp - hbpl) << 8;
991  if (y > 1) line_h3 = (long)*(hp - hbpl - hbpl) << 8;
992 
993  /* encode line */
994  for (j = 0; j < hx; hp++) {
995  line_h1 |= *hp;
996  if (j < hbpl * 8 - 8 && y > 0) {
997  line_h2 |= *(hp - hbpl + 1);
998  if (y > 1)
999  line_h3 |= *(hp - hbpl - hbpl + 1);
1000  }
1001  if (s->options & JBG_LRLTWO) {
1002  /* two line template */
1003  do {
1004  line_h1 <<= 1; line_h2 <<= 1; line_h3 <<= 1;
1005  if (s->tx[plane])
1006  arith_encode(se, (((line_h2 >> 10) & 0x3e0) |
1007  ((line_h1 >> (4 + s->tx[plane])) & 0x010) |
1008  ((line_h1 >> 9) & 0x00f)),
1009  (line_h1 >> 8) & 1);
1010  else
1011  arith_encode(se, (((line_h2 >> 10) & 0x3f0) |
1012  ((line_h1 >> 9) & 0x00f)),
1013  (line_h1 >> 8) & 1);
1014 #ifdef DEBUG
1015  encoded_pixels++;
1016 #endif
1017  /* statistics for adaptive template changes */
1018  if (!at_determined && j >= s->mx && j < hx-2) {
1019  c[0] += !(((line_h2 >> 6) ^ line_h1) & 0x100);
1020  for (t = 5; t <= s->mx; t++)
1021  c[t] += !(((line_h1 >> t) ^ line_h1) & 0x100);
1022  ++c_all;
1023  }
1024  } while (++j & 7 && j < hx);
1025  } else {
1026  /* three line template */
1027  do {
1028  line_h1 <<= 1; line_h2 <<= 1; line_h3 <<= 1;
1029  if (s->tx[plane])
1030  arith_encode(se, (((line_h3 >> 8) & 0x380) |
1031  ((line_h2 >> 12) & 0x078) |
1032  ((line_h1 >> (6 + s->tx[plane])) & 0x004) |
1033  ((line_h1 >> 9) & 0x003)),
1034  (line_h1 >> 8) & 1);
1035  else
1036  arith_encode(se, (((line_h3 >> 8) & 0x380) |
1037  ((line_h2 >> 12) & 0x07c) |
1038  ((line_h1 >> 9) & 0x003)),
1039  (line_h1 >> 8) & 1);
1040 #ifdef DEBUG
1041  encoded_pixels++;
1042 #endif
1043  /* statistics for adaptive template changes */
1044  if (!at_determined && j >= s->mx && j < hx-2) {
1045  c[0] += !(((line_h2 >> 6) ^ line_h1) & 0x100);
1046  for (t = 3; t <= s->mx; t++)
1047  c[t] += !(((line_h1 >> t) ^ line_h1) & 0x100);
1048  ++c_all;
1049  }
1050  } while (++j & 7 && j < hx);
1051  } /* if (s->options & JBG_LRLTWO) */
1052  } /* for (j = ...) */
1053  } /* for (i = ...) */
1054 
1055  } else {
1056 
1057  /*
1058  * Encode differential layer
1059  */
1060 
1061  for (i = 0; i < hl && y < hy; i++, y++) {
1062 
1063  /* check whether it is worth to perform an ATMOVE */
1064  if (!at_determined && c_all > 2048) {
1065  cmin = clmin = 0xffffffffL;
1066  cmax = clmax = 0;
1067  tmax = 0;
1068  for (t = 3; t <= s->mx; t++) {
1069  if (c[t] > cmax) cmax = c[t];
1070  if (c[t] < cmin) cmin = c[t];
1071  if (c[t] > c[tmax]) tmax = t;
1072  }
1073  clmin = (c[0] < cmin) ? c[0] : cmin;
1074  clmax = (c[0] > cmax) ? c[0] : cmax;
1075  if (c_all - cmax < (c_all >> 3) &&
1076  cmax - c[s->tx[plane]] > c_all - cmax &&
1077  cmax - c[s->tx[plane]] > (c_all >> 4) &&
1078  /* ^ T.82 says here < !!! Typo ? */
1079  cmax - (c_all - c[s->tx[plane]]) > c_all - cmax &&
1080  cmax - (c_all - c[s->tx[plane]]) > (c_all >> 4) &&
1081  cmax - cmin > (c_all >> 2) &&
1082  (s->tx[plane] || clmax - clmin > (c_all >> 3))) {
1083  /* we have decided to perform an ATMOVE */
1084  new_tx = tmax;
1085  if (!(s->options & JBG_DELAY_AT)) {
1086  new_tx_line = i;
1087  s->tx[plane] = new_tx;
1088  }
1089 #ifdef DEBUG
1090  fprintf(stderr, "ATMOVE: line=%ld, tx=%d, c_all=%ld\n",
1091  i, new_tx, c_all);
1092 #endif
1093  }
1094  at_determined = 1;
1095  }
1096 
1097  if ((i >> 1) >= ll - 1 || (y >> 1) >= ly - 1)
1098  lp1 = lp2;
1099 
1100  /* typical prediction */
1101  if (s->options & JBG_TPDON && (i & 1) == 0) {
1102  q1 = lp1; q2 = lp2;
1103  p0 = p1 = hp;
1104  if (i < hl - 1 && y < hy - 1)
1105  p0 = hp + hbpl;
1106  if (y > 1)
1107  line_l3 = (long)*(q2 - lbpl) << 8;
1108  else
1109  line_l3 = 0;
1110  line_l2 = (long)*q2 << 8;
1111  line_l1 = (long)*q1 << 8;
1112  ltp = 1;
1113  for (j = 0; j < lx && ltp; q1++, q2++) {
1114  if (j < lbpl * 8 - 8) {
1115  if (y > 1)
1116  line_l3 |= *(q2 - lbpl + 1);
1117  line_l2 |= *(q2 + 1);
1118  line_l1 |= *(q1 + 1);
1119  }
1120  do {
1121  if ((j >> 2) < hbpl) {
1122  line_h1 = *(p1++);
1123  line_h0 = *(p0++);
1124  }
1125  do {
1126  line_l3 <<= 1;
1127  line_l2 <<= 1;
1128  line_l1 <<= 1;
1129  line_h1 <<= 2;
1130  line_h0 <<= 2;
1131  cx = (((line_l3 >> 15) & 0x007) |
1132  ((line_l2 >> 12) & 0x038) |
1133  ((line_l1 >> 9) & 0x1c0));
1134  if (cx == 0x000)
1135  if ((line_h1 & 0x300) == 0 && (line_h0 & 0x300) == 0)
1136  s->tp[j] = 0;
1137  else {
1138  ltp = 0;
1139 #ifdef DEBUG
1140  tp_exceptions++;
1141 #endif
1142  }
1143  else if (cx == 0x1ff)
1144  if ((line_h1 & 0x300) == 0x300 && (line_h0 & 0x300) == 0x300)
1145  s->tp[j] = 1;
1146  else {
1147  ltp = 0;
1148 #ifdef DEBUG
1149  tp_exceptions++;
1150 #endif
1151  }
1152  else
1153  s->tp[j] = 2;
1154  } while (++j & 3 && j < lx);
1155  } while (j & 7 && j < lx);
1156  } /* for (j = ...) */
1157  arith_encode(se, TPDCX, !ltp);
1158 #ifdef DEBUG
1159  tp_lines += ltp;
1160 #endif
1161  }
1162 
1163 
1164  /*
1165  * Layout of the variables line_h1, line_h2, line_h3, which contain
1166  * as bits the high resolution neighbour pixels of the currently coded
1167  * highres pixel X:
1168  *
1169  * 76543210 76543210 76543210 76543210 line_h3
1170  * 76543210 76543210 76543210 76543210 line_h2
1171  * 76543210 76543210 7654321X 76543210 line_h1
1172  *
1173  * Layout of the variables line_l1, line_l2, line_l3, which contain
1174  * the low resolution pixels near the currently coded pixel as bits.
1175  * The lowres pixel in which the currently coded highres pixel is
1176  * located is marked as Y:
1177  *
1178  * 76543210 76543210 76543210 76543210 line_l3
1179  * 76543210 7654321Y 76543210 76543210 line_l2
1180  * 76543210 76543210 76543210 76543210 line_l1
1181  */
1182 
1183 
1184  line_h1 = line_h2 = line_h3 = line_l1 = line_l2 = line_l3 = 0;
1185  if (y > 0) line_h2 = (long)*(hp - hbpl) << 8;
1186  if (y > 1) {
1187  line_h3 = (long)*(hp - hbpl - hbpl) << 8;
1188  line_l3 = (long)*(lp2 - lbpl) << 8;
1189  }
1190  line_l2 = (long)*lp2 << 8;
1191  line_l1 = (long)*lp1 << 8;
1192 
1193  /* encode line */
1194  for (j = 0; j < hx; lp1++, lp2++) {
1195  if ((j >> 1) < lbpl * 8 - 8) {
1196  if (y > 1)
1197  line_l3 |= *(lp2 - lbpl + 1);
1198  line_l2 |= *(lp2 + 1);
1199  line_l1 |= *(lp1 + 1);
1200  }
1201  do {
1202 
1203  assert(hp - (s->lhp[s->highres[plane]][plane] +
1204  (stripe * hl + i) * hbpl)
1205  == (ptrdiff_t) j >> 3);
1206 
1207  assert(lp2 - (s->lhp[1-s->highres[plane]][plane] +
1208  (stripe * ll + (i>>1)) * lbpl)
1209  == (ptrdiff_t) j >> 4);
1210 
1211  line_h1 |= *(hp++);
1212  if (j < hbpl * 8 - 8) {
1213  if (y > 0) {
1214  line_h2 |= *(hp - hbpl);
1215  if (y > 1)
1216  line_h3 |= *(hp - hbpl - hbpl);
1217  }
1218  }
1219  do {
1220  line_l1 <<= 1; line_l2 <<= 1; line_l3 <<= 1;
1221  if (ltp && s->tp[j >> 1] < 2) {
1222  /* pixel are typical and have not to be encoded */
1223  line_h1 <<= 2; line_h2 <<= 2; line_h3 <<= 2;
1224 #ifdef DEBUG
1225  do {
1226  ++tp_pixels;
1227  } while (++j & 1 && j < hx);
1228 #else
1229  j += 2;
1230 #endif
1231  } else
1232  do {
1233  line_h1 <<= 1; line_h2 <<= 1; line_h3 <<= 1;
1234 
1235  /* deterministic prediction */
1236  if (s->options & JBG_DPON) {
1237  if ((y & 1) == 0) {
1238  if ((j & 1) == 0) {
1239  /* phase 0 */
1240  if (s->dppriv[((line_l3 >> 16) & 0x003) |
1241  ((line_l2 >> 14) & 0x00c) |
1242  ((line_h1 >> 5) & 0x010) |
1243  ((line_h2 >> 10) & 0x0e0)] < 2) {
1244 #ifdef DEBUG
1245  ++dp_pixels;
1246 #endif
1247  continue;
1248  }
1249  } else {
1250  /* phase 1 */
1251  if (s->dppriv[(((line_l3 >> 16) & 0x003) |
1252  ((line_l2 >> 14) & 0x00c) |
1253  ((line_h1 >> 5) & 0x030) |
1254  ((line_h2 >> 10) & 0x1c0)) + 256] < 2) {
1255 #ifdef DEBUG
1256  ++dp_pixels;
1257 #endif
1258  continue;
1259  }
1260  }
1261  } else {
1262  if ((j & 1) == 0) {
1263  /* phase 2 */
1264  if (s->dppriv[(((line_l3 >> 16) & 0x003) |
1265  ((line_l2 >> 14) & 0x00c) |
1266  ((line_h1 >> 5) & 0x010) |
1267  ((line_h2 >> 10) & 0x0e0) |
1268  ((line_h3 >> 7) & 0x700)) + 768] < 2) {
1269 #ifdef DEBUG
1270  ++dp_pixels;
1271 #endif
1272  continue;
1273  }
1274  } else {
1275  /* phase 3 */
1276  if (s->dppriv[(((line_l3 >> 16) & 0x003) |
1277  ((line_l2 >> 14) & 0x00c) |
1278  ((line_h1 >> 5) & 0x030) |
1279  ((line_h2 >> 10) & 0x1c0) |
1280  ((line_h3 >> 7) & 0xe00)) + 2816] < 2) {
1281 #ifdef DEBUG
1282  ++dp_pixels;
1283 #endif
1284  continue;
1285  }
1286  }
1287  }
1288  }
1289 
1290  /* determine context */
1291  if (s->tx[plane])
1292  cx = (((line_h1 >> 9) & 0x003) |
1293  ((line_h1 >> (4 + s->tx[plane])) & 0x010) |
1294  ((line_h2 >> 13) & 0x00c) |
1295  ((line_h3 >> 11) & 0x020));
1296  else
1297  cx = (((line_h1 >> 9) & 0x003) |
1298  ((line_h2 >> 13) & 0x01c) |
1299  ((line_h3 >> 11) & 0x020));
1300  if (j & 1)
1301  cx |= (((line_l2 >> 9) & 0x0c0) |
1302  ((line_l1 >> 7) & 0x300)) | (1UL << 10);
1303  else
1304  cx |= (((line_l2 >> 10) & 0x0c0) |
1305  ((line_l1 >> 8) & 0x300));
1306  cx |= (y & 1) << 11;
1307 
1308  arith_encode(se, cx, (line_h1 >> 8) & 1);
1309 #ifdef DEBUG
1310  encoded_pixels++;
1311 #endif
1312 
1313  /* statistics for adaptive template changes */
1314  if (!at_determined && j >= s->mx) {
1315  c[0] += !(((line_h2 >> 6) ^ line_h1) & 0x100);
1316  for (t = 3; t <= s->mx; t++)
1317  c[t] += !(((line_h1 >> t) ^ line_h1) & 0x100);
1318  ++c_all;
1319  }
1320 
1321  } while (++j & 1 && j < hx);
1322  } while (j & 7 && j < hx);
1323  } while (j & 15 && j < hx);
1324  } /* for (j = ...) */
1325 
1326  /* low resolution pixels are used twice */
1327  if ((i & 1) == 0) {
1328  lp1 -= lbpl;
1329  lp2 -= lbpl;
1330  }
1331 
1332  } /* for (i = ...) */
1333  }
1334 
1335  arith_encode_flush(se);
1336  jbg_buf_remove_zeros(s->sde[stripe][layer][plane]);
1337  jbg_buf_write(MARKER_ESC, s->sde[stripe][layer][plane]);
1338  jbg_buf_write(MARKER_SDNORM, s->sde[stripe][layer][plane]);
1339 
1340  /* add ATMOVE */
1341  if (new_tx != -1) {
1342  if (s->options & JBG_DELAY_AT) {
1343  /* ATMOVE will become active at the first line of the next stripe */
1344  s->tx[plane] = new_tx;
1345  jbg_buf_write(MARKER_ESC, s->sde[stripe][layer][plane]);
1346  jbg_buf_write(MARKER_ATMOVE, s->sde[stripe][layer][plane]);
1347  jbg_buf_write(0, s->sde[stripe][layer][plane]);
1348  jbg_buf_write(0, s->sde[stripe][layer][plane]);
1349  jbg_buf_write(0, s->sde[stripe][layer][plane]);
1350  jbg_buf_write(0, s->sde[stripe][layer][plane]);
1351  jbg_buf_write(s->tx[plane], s->sde[stripe][layer][plane]);
1352  jbg_buf_write(0, s->sde[stripe][layer][plane]);
1353  } else {
1354  /* ATMOVE has already become active during this stripe
1355  * => we have to prefix the SDE data with an ATMOVE marker */
1356  new_jbg_buf = jbg_buf_init(&s->free_list);
1357  jbg_buf_write(MARKER_ESC, new_jbg_buf);
1358  jbg_buf_write(MARKER_ATMOVE, new_jbg_buf);
1359  jbg_buf_write((new_tx_line >> 24) & 0xff, new_jbg_buf);
1360  jbg_buf_write((new_tx_line >> 16) & 0xff, new_jbg_buf);
1361  jbg_buf_write((new_tx_line >> 8) & 0xff, new_jbg_buf);
1362  jbg_buf_write(new_tx_line & 0xff, new_jbg_buf);
1363  jbg_buf_write(new_tx, new_jbg_buf);
1364  jbg_buf_write(0, new_jbg_buf);
1365  jbg_buf_prefix(new_jbg_buf, &s->sde[stripe][layer][plane]);
1366  }
1367  }
1368 
1369 #if 0
1370  if (stripe == s->stripes - 1)
1371  fprintf(stderr, "tp_lines = %ld, tp_exceptions = %ld, tp_pixels = %ld, "
1372  "dp_pixels = %ld, encoded_pixels = %ld\n",
1373  tp_lines, tp_exceptions, tp_pixels, dp_pixels, encoded_pixels);
1374 #endif
1375 
1376  return;
1377 }
1378 
1379 
1380 /*
1381  * Create the next lower resolution version of an image
1382  */
1383 static void resolution_reduction(struct jbg_enc_state *s, int plane,
1384  int higher_layer)
1385 {
1386  unsigned long hx, hy, lx, ly, hbpl, lbpl;
1387  unsigned char *hp1, *hp2, *hp3, *lp;
1388  unsigned long line_h1, line_h2, line_h3, line_l2;
1389  unsigned long i, j;
1390  int pix, k, l;
1391 
1392  /* number of pixels in highres image */
1393  hx = jbg_ceil_half(s->xd, s->d - higher_layer);
1394  hy = jbg_ceil_half(s->yd, s->d - higher_layer);
1395  /* number of pixels in lowres image */
1396  lx = jbg_ceil_half(hx, 1);
1397  ly = jbg_ceil_half(hy, 1);
1398  /* bytes per line in highres and lowres image */
1399  hbpl = (hx + 7) / 8;
1400  lbpl = (lx + 7) / 8;
1401  /* pointers to first image bytes */
1402  hp2 = s->lhp[s->highres[plane]][plane];
1403  hp1 = hp2 + hbpl;
1404  hp3 = hp2 - hbpl;
1405  lp = s->lhp[1 - s->highres[plane]][plane];
1406 
1407 #ifdef DEBUG
1408  fprintf(stderr, "resolution_reduction: plane = %d, higher_layer = %d\n",
1409  plane, higher_layer);
1410 #endif
1411 
1412  /*
1413  * Layout of the variables line_h1, line_h2, line_h3, which contain
1414  * as bits the high resolution neighbour pixels of the currently coded
1415  * lowres pixel /\:
1416  * \/
1417  *
1418  * 76543210 76543210 76543210 76543210 line_h3
1419  * 76543210 76543210 765432/\ 76543210 line_h2
1420  * 76543210 76543210 765432\/ 76543210 line_h1
1421  *
1422  * Layout of the variable line_l2, which contains the low resolution
1423  * pixels near the currently coded pixel as bits. The lowres pixel
1424  * which is currently coded is marked as X:
1425  *
1426  * 76543210 76543210 76543210 76543210 line_l2
1427  * X
1428  */
1429 
1430  for (i = 0; i < ly; i++) {
1431  if (2*i + 1 >= hy)
1432  hp1 = hp2;
1433  pix = 0;
1434  line_h1 = line_h2 = line_h3 = line_l2 = 0;
1435  for (j = 0; j < lbpl * 8; j += 8) {
1436  *lp = 0;
1437  line_l2 |= i ? lp[-lbpl] : 0;
1438  for (k = 0; k < 8 && j + k < lx; k += 4) {
1439  if (((j + k) >> 2) < hbpl) {
1440  line_h3 |= i ? *hp3 : 0;
1441  ++hp3;
1442  line_h2 |= *(hp2++);
1443  line_h1 |= *(hp1++);
1444  }
1445  for (l = 0; l < 4 && j + k + l < lx; l++) {
1446  line_h3 <<= 2;
1447  line_h2 <<= 2;
1448  line_h1 <<= 2;
1449  line_l2 <<= 1;
1450  pix = s->res_tab[((line_h1 >> 8) & 0x007) |
1451  ((line_h2 >> 5) & 0x038) |
1452  ((line_h3 >> 2) & 0x1c0) |
1453  (pix << 9) | ((line_l2 << 2) & 0xc00)];
1454  *lp = (*lp << 1) | pix;
1455  }
1456  }
1457  ++lp;
1458  }
1459  *(lp - 1) <<= lbpl * 8 - lx;
1460  hp1 += hbpl;
1461  hp2 += hbpl;
1462  hp3 += hbpl;
1463  }
1464 
1465 #ifdef DEBUG
1466  {
1467  FILE *f;
1468  char fn[50];
1469 
1470  sprintf(fn, "dbg_d=%02d.pbm", higher_layer - 1);
1471  f = fopen(fn, "wb");
1472  fprintf(f, "P4\n%lu %lu\n", lx, ly);
1473  fwrite(s->lhp[1 - s->highres[plane]][plane], 1, lbpl * ly, f);
1474  fclose(f);
1475  }
1476 #endif
1477 
1478  return;
1479 }
1480 
1481 
1482 /*
1483  * This function is called inside the three loops of jbg_enc_out() in
1484  * order to write the next SDE. It has first to generate the required
1485  * SDE and all SDEs which have to be encoded before this SDE can be
1486  * created. The problem here is that if we want to output a lower
1487  * resolution layer, we have to allpy the resolution reduction
1488  * algorithm in order to get it. As we try to safe as much memory as
1489  * possible, the resolution reduction will overwrite previous higher
1490  * resolution bitmaps. Consequently, we have to encode and buffer SDEs
1491  * which depend on higher resolution layers before we can start the
1492  * resolution reduction. All this logic about which SDE has to be
1493  * encoded before resolution reduction is allowed is handled here.
1494  * This approach might be a little bit more complex than alternative
1495  * ways to do it, but it allows us to do the encoding with the minimal
1496  * possible amount of temporary memory.
1497  */
1498 static void output_sde(struct jbg_enc_state *s,
1499  unsigned long stripe, int layer, int plane)
1500 {
1501  int lfcl; /* lowest fully coded layer */
1502  long i;
1503  unsigned long u;
1504 
1505  assert(s->sde[stripe][layer][plane] != SDE_DONE);
1506 
1507  if (s->sde[stripe][layer][plane] != SDE_TODO) {
1508 #ifdef DEBUG
1509  fprintf(stderr, "writing SDE: s/d/p = %2lu/%2d/%2d\n",
1510  stripe, layer, plane);
1511 #endif
1512  jbg_buf_output(&s->sde[stripe][layer][plane], s->data_out, s->file);
1513  s->sde[stripe][layer][plane] = SDE_DONE;
1514  return;
1515  }
1516 
1517  /* Determine the smallest resolution layer in this plane for which
1518  * not yet all stripes have been encoded into SDEs. This layer will
1519  * have to be completely coded, before we can apply the next
1520  * resolution reduction step. */
1521  lfcl = 0;
1522  for (i = s->d; i >= 0; i--)
1523  if (s->sde[s->stripes - 1][i][plane] == SDE_TODO) {
1524  lfcl = i + 1;
1525  break;
1526  }
1527  if (lfcl > s->d && s->d > 0 && stripe == 0) {
1528  /* perform the first resolution reduction */
1529  resolution_reduction(s, plane, s->d);
1530  }
1531  /* In case HITOLO is not used, we have to encode and store the higher
1532  * resolution layers first, although we do not need them right now. */
1533  while (lfcl - 1 > layer) {
1534  for (u = 0; u < s->stripes; u++)
1535  encode_sde(s, u, lfcl - 1, plane);
1536  --lfcl;
1537  s->highres[plane] ^= 1;
1538  if (lfcl > 1)
1539  resolution_reduction(s, plane, lfcl - 1);
1540  }
1541 
1542  encode_sde(s, stripe, layer, plane);
1543 
1544 #ifdef DEBUG
1545  fprintf(stderr, "writing SDE: s/d/p = %2lu/%2d/%2d\n", stripe, layer, plane);
1546 #endif
1547  jbg_buf_output(&s->sde[stripe][layer][plane], s->data_out, s->file);
1548  s->sde[stripe][layer][plane] = SDE_DONE;
1549 
1550  if (stripe == s->stripes - 1 && layer > 0 &&
1551  s->sde[0][layer-1][plane] == SDE_TODO) {
1552  s->highres[plane] ^= 1;
1553  if (layer > 1)
1554  resolution_reduction(s, plane, layer - 1);
1555  }
1556 
1557  return;
1558 }
1559 
1560 
1561 /*
1562  * Convert the table which controls the deterministic prediction
1563  * process from the internal format into the representation required
1564  * for the 1728 byte long DPTABLE element of a BIH.
1565  *
1566  * The bit order of the DPTABLE format (see also ITU-T T.82 figure 13) is
1567  *
1568  * high res: 4 5 6 low res: 0 1
1569  * 7 8 9 2 3
1570  * 10 11 12
1571  *
1572  * were 4 table entries are packed into one byte, while we here use
1573  * internally an unpacked 6912 byte long table indexed by the following
1574  * bit order:
1575  *
1576  * high res: 7 6 5 high res: 8 7 6 low res: 1 0
1577  * (phase 0) 4 . . (phase 1) 5 4 . 3 2
1578  * . . . . . .
1579  *
1580  * high res: 10 9 8 high res: 11 10 9
1581  * (phase 2) 7 6 5 (phase 3) 8 7 6
1582  * 4 . . 5 4 .
1583  */
1584 void jbg_int2dppriv(unsigned char *dptable, const char *internal)
1585 {
1586  int i, j, k;
1587  int trans0[ 8] = { 1, 0, 3, 2, 7, 6, 5, 4 };
1588  int trans1[ 9] = { 1, 0, 3, 2, 8, 7, 6, 5, 4 };
1589  int trans2[11] = { 1, 0, 3, 2, 10, 9, 8, 7, 6, 5, 4 };
1590  int trans3[12] = { 1, 0, 3, 2, 11, 10, 9, 8, 7, 6, 5, 4 };
1591 
1592  for (i = 0; i < 1728; dptable[i++] = 0);
1593 
1594 #define FILL_TABLE1(offset, len, trans) \
1595  for (i = 0; i < len; i++) { \
1596  k = 0; \
1597  for (j = 0; j < 8; j++) \
1598  k |= ((i >> j) & 1) << trans[j]; \
1599  dptable[(i + offset) >> 2] |= \
1600  (internal[k + offset] & 3) << ((3 - (i&3)) << 1); \
1601  }
1602 
1603  FILL_TABLE1( 0, 256, trans0);
1604  FILL_TABLE1( 256, 512, trans1);
1605  FILL_TABLE1( 768, 2048, trans2);
1606  FILL_TABLE1(2816, 4096, trans3);
1607 
1608  return;
1609 }
1610 
1611 
1612 /*
1613  * Convert the table which controls the deterministic prediction
1614  * process from the 1728 byte long DPTABLE format into the 6912 byte long
1615  * internal format.
1616  */
1617 void jbg_dppriv2int(char *internal, const unsigned char *dptable)
1618 {
1619  int i, j, k;
1620  int trans0[ 8] = { 1, 0, 3, 2, 7, 6, 5, 4 };
1621  int trans1[ 9] = { 1, 0, 3, 2, 8, 7, 6, 5, 4 };
1622  int trans2[11] = { 1, 0, 3, 2, 10, 9, 8, 7, 6, 5, 4 };
1623  int trans3[12] = { 1, 0, 3, 2, 11, 10, 9, 8, 7, 6, 5, 4 };
1624 
1625 #define FILL_TABLE2(offset, len, trans) \
1626  for (i = 0; i < len; i++) { \
1627  k = 0; \
1628  for (j = 0; j < 8; j++) \
1629  k |= ((i >> j) & 1) << trans[j]; \
1630  internal[k + offset] = \
1631  (dptable[(i + offset) >> 2] >> ((3 - (i & 3)) << 1)) & 3; \
1632  }
1633 
1634  FILL_TABLE2( 0, 256, trans0);
1635  FILL_TABLE2( 256, 512, trans1);
1636  FILL_TABLE2( 768, 2048, trans2);
1637  FILL_TABLE2(2816, 4096, trans3);
1638 
1639  return;
1640 }
1641 
1642 
1643 /*
1644  * Encode one full BIE and pass the generated data to the specified
1645  * call-back function
1646  */
1648 {
1649  long bpl;
1650  unsigned char bih[20];
1651  unsigned long xd, yd, y;
1652  long ii[3], is[3], ie[3]; /* generic variables for the 3 nested loops */
1653  unsigned long stripe;
1654  int layer, plane;
1655  int order;
1656  unsigned char dpbuf[1728];
1657  extern char jbg_dptable[];
1658 
1659  /* some sanity checks */
1660  s->order &= JBG_HITOLO | JBG_SEQ | JBG_ILEAVE | JBG_SMID;
1661  order = s->order & (JBG_SEQ | JBG_ILEAVE | JBG_SMID);
1662  if (index[order][0] < 0)
1663  s->order = order = JBG_SMID | JBG_ILEAVE;
1664  if (s->options & JBG_DPON && s->dppriv != jbg_dptable)
1665  s->options |= JBG_DPPRIV;
1666  if (s->mx > MX_MAX)
1667  s->mx = MX_MAX;
1668  s->my = 0;
1669  if (s->mx && s->mx < ((s->options & JBG_LRLTWO) ? 5U : 3U))
1670  s->mx = 0;
1671  if (s->d > 255 || s->d < 0 || s->dh > s->d || s->dh < 0 ||
1672  s->dl < 0 || s->dl > s->dh || s->planes < 0 || s->planes > 255)
1673  return;
1674 
1675  /* ensure correct zero padding of bitmap at the final byte of each line */
1676  if (s->xd & 7) {
1677  bpl = (s->xd + 7) / 8; /* bytes per line */
1678  for (plane = 0; plane < s->planes; plane++)
1679  for (y = 0; y < s->yd; y++)
1680  s->lhp[0][plane][y * bpl + bpl - 1] &= ~((1 << (8 - (s->xd & 7))) - 1);
1681  }
1682 
1683  /* calculate number of stripes that will be required */
1684  s->stripes = ((s->yd >> s->d) +
1685  ((((1UL << s->d) - 1) & s->xd) != 0) + s->l0 - 1) / s->l0;
1686 
1687  /* allocate buffers for SDE pointers */
1688  if (s->sde == NULL) {
1689  s->sde = (struct jbg_buf ****)
1690  checked_malloc(s->stripes * sizeof(struct jbg_buf ***));
1691  for (stripe = 0; stripe < s->stripes; stripe++) {
1692  s->sde[stripe] = (struct jbg_buf ***)
1693  checked_malloc((s->d + 1) * sizeof(struct jbg_buf **));
1694  for (layer = 0; layer < s->d + 1; layer++) {
1695  s->sde[stripe][layer] = (struct jbg_buf **)
1696  checked_malloc(s->planes * sizeof(struct jbg_buf *));
1697  for (plane = 0; plane < s->planes; plane++)
1698  s->sde[stripe][layer][plane] = SDE_TODO;
1699  }
1700  }
1701  }
1702 
1703  /* output BIH */
1704  bih[0] = s->dl;
1705  bih[1] = s->dh;
1706  bih[2] = s->planes;
1707  bih[3] = 0;
1708  xd = jbg_ceil_half(s->xd, s->d - s->dh);
1709  yd = jbg_ceil_half(s->yd, s->d - s->dh);
1710  bih[4] = xd >> 24;
1711  bih[5] = (xd >> 16) & 0xff;
1712  bih[6] = (xd >> 8) & 0xff;
1713  bih[7] = xd & 0xff;
1714  bih[8] = yd >> 24;
1715  bih[9] = (yd >> 16) & 0xff;
1716  bih[10] = (yd >> 8) & 0xff;
1717  bih[11] = yd & 0xff;
1718  bih[12] = s->l0 >> 24;
1719  bih[13] = (s->l0 >> 16) & 0xff;
1720  bih[14] = (s->l0 >> 8) & 0xff;
1721  bih[15] = s->l0 & 0xff;
1722  bih[16] = s->mx;
1723  bih[17] = s->my;
1724  bih[18] = s->order;
1725  bih[19] = s->options & 0x7f;
1726  s->data_out(bih, 20, s->file);
1727  if ((s->options & (JBG_DPON | JBG_DPPRIV | JBG_DPLAST)) ==
1728  (JBG_DPON | JBG_DPPRIV)) {
1729  /* write private table */
1730  jbg_int2dppriv(dpbuf, s->dppriv);
1731  s->data_out(dpbuf, 1728, s->file);
1732  }
1733 
1734 #if 0
1735  /*
1736  * Encode everything first. This is a simple-minded alternative to
1737  * all the tricky on-demand encoding logic in output_sde() for
1738  * debugging purposes.
1739  */
1740  for (layer = s->dh; layer >= s->dl; layer--) {
1741  for (plane = 0; plane < s->planes; plane++) {
1742  if (layer > 0)
1743  resolution_reduction(s, plane, layer);
1744  for (stripe = 0; stripe < s->stripes; stripe++)
1745  encode_sde(s, stripe, layer, plane);
1746  s->highres[plane] ^= 1;
1747  }
1748  }
1749 #endif
1750 
1751  /*
1752  * Generic loops over all SDEs. Which loop represents layer, plane and
1753  * stripe depends on the option flags.
1754  */
1755 
1756  /* start and end value vor each loop */
1757  is[index[order][STRIPE]] = 0;
1758  ie[index[order][STRIPE]] = s->stripes - 1;
1759  is[index[order][LAYER]] = s->dl;
1760  ie[index[order][LAYER]] = s->dh;
1761  is[index[order][PLANE]] = 0;
1762  ie[index[order][PLANE]] = s->planes - 1;
1763 
1764  for (ii[0] = is[0]; ii[0] <= ie[0]; ii[0]++)
1765  for (ii[1] = is[1]; ii[1] <= ie[1]; ii[1]++)
1766  for (ii[2] = is[2]; ii[2] <= ie[2]; ii[2]++) {
1767 
1768  stripe = ii[index[order][STRIPE]];
1769  if (s->order & JBG_HITOLO)
1770  layer = s->dh - (ii[index[order][LAYER]] - s->dl);
1771  else
1772  layer = ii[index[order][LAYER]];
1773  plane = ii[index[order][PLANE]];
1774 
1775  output_sde(s, stripe, layer, plane);
1776 
1777  }
1778 
1779  return;
1780 }
1781 
1782 
1784 {
1785  unsigned long stripe;
1786  int layer, plane;
1787 
1788 #ifdef DEBUG
1789  fprintf(stderr, "jbg_enc_free(%p)\n", s);
1790 #endif
1791 
1792  /* clear buffers for SDEs */
1793  if (s->sde) {
1794  for (stripe = 0; stripe < s->stripes; stripe++) {
1795  for (layer = 0; layer < s->d + 1; layer++) {
1796  for (plane = 0; plane < s->planes; plane++)
1797  if (s->sde[stripe][layer][plane] != SDE_DONE &&
1798  s->sde[stripe][layer][plane] != SDE_TODO)
1799  jbg_buf_free(&s->sde[stripe][layer][plane]);
1800  checked_free(s->sde[stripe][layer]);
1801  }
1802  checked_free(s->sde[stripe]);
1803  }
1804  checked_free(s->sde);
1805  }
1806 
1807  /* clear free_list */
1808  jbg_buf_free(&s->free_list);
1809 
1810  /* clear memory for arithmetic encoder states */
1811  checked_free(s->s);
1812 
1813  /* clear memory for differential-layer typical prediction buffer */
1814  checked_free(s->tp);
1815 
1816  /* clear memory for adaptive template pixel offsets */
1817  checked_free(s->tx);
1818 
1819  /* clear lowres image buffers */
1820  if (s->lhp[1]) {
1821  for (plane = 0; plane < s->planes; plane++)
1822  checked_free(s->lhp[1][plane]);
1823  checked_free(s->lhp[1]);
1824  }
1825 
1826  return;
1827 }
1828 
1829 
1830 /*
1831  * Convert the error codes used by jbg_dec_in() into a string
1832  * written in the selected language and character set.
1833  */
1834 const char *jbg_strerror(int errnum, int language)
1835 {
1836  if (errnum < 0 || errnum >= NEMSG)
1837  return "Unknown error code passed to jbg_strerror()";
1838  if (language < 0 || language >= NEMSG_LANG)
1839  return "Unknown language code passed to jbg_strerror()";
1840 
1841  return errmsg[language][errnum];
1842 }
1843 
1844 
1845 /*
1846  * The constructor for a decoder
1847  */
1849 {
1850  s->order = 0;
1851  s->d = -1;
1852  s->bie_len = 0;
1853  s->buf_len = 0;
1854  s->dppriv = NULL;
1855  s->xmax = 4294967295UL;
1856  s->ymax = 4294967295UL;
1857  s->dmax = 256;
1858  s->s = NULL;
1859 
1860  return;
1861 }
1862 
1863 
1864 /*
1865  * Specify a maximum image size for the decoder. If the JBIG file has
1866  * the order bit ILEAVE, but not the bit SEQ set, then the decoder
1867  * will abort to decode after the image has reached the maximal
1868  * resolution layer which is still not wider than xmax or higher than
1869  * ymax.
1870  */
1871 void jbg_dec_maxsize(struct jbg_dec_state *s, unsigned long xmax,
1872  unsigned long ymax)
1873 {
1874  if (xmax > 0) s->xmax = xmax;
1875  if (ymax > 0) s->ymax = ymax;
1876 
1877  return;
1878 }
1879 
1880 
1881 /*
1882  * Decode the new len PSDC bytes to which data points and add them to
1883  * the current stripe. Return the number of bytes which have actually
1884  * been read (this will be less than len if a marker segment was
1885  * part of the data or if the final byte was 0xff were this code
1886  * can not determine, whether we have a marker segment.
1887  */
1888 static size_t decode_pscd(struct jbg_dec_state *s, unsigned char *data,
1889  size_t len)
1890 {
1891  unsigned long stripe;
1892  unsigned int layer, plane;
1893  unsigned long hl, ll, y, hx, hy, lx, ly, hbpl, lbpl;
1894  unsigned char *hp, *lp1, *lp2, *p1, *q1;
1895  register unsigned long line_h1, line_h2, line_h3;
1896  register unsigned long line_l1, line_l2, line_l3;
1897  struct jbg_ardec_state *se;
1898  unsigned long x;
1899  int n;
1900  int pix, cx = 0, slntp, shift, tx;
1901 
1902  /* SDE loop variables */
1903  stripe = s->ii[index[s->order & 7][STRIPE]];
1904  layer = s->ii[index[s->order & 7][LAYER]];
1905  plane = s->ii[index[s->order & 7][PLANE]];
1906 
1907  /* forward data to arithmetic decoder */
1908  se = s->s[plane] + layer - s->dl;
1909  se->pscd_ptr = data;
1910  se->pscd_end = data + len;
1911 
1912  /* number of lines per stripe in highres image */
1913  hl = s->l0 << layer;
1914  /* number of lines per stripe in lowres image */
1915  ll = hl >> 1;
1916  /* current line number in highres image */
1917  y = stripe * hl + s->i;
1918  /* number of pixels in highres image */
1919  hx = jbg_ceil_half(s->xd, s->d - layer);
1920  hy = jbg_ceil_half(s->yd, s->d - layer);
1921  /* number of pixels in lowres image */
1922  lx = jbg_ceil_half(hx, 1);
1923  ly = jbg_ceil_half(hy, 1);
1924  /* bytes per line in highres and lowres image */
1925  hbpl = (hx + 7) / 8;
1926  lbpl = (lx + 7) / 8;
1927  /* pointer to highres and lowres image bytes */
1928  hp = s->lhp[ layer & 1][plane] + (stripe * hl + s->i) * hbpl +
1929  (s->x >> 3);
1930  lp2 = s->lhp[(layer-1) & 1][plane] + (stripe * ll + (s->i >> 1)) * lbpl +
1931  (s->x >> 4);
1932  lp1 = lp2 + lbpl;
1933 
1934  /* restore a few local variables */
1935  line_h1 = s->line_h1;
1936  line_h2 = s->line_h2;
1937  line_h3 = s->line_h3;
1938  line_l1 = s->line_l1;
1939  line_l2 = s->line_l2;
1940  line_l3 = s->line_l3;
1941  x = s->x;
1942 
1943  if (s->x == 0 && s->i == 0 &&
1944  (stripe == 0 || s->reset[plane][layer - s->dl])) {
1945  s->tx[plane][layer - s->dl] = s->ty[plane][layer - s->dl] = 0;
1946  if (s->pseudo)
1947  s->lntp[plane][layer - s->dl] = 1;
1948  }
1949 
1950 #ifdef DEBUG
1951  if (s->x == 0 && s->i == 0 && s->pseudo)
1952  fprintf(stderr, "decode_pscd(%p, %p, %ld): s/d/p = %2lu/%2u/%2u\n",
1953  s, data, (long) len, stripe, layer, plane);
1954 #endif
1955 
1956  if (layer == 0) {
1957 
1958  /*
1959  * Decode lowest resolution layer
1960  */
1961 
1962  for (; s->i < hl && y < hy; s->i++, y++) {
1963 
1964  /* adaptive template changes */
1965  if (x == 0)
1966  for (n = 0; n < s->at_moves; n++)
1967  if (s->at_line[n] == s->i) {
1968  s->tx[plane][layer - s->dl] = s->at_tx[n];
1969  s->ty[plane][layer - s->dl] = s->at_ty[n];
1970 #ifdef DEBUG
1971  fprintf(stderr, "ATMOVE: line=%lu, tx=%d, ty=%d.\n", s->i,
1972  s->tx[plane][layer - s->dl], s->ty[plane][layer - s->dl]);
1973 #endif
1974  }
1975  tx = s->tx[plane][layer - s->dl];
1976  shift = tx - ((s->options & JBG_LRLTWO) ? 5 : 3);
1977 
1978  /* typical prediction */
1979  if (s->options & JBG_TPBON && s->pseudo) {
1980  slntp = arith_decode(se, (s->options & JBG_LRLTWO) ? TPB2CX : TPB3CX);
1981  if (se->result == JBG_MORE || se->result == JBG_MARKER)
1982  goto leave;
1983  s->lntp[plane][layer - s->dl] =
1984  !(slntp ^ s->lntp[plane][layer - s->dl]);
1985  if (s->lntp[plane][layer - s->dl]) {
1986  /* this line is 'not typical' and has to be coded completely */
1987  s->pseudo = 0;
1988  } else {
1989  /* this line is 'typical' (i.e. identical to the previous one) */
1990  p1 = hp;
1991  if (s->i == 0 && (stripe == 0 || s->reset[plane][layer - s->dl]))
1992  while (p1 < hp + hbpl) *p1++ = 0;
1993  else {
1994  q1 = hp - hbpl;
1995  while (q1 < hp) *p1++ = *q1++;
1996  }
1997  hp += hbpl;
1998  continue;
1999  }
2000  }
2001 
2002  /*
2003  * Layout of the variables line_h1, line_h2, line_h3, which contain
2004  * as bits the neighbour pixels of the currently decoded pixel X:
2005  *
2006  * 76543210 76543210 76543210 76543210 line_h3
2007  * 76543210 76543210 76543210 76543210 line_h2
2008  * 76543210 76543210 76543210 76543210 X line_h1
2009  */
2010 
2011  if (x == 0) {
2012  line_h1 = line_h2 = line_h3 = 0;
2013  if (s->i > 0 || (y > 0 && !s->reset[plane][layer - s->dl]))
2014  line_h2 = (long)*(hp - hbpl) << 8;
2015  if (s->i > 1 || (y > 1 && !s->reset[plane][layer - s->dl]))
2016  line_h3 = (long)*(hp - hbpl - hbpl) << 8;
2017  }
2018 
2019  /*
2020  * Another tiny JBIG standard bug:
2021  *
2022  * While implementing the line_h3 handling here, I discovered
2023  * another problem with the ITU-T T.82(1993 E) specification.
2024  * This might be a somewhat pathological case, however. The
2025  * standard is unclear about how a decoder should behave in the
2026  * following situation:
2027  *
2028  * Assume we are in layer 0 and all stripes are single lines
2029  * (L0=1 allowed by table 9). We are now decoding the first (and
2030  * only) line of the third stripe. Assume, the first stripe was
2031  * terminated by SDRST and the second stripe was terminated by
2032  * SDNORM. While decoding the only line of the third stripe with
2033  * the three-line template, we need access to pixels from the
2034  * previous two stripes. We know that the previous stripe
2035  * terminated with SDNROM, so we access the pixel from the
2036  * second stripe. But do we have to replace the pixels from the
2037  * first stripe by background pixels, because this stripe ended
2038  * with SDRST? The standard, especially clause 6.2.5 does never
2039  * mention this case, so the behaviour is undefined here. My
2040  * current implementation remembers only the marker used to
2041  * terminate the previous stripe. In the above example, the
2042  * pixels of the first stripe are accessed despite the fact that
2043  * this stripe ended with SDRST. An alternative (only slightly
2044  * more complicated) implementation would be to remember the end
2045  * marker (SDNORM or SDRST) of the previous two stripes in a
2046  * plane/layer and to act accordingly when accessing the two
2047  * previous lines. What am I supposed to do here?
2048  *
2049  * As the standard is unclear about the correct behaviour in the
2050  * situation of the above example, I strongly suggest to avoid
2051  * the following situation while encoding data with JBIG:
2052  *
2053  * LRLTWO = 0, L0=1 and both SDNORM and SDRST appear in layer 0.
2054  *
2055  * I guess that only a very few if any encoders will switch
2056  * between SDNORM and SDRST, so let us hope that this ambiguity
2057  * in the standard will never cause any interoperability
2058  * problems.
2059  *
2060  * Markus Kuhn -- 1995-04-30
2061  */
2062 
2063  /* decode line */
2064  while (x < hx) {
2065  if ((x & 7) == 0) {
2066  if (x < hbpl * 8 - 8 &&
2067  (s->i > 0 || (y > 0 && !s->reset[plane][layer - s->dl]))) {
2068  line_h2 |= *(hp - hbpl + 1);
2069  if (s->i > 1 || (y > 1 && !s->reset[plane][layer - s->dl]))
2070  line_h3 |= *(hp - hbpl - hbpl + 1);
2071  }
2072  }
2073  if (s->options & JBG_LRLTWO) {
2074  /* two line template */
2075  do {
2076  if (tx)
2077  pix = arith_decode(se, (((line_h2 >> 9) & 0x3e0) |
2078  ((line_h1 >> shift) & 0x010) |
2079  (line_h1 & 0x00f)));
2080  else
2081  pix = arith_decode(se, (((line_h2 >> 9) & 0x3f0) |
2082  (line_h1 & 0x00f)));
2083  if (se->result == JBG_MORE || se->result == JBG_MARKER)
2084  goto leave;
2085  line_h1 = (line_h1 << 1) | pix;
2086  line_h2 <<= 1;
2087  } while ((++x & 7) && x < hx);
2088  } else {
2089  /* three line template */
2090  do {
2091  if (tx)
2092  pix = arith_decode(se, (((line_h3 >> 7) & 0x380) |
2093  ((line_h2 >> 11) & 0x078) |
2094  ((line_h1 >> shift) & 0x004) |
2095  (line_h1 & 0x003)));
2096  else
2097  pix = arith_decode(se, (((line_h3 >> 7) & 0x380) |
2098  ((line_h2 >> 11) & 0x07c) |
2099  (line_h1 & 0x003)));
2100  if (se->result == JBG_MORE || se->result == JBG_MARKER)
2101  goto leave;
2102 
2103  line_h1 = (line_h1 << 1) | pix;
2104  line_h2 <<= 1;
2105  line_h3 <<= 1;
2106  } while ((++x & 7) && x < hx);
2107  } /* if (s->options & JBG_LRLTWO) */
2108  *hp++ = line_h1;
2109  } /* while */
2110  *(hp - 1) <<= hbpl * 8 - hx;
2111  x = 0;
2112  s->pseudo = 1;
2113  } /* for (i = ...) */
2114 
2115  } else {
2116 
2117  /*
2118  * Decode differential layer
2119  */
2120 
2121  for (; s->i < hl && y < hy; s->i++, y++) {
2122 
2123  /* adaptive template changes */
2124  if (x == 0)
2125  for (n = 0; n < s->at_moves; n++)
2126  if (s->at_line[n] == s->i) {
2127  s->tx[plane][layer - s->dl] = s->at_tx[n];
2128  s->ty[plane][layer - s->dl] = s->at_ty[n];
2129 #ifdef DEBUG
2130  fprintf(stderr, "ATMOVE: line=%lu, tx=%d, ty=%d.\n", s->i,
2131  s->tx[plane][layer - s->dl], s->ty[plane][layer - s->dl]);
2132 #endif
2133  }
2134  tx = s->tx[plane][layer - s->dl];
2135  shift = tx - 3;
2136 
2137  /* handle lower border of low-resolution image */
2138  if ((s->i >> 1) >= ll - 1 || (y >> 1) >= ly - 1)
2139  lp1 = lp2;
2140 
2141  /* typical prediction */
2142  if (s->options & JBG_TPDON && s->pseudo) {
2143  s->lntp[plane][layer - s->dl] = arith_decode(se, TPDCX);
2144  if (se->result == JBG_MORE || se->result == JBG_MARKER)
2145  goto leave;
2146  s->pseudo = 0;
2147  }
2148 
2149 
2150  /*
2151  * Layout of the variables line_h1, line_h2, line_h3, which contain
2152  * as bits the high resolution neighbour pixels of the currently
2153  * decoded highres pixel X:
2154  *
2155  * 76543210 76543210 76543210 76543210 line_h3
2156  * 76543210 76543210 76543210 76543210 line_h2
2157  * 76543210 76543210 76543210 76543210 X line_h1
2158  *
2159  * Layout of the variables line_l1, line_l2, line_l3, which contain
2160  * the low resolution pixels near the currently decoded pixel as bits.
2161  * The lowres pixel in which the currently coded highres pixel is
2162  * located is marked as Y:
2163  *
2164  * 76543210 76543210 76543210 76543210 line_l3
2165  * 76543210 76543210 Y6543210 76543210 line_l2
2166  * 76543210 76543210 76543210 76543210 line_l1
2167  */
2168 
2169 
2170  if (x == 0) {
2171  line_h1 = line_h2 = line_h3 = line_l1 = line_l2 = line_l3 = 0;
2172  if (s->i > 0 || (y > 0 && !s->reset[plane][layer - s->dl])) {
2173  line_h2 = (long)*(hp - hbpl) << 8;
2174  if (s->i > 1 || (y > 1 && !s->reset[plane][layer - s->dl]))
2175  line_h3 = (long)*(hp - hbpl - hbpl) << 8;
2176  }
2177  if (s->i > 1 || (y > 1 && !s->reset[plane][layer-s->dl]))
2178  line_l3 = (long)*(lp2 - lbpl) << 8;
2179  line_l2 = (long)*lp2 << 8;
2180  line_l1 = (long)*lp1 << 8;
2181  }
2182 
2183  /* decode line */
2184  while (x < hx) {
2185  if ((x & 15) == 0)
2186  if ((x >> 1) < lbpl * 8 - 8) {
2187  line_l1 |= *(lp1 + 1);
2188  line_l2 |= *(lp2 + 1);
2189  if (s->i > 1 ||
2190  (y > 1 && !s->reset[plane][layer - s->dl]))
2191  line_l3 |= *(lp2 - lbpl + 1);
2192  }
2193  do {
2194 
2195  assert(hp - (s->lhp[ layer &1][plane] + (stripe * hl + s->i)
2196  * hbpl) == (ptrdiff_t) x >> 3);
2197  assert(lp2 - (s->lhp[(layer-1) &1][plane] + (stripe * ll + (s->i>>1))
2198  * lbpl) == (ptrdiff_t) x >> 4);
2199 
2200  if ((x & 7) == 0)
2201  if (x < hbpl * 8 - 8) {
2202  if (s->i > 0 || (y > 0 && !s->reset[plane][layer - s->dl])) {
2203  line_h2 |= *(hp + 1 - hbpl);
2204  if (s->i > 1 || (y > 1 && !s->reset[plane][layer - s->dl]))
2205  line_h3 |= *(hp + 1 - hbpl - hbpl);
2206  }
2207  }
2208  do {
2209  if (!s->lntp[plane][layer - s->dl])
2210  cx = (((line_l3 >> 14) & 0x007) |
2211  ((line_l2 >> 11) & 0x038) |
2212  ((line_l1 >> 8) & 0x1c0));
2213  if (!s->lntp[plane][layer - s->dl] &&
2214  (cx == 0x000 || cx == 0x1ff)) {
2215  /* pixels are typical and have not to be decoded */
2216  do {
2217  line_h1 = (line_h1 << 1) | (cx & 1);
2218  } while ((++x & 1) && x < hx);
2219  line_h2 <<= 2; line_h3 <<= 2;
2220  } else
2221  do {
2222 
2223  /* deterministic prediction */
2224  if (s->options & JBG_DPON)
2225  if ((y & 1) == 0)
2226  if ((x & 1) == 0)
2227  /* phase 0 */
2228  pix = s->dppriv[((line_l3 >> 15) & 0x003) |
2229  ((line_l2 >> 13) & 0x00c) |
2230  ((line_h1 << 4) & 0x010) |
2231  ((line_h2 >> 9) & 0x0e0)];
2232  else
2233  /* phase 1 */
2234  pix = s->dppriv[(((line_l3 >> 15) & 0x003) |
2235  ((line_l2 >> 13) & 0x00c) |
2236  ((line_h1 << 4) & 0x030) |
2237  ((line_h2 >> 9) & 0x1c0)) + 256];
2238  else
2239  if ((x & 1) == 0)
2240  /* phase 2 */
2241  pix = s->dppriv[(((line_l3 >> 15) & 0x003) |
2242  ((line_l2 >> 13) & 0x00c) |
2243  ((line_h1 << 4) & 0x010) |
2244  ((line_h2 >> 9) & 0x0e0) |
2245  ((line_h3 >> 6) & 0x700)) + 768];
2246  else
2247  /* phase 3 */
2248  pix = s->dppriv[(((line_l3 >> 15) & 0x003) |
2249  ((line_l2 >> 13) & 0x00c) |
2250  ((line_h1 << 4) & 0x030) |
2251  ((line_h2 >> 9) & 0x1c0) |
2252  ((line_h3 >> 6) & 0xe00)) + 2816];
2253  else
2254  pix = 2;
2255 
2256  if (pix & 2) {
2257  if (tx)
2258  cx = ((line_h1 & 0x003) |
2259  (((line_h1 << 2) >> shift) & 0x010) |
2260  ((line_h2 >> 12) & 0x00c) |
2261  ((line_h3 >> 10) & 0x020));
2262  else
2263  cx = ((line_h1 & 0x003) |
2264  ((line_h2 >> 12) & 0x01c) |
2265  ((line_h3 >> 10) & 0x020));
2266  if (x & 1)
2267  cx |= (((line_l2 >> 8) & 0x0c0) |
2268  ((line_l1 >> 6) & 0x300)) | (1UL << 10);
2269  else
2270  cx |= (((line_l2 >> 9) & 0x0c0) |
2271  ((line_l1 >> 7) & 0x300));
2272  cx |= (y & 1) << 11;
2273 
2274  pix = arith_decode(se, cx);
2275  if (se->result == JBG_MORE || se->result == JBG_MARKER)
2276  goto leave;
2277  }
2278 
2279  line_h1 = (line_h1 << 1) | pix;
2280  line_h2 <<= 1;
2281  line_h3 <<= 1;
2282 
2283  } while ((++x & 1) && x < hx);
2284  line_l1 <<= 1; line_l2 <<= 1; line_l3 <<= 1;
2285  } while ((x & 7) && x < hx);
2286  *hp++ = line_h1;
2287  } while ((x & 15) && x < hx);
2288  ++lp1;
2289  ++lp2;
2290  } /* while */
2291  x = 0;
2292 
2293  *(hp - 1) <<= hbpl * 8 - hx;
2294  if ((s->i & 1) == 0) {
2295  /* low resolution pixels are used twice */
2296  lp1 -= lbpl;
2297  lp2 -= lbpl;
2298  } else
2299  s->pseudo = 1;
2300 
2301  } /* for (i = ...) */
2302 
2303  }
2304 
2305  leave:
2306 
2307  /* save a few local variables */
2308  s->line_h1 = line_h1;
2309  s->line_h2 = line_h2;
2310  s->line_h3 = line_h3;
2311  s->line_l1 = line_l1;
2312  s->line_l2 = line_l2;
2313  s->line_l3 = line_l3;
2314  s->x = x;
2315 
2316  return se->pscd_ptr - data;
2317 }
2318 
2319 
2320 /*
2321  * Provide a new BIE fragment to the decoder.
2322  *
2323  * If cnt is not NULL, then *cnt will contain after the call the
2324  * number of actually read bytes. If the data was not complete, then
2325  * the return value will be JBG_EAGAIN and *cnt == len. In case this
2326  * function has returned with JBG_EOK, then it has reached the end of
2327  * a BIE but it can be called again with data from the next BIE if
2328  * there exists one in order to get to a higher resolution layer. In
2329  * case the return value was JBG_EOK_INTR then this function can be
2330  * called again with the rest of the BIE, because parsing the BIE has
2331  * been interrupted by a jbg_dec_maxsize() specification. In both
2332  * cases the remaining len - *cnt bytes of the previous block will
2333  * have to passed to this function again (if len > *cnt). In case of
2334  * any other return value than JBG_EOK, JBG_EOK_INTR or JBG_EAGAIN, a
2335  * serious problem has occured and the only function you should call
2336  * is jbg_dec_free() in order to remove the mess (and probably
2337  * jbg_strerror() in order to find out what to tell the user).
2338  */
2339 int jbg_dec_in(struct jbg_dec_state *s, unsigned char *data, size_t len,
2340  size_t *cnt)
2341 {
2342  int i, j, required_length;
2343  unsigned long x, y;
2344  unsigned long is[3], ie[3];
2345  long hsize, lsize;
2346  extern char jbg_dptable[];
2347  size_t dummy_cnt;
2348 
2349  if (!cnt) cnt = &dummy_cnt;
2350  *cnt = 0;
2351  if (len < 1) return JBG_EAGAIN;
2352 
2353  /* read in 20-byte BIH */
2354  if (s->bie_len < 20) {
2355  while (s->bie_len < 20 && *cnt < len)
2356  s->buffer[s->bie_len++] = data[(*cnt)++];
2357  if (s->bie_len < 20)
2358  return JBG_EAGAIN;
2359  if (s->buffer[1] < s->buffer[0])
2360  return JBG_EINVAL;
2361  /* test whether this looks like a valid JBIG header at all */
2362  if (s->buffer[3] != 0 || (s->buffer[18] & 0xf0) != 0 ||
2363  (s->buffer[19] & 0x80) != 0)
2364  return JBG_EINVAL;
2365  if (s->buffer[0] != s->d + 1)
2366  return JBG_ENOCONT;
2367  s->dl = s->buffer[0];
2368  s->d = s->buffer[1];
2369  if (s->dl == 0)
2370  s->planes = s->buffer[2];
2371  else
2372  if (s->planes != s->buffer[2])
2373  return JBG_ENOCONT;
2374  x = (((long) s->buffer[ 4] << 24) | ((long) s->buffer[ 5] << 16) |
2375  ((long) s->buffer[ 6] << 8) | (long) s->buffer[ 7]);
2376  y = (((long) s->buffer[ 8] << 24) | ((long) s->buffer[ 9] << 16) |
2377  ((long) s->buffer[10] << 8) | (long) s->buffer[11]);
2378  if (s->dl != 0 && ((s->xd << (s->d - s->dl + 1)) != x &&
2379  (s->yd << (s->d - s->dl + 1)) != y))
2380  return JBG_ENOCONT;
2381  s->xd = x;
2382  s->yd = y;
2383  s->l0 = (((long) s->buffer[12] << 24) | ((long) s->buffer[13] << 16) |
2384  ((long) s->buffer[14] << 8) | (long) s->buffer[15]);
2385  if (!s->planes || !s->xd || !s->yd || !s->l0)
2386  return JBG_EINVAL;
2387  s->mx = s->buffer[16];
2388  if (s->mx > 127)
2389  return JBG_EINVAL;
2390  s->my = s->buffer[17];
2391  if (s->mx > 32 || s->my > 0)
2392  return JBG_EIMPL;
2393  s->order = s->buffer[18];
2394  if (index[s->order & 7][0] < 0)
2395  return JBG_EINVAL;
2396  /* HITOLO and SEQ currently not yet implemented */
2397  if (s->dl != s->d && (s->order & JBG_HITOLO || s->order & JBG_SEQ))
2398  return JBG_EIMPL;
2399  s->options = s->buffer[19];
2400 
2401  /* calculate number of stripes that will be required */
2402  s->stripes = ((s->yd >> s->d) +
2403  ((((1UL << s->d) - 1) & s->xd) != 0) + s->l0 - 1) / s->l0;
2404 
2405  /* some initialization */
2406  s->ii[index[s->order & 7][STRIPE]] = 0;
2407  s->ii[index[s->order & 7][LAYER]] = s->dl;
2408  s->ii[index[s->order & 7][PLANE]] = 0;
2409  /* bytes required for resolution layer D and D-1 */
2410  hsize = ((s->xd + 7) / 8) * s->yd;
2411  lsize = ((jbg_ceil_half(s->xd, 1) + 7) / 8) *
2412  jbg_ceil_half(s->yd, 1);
2413  if (s->dl == 0) {
2414  s->s = checked_malloc(s->planes * sizeof(struct jbg_ardec_state *));
2415  s->tx = checked_malloc(s->planes * sizeof(int *));
2416  s->ty = checked_malloc(s->planes * sizeof(int *));
2417  s->reset = checked_malloc(s->planes * sizeof(int *));
2418  s->lntp = checked_malloc(s->planes * sizeof(int *));
2419  s->lhp[0] = checked_malloc(s->planes * sizeof(unsigned char *));
2420  s->lhp[1] = checked_malloc(s->planes * sizeof(unsigned char *));
2421  for (i = 0; i < s->planes; i++) {
2422  s->s[i] = checked_malloc((s->d - s->dl + 1) *
2423  sizeof(struct jbg_ardec_state));
2424  s->tx[i] = checked_malloc((s->d - s->dl + 1) * sizeof(int));
2425  s->ty[i] = checked_malloc((s->d - s->dl + 1) * sizeof(int));
2426  s->reset[i] = checked_malloc((s->d - s->dl + 1) * sizeof(int));
2427  s->lntp[i] = checked_malloc((s->d - s->dl + 1) * sizeof(int));
2428  s->lhp[s->d &1][i] = checked_malloc(sizeof(unsigned char) * hsize);
2429  s->lhp[(s->d-1)&1][i] = checked_malloc(sizeof(unsigned char) * lsize);
2430  }
2431  } else {
2432  for (i = 0; i < s->planes; i++) {
2433  s->s[i] = checked_realloc(s->s[i], (s->d - s->dl + 1) *
2434  sizeof(struct jbg_ardec_state));
2435  s->tx[i] = checked_realloc(s->tx[i], (s->d - s->dl + 1) * sizeof(int));
2436  s->ty[i] = checked_realloc(s->ty[i], (s->d - s->dl + 1) * sizeof(int));
2437  s->reset[i] = checked_realloc(s->reset[i],
2438  (s->d - s->dl +1) * sizeof(int));
2439  s->lntp[i] = checked_realloc(s->lntp[i],
2440  (s->d - s->dl +1) * sizeof(int));
2441  s->lhp[s->d &1][i] = checked_realloc(s->lhp[s->d & 1][i],
2442  sizeof(unsigned char) * hsize);
2443  s->lhp[(s->d-1)&1][i] = checked_realloc(s->lhp[(s->d-1)&1][i],
2444  sizeof(unsigned char) * lsize);
2445  }
2446  }
2447  for (i = 0; i < s->planes; i++)
2448  for (j = 0; j <= s->d - s->dl; j++)
2449  arith_decode_init(s->s[i] + j, 0);
2450  if (s->dl == 0 || (s->options & JBG_DPON && !(s->options & JBG_DPPRIV)))
2451  s->dppriv = jbg_dptable;
2452  s->comment_skip = 0;
2453  s->buf_len = 0;
2454  s->x = 0;
2455  s->i = 0;
2456  s->pseudo = 1;
2457  s->at_moves = 0;
2458  }
2459 
2460  /* read in DPTABLE */
2461  if (s->bie_len < 20 + 1728 &&
2462  (s->options & (JBG_DPON | JBG_DPPRIV | JBG_DPLAST)) ==
2463  (JBG_DPON | JBG_DPPRIV)) {
2464  assert(s->bie_len >= 20);
2465  while (s->bie_len < 20 + 1728 && *cnt < len)
2466  s->buffer[s->bie_len++ - 20] = data[(*cnt)++];
2467  if (s->bie_len < 20 + 1728)
2468  return JBG_EAGAIN;
2469  if (!s->dppriv || s->dppriv == jbg_dptable)
2470  s->dppriv = checked_malloc(sizeof(char) * 1728);
2471  jbg_dppriv2int(s->dppriv, s->buffer);
2472  }
2473 
2474  /*
2475  * BID processing loop
2476  */
2477 
2478  while (*cnt < len) {
2479 
2480  /* process floating marker segments */
2481 
2482  /* skip COMMENT contents */
2483  if (s->comment_skip) {
2484  if (s->comment_skip <= len - *cnt) {
2485  *cnt += s->comment_skip;
2486  s->comment_skip = 0;
2487  } else {
2488  s->comment_skip -= len - *cnt;
2489  *cnt = len;
2490  }
2491  continue;
2492  }
2493 
2494  /* load complete marker segments into s->buffer for processing */
2495  if (s->buf_len > 0) {
2496  assert(s->buffer[0] == MARKER_ESC);
2497  while (s->buf_len < 2 && *cnt < len)
2498  s->buffer[s->buf_len++] = data[(*cnt)++];
2499  if (s->buf_len < 2) continue;
2500  switch (s->buffer[1]) {
2501  case MARKER_COMMENT: required_length = 6; break;
2502  case MARKER_ATMOVE: required_length = 8; break;
2503  case MARKER_NEWLEN: required_length = 6; break;
2504  case MARKER_ABORT:
2505  case MARKER_SDNORM:
2506  case MARKER_SDRST: required_length = 2; break;
2507  case MARKER_STUFF:
2508  /* forward stuffed 0xff to arithmetic decoder */
2509  s->buf_len = 0;
2510  decode_pscd(s, s->buffer, 2);
2511  continue;
2512  default:
2513  return JBG_EMARKER;
2514  }
2515  while (s->buf_len < required_length && *cnt < len)
2516  s->buffer[s->buf_len++] = data[(*cnt)++];
2517  if (s->buf_len < required_length) continue;
2518  /* now the buffer is filled with exactly one marker segment */
2519  switch (s->buffer[1]) {
2520  case MARKER_COMMENT:
2521  s->comment_skip =
2522  (((long) s->buffer[2] << 24) | ((long) s->buffer[3] << 16) |
2523  ((long) s->buffer[4] << 8) | (long) s->buffer[5]);
2524  break;
2525  case MARKER_ATMOVE:
2526  if (s->at_moves < JBG_ATMOVES_MAX) {
2527  s->at_line[s->at_moves] =
2528  (((long) s->buffer[2] << 24) | ((long) s->buffer[3] << 16) |
2529  ((long) s->buffer[4] << 8) | (long) s->buffer[5]);
2530  s->at_tx[s->at_moves] = (signed char) s->buffer[6];
2531  s->at_ty[s->at_moves] = s->buffer[7];
2532  if (s->at_tx[s->at_moves] < - (int) s->mx ||
2533  s->at_tx[s->at_moves] > (int) s->mx ||
2534  s->at_ty[s->at_moves] > (int) s->my ||
2535  (s->at_ty[s->at_moves] == 0 && s->at_tx[s->at_moves] < 0))
2536  return JBG_EINVAL;
2537  s->at_moves++;
2538  } else
2539  return JBG_EINVAL;
2540  break;
2541  case MARKER_NEWLEN:
2542  y = (((long) s->buffer[2] << 24) | ((long) s->buffer[3] << 16) |
2543  ((long) s->buffer[4] << 8) | (long) s->buffer[5]);
2544  if (y > s->yd || !(s->options & JBG_VLENGTH))
2545  return JBG_EINVAL;
2546  s->yd = y;
2547  /* calculate again number of stripes that will be required */
2548  s->stripes =
2549  ((s->yd >> s->d) +
2550  ((((1UL << s->d) - 1) & s->xd) != 0) + s->l0 - 1) / s->l0;
2551  break;
2552  case MARKER_ABORT:
2553  return JBG_EABORT;
2554 
2555  case MARKER_SDNORM:
2556  case MARKER_SDRST:
2557  /* decode final pixels based on trailing zero bytes */
2558  decode_pscd(s, s->buffer, 2);
2559 
2560  arith_decode_init(s->s[s->ii[index[s->order & 7][PLANE]]] +
2561  s->ii[index[s->order & 7][LAYER]] - s->dl,
2562  s->ii[index[s->order & 7][STRIPE]] != s->stripes - 1
2563  && s->buffer[1] != MARKER_SDRST);
2564 
2565  s->reset[s->ii[index[s->order & 7][PLANE]]]
2566  [s->ii[index[s->order & 7][LAYER]] - s->dl] =
2567  (s->buffer[1] == MARKER_SDRST);
2568 
2569  /* prepare for next SDE */
2570  s->x = 0;
2571  s->i = 0;
2572  s->pseudo = 1;
2573  s->at_moves = 0;
2574 
2575  /* increment layer/stripe/plane loop variables */
2576  /* start and end value for each loop: */
2577  is[index[s->order & 7][STRIPE]] = 0;
2578  ie[index[s->order & 7][STRIPE]] = s->stripes - 1;
2579  is[index[s->order & 7][LAYER]] = s->dl;
2580  ie[index[s->order & 7][LAYER]] = s->d;
2581  is[index[s->order & 7][PLANE]] = 0;
2582  ie[index[s->order & 7][PLANE]] = s->planes - 1;
2583  i = 2; /* index to innermost loop */
2584  do {
2585  j = 0; /* carry flag */
2586  if (++s->ii[i] > ie[i]) {
2587  /* handling overflow of loop variable */
2588  j = 1;
2589  if (i > 0)
2590  s->ii[i] = is[i];
2591  }
2592  } while (--i >= 0 && j);
2593 
2594  s->buf_len = 0;
2595 
2596  /* check whether this have been all SDEs */
2597  if (j) {
2598  s->bie_len = 0;
2599  return JBG_EOK;
2600  }
2601 
2602  /* check whether we have to abort because of xmax/ymax */
2603  if (index[s->order & 7][LAYER] == 0 && i < 0) {
2604  /* LAYER is the outermost loop and we have just gone to next layer */
2605  if (jbg_ceil_half(s->xd, s->d - s->ii[0]) > s->xmax ||
2606  jbg_ceil_half(s->yd, s->d - s->ii[0]) > s->ymax) {
2607  s->xmax = 4294967295UL;
2608  s->ymax = 4294967295UL;
2609  return JBG_EOK_INTR;
2610  }
2611  if (s->ii[0] > (unsigned long) s->dmax) {
2612  s->dmax = 256;
2613  return JBG_EOK_INTR;
2614  }
2615  }
2616 
2617  break;
2618  }
2619  s->buf_len = 0;
2620 
2621  } else if (data[*cnt] == MARKER_ESC)
2622  s->buffer[s->buf_len++] = data[(*cnt)++];
2623 
2624  else {
2625 
2626  /* we have found PSCD bytes */
2627  *cnt += decode_pscd(s, data + *cnt, len - *cnt);
2628  if (*cnt < len && data[*cnt] != 0xff) {
2629 #ifdef DEBUG
2630  fprintf(stderr, "PSCD was longer than expected, unread bytes "
2631  "%02x %02x %02x %02x ...\n", data[*cnt], data[*cnt+1],
2632  data[*cnt+2], data[*cnt+3]);
2633 #endif
2634  return JBG_EINVAL;
2635  }
2636 
2637  }
2638  } /* of BID processing loop 'while (*cnt < len) ...' */
2639 
2640  return JBG_EAGAIN;
2641 }
2642 
2643 
2644 /*
2645  * After jbg_dec_in() returned JBG_EOK or JBG_EOK_INTR, you can call this
2646  * function in order to find out the width of the image.
2647  */
2648 long jbg_dec_getwidth(const struct jbg_dec_state *s)
2649 {
2650  if (s->d < 0)
2651  return -1;
2652  if (index[s->order & 7][LAYER] == 0) {
2653  if (s->ii[0] < 1)
2654  return -1;
2655  else
2656  return jbg_ceil_half(s->xd, s->d - (s->ii[0] - 1));
2657  }
2658 
2659  return s->xd;
2660 }
2661 
2662 
2663 /*
2664  * After jbg_dec_in() returned JBG_EOK or JBG_EOK_INTR, you can call this
2665  * function in order to find out the height of the image.
2666  */
2667 long jbg_dec_getheight(const struct jbg_dec_state *s)
2668 {
2669  if (s->d < 0)
2670  return -1;
2671  if (index[s->order & 7][LAYER] == 0) {
2672  if (s->ii[0] < 1)
2673  return -1;
2674  else
2675  return jbg_ceil_half(s->yd, s->d - (s->ii[0] - 1));
2676  }
2677 
2678  return s->yd;
2679 }
2680 
2681 
2682 /*
2683  * After jbg_dec_in() returned JBG_EOK or JBG_EOK_INTR, you can call this
2684  * function in order to get a pointer to the image.
2685  */
2686 unsigned char *jbg_dec_getimage(const struct jbg_dec_state *s, int plane)
2687 {
2688  if (s->d < 0)
2689  return NULL;
2690  if (index[s->order & 7][LAYER] == 0) {
2691  if (s->ii[0] < 1)
2692  return NULL;
2693  else
2694  return s->lhp[(s->ii[0] - 1) & 1][plane];
2695  }
2696 
2697  return s->lhp[s->d & 1][plane];
2698 }
2699 
2700 
2701 /*
2702  * After jbg_dec_in() returned JBG_EOK or JBG_EOK_INTR, you can call
2703  * this function in order to find out the size in bytes of one
2704  * bitplane of the image.
2705  */
2706 long jbg_dec_getsize(const struct jbg_dec_state *s)
2707 {
2708  if (s->d < 0)
2709  return -1;
2710  if (index[s->order & 7][LAYER] == 0) {
2711  if (s->ii[0] < 1)
2712  return -1;
2713  else
2714  return
2715  ((jbg_ceil_half(s->xd, s->d - (s->ii[0] - 1)) + 7) / 8) *
2716  jbg_ceil_half(s->yd, s->d - (s->ii[0] - 1));
2717  }
2718 
2719  return ((s->xd + 7) / 8) * s->yd;
2720 }
2721 
2722 
2723 /*
2724  * After jbg_dec_in() returned JBG_EOK or JBG_EOK_INTR, you can call
2725  * this function in order to find out the size of the image that you
2726  * can retrieve with jbg_merge_planes().
2727  */
2729 {
2730  if (s->d < 0)
2731  return -1;
2732  if (index[s->order & 7][LAYER] == 0) {
2733  if (s->ii[0] < 1)
2734  return -1;
2735  else
2736  return
2737  jbg_ceil_half(s->xd, s->d - (s->ii[0] - 1)) *
2738  jbg_ceil_half(s->yd, s->d - (s->ii[0] - 1)) *
2739  ((s->planes + 7) / 8);
2740  }
2741 
2742  return s->xd * s->yd * ((s->planes + 7) / 8);
2743 }
2744 
2745 
2746 /*
2747  * The destructor function which releases any resources obtained by the
2748  * other decoder functions.
2749  */
2751 {
2752  int i;
2753 
2754  if (s->d < 0 || s->s == NULL)
2755  return;
2756  s->d = -2;
2757 
2758  for (i = 0; i < s->planes; i++) {
2759  checked_free(s->s[i]);
2760  checked_free(s->tx[i]);
2761  checked_free(s->ty[i]);
2762  checked_free(s->reset[i]);
2763  checked_free(s->lntp[i]);
2764  checked_free(s->lhp[0][i]);
2765  checked_free(s->lhp[1][i]);
2766  }
2767 
2768  checked_free(s->s);
2769  checked_free(s->tx);
2770  checked_free(s->ty);
2771  checked_free(s->reset);
2772  checked_free(s->lntp);
2773  checked_free(s->lhp[0]);
2774  checked_free(s->lhp[1]);
2775 
2776  s->s = NULL;
2777 
2778  return;
2779 }
2780 
2781 
2782 /*
2783  * Split bigendian integer pixel field into separate bit planes. In the
2784  * src array, every pixel is represented by a ((has_planes + 7) / 8) byte
2785  * long word, most significant byte first. While has_planes describes
2786  * the number of used bits per pixel in the source image, encode_plane
2787  * is the number of most significant bits among those that we
2788  * actually transfer to dest.
2789  */
2790 void jbg_split_planes(unsigned long x, unsigned long y, int has_planes,
2791  int encode_planes,
2792  const unsigned char *src, unsigned char **dest,
2793  int use_graycode)
2794 {
2795  unsigned bpl = (x + 7) / 8; /* bytes per line in dest plane */
2796  unsigned i, k = 8;
2797  int p;
2798  unsigned long line;
2799  extern void *memset(void *s, int c, size_t n);
2800  unsigned prev; /* previous *src byte shifted by 8 bit to the left */
2801  register int bits, msb = has_planes - 1;
2802  int bitno;
2803 
2804  /* sanity checks */
2805  if (encode_planes > has_planes)
2806  encode_planes = has_planes;
2807  use_graycode = use_graycode != 0 && encode_planes > 1;
2808 
2809  for (p = 0; p < encode_planes; p++)
2810  memset(dest[p], 0, bpl * y);
2811 
2812  for (line = 0; line < y; line++) { /* lines loop */
2813  for (i = 0; i * 8 < x; i++) { /* dest bytes loop */
2814  for (k = 0; k < 8 && i * 8 + k < x; k++) { /* pixel loop */
2815  prev = 0;
2816  for (p = 0; p < encode_planes; p++) { /* bit planes loop */
2817  /* calculate which bit in *src do we want */
2818  bitno = (msb - p) & 7;
2819  /* put this bit with its left neighbor right adjusted into bits */
2820  bits = (prev | *src) >> bitno;
2821  /* go to next *src byte, but keep old */
2822  if (bitno == 0)
2823  prev = *src++;
2824  /* make space for inserting new bit */
2825  dest[p][bpl * line + i] <<= 1;
2826  /* insert bit, if requested apply Gray encoding */
2827  dest[p][bpl * line + i] |= (bits ^ (use_graycode & (bits>>1))) & 1;
2828  /*
2829  * Theorem: Let b(n),...,b(1),b(0) be the digits of a
2830  * binary word and let g(n),...,g(1),g(0) be the digits of the
2831  * corresponding Gray code word, then g(i) = b(i) xor b(i+1).
2832  */
2833  }
2834  /* skip unused *src bytes */
2835  for (;p < has_planes; p++)
2836  if (((has_planes - 1 - p) & 7) == 0)
2837  src++;
2838  }
2839  }
2840  for (p = 0; p < encode_planes; p++) /* right padding loop */
2841  dest[p][bpl * (line + 1) - 1] <<= 8 - k;
2842  }
2843 
2844  return;
2845 }
2846 
2847 /*
2848  * Merge the separate bit planes decoded by the JBIG decoder into an
2849  * integer pixel field. This is essentially the counterpart to
2850  * jbg_split_planes(). */
2851 void jbg_dec_merge_planes(const struct jbg_dec_state *s, int use_graycode,
2852  void (*data_out)(unsigned char *start, size_t len,
2853  void *file), void *file)
2854 {
2855 #define BUFLEN 4096
2856  int bpp, bpl;
2857  unsigned long line;
2858  unsigned i, k = 8;
2859  int p, q;
2860  unsigned char buf[BUFLEN];
2861  unsigned char *bp = buf;
2862  unsigned char **src;
2863  unsigned long x, y;
2864  unsigned v;
2865 
2866  /* sanity check */
2867  use_graycode = use_graycode != 0;
2868 
2869  x = jbg_dec_getwidth(s);
2870  y = jbg_dec_getheight(s);
2871  if (x <= 0 || y <= 0)
2872  return;
2873  bpp = (s->planes + 7) / 8; /* bytes per pixel in dest image */
2874  bpl = (x + 7) / 8; /* bytes per line in src plane */
2875 
2876  if (index[s->order & 7][LAYER] == 0)
2877  if (s->ii[0] < 1)
2878  return;
2879  else
2880  src = s->lhp[(s->ii[0] - 1) & 1];
2881  else
2882  src = s->lhp[s->d & 1];
2883 
2884  for (line = 0; line < y; line++) { /* lines loop */
2885  for (i = 0; i * 8 < x; i++) { /* src bytes loop */
2886  for (k = 0; k < 8 && i * 8 + k < x; k++) { /* pixel loop */
2887  for (p = (s->planes-1) & ~7; p >= 0; p -= 8) { /* dest bytes loop */
2888  v = 0;
2889  for (q = 0; q < 8 && p+q < s->planes; q++) /* pixel bit loop */
2890  v = (v << 1) |
2891  (((src[p+q][bpl * line + i] >> (7 - k)) & 1) ^
2892  (use_graycode & v));
2893  *bp++ = v;
2894  if (bp - buf == BUFLEN) {
2895  data_out(buf, BUFLEN, file);
2896  bp = buf;
2897  }
2898  }
2899  }
2900  }
2901  }
2902 
2903  if (bp - buf > 0)
2904  data_out(buf, bp - buf, file);
2905 
2906  return;
2907 }
return _Result< 0 ? -1 :_Result;} #line 1069 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsnwprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1091 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, va_list _ArgList) { return _vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1108 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format, va_list _Args);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format, va_list _ArgList) { return _vsnwprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1133 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_c_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1163 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_c(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1179 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1196 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl __vswprintf_l(wchar_t *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vswprintf_l(_Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1212 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf(wchar_t *const _Buffer, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_l(_Buffer,(size_t) -1, _Format,((void *) 0), _ArgList);} #line 1227 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswprintf(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1243 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1264 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1281 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1283 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_p_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_p((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1312 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_p(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1328 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_l(wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1347 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf(wchar_t const *const _Format, va_list _ArgList) { return _vscwprintf_l(_Format,((void *) 0), _ArgList);} #line 1361 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_p_l(wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_p((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1380 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_p(wchar_t const *const _Format, va_list _ArgList) { return _vscwprintf_p_l(_Format,((void *) 0), _ArgList);} #line 1394 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl __swprintf_l(wchar_t *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__vswprintf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1414 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1435 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf(wchar_t *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__vswprintf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1454 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swprintf(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1474 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "__swprintf_l_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __swprintf_l(wchar_t *_Buffer, wchar_t const *_Format, _locale_t _Locale,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vswprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __vswprintf_l(wchar_t *_Buffer, wchar_t const *_Format, _locale_t _Locale, va_list _Args);__declspec(deprecated("This function or variable may be unsafe. Consider using " "swprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swprintf(wchar_t *_Buffer, wchar_t const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "vswprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vswprintf(wchar_t *_Buffer, wchar_t const *_Format, va_list _Args);__inline int __cdecl _swprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1511 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1532 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1534 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_p_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1562 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_p(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1582 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_c_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1603 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_c(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1623 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1646 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1668 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1690 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1711 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_l(wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1737 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf(wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1755 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_p_l(wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_p_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1774 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_p(wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_p_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1792 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #pragma warning(push) #pragma warning(disable:4141 6054) #pragma warning(pop) #line 1856 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" int __cdecl __stdio_common_vswscanf(unsigned __int64 _Options, wchar_t const *_Buffer, size_t _BufferCount, wchar_t const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vswscanf_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options()), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1897 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswscanf(wchar_t const *_Buffer, wchar_t const *_Format, va_list _ArgList) { return _vswscanf_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 1912 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswscanf_s_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1930 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswscanf_s(wchar_t const *const _Buffer, wchar_t const *const _Format, va_list _ArgList) { return _vswscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 1947 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1949 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwscanf_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1976 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwscanf_s_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1995 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_swscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swscanf_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2015 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "swscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl swscanf(wchar_t const *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2034 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swscanf_s_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_s_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2054 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swscanf_s(wchar_t const *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2075 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 2077 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2100 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2122 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwscanf_s_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2143 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwscanf_s(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2163 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) typedef __int64 fpos_t;errno_t __cdecl _get_stream_buffer_pointers(FILE *_Stream, char ***_Base, char ***_Pointer, int **_Count);errno_t __cdecl clearerr_s(FILE *_Stream);errno_t __cdecl fopen_s(FILE **_Stream, char const *_FileName, char const *_Mode);size_t __cdecl fread_s(void *_Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);errno_t __cdecl freopen_s(FILE **_Stream, char const *_FileName, char const *_Mode, FILE *_OldStream);char *__cdecl gets_s(char *_Buffer, rsize_t _Size);errno_t __cdecl tmpfile_s(FILE **_Stream);errno_t __cdecl tmpnam_s(char *_Buffer, rsize_t _Size);#line 145 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" void __cdecl clearerr(FILE *_Stream);int __cdecl fclose(FILE *_Stream);int __cdecl _fcloseall(void);FILE *__cdecl _fdopen(int _FileHandle, char const *_Mode);int __cdecl feof(FILE *_Stream);int __cdecl ferror(FILE *_Stream);int __cdecl fflush(FILE *_Stream);int __cdecl fgetc(FILE *_Stream);int __cdecl _fgetchar(void);int __cdecl fgetpos(FILE *_Stream, fpos_t *_Position);char *__cdecl fgets(char *_Buffer, int _MaxCount, FILE *_Stream);int __cdecl _fileno(FILE *_Stream);int __cdecl _flushall(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "fopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl fopen(char const *_FileName, char const *_Mode);int __cdecl fputc(int _Character, FILE *_Stream);int __cdecl _fputchar(int _Character);int __cdecl fputs(char const *_Buffer, FILE *_Stream);size_t __cdecl fread(void *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);__declspec(deprecated("This function or variable may be unsafe. Consider using " "freopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl freopen(char const *_FileName, char const *_Mode, FILE *_Stream);FILE *__cdecl _fsopen(char const *_FileName, char const *_Mode, int _ShFlag);int __cdecl fsetpos(FILE *_Stream, fpos_t const *_Position);int __cdecl fseek(FILE *_Stream, long _Offset, int _Origin);int __cdecl _fseeki64(FILE *_Stream, __int64 _Offset, int _Origin);long __cdecl ftell(FILE *_Stream);__int64 __cdecl _ftelli64(FILE *_Stream);size_t __cdecl fwrite(void const *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl getc(FILE *_Stream);int __cdecl getchar(void);int __cdecl _getmaxstdio(void);int __cdecl _getw(FILE *_Stream);void __cdecl perror(char const *_ErrorMessage);int __cdecl _pclose(FILE *_Stream);FILE *__cdecl _popen(char const *_Command, char const *_Mode);#line 344 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl putc(int _Character, FILE *_Stream);int __cdecl putchar(int _Character);int __cdecl puts(char const *_Buffer);int __cdecl _putw(int _Word, FILE *_Stream);int __cdecl remove(char const *_FileName);int __cdecl rename(char const *_OldFileName, char const *_NewFileName);int __cdecl _unlink(char const *_FileName);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_unlink" ". See online help for details.")) int __cdecl unlink(char const *_FileName);#line 391 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" void __cdecl rewind(FILE *_Stream);int __cdecl _rmtmp(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "setvbuf" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) void __cdecl setbuf(FILE *_Stream, char *_Buffer);int __cdecl _setmaxstdio(int _Maximum);int __cdecl setvbuf(FILE *_Stream, char *_Buffer, int _Mode, size_t _Size);__declspec(allocator) char *__cdecl _tempnam(char const *_DirectoryName, char const *_FilePrefix);__declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpfile_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl tmpfile(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpnam_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl tmpnam(char *_Buffer);int __cdecl ungetc(int _Character, FILE *_Stream);void __cdecl _lock_file(FILE *_Stream);void __cdecl _unlock_file(FILE *_Stream);int __cdecl _fclose_nolock(FILE *_Stream);int __cdecl _fflush_nolock(FILE *_Stream);int __cdecl _fgetc_nolock(FILE *_Stream);int __cdecl _fputc_nolock(int _Character, FILE *_Stream);size_t __cdecl _fread_nolock(void *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);size_t __cdecl _fread_nolock_s(void *_Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl _fseek_nolock(FILE *_Stream, long _Offset, int _Origin);int __cdecl _fseeki64_nolock(FILE *_Stream, __int64 _Offset, int _Origin);long __cdecl _ftell_nolock(FILE *_Stream);__int64 __cdecl _ftelli64_nolock(FILE *_Stream);size_t __cdecl _fwrite_nolock(void const *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl _getc_nolock(FILE *_Stream);int __cdecl _putc_nolock(int _Character, FILE *_Stream);int __cdecl _ungetc_nolock(int _Character, FILE *_Stream);int *__cdecl __p__commode(void);#line 596 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vfprintf(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vfprintf_s(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vfprintf_p(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vfprintf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 648 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfprintf(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_l(_Stream, _Format,((void *) 0), _ArgList);} #line 662 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf_s((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 677 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfprintf_s(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_s_l(_Stream, _Format,((void *) 0), _ArgList);} #line 693 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 695 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_p_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf_p((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 710 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_p(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_p_l(_Stream, _Format,((void *) 0), _ArgList);} #line 724 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 738 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vprintf(char const *const _Format, va_list _ArgList) { return _vfprintf_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 751 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_s_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 765 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vprintf_s(char const *const _Format, va_list _ArgList) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 780 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 782 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_p_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 796 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_p(char const *const _Format, va_list _ArgList) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 809 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 828 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fprintf(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 846 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl _set_printf_count_output(int _Value);int __cdecl _get_printf_count_output(void);__inline int __cdecl _fprintf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 871 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fprintf_s(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 891 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 893 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_p_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 912 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_p(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 930 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 948 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl printf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 965 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_s_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 983 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl printf_s(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1002 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1004 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_p_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1022 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_p(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1039 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vfscanf(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _Arglist);__inline int __cdecl _vfscanf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfscanf((*__local_stdio_scanf_options()), _Stream, _Format, _Locale, _ArgList);} #line 1070 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfscanf(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfscanf_l(_Stream, _Format,((void *) 0), _ArgList);} #line 1084 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfscanf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Stream, _Format, _Locale, _ArgList);} #line 1101 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfscanf_s(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfscanf_s_l(_Stream, _Format,((void *) 0), _ArgList);} #line 1118 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1120 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscanf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);} #line 1134 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vscanf(char const *const _Format, va_list _ArgList) { return _vfscanf_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);} #line 1147 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscanf_s_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);} #line 1161 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vscanf_s(char const *const _Format, va_list _ArgList) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);} #line 1176 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1178 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_fscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _fscanf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1197 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "fscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl fscanf(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1215 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fscanf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1234 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fscanf_s(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1254 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1256 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_scanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _scanf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1274 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "scanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl scanf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1291 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scanf_s_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1309 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl scanf_s(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1328 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1330 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vsprintf(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsprintf_s(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsnprintf_s(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, size_t _MaxCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsprintf_p(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnprintf_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1399 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1415 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsnprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 1), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);return _Result< 0 ? -1 :_Result;} #line 1446 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsprintf_l(char *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vsnprintf_l(_Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1462 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl vsprintf(char *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsnprintf_l(_Buffer,(size_t) -1, _Format,((void *) 0), _ArgList);} #line 1477 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_s_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1498 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsprintf_s(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1516 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1526 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_p_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_p((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1547 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_p(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1563 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_s_l(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsnprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1585 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1602 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsnprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1630 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1641 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1659 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf(char const *const _Format, va_list _ArgList) { return _vscprintf_l(_Format,((void *) 0), _ArgList);} #line 1672 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_p_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_p((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1690 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_p(char const *const _Format, va_list _ArgList) { return _vscprintf_p_l(_Format,((void *) 0), _ArgList);} #line 1703 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_c_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1723 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_c(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1739 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sprintf_l(char *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1761 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sprintf(char *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1782 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "sprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl sprintf(char *_Buffer, char const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl vsprintf(char *_Buffer, char const *_Format, va_list _Args);__inline int __cdecl _sprintf_s_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1810 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sprintf_s(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1832 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1834 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sprintf_p_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1862 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sprintf_p(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1882 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snprintf_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1905 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl snprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=vsnprintf(_Buffer, _BufferCount, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1936 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf(_Buffer, _BufferCount, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1956 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _snprintf(char *_Buffer, size_t _BufferCount, char const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _vsnprintf(char *_Buffer, size_t _BufferCount, char const *_Format, va_list _Args);__inline int __cdecl _snprintf_c_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1986 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_c(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2006 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_s_l(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2028 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2049 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2075 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2092 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_p_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_p_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2110 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_p(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_p(_Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2127 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vsscanf(unsigned __int64 _Options, char const *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vsscanf_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 2158 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsscanf(char const *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsscanf_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 2172 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsscanf_s_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 2189 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(push) #pragma warning(disable:6530) __inline int __cdecl vsscanf_s(char const *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 2208 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(pop) #line 2219 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sscanf_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2238 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "sscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl sscanf(char const *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2256 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sscanf_s_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_s_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2275 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sscanf_s(char const *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=vsscanf_s(_Buffer, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2297 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 2299 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(push) #pragma warning(disable:6530) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf_l(char const *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2326 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf(char const *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2349 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snscanf_s_l(char const *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2374 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snscanf_s(char const *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2397 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(pop) __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_tempnam" ". See online help for details.")) char *__cdecl tempnam(char const *_Directory, char const *_FilePrefix);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fcloseall" ". See online help for details.")) int __cdecl fcloseall(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fdopen" ". See online help for details.")) FILE *__cdecl fdopen(int _FileHandle, char const *_Format);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fgetchar" ". See online help for details.")) int __cdecl fgetchar(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fileno" ". See online help for details.")) int __cdecl fileno(FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_flushall" ". See online help for details.")) int __cdecl flushall(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fputchar" ". See online help for details.")) int __cdecl fputchar(int _Ch);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_getw" ". See online help for details.")) int __cdecl getw(FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_putw" ". See online help for details.")) int __cdecl putw(int _Ch, FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_rmtmp" ". See online help for details.")) int __cdecl rmtmp(void);#line 2441 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h"__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma once#pragma once#pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) int *__cdecl _errno(void);errno_t __cdecl _set_errno(int _Value);errno_t __cdecl _get_errno(int *_Value);unsigned long *__cdecl __doserrno(void);errno_t __cdecl _set_doserrno(unsigned long _Value);errno_t __cdecl _get_doserrno(unsigned long *_Value);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4514 4820) __pragma(pack(push, 8)) void *__cdecl memchr(void const *_Buf, int _Val, size_t _MaxCount);int __cdecl memcmp(void const *_Buf1, void const *_Buf2, size_t _Size);void *__cdecl memcpy(void *_Dst, void const *_Src, size_t _Size);void *__cdecl memmove(void *_Dst, void const *_Src, size_t _Size);void *__cdecl memset(void *_Dst, int _Val, size_t _Size);char *__cdecl strchr(char const *_Str, int _Val);char *__cdecl strrchr(char const *_Str, int _Ch);char *__cdecl strstr(char const *_Str, char const *_SubStr);wchar_t *__cdecl wcschr(wchar_t const *_Str, wchar_t _Ch);wchar_t *__cdecl wcsrchr(wchar_t const *_Str, wchar_t _Ch);wchar_t *__cdecl wcsstr(wchar_t const *_Str, wchar_t const *_SubStr);__pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) static __inline errno_t __cdecl memcpy_s(void *const _Destination, rsize_t const _DestinationSize, void const *const _Source, rsize_t const _SourceSize) { if(_SourceSize==0) { return 0;} { int _Expr_val=!!(_Destination !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;if(_Source==((void *) 0)||_DestinationSize< _SourceSize) { memset(_Destination, 0, _DestinationSize);{ int _Expr_val=!!(_Source !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_DestinationSize >=_SourceSize);if(!(_Expr_val)) {(*_errno())=34;_invalid_parameter_noinfo();return 34;} } ;return 22 ;} memcpy(_Destination, _Source, _SourceSize);return 0;} static __inline errno_t __cdecl memmove_s(void *const _Destination, rsize_t const _DestinationSize, void const *const _Source, rsize_t const _SourceSize) { if(_SourceSize==0) { return 0;} { int _Expr_val=!!(_Destination !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_Source !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_DestinationSize >=_SourceSize);if(!(_Expr_val)) {(*_errno())=34;_invalid_parameter_noinfo();return 34;} } ;memmove(_Destination, _Source, _SourceSize);return 0;}#pragma warning(pop) __pragma(pack(pop))#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) int __cdecl _memicmp(void const *_Buf1, void const *_Buf2, size_t _Size);int __cdecl _memicmp_l(void const *_Buf1, void const *_Buf2, size_t _Size, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memccpy" ". See online help for details.")) void *__cdecl memccpy(void *_Dst, void const *_Src, int _Val, size_t _Size);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memicmp" ". See online help for details.")) int __cdecl memicmp(void const *_Buf1, void const *_Buf2, size_t _Size);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) errno_t __cdecl wcscat_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source);errno_t __cdecl wcscpy_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source);errno_t __cdecl wcsncat_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source, rsize_t _MaxCount);errno_t __cdecl wcsncpy_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source, rsize_t _MaxCount);wchar_t *__cdecl wcstok_s(wchar_t *_String, wchar_t const *_Delimiter, wchar_t **_Context);__declspec(allocator) wchar_t *__cdecl _wcsdup(wchar_t const *_String);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcscat(wchar_t *_Destination, wchar_t const *_Source);int __cdecl wcscmp(wchar_t const *_String1, wchar_t const *_String2);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcscpy(wchar_t *_Destination, wchar_t const *_Source);size_t __cdecl wcscspn(wchar_t const *_String, wchar_t const *_Control);size_t __cdecl wcslen(wchar_t const *_String);size_t __cdecl wcsnlen(wchar_t const *_Source, size_t _MaxCount);static __inline size_t __cdecl wcsnlen_s(wchar_t const *_Source, size_t _MaxCount) { return(_Source==0) ? 0 :wcsnlen(_Source, _MaxCount);}__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcsncat(wchar_t *_Destination, wchar_t const *_Source, size_t _Count);int __cdecl wcsncmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcsncpy(wchar_t *_Destination, wchar_t const *_Source, size_t _Count);wchar_t *__cdecl wcspbrk(wchar_t const *_String, wchar_t const *_Control);size_t __cdecl wcsspn(wchar_t const *_String, wchar_t const *_Control);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcstok(wchar_t *_String, wchar_t const *_Delimiter, wchar_t **_Context);#line 237 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstring.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) static __inline wchar_t *__cdecl _wcstok(wchar_t *const _String, wchar_t const *const _Delimiter) { return wcstok(_String, _Delimiter, 0);} __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcserror(int _ErrorNumber);errno_t __cdecl _wcserror_s(wchar_t *_Buffer, size_t _SizeInWords, int _ErrorNumber);__declspec(deprecated("This function or variable may be unsafe. Consider using " "__wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl __wcserror(wchar_t const *_String);errno_t __cdecl __wcserror_s(wchar_t *_Buffer, size_t _SizeInWords, wchar_t const *_ErrorMessage);int __cdecl _wcsicmp(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcsicmp_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsnicmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsnicmp_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);errno_t __cdecl _wcsnset_s(wchar_t *_Destination, size_t _SizeInWords, wchar_t _Value, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsnset(wchar_t *_String, wchar_t _Value, size_t _MaxCount);wchar_t *__cdecl _wcsrev(wchar_t *_String);errno_t __cdecl _wcsset_s(wchar_t *_Destination, size_t _SizeInWords, wchar_t _Value);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsset(wchar_t *_String, wchar_t _Value);errno_t __cdecl _wcslwr_s(wchar_t *_String, size_t _SizeInWords);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcslwr(wchar_t *_String);errno_t __cdecl _wcslwr_s_l(wchar_t *_String, size_t _SizeInWords, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcslwr_l(wchar_t *_String, _locale_t _Locale);errno_t __cdecl _wcsupr_s(wchar_t *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsupr(wchar_t *_String);errno_t __cdecl _wcsupr_s_l(wchar_t *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsupr_l(wchar_t *_String, _locale_t _Locale);size_t __cdecl wcsxfrm(wchar_t *_Destination, wchar_t const *_Source, size_t _MaxCount);size_t __cdecl _wcsxfrm_l(wchar_t *_Destination, wchar_t const *_Source, size_t _MaxCount, _locale_t _Locale);int __cdecl wcscoll(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcscoll_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsicoll(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcsicoll_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsncoll(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsncoll_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _wcsnicoll(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsnicoll_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsdup" ". See online help for details.")) wchar_t *__cdecl wcsdup(wchar_t const *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicmp" ". See online help for details.")) int __cdecl wcsicmp(wchar_t const *_String1, wchar_t const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnicmp" ". See online help for details.")) int __cdecl wcsnicmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnset" ". See online help for details.")) wchar_t *__cdecl wcsnset(wchar_t *_String, wchar_t _Value, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsrev" ". See online help for details.")) wchar_t *__cdecl wcsrev(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsset" ". See online help for details.")) wchar_t *__cdecl wcsset(wchar_t *_String, wchar_t _Value);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcslwr" ". See online help for details.")) wchar_t *__cdecl wcslwr(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsupr" ". See online help for details.")) wchar_t *__cdecl wcsupr(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicoll" ". See online help for details.")) int __cdecl wcsicoll(wchar_t const *_String1, wchar_t const *_String2);__pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) errno_t __cdecl strcpy_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source);errno_t __cdecl strcat_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source);errno_t __cdecl strerror_s(char *_Buffer, size_t _SizeInBytes, int _ErrorNumber);errno_t __cdecl strncat_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source, rsize_t _MaxCount);errno_t __cdecl strncpy_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source, rsize_t _MaxCount);char *__cdecl strtok_s(char *_String, char const *_Delimiter, char **_Context);void *__cdecl _memccpy(void *_Dst, void const *_Src, int _Val, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strcat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strcat(char *_Destination, char const *_Source);int __cdecl strcmp(char const *_Str1, char const *_Str2);int __cdecl _strcmpi(char const *_String1, char const *_String2);int __cdecl strcoll(char const *_String1, char const *_String2);int __cdecl _strcoll_l(char const *_String1, char const *_String2, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strcpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strcpy(char *_Destination, char const *_Source);size_t __cdecl strcspn(char const *_Str, char const *_Control);__declspec(allocator) char *__cdecl _strdup(char const *_Source);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strerror(char const *_ErrorMessage);errno_t __cdecl _strerror_s(char *_Buffer, size_t _SizeInBytes, char const *_ErrorMessage);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strerror(int _ErrorMessage);int __cdecl _stricmp(char const *_String1, char const *_String2);int __cdecl _stricoll(char const *_String1, char const *_String2);int __cdecl _stricoll_l(char const *_String1, char const *_String2, _locale_t _Locale);int __cdecl _stricmp_l(char const *_String1, char const *_String2, _locale_t _Locale);size_t __cdecl strlen(char const *_Str);errno_t __cdecl _strlwr_s(char *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strlwr(char *_String);errno_t __cdecl _strlwr_s_l(char *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strlwr_l(char *_String, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strncat(char *_Destination, char const *_Source, size_t _Count);int __cdecl strncmp(char const *_Str1, char const *_Str2, size_t _MaxCount);int __cdecl _strnicmp(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strnicmp_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _strnicoll(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strnicoll_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _strncoll(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strncoll_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);size_t __cdecl __strncnt(char const *_String, size_t _Count);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strncpy(char *_Destination, char const *_Source, size_t _Count);size_t __cdecl strnlen(char const *_String, size_t _MaxCount);static __inline size_t __cdecl strnlen_s(char const *_String, size_t _MaxCount) { return _String==0 ? 0 :strnlen(_String, _MaxCount);} errno_t __cdecl _strnset_s(char *_String, size_t _SizeInBytes, int _Value, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strnset(char *_Destination, int _Value, size_t _Count);char *__cdecl strpbrk(char const *_Str, char const *_Control);char *__cdecl _strrev(char *_Str);errno_t __cdecl _strset_s(char *_Destination, size_t _DestinationSize, int _Value);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strset(char *_Destination, int _Value);size_t __cdecl strspn(char const *_Str, char const *_Control);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strtok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strtok(char *_String, char const *_Delimiter);errno_t __cdecl _strupr_s(char *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strupr(char *_String);errno_t __cdecl _strupr_s_l(char *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strupr_l(char *_String, _locale_t _Locale);size_t __cdecl strxfrm(char *_Destination, char const *_Source, size_t _MaxCount);size_t __cdecl _strxfrm_l(char *_Destination, char const *_Source, size_t _MaxCount, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strdup" ". See online help for details.")) char *__cdecl strdup(char const *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strcmpi" ". See online help for details.")) int __cdecl strcmpi(char const *_String1, char const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_stricmp" ". See online help for details.")) int __cdecl stricmp(char const *_String1, char const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strlwr" ". See online help for details.")) char *__cdecl strlwr(char *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnicmp" ". See online help for details.")) int __cdecl strnicmp(char const *_String1, char const *_String2, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnset" ". See online help for details.")) char *__cdecl strnset(char *_String, int _Value, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strrev" ". See online help for details.")) char *__cdecl strrev(char *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strset" ". See online help for details.")) char *__cdecl strset(char *_String, int _Value);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strupr" ". See online help for details.")) char *__cdecl strupr(char *_String);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4514 4820) __pragma(pack(push, 8)) __pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) typedef unsigned short _ino_t;typedef _ino_t ino_t;#line 24 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h" typedef unsigned int _dev_t;typedef _dev_t dev_t;#line 36 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h" typedef long _off_t;typedef _off_t off_t;#line 48 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h"#pragma warning(pop) typedef char *sds;#pragma pack(push, 1) struct sdshdr5 { unsigned char flags;char buf[];};struct sdshdr8 { uint8_t len;uint8_t alloc;unsigned char flags;char buf[];};struct sdshdr16 { uint16_t len;uint16_t alloc;unsigned char flags;char buf[];};struct sdshdr32 { uint32_t len;uint32_t alloc;unsigned char flags;char buf[];};struct sdshdr64 { uint64_t len;uint64_t alloc;unsigned char flags;char buf[];};#pragma pack(pop) static inline size_t sdslen(const sds s) { unsigned char flags=s[-1];switch(flags &7) { case 0 :return((flags) >> 3) ;case 1 :return((struct sdshdr8 *)((s) -(sizeof(struct sdshdr8)))) ->len;case 2 :return((struct sdshdr16 *)((s) -(sizeof(struct sdshdr16)))) ->len;case 3 :return((struct sdshdr32 *)((s) -(sizeof(struct sdshdr32)))) ->len;case 4 :return((struct sdshdr64 *)((s) -(sizeof(struct sdshdr64)))) ->len;} return 0;}static inline size_t sdsavail(const sds s) { unsigned char flags=s[-1];switch(flags &7) { case 0 :{ return 0;} case 1 :{ struct sdshdr8 *sh=(void *)((s) -(sizeof(struct sdshdr8)));;return sh->alloc - sh->len;} case 2 :{ struct sdshdr16 *sh=(void *)((s) -(sizeof(struct sdshdr16)));;return sh->alloc - sh->len;} case 3 :{ struct sdshdr32 *sh=(void *)((s) -(sizeof(struct sdshdr32)));;return sh->alloc - sh->len;} case 4 :{ struct sdshdr64 *sh=(void *)((s) -(sizeof(struct sdshdr64)));;return sh->alloc - sh->len;} } return 0;}static inline void sdssetlen(sds s, size_t newlen) { unsigned char flags=s[-1];switch(flags &7) { case 0 :{ unsigned char *fp=((unsigned char *) s) - 1;*fp=0|(newlen<< 3);} break;case 1 :((struct sdshdr8 *)((s) -(sizeof(struct sdshdr8)))) ->len=(uint8_t) newlen;break;case 2 :((struct sdshdr16 *)((s) -(sizeof(struct sdshdr16)))) ->len=(uint16_t) newlen;break;case 3 :((struct sdshdr32 *)((s) -(sizeof(struct sdshdr32)))) -> len
Definition: CPAL.d:15583
int ptrdiff_t
Definition: CPAL.d:3845
bp
Definition: action.c:1035
q
Definition: afm2pl.c:2287
#define head
Definition: aptex-macros.h:513
#define language
Definition: aptex-macros.h:837
static char * options
Definition: bmeps.c:236
char * p1
Definition: bmpfont.h:62
static char mx
Definition: bmpfont.h:51
char_entry ** planes[0x08000]
Definition: char_routines.c:74
#define n
Definition: t4ht.c:1290
#define b
Definition: jpegint.h:372
#define free(a)
Definition: decNumber.cpp:310
#define q1
#define q2
int v
Definition: dviconv.c:10
#define fopen
Definition: xxstdio.h:21
char * temp
Definition: dvidvi.c:137
struct rect data
Definition: dvipdfm.c:64
#define shift
Definition: exp3.c:154
mpz_t * f
Definition: gen-fib.c:34
DataHeader dh
Definition: genbrk.cpp:103
#define p0
#define s
Definition: afcover.h:80
#define t
Definition: afcover.h:96
static FIELD_PTR prev
Definition: genind.c:36
#define c(n)
Definition: gpos-common.c:150
#define d(n)
Definition: gpos-common.c:151
byte * data_out
Definition: gsftopk.c:483
pix
Definition: in_pcx.cpp:383
assert(pcxLoadImage24((char *)((void *) 0), fp, pinfo, hdr))
static struct jbg_buf * jbg_buf_init(struct jbg_buf **free_list)
Definition: jbig.c:527
const char jbg_version[]
Definition: jbig.c:95
#define SDE_TODO
Definition: jbig.c:91
static void jbg_buf_output(struct jbg_buf **head, void(*data_out)(unsigned char *start, size_t len, void *file), void *file)
Definition: jbig.c:653
static void arith_encode_init(struct jbg_arenc_state *s, int reuse_st)
Definition: jbig.c:233
#define TPB2CX
Definition: jbig.c:69
#define NEMSG_LANG
Definition: jbig.c:121
void jbg_dppriv2int(char *internal, const unsigned char *dptable)
Definition: jbig.c:1617
long jbg_dec_getsize(const struct jbg_dec_state *s)
Definition: jbig.c:2706
#define MARKER_SDNORM
Definition: jbig.c:76
#define TPDCX
Definition: jbig.c:71
#define MARKER_COMMENT
Definition: jbig.c:81
#define MARKER_ABORT
Definition: jbig.c:78
void jbg_split_planes(unsigned long x, unsigned long y, int has_planes, int encode_planes, const unsigned char *src, unsigned char **dest, int use_graycode)
Definition: jbig.c:2790
static void arith_encode(struct jbg_arenc_state *s, int cx, int pix)
Definition: jbig.c:302
static void output_sde(struct jbg_enc_state *s, unsigned long stripe, int layer, int plane)
Definition: jbig.c:1498
#define MARKER_SDRST
Definition: jbig.c:77
static void * checked_malloc(size_t size)
Definition: jbig.c:173
static void * checked_realloc(void *ptr, size_t size)
Definition: jbig.c:192
void jbg_enc_init(struct jbg_enc_state *s, unsigned long x, unsigned long y, int planes, unsigned char **p, void(*data_out)(unsigned char *start, size_t len, void *file), void *file)
Definition: jbig.c:690
void jbg_enc_layers(struct jbg_enc_state *s, int d)
Definition: jbig.c:779
#define FILL_TABLE2(offset, len, trans)
void jbg_dec_maxsize(struct jbg_dec_state *s, unsigned long xmax, unsigned long ymax)
Definition: jbig.c:1871
int jbg_enc_lrlmax(struct jbg_enc_state *s, unsigned long x, unsigned long y)
Definition: jbig.c:756
#define PLANE
Definition: jbig.c:87
void jbg_dec_merge_planes(const struct jbg_dec_state *s, int use_graycode, void(*data_out)(unsigned char *start, size_t len, void *file), void *file)
Definition: jbig.c:2851
static void jbg_buf_remove_zeros(struct jbg_buf *head)
Definition: jbig.c:599
int jbg_dec_in(struct jbg_dec_state *s, unsigned char *data, size_t len, size_t *cnt)
Definition: jbig.c:2339
static void encode_sde(struct jbg_enc_state *s, long stripe, int layer, int plane)
Definition: jbig.c:835
unsigned long jbg_ceil_half(unsigned long x, int n)
Definition: jbig.c:678
void jbg_dec_init(struct jbg_dec_state *s)
Definition: jbig.c:1848
const char * jbg_strerror(int errnum, int language)
Definition: jbig.c:1834
long jbg_dec_getsize_merged(const struct jbg_dec_state *s)
Definition: jbig.c:2728
#define MARKER_ATMOVE
Definition: jbig.c:80
void jbg_enc_options(struct jbg_enc_state *s, int order, int options, long l0, int mx, int my)
Definition: jbig.c:817
#define MARKER_NEWLEN
Definition: jbig.c:79
#define NEMSG
Definition: jbig.c:120
static void jbg_buf_free(struct jbg_buf **free_list)
Definition: jbig.c:553
static void arith_encode_flush(struct jbg_arenc_state *s)
Definition: jbig.c:249
static void arith_decode_init(struct jbg_ardec_state *s, int reuse_st)
Definition: jbig.c:400
static size_t decode_pscd(struct jbg_dec_state *s, unsigned char *data, size_t len)
Definition: jbig.c:1888
static const char * errmsg[3][9]
Definition: jbig.c:122
static void jbg_buf_prefix(struct jbg_buf *new_prefix, struct jbg_buf **start)
Definition: jbig.c:636
#define ARITH_INL
Definition: jbig.c:62
void jbg_int2dppriv(unsigned char *dptable, const char *internal)
Definition: jbig.c:1584
int jbg_enc_lrange(struct jbg_enc_state *s, int dl, int dh)
Definition: jbig.c:803
#define SDE_DONE
Definition: jbig.c:90
static void jbg_buf_write(int b, void *head)
Definition: jbig.c:574
long jbg_dec_getheight(const struct jbg_dec_state *s)
Definition: jbig.c:2667
#define STRIPE
Definition: jbig.c:85
#define TPB3CX
Definition: jbig.c:70
unsigned char * jbg_dec_getimage(const struct jbg_dec_state *s, int plane)
Definition: jbig.c:2686
void jbg_dec_free(struct jbg_dec_state *s)
Definition: jbig.c:2750
#define LAYER
Definition: jbig.c:86
void jbg_enc_out(struct jbg_enc_state *s)
Definition: jbig.c:1647
#define MX_MAX
Definition: jbig.c:66
#define BUFLEN
#define FILL_TABLE1(offset, len, trans)
static void resolution_reduction(struct jbg_enc_state *s, int plane, int higher_layer)
Definition: jbig.c:1383
static void checked_free(void *ptr)
Definition: jbig.c:211
static int arith_decode(struct jbg_ardec_state *s, int cx)
Definition: jbig.c:415
long jbg_dec_getwidth(const struct jbg_dec_state *s)
Definition: jbig.c:2648
#define MARKER_STUFF
Definition: jbig.c:74
#define ARITH
Definition: jbig.c:58
void jbg_enc_free(struct jbg_enc_state *s)
Definition: jbig.c:1783
#define MARKER_ESC
Definition: jbig.c:82
#define JBG_DPPRIV
Definition: jbig.h:56
#define JBG_EMARKER
Definition: jbig.h:73
#define JBG_ATMOVES_MAX
Definition: jbig.h:40
#define JBG_HITOLO
Definition: jbig.h:46
#define JBG_LRLTWO
Definition: jbig.h:51
#define JBG_BUFSIZE
Definition: jbig.h:24
#define JBG_TPDON
Definition: jbig.h:53
#define JBG_EABORT
Definition: jbig.h:72
#define JBG_DPON
Definition: jbig.h:55
#define JBG_TPBON
Definition: jbig.h:54
#define JBG_VLENGTH
Definition: jbig.h:52
#define JBG_EIMPL
Definition: jbig.h:76
#define JBG_VERSION
Definition: jbig.h:18
#define JBG_EOK_INTR
Definition: jbig.h:69
#define JBG_DELAY_AT
Definition: jbig.h:59
#define JBG_EINVAL
Definition: jbig.h:75
#define JBG_ILEAVE
Definition: jbig.h:48
#define JBG_DPLAST
Definition: jbig.h:57
#define JBG_EOK
Definition: jbig.h:68
#define JBG_SMID
Definition: jbig.h:49
#define JBG_SEQ
Definition: jbig.h:47
#define JBG_ENOCONT
Definition: jbig.h:74
#define JBG_EAGAIN
Definition: jbig.h:70
unsigned char jbg_nlps[113]
Definition: jbig_tab.c:48
unsigned char jbg_nmps[113]
Definition: jbig_tab.c:26
short jbg_lsz[113]
Definition: jbig_tab.c:8
char jbg_dptable[256+512+2048+4096]
Definition: jbig_tab.c:207
char jbg_resred[4096]
Definition: jbig_tab.c:70
#define bufsize
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p scientific f u
Definition: afcover.h:88
small capitals from c petite p
Definition: afcover.h:72
small capitals from c petite p scientific i
Definition: afcover.h:80
#define bits
Definition: infblock.c:15
kerning y
Definition: ttdriver.c:212
#define hsize
Definition: gd_gif_out.c:57
int cx
Definition: gdfx.h:12
#define buf
#define fclose
Definition: debug.h:100
#define fprintf
Definition: mendex.h:64
Code related to b fwrite(a, sizeof(char), b, stdout) @d C_printf(c
#define malloc
Definition: alloca.c:91
#define dest
int ii
Definition: main.c:50
void abort()
#define sprintf
Definition: snprintf.c:44
#define realloc
Definition: glob.c:206
float x
Definition: cordic.py:15
string fn
Definition: fc-lang.py:335
int k
Definition: otp-parser.c:70
int xd[]
Definition: pbmclean.c:21
int yd[]
Definition: pbmclean.c:22
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst st
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF base if bpp PF set rept prefetch_distance PF set OFFSET endr endif endm macro preload_leading_step2 base if bpp ifc DST PF PF else if bpp lsl PF PF lsl PF PF lsl PF PF bpl
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF ptr
static int cnt
Definition: pkout.c:166
static int32_t last
Definition: ppagelist.c:29
static int size
Definition: ppmlabel.c:24
char line[1024]
Definition: process_score.c:29
bstring c int memset(void *s, int c, int length)
static int bitno
Definition: ps2pk.c:588
#define mask(n)
Definition: lbitlib.c:93
mp_ptr hp
Definition: sec_pi1_div.c:86
Definition: namelist.c:170
Definition: filedef.h:30
Definition: ttf.h:354
Definition: mendex.h:20
unsigned char * pscd_end
Definition: jbig.h:115
unsigned char * pscd_ptr
Definition: jbig.h:114
enum jbg_ardec_state::@62 result
void(* byte_out)(int, void *)
Definition: jbig.h:99
void * file
Definition: jbig.h:100
Definition: jbig.h:26
struct jbg_buf * last
Definition: jbig.h:32
struct jbg_buf * next
Definition: jbig.h:29
struct jbg_buf ** free_list
Definition: jbig.h:33
int len
Definition: jbig.h:28
struct jbg_buf * previous
Definition: jbig.h:30
unsigned char d[4000]
Definition: jbig.h:27
Definition: bdf.c:133
Definition: stemdb.c:56
Definition: dvips.h:235
#define FILE
Definition: t1stdio.h:34
int j
Definition: t4ht.c:1589
char * file
Definition: t4ht.c:931
#define is
Definition: tex2xindy.c:759
return() int(((double) *(font_tbl[cur_fnt].wtbl+(int)(*(font_tbl[cur_fnt].char_wi+(int)(ch - font_tbl[cur_fnt].char_f)% 256)))/(double)(1L<< 20)) *(double) font_tbl[cur_fnt].scale)
unsigned int * lp
Definition: ttf.c:84
@ start
Definition: preamble.c:52
static hdrptr free_list[8+1]
Definition: gc.c:513
static node * new_block(parser_state *p, node *a, node *b)
Definition: y.tab.c:980