Skip to content

Commit

Permalink
replacing PACKAGE_BUGREPORT with bug_msg
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPulec committed Aug 14, 2024
1 parent e154dfa commit c12bef6
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 31 deletions.
5 changes: 2 additions & 3 deletions src/audio/capture/alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
/* Use the newer ALSA API */
#define ALSA_PCM_NEW_HW_PARAMS_API

#include "config.h"
#include "config_unix.h"

#include "host.h"
Expand Down Expand Up @@ -197,8 +196,8 @@ static void * audio_cap_alsa_init(struct module *parent, const char *cfg)
}
}
if (s->frame.bps == 0) {
log_msg(LOG_LEVEL_ERROR, MOD_NAME "Cannot find suitable sample format, "
"please contact %s.\n", PACKAGE_BUGREPORT);
bug_msg(LOG_LEVEL_ERROR, MOD_NAME
"Cannot find suitable sample format. ");
goto error;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/audio/playback/jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ static int jack_samplerate_changed_callback(jack_nframes_t nframes, void *arg)
struct state_jack_playback *s = (struct state_jack_playback *) arg;

if (s->jack_sample_rate != 0) {
log_msg(LOG_LEVEL_WARNING, "JACK sample rate changed from %d to %d. "
bug_msg(LOG_LEVEL_WARNING, "JACK sample rate changed from %d to %d. "
"Runtime change is not supported in UG and will likely "
"cause malfunctioning. If so, pleaser report to %s\n.",
s->jack_sample_rate, nframes, PACKAGE_BUGREPORT);
"cause malfunctioning. ",
s->jack_sample_rate, nframes);
} else {
log_msg(LOG_LEVEL_NOTICE, MOD_NAME "Sample rate changed to: %d\n",
nframes);
Expand Down
7 changes: 3 additions & 4 deletions src/audio/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#include "config_unix.h"
#include "config_win32.h"
#endif // HAVE_CONFIG_H
Expand All @@ -57,9 +56,9 @@
#include "utils/macros.h"
#include "utils/misc.h"

#ifdef WORDS_BIGENDIAN
#error "This code will not run with a big-endian machine. Please report a bug to " PACKAGE_BUGREPORT " if you reach here."
#endif // WORDS_BIGENDIAN
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#error "This code will not run with a big-endian machine. Please report a bug if you reach here."
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__

using std::clamp;
using std::max;
Expand Down
12 changes: 9 additions & 3 deletions src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,21 @@ void debug_file_dump(const char *key, void (*serialize)(const void *data, FILE *
* MOD_NAME. Should end with either ' ' or '\n' (what fits the caller better).
*/
void
bug_msg(int level, const char *msg)
bug_msg(int level, const char *format, ...)
{
log_msg(level,
char fmt_adj[STR_LEN];
snprintf_ch(fmt_adj,
"%sPlease report a bug"
#ifdef PACKAGE_BUGREPORT
" to " PACKAGE_BUGREPORT
#endif // defined PACKAGE_BUGREPORT
" if you reach here.\n",
msg);
format);

va_list ap;
va_start(ap, format);
log_vprintf(level, fmt_adj, ap);
va_end(ap);
}

Log_output::Log_output(){
Expand Down
2 changes: 1 addition & 1 deletion src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ bool parse_log_cfg(const char *conf_str,
bool *logger_skip_repeats,
enum log_timestamp_mode *show_timestamps);

void bug_msg(int level, const char *msg);
void bug_msg(int level, const char *format, ...) __attribute__((format (printf, 2, 3)));

#ifdef __cplusplus
}
Expand Down
5 changes: 4 additions & 1 deletion src/utils/windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ const char *win_wstr_to_str(const wchar_t *wstr) {
int ret = WideCharToMultiByte(CP_UTF8, 0, wstr, -1 /* NULL-terminated */, res, sizeof res - 1, NULL, NULL);
if (ret == 0) {
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
log_msg(LOG_LEVEL_ERROR, "win_wstr_to_str: Insufficient buffer length %zd, please report to %s!\n", sizeof res, PACKAGE_BUGREPORT);
bug_msg(
LOG_LEVEL_ERROR,
"win_wstr_to_str: Insufficient buffer length %zd. ",
sizeof res);
} else {
log_msg(LOG_LEVEL_ERROR, "win_wstr_to_str: %s\n", get_win32_error(GetLastError()));
}
Expand Down
10 changes: 6 additions & 4 deletions src/video_capture/DirectShowGrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,12 @@ static bool process_args(struct vidcap_dshow_state *s, char *init_fmt) {
s->desc.color_spec = get_ug_from_subtype_name(token);
}
if (s->desc.color_spec == VIDEO_CODEC_NONE) {
log_msg(LOG_LEVEL_ERROR, MOD_NAME "Unsupported video format: %s. "
"Please contact us via %s if you need support for this codec.\n",
token, PACKAGE_BUGREPORT);
return false;
bug_msg(LOG_LEVEL_ERROR,
MOD_NAME
"Unsupported video "
"format: %s. ",
token);
return false;
}
}
break;
Expand Down
5 changes: 3 additions & 2 deletions src/video_capture/decklink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
#include "audio/utils.h"
#include "compat/htonl.h"
#include "compat/strings.h"
#include "config.h" // for PACKAGE_BUGREPORT
#include "debug.h"
#include "host.h"
#include "lib_common.h"
Expand Down Expand Up @@ -993,7 +992,9 @@ static HRESULT set_display_mode_properties(struct vidcap_decklink_state *s, stru
s->next_frame_time = static_cast<int>(std::chrono::microseconds::period::den / s->frame->fps); // in microseconds
switch(displayMode->GetFieldDominance()) {
case bmdLowerFieldFirst:
log_msg(LOG_LEVEL_WARNING, MOD_NAME "Lower field first format detected, fields can be switched! If so, please report a bug to " PACKAGE_BUGREPORT "\n");
bug_msg(LOG_LEVEL_WARNING,
MOD_NAME "Lower field first format detected, "
"fields can be switched! ");
// fall through
case bmdUpperFieldFirst:
s->frame->interlacing = INTERLACED_MERGED;
Expand Down
11 changes: 6 additions & 5 deletions src/video_display/aja.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
* The use of ping-pong buffer technique is based on NTV2LLBurn.
*/

#ifdef HAVE_CONFIG_H
#include "config.h" // for PACKAGE_BUGREPORT
#endif // HAVE_CONFIG_H
#include "config_msvc.h"

#include "debug.h"
Expand Down Expand Up @@ -552,8 +549,12 @@ void display::RouteOutputSignal ()
"Connect from CSC", NOOP);
}
} else {
LOG(LOG_LEVEL_WARNING) << MOD_NAME "Routing for " << NTV2OutputDestinationToString(mConf.outputDestination)
<< " may be incorrect. Please report to " PACKAGE_BUGREPORT ".\n" << endl;
bug_msg(LOG_LEVEL_WARNING,
MOD_NAME
"Routing for %s may be incorrect. ",
NTV2OutputDestinationToString(
mConf.outputDestination)
.c_str());
CHECK_EX(mDevice.Connect(::GetOutputDestInputXpt(mConf.outputDestination), fbIsRGB ? cscVidOutXpt : fsVidOutXpt),
"Connect from CSC or frame store", NOOP);
}
Expand Down
7 changes: 5 additions & 2 deletions src/video_display/decklink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
#include "blackmagic_common.hpp"
#include "compat/htonl.h"
#include "compat/strings.h"
#include "config.h" // for PACKAGE_BUGREPORT
#include "debug.h"
#include "host.h"
#include "lib_common.h"
Expand Down Expand Up @@ -870,7 +869,11 @@ static BMDDisplayMode get_mode(IDeckLinkOutput *deckLinkOutput, struct video_des
if (dominance == bmdLowerFieldFirst ||
dominance == bmdUpperFieldFirst) {
if (dominance == bmdLowerFieldFirst) {
log_msg(LOG_LEVEL_WARNING, MOD_NAME "Lower field first format detected, fields can be switched! If so, please report a bug to " PACKAGE_BUGREPORT "\n");
bug_msg(
LOG_LEVEL_WARNING, MOD_NAME
"Lower field first format "
"detected, fields can be "
"switched! ");
}
interlaced = true;
} else { // progressive, psf, unknown
Expand Down
4 changes: 1 addition & 3 deletions src/vo_postprocess/text.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@


#ifdef HAVE_CONFIG_H
#include "config.h"
#include "config_unix.h"
#include "config_win32.h"
#endif /* HAVE_CONFIG_H */
Expand Down Expand Up @@ -229,8 +228,7 @@ text_postprocess_reconfigure(void *state, struct video_desc desc)
color_outline = "#EB8080FF";
colorspace = "UYVY";
} else {
log_msg(LOG_LEVEL_ERROR, "[text vo_pp.] Codec not supported! Please report to "
PACKAGE_BUGREPORT ".\n");
bug_msg(LOG_LEVEL_ERROR, "[text vo_pp.] Codec not supported! ");
return false;
}

Expand Down

0 comments on commit c12bef6

Please sign in to comment.