Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: src/xz/message.h

Issue 7109015: Update XZ Utils to 5.0.3 (in deps) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/xz/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/xz/list.c ('k') | src/xz/message.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /////////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////////
2 // 2 //
3 /// \file message.h 3 /// \file message.h
4 /// \brief Printing messages to stderr 4 /// \brief Printing messages to stderr
5 // 5 //
6 // Author: Lasse Collin 6 // Author: Lasse Collin
7 // 7 //
8 // This file has been put into the public domain. 8 // This file has been put into the public domain.
9 // You can do whatever you want with this file. 9 // You can do whatever you want with this file.
10 // 10 //
11 /////////////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////////////
12 12
13 /// Verbosity levels 13 /// Verbosity levels
14 enum message_verbosity { 14 enum message_verbosity {
15 V_SILENT, ///< No messages 15 V_SILENT, ///< No messages
16 V_ERROR, ///< Only error messages 16 V_ERROR, ///< Only error messages
17 V_WARNING, ///< Errors and warnings 17 V_WARNING, ///< Errors and warnings
18 V_VERBOSE, ///< Errors, warnings, and verbose statistics 18 V_VERBOSE, ///< Errors, warnings, and verbose statistics
19 » V_DEBUG, ///< Debugging, FIXME remove? 19 » V_DEBUG, ///< Very verbose
20 }; 20 };
21 21
22 22
23 /// \brief Signals used for progress message handling
24 extern const int message_progress_sigs[];
25
26
23 /// \brief Initializes the message functions 27 /// \brief Initializes the message functions
24 /// 28 ///
25 /// If an error occurs, this function doesn't return. 29 /// If an error occurs, this function doesn't return.
26 /// 30 ///
27 extern void message_init(void); 31 extern void message_init(void);
28 32
29 33
30 /// Increase verbosity level by one step unless it was at maximum. 34 /// Increase verbosity level by one step unless it was at maximum.
31 extern void message_verbosity_increase(void); 35 extern void message_verbosity_increase(void);
32 36
33 /// Decrease verbosity level by one step unless it was at minimum. 37 /// Decrease verbosity level by one step unless it was at minimum.
34 extern void message_verbosity_decrease(void); 38 extern void message_verbosity_decrease(void);
35 39
36 /// Get the current verbosity level. 40 /// Get the current verbosity level.
37 extern enum message_verbosity message_verbosity_get(void); 41 extern enum message_verbosity message_verbosity_get(void);
38 42
39 43
40 /// \brief Print a message if verbosity level is at least "verbosity" 44 /// \brief Print a message if verbosity level is at least "verbosity"
41 /// 45 ///
42 /// This doesn't touch the exit status. 46 /// This doesn't touch the exit status.
43 extern void message(enum message_verbosity verbosity, const char *fmt, ...) 47 extern void message(enum message_verbosity verbosity, const char *fmt, ...)
44 » » lzma_attribute((format(printf, 2, 3))); 48 » » lzma_attribute((__format__(__printf__, 2, 3)));
45 49
46 50
47 /// \brief Prints a warning and possibly sets exit status 51 /// \brief Prints a warning and possibly sets exit status
48 /// 52 ///
49 /// The message is printed only if verbosity level is at least V_WARNING. 53 /// The message is printed only if verbosity level is at least V_WARNING.
50 /// The exit status is set to WARNING unless it was already at ERROR. 54 /// The exit status is set to WARNING unless it was already at ERROR.
51 extern void message_warning(const char *fmt, ...) 55 extern void message_warning(const char *fmt, ...)
52 » » lzma_attribute((format(printf, 1, 2))); 56 » » lzma_attribute((__format__(__printf__, 1, 2)));
53 57
54 58
55 /// \brief Prints an error message and sets exit status 59 /// \brief Prints an error message and sets exit status
56 /// 60 ///
57 /// The message is printed only if verbosity level is at least V_ERROR. 61 /// The message is printed only if verbosity level is at least V_ERROR.
58 /// The exit status is set to ERROR. 62 /// The exit status is set to ERROR.
59 extern void message_error(const char *fmt, ...) 63 extern void message_error(const char *fmt, ...)
60 » » lzma_attribute((format(printf, 1, 2))); 64 » » lzma_attribute((__format__(__printf__, 1, 2)));
61 65
62 66
63 /// \brief Prints an error message and exits with EXIT_ERROR 67 /// \brief Prints an error message and exits with EXIT_ERROR
64 /// 68 ///
65 /// The message is printed only if verbosity level is at least V_ERROR. 69 /// The message is printed only if verbosity level is at least V_ERROR.
66 extern void message_fatal(const char *fmt, ...) 70 extern void message_fatal(const char *fmt, ...)
67 » » lzma_attribute((format(printf, 1, 2))) 71 » » lzma_attribute((__format__(__printf__, 1, 2)))
68 » » lzma_attribute((noreturn)); 72 » » lzma_attribute((__noreturn__));
69 73
70 74
71 /// Print an error message that an internal error occurred and exit with 75 /// Print an error message that an internal error occurred and exit with
72 /// EXIT_ERROR. 76 /// EXIT_ERROR.
73 extern void message_bug(void) lzma_attribute((noreturn)); 77 extern void message_bug(void) lzma_attribute((__noreturn__));
74 78
75 79
76 /// Print a message that establishing signal handlers failed, and exit with 80 /// Print a message that establishing signal handlers failed, and exit with
77 /// exit status ERROR. 81 /// exit status ERROR.
78 extern void message_signal_handler(void) lzma_attribute((noreturn)); 82 extern void message_signal_handler(void) lzma_attribute((__noreturn__));
79 83
80 84
81 /// Convert lzma_ret to a string. 85 /// Convert lzma_ret to a string.
82 extern const char *message_strm(lzma_ret code); 86 extern const char *message_strm(lzma_ret code);
83 87
84 88
85 /// Display how much memory was needed and how much the limit was. 89 /// Display how much memory was needed and how much the limit was.
86 extern void message_mem_needed(enum message_verbosity v, uint64_t memusage); 90 extern void message_mem_needed(enum message_verbosity v, uint64_t memusage);
87 91
88 92
93 /// Buffer size for message_filters_to_str()
94 #define FILTERS_STR_SIZE 512
95
96
89 /// \brief Get the filter chain as a string 97 /// \brief Get the filter chain as a string
90 /// 98 ///
99 /// \param buf Pointer to caller allocated buffer to hold
100 /// the filter chain string
91 /// \param filters Pointer to the filter chain 101 /// \param filters Pointer to the filter chain
92 /// \param all_known If true, all filter options are printed. 102 /// \param all_known If true, all filter options are printed.
93 /// If false, only the options that get stored 103 /// If false, only the options that get stored
94 /// into .xz headers are printed. 104 /// into .xz headers are printed.
95 /// 105 extern void message_filters_to_str(char buf[FILTERS_STR_SIZE],
96 /// \return Pointer to a statically allocated buffer.
97 extern const char *message_filters_to_str(
98 const lzma_filter *filters, bool all_known); 106 const lzma_filter *filters, bool all_known);
99 107
100 108
101 /// Print the filter chain. 109 /// Print the filter chain.
102 extern void message_filters_show( 110 extern void message_filters_show(
103 enum message_verbosity v, const lzma_filter *filters); 111 enum message_verbosity v, const lzma_filter *filters);
104 112
105 113
106 /// Print a message that user should try --help. 114 /// Print a message that user should try --help.
107 extern void message_try_help(void); 115 extern void message_try_help(void);
108 116
109 117
110 /// Print the memory usage limit and exit.
111 extern void message_memlimit(void) lzma_attribute((noreturn));
112
113
114 /// Prints the version number to stdout and exits with exit status SUCCESS. 118 /// Prints the version number to stdout and exits with exit status SUCCESS.
115 extern void message_version(void) lzma_attribute((noreturn)); 119 extern void message_version(void) lzma_attribute((__noreturn__));
116 120
117 121
118 /// Print the help message. 122 /// Print the help message.
119 extern void message_help(bool long_help) lzma_attribute((noreturn)); 123 extern void message_help(bool long_help) lzma_attribute((__noreturn__));
120 124
121 125
122 /// \brief Set the total number of files to be processed 126 /// \brief Set the total number of files to be processed
123 /// 127 ///
124 /// Standard input is counted as a file here. This is used when printing 128 /// Standard input is counted as a file here. This is used when printing
125 /// the filename via message_filename(). 129 /// the filename via message_filename().
126 extern void message_set_files(unsigned int files); 130 extern void message_set_files(unsigned int files);
127 131
128 132
129 /// \brief Set the name of the current file and possibly print it too 133 /// \brief Set the name of the current file and possibly print it too
(...skipping 24 matching lines...) Expand all
154 /// message_progress_start() has already been used. 158 /// message_progress_start() has already been used.
155 extern void message_progress_update(void); 159 extern void message_progress_update(void);
156 160
157 161
158 /// \brief Finishes the progress message if we were in verbose mode 162 /// \brief Finishes the progress message if we were in verbose mode
159 /// 163 ///
160 /// \param finished True if the whole stream was successfully coded 164 /// \param finished True if the whole stream was successfully coded
161 /// and output written to the output stream. 165 /// and output written to the output stream.
162 /// 166 ///
163 extern void message_progress_end(bool finished); 167 extern void message_progress_end(bool finished);
OLDNEW
« no previous file with comments | « src/xz/list.c ('k') | src/xz/message.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698