source: trunk/poppler/mypoppler/poppler/Error.cc @ 461

Last change on this file since 461 was 257, checked in by Eugene Romanenko, 13 years ago

PDF plugin: Poppler library updated to version 0.10.0

File size: 1.8 KB
Line 
1//========================================================================
2//
3// Error.cc
4//
5// Copyright 1996-2003 Glyph & Cog, LLC
6//
7//========================================================================
8
9//========================================================================
10//
11// Modified under the Poppler project - http://poppler.freedesktop.org
12//
13// All changes made under the Poppler project to this file are licensed
14// under GPL version 2 or later
15//
16// Copyright (C) 2005, 2007 Jeff Muizelaar <jeff@infidigm.net>
17// Copyright (C) 2005 Albert Astals Cid <aacid@kde.org>
18// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
19//
20// To see a description of the changes please see the Changelog file that
21// came with your tarball or type make ChangeLog if you are building from git
22//
23//========================================================================
24
25#include <config.h>
26
27#ifdef USE_GCC_PRAGMAS
28#pragma implementation
29#endif
30
31#include <stdio.h>
32#include <stddef.h>
33#include <stdarg.h>
34#include "GlobalParams.h"
35#include "Error.h"
36
37static void defaultErrorFunction(int pos, char *msg, va_list args)
38{
39  if (pos >= 0) {
40    fprintf(stderr, "Error (%d): ", pos);
41  } else {
42    fprintf(stderr, "Error: ");
43  }
44  vfprintf(stderr, msg, args);
45  fprintf(stderr, "\n");
46  fflush(stderr);
47}
48
49static void (*errorFunction)(int, char *, va_list args) = defaultErrorFunction;
50
51void setErrorFunction(void (* f)(int, char *, va_list args))
52{
53    errorFunction = f;
54}
55
56void CDECL error(int pos, char *msg, ...) {
57  va_list args;
58  // NB: this can be called before the globalParams object is created
59  if (globalParams && globalParams->getErrQuiet()) {
60    return;
61  }
62  va_start(args, msg);
63  (*errorFunction)(pos, msg, args);
64  va_end(args);
65}
66
67void warning(char *msg, ...) {
68  va_list args;
69  va_start(args, msg);
70  vprintf(msg, args);
71  va_end(args);
72}
Note: See TracBrowser for help on using the repository browser.