Minor style modifications to comply with c99 compiler flag; removed Microsoft-specific "union-in-struct" syntax; Re-enabled cstr_info struct creation when -W switch is specified. Changed a number of things in opjviewer (e.g., decoding thread does not execute GUI calls anymore), to have it running under linux --> it is better than before, but still crashes
This commit is contained in:
@@ -130,7 +130,6 @@ void *OPJEncoThread::Entry()
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Decoding thread class
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
OPJDecoThread::OPJDecoThread(OPJCanvas *canvas)
|
||||
: wxThread()
|
||||
{
|
||||
@@ -141,7 +140,15 @@ OPJDecoThread::OPJDecoThread(OPJCanvas *canvas)
|
||||
void OPJDecoThread::WriteText(const wxString& text)
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
// we use a fake event and post it for inter-thread gui communication
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_THREADLOGMSG);
|
||||
event.SetInt(-1);
|
||||
msg << text;
|
||||
event.SetString(msg);
|
||||
wxPostEvent(this->m_canvas->m_childframe->m_frame, event);
|
||||
|
||||
/*
|
||||
// before doing any GUI calls we must ensure that this thread is the only
|
||||
// one doing it!
|
||||
|
||||
@@ -155,6 +162,7 @@ void OPJDecoThread::WriteText(const wxString& text)
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif // __WXGTK__
|
||||
*/
|
||||
}
|
||||
|
||||
void OPJDecoThread::OnExit()
|
||||
@@ -180,53 +188,24 @@ void *OPJDecoThread::Entry()
|
||||
|
||||
wxString text;
|
||||
|
||||
srand(GetId());
|
||||
//srand(GetId());
|
||||
//int m_countnum = rand() % 9;
|
||||
//text.Printf(wxT("Deco thread 0x%lx started (priority = %u, time = %d)."),
|
||||
// GetId(), GetPriority(), m_countnum);
|
||||
text.Printf(wxT("Deco thread %d started"), m_canvas->m_childframe->m_winnumber);
|
||||
|
||||
// we have started
|
||||
text.Printf(wxT("Deco thread %d started"), m_canvas->m_childframe->m_winnumber);
|
||||
WriteText(text);
|
||||
|
||||
// prepare dummy wximage
|
||||
wxBitmap bitmap(100, 100);
|
||||
wxImage image(100, 100, true); //= bitmap.ConvertToImage();
|
||||
image.Destroy();
|
||||
|
||||
// show image full name
|
||||
WriteText(m_canvas->m_fname.GetFullPath());
|
||||
|
||||
|
||||
// set handler properties
|
||||
/* wxJ2KHandler *j2kkkhandler = (wxJ2KHandler *) wxImage::FindHandler( wxBITMAP_TYPE_J2K);
|
||||
j2kkkhandler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||
j2kkkhandler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||
j2kkkhandler->m_components = wxGetApp().m_components;
|
||||
#ifdef USE_JPWL
|
||||
j2kkkhandler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
||||
j2kkkhandler->m_expcomps = wxGetApp().m_expcomps;
|
||||
j2kkkhandler->m_maxtiles = wxGetApp().m_maxtiles;
|
||||
#endif // USE_JPWL*/
|
||||
|
||||
/* wxJP2Handler *jp222handler = (wxJP2Handler *) wxImage::FindHandler( wxBITMAP_TYPE_JP2);
|
||||
jp222handler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||
jp222handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||
jp222handler->m_components = wxGetApp().m_components;
|
||||
#ifdef USE_JPWL
|
||||
jp222handler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
||||
jp222handler->m_expcomps = wxGetApp().m_expcomps;
|
||||
jp222handler->m_maxtiles = wxGetApp().m_maxtiles;
|
||||
#endif // USE_JPWL*/
|
||||
|
||||
/* wxMJ2Handler *mj222handler = (wxMJ2Handler *) wxImage::FindHandler( wxBITMAP_TYPE_MJ2);
|
||||
mj222handler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||
mj222handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||
mj222handler->m_components = wxGetApp().m_components;
|
||||
mj222handler->m_framenum = wxGetApp().m_framenum;
|
||||
#ifdef USE_JPWL
|
||||
mj222handler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
||||
mj222handler->m_expcomps = wxGetApp().m_expcomps;
|
||||
mj222handler->m_maxtiles = wxGetApp().m_maxtiles;
|
||||
#endif // USE_JPWL*/
|
||||
|
||||
wxJPEG2000Handler *jpeg2000handler = (wxJPEG2000Handler *) wxImage::FindHandler(wxBITMAP_TYPE_JPEG2000);
|
||||
jpeg2000handler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||
jpeg2000handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||
@@ -239,7 +218,7 @@ void *OPJDecoThread::Entry()
|
||||
#endif // USE_JPWL
|
||||
|
||||
#ifdef USE_MXF
|
||||
wxMXFHandler *mxfffhandler = (wxMXFHandler *) wxImage::FindHandler( wxBITMAP_TYPE_MXF);
|
||||
wxMXFHandler *mxfffhandler = (wxMXFHandler *) wxImage::FindHandler(wxBITMAP_TYPE_MXF);
|
||||
mxfffhandler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||
mxfffhandler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||
mxfffhandler->m_components = wxGetApp().m_components;
|
||||
@@ -252,11 +231,12 @@ void *OPJDecoThread::Entry()
|
||||
#endif // USE_JPWL
|
||||
#endif // USE_MXF
|
||||
|
||||
// if decoding is enabled...
|
||||
if (wxGetApp().m_enabledeco) {
|
||||
|
||||
// load the file
|
||||
if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY, 0)) {
|
||||
WriteText(wxT("Can't load image"));
|
||||
WriteText(wxT("Can't load image!"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -264,7 +244,7 @@ void *OPJDecoThread::Entry()
|
||||
|
||||
// display a warning
|
||||
if (!image.Create(300, 5, false)) {
|
||||
WriteText(wxT("Can't create image"));
|
||||
WriteText(wxT("Can't create image!"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -273,16 +253,22 @@ void *OPJDecoThread::Entry()
|
||||
// assign 100% image
|
||||
m_canvas->m_image100 = wxBitmap(image);
|
||||
|
||||
// signal the frame to refresh the canvas
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_VIEWFIT);
|
||||
event.SetString(wxT("Fit me"));
|
||||
event.SetInt(m_canvas->m_childframe->m_winnumber);
|
||||
wxPostEvent(m_canvas->m_childframe->m_frame, event);
|
||||
|
||||
// find a fit-to-width zoom
|
||||
int zooml, wzooml, hzooml;
|
||||
/*int zooml, wzooml, hzooml;
|
||||
wxSize clientsize = m_canvas->GetClientSize();
|
||||
wzooml = (int) floor(100.0 * (double) clientsize.GetWidth() / (double) (2 * OPJ_CANVAS_BORDER + image.GetWidth()));
|
||||
hzooml = (int) floor(100.0 * (double) clientsize.GetHeight() / (double) (2 * OPJ_CANVAS_BORDER + image.GetHeight()));
|
||||
zooml = wxMin(100, wxMin(wzooml, hzooml));
|
||||
zooml = wxMin(100, wxMin(wzooml, hzooml));*/
|
||||
|
||||
// fit to width
|
||||
#ifndef __WXGTK__
|
||||
m_canvas->m_childframe->m_frame->Rescale(zooml, m_canvas->m_childframe);
|
||||
//m_canvas->m_childframe->m_frame->Rescale(zooml, m_canvas->m_childframe);
|
||||
#endif // __WXGTK__
|
||||
|
||||
//m_canvas->m_image = m_canvas->m_image100;
|
||||
@@ -311,8 +297,15 @@ OPJParseThread::OPJParseThread(OPJMarkerTree *tree, wxTreeItemId parentid)
|
||||
void OPJParseThread::WriteText(const wxString& text)
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
// we use a fake event and post it for inter-thread gui communication
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_THREADLOGMSG);
|
||||
event.SetInt(-1);
|
||||
msg << text;
|
||||
event.SetString(msg);
|
||||
wxPostEvent(this->m_tree->m_childframe->m_frame, event);
|
||||
|
||||
// before doing any GUI calls we must ensure that this thread is the only
|
||||
/* // before doing any GUI calls we must ensure that this thread is the only
|
||||
// one doing it!
|
||||
|
||||
#ifndef __WXGTK__
|
||||
@@ -324,7 +317,7 @@ void OPJParseThread::WriteText(const wxString& text)
|
||||
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif // __WXGTK
|
||||
#endif // __WXGTK*/
|
||||
}
|
||||
|
||||
void OPJParseThread::OnExit()
|
||||
@@ -595,7 +588,6 @@ void OPJParseThread::LoadFile(wxFileName fname)
|
||||
|
||||
}
|
||||
|
||||
|
||||
// this is the root node
|
||||
if (this->m_parentid)
|
||||
m_tree->SetItemText(rootid, wxT("Codestream"));
|
||||
|
||||
@@ -165,10 +165,6 @@ bool OPJViewerApp::OnInit(void)
|
||||
|
||||
wxCmdLineParser parser(cmdLineDesc, argc, wxArgv);
|
||||
|
||||
/*parser.AddOption(_T("project_name"), _T(""), _T("full path to project file"),
|
||||
wxCMD_LINE_VAL_STRING,
|
||||
wxCMD_LINE_OPTION_MANDATORY | wxCMD_LINE_NEEDS_SEPARATOR);*/
|
||||
|
||||
switch (parser.Parse()) {
|
||||
case -1:
|
||||
wxLogMessage(wxT("Help was given, terminating."));
|
||||
@@ -190,9 +186,6 @@ bool OPJViewerApp::OnInit(void)
|
||||
wxImage::AddHandler( new wxJPEGHandler );
|
||||
#endif
|
||||
#if wxUSE_LIBOPENJPEG
|
||||
//wxImage::AddHandler( new wxJ2KHandler );
|
||||
//wxImage::AddHandler( new wxJP2Handler );
|
||||
//wxImage::AddHandler( new wxMJ2Handler );
|
||||
wxImage::AddHandler( new wxJPEG2000Handler );
|
||||
#endif
|
||||
#if USE_MXF
|
||||
@@ -477,9 +470,6 @@ void OPJViewerApp::ShowCmdLine(const wxCmdLineParser& parser)
|
||||
// OPJFrame events
|
||||
|
||||
// Event class for sending text messages between worker and GUI threads
|
||||
DECLARE_EVENT_TYPE(wxEVT_LOGMSG_EVENT, -1)
|
||||
DEFINE_EVENT_TYPE(wxEVT_LOGMSG_EVENT)
|
||||
|
||||
BEGIN_EVENT_TABLE(OPJFrame, wxMDIParentFrame)
|
||||
EVT_MENU(OPJFRAME_HELPABOUT, OPJFrame::OnAbout)
|
||||
EVT_MENU(OPJFRAME_FILEOPEN, OPJFrame::OnFileOpen)
|
||||
@@ -510,7 +500,7 @@ BEGIN_EVENT_TABLE(OPJFrame, wxMDIParentFrame)
|
||||
EVT_MENU(OPJFRAME_SETSDECO, OPJFrame::OnSetsDeco)
|
||||
EVT_SASH_DRAGGED_RANGE(OPJFRAME_BROWSEWIN, OPJFRAME_LOGWIN, OPJFrame::OnSashDrag)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(LEFT_NOTEBOOK_ID, OPJFrame::OnNotebook)
|
||||
EVT_COMMAND(wxID_ANY, wxEVT_LOGMSG_EVENT, OPJFrame::OnLogmsgEvent)
|
||||
EVT_MENU(OPJFRAME_THREADLOGMSG, OPJFrame::OnThreadLogmsg)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// this is the frame constructor
|
||||
@@ -928,10 +918,21 @@ void OPJFrame::OnClose(wxCommandEvent& WXUNUSED(event))
|
||||
currframe->OnClose(e);
|
||||
}
|
||||
|
||||
void OPJFrame::OnFit(wxCommandEvent& WXUNUSED(event))
|
||||
void OPJFrame::OnFit(wxCommandEvent& event)
|
||||
{
|
||||
OPJChildFrame *currchild;
|
||||
wxString eventstring = event.GetString();
|
||||
|
||||
//wxLogMessage(wxT("OnFit:%d:%s"), event.GetInt(), eventstring);
|
||||
|
||||
// current child
|
||||
OPJChildFrame *currchild = (OPJChildFrame *) GetActiveChild();
|
||||
if (event.GetInt() >= 1) {
|
||||
currchild = m_childhash[event.GetInt()];
|
||||
} else {
|
||||
currchild = (OPJChildFrame *) GetActiveChild();
|
||||
}
|
||||
|
||||
// problems
|
||||
if (!currchild)
|
||||
return;
|
||||
|
||||
@@ -939,14 +940,14 @@ void OPJFrame::OnFit(wxCommandEvent& WXUNUSED(event))
|
||||
OPJCanvas *currcanvas = currchild->m_canvas;
|
||||
|
||||
// find a fit-to-width zoom
|
||||
int zooml, wzooml, hzooml;
|
||||
/*int zooml, wzooml, hzooml;
|
||||
wxSize clientsize = currcanvas->GetClientSize();
|
||||
wzooml = (int) ceil(100.0 * (double) (clientsize.GetWidth() - 2 * OPJ_CANVAS_BORDER) / (double) (currcanvas->m_image100.GetWidth()));
|
||||
hzooml = (int) ceil(100.0 * (double) (clientsize.GetHeight() - 2 * OPJ_CANVAS_BORDER) / (double) (currcanvas->m_image100.GetHeight()));
|
||||
zooml = wxMin(100, wxMin(wzooml, hzooml));
|
||||
zooml = wxMin(100, wxMin(wzooml, hzooml));*/
|
||||
|
||||
// fit to width
|
||||
Rescale(zooml, currchild);
|
||||
Rescale(-1, currchild);
|
||||
}
|
||||
|
||||
void OPJFrame::OnZoom(wxCommandEvent& WXUNUSED(event))
|
||||
@@ -976,7 +977,20 @@ void OPJFrame::Rescale(int zooml, OPJChildFrame *currframe)
|
||||
|
||||
// resizing enabled?
|
||||
if (wxGetApp().m_resizemethod == -1) {
|
||||
|
||||
zooml = 100;
|
||||
|
||||
} else {
|
||||
|
||||
if (zooml < 0) {
|
||||
// find a fit-to-width zoom
|
||||
int wzooml, hzooml;
|
||||
//wxSize clientsize = currframe->m_canvas->GetClientSize();
|
||||
wxSize clientsize = currframe->m_frame->GetActiveChild()->GetClientSize();
|
||||
wzooml = (int) floor(100.0 * (double) clientsize.GetWidth() / (double) (2 * OPJ_CANVAS_BORDER + currframe->m_canvas->m_image100.GetWidth()));
|
||||
hzooml = (int) floor(100.0 * (double) clientsize.GetHeight() / (double) (2 * OPJ_CANVAS_BORDER + currframe->m_canvas->m_image100.GetHeight()));
|
||||
zooml = wxMin(100, wxMin(wzooml, hzooml));
|
||||
}
|
||||
}
|
||||
|
||||
if (zooml != 100)
|
||||
@@ -992,6 +1006,8 @@ void OPJFrame::Rescale(int zooml, OPJChildFrame *currframe)
|
||||
|
||||
currframe->m_canvas->Refresh();
|
||||
|
||||
wxLogMessage(wxT("Rescale said %d%%"), zooml);
|
||||
|
||||
// update zoom
|
||||
currframe->m_canvas->m_zooml = zooml;
|
||||
}
|
||||
@@ -1199,6 +1215,36 @@ void OPJFrame::OnSashDrag(wxSashEvent& event)
|
||||
|
||||
}
|
||||
|
||||
void OPJFrame::OnThreadLogmsg(wxCommandEvent& event)
|
||||
{
|
||||
#if 1
|
||||
wxLogMessage(wxT("Frame got message from worker thread: %d"), event.GetInt());
|
||||
wxLogMessage(event.GetString());
|
||||
#else
|
||||
int n = event.GetInt();
|
||||
if ( n == -1 )
|
||||
{
|
||||
m_dlgProgress->Destroy();
|
||||
m_dlgProgress = (wxProgressDialog *)NULL;
|
||||
|
||||
// the dialog is aborted because the event came from another thread, so
|
||||
// we may need to wake up the main event loop for the dialog to be
|
||||
// really closed
|
||||
wxWakeUpIdle();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !m_dlgProgress->Update(n) )
|
||||
{
|
||||
wxCriticalSectionLocker lock(m_critsectWork);
|
||||
|
||||
m_cancelled = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// physically save the file
|
||||
void OPJFrame::SaveFile(wxArrayString paths, wxArrayString filenames)
|
||||
{
|
||||
@@ -1364,6 +1410,7 @@ void OPJFrame::OnMemoryOpen(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
BEGIN_EVENT_TABLE(OPJCanvas, wxScrolledWindow)
|
||||
EVT_MOUSE_EVENTS(OPJCanvas::OnEvent)
|
||||
EVT_MENU(OPJCANVAS_THREADSIGNAL, OPJCanvas::OnThreadSignal)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Define a constructor for my canvas
|
||||
@@ -1469,13 +1516,33 @@ void OPJFrame::OnSize(wxSizeEvent& WXUNUSED(event))
|
||||
layout.LayoutMDIFrame(this);
|
||||
}
|
||||
|
||||
void OPJFrame::OnLogmsgEvent(wxCommandEvent &event)
|
||||
void OPJCanvas::OnThreadSignal(wxCommandEvent& event)
|
||||
{
|
||||
// receive string
|
||||
wxString text = event.GetString();
|
||||
#if 1
|
||||
wxLogMessage(wxT("Canvas got signal from deco thread: %d"), event.GetInt());
|
||||
wxLogMessage(event.GetString());
|
||||
#else
|
||||
int n = event.GetInt();
|
||||
if ( n == -1 )
|
||||
{
|
||||
m_dlgProgress->Destroy();
|
||||
m_dlgProgress = (wxProgressDialog *)NULL;
|
||||
|
||||
// show it on the log
|
||||
wxLogMessage(text);
|
||||
// the dialog is aborted because the event came from another thread, so
|
||||
// we may need to wake up the main event loop for the dialog to be
|
||||
// really closed
|
||||
wxWakeUpIdle();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !m_dlgProgress->Update(n) )
|
||||
{
|
||||
wxCriticalSectionLocker lock(m_critsectWork);
|
||||
|
||||
m_cancelled = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -269,8 +269,13 @@ class OPJCanvas: public wxScrolledWindow
|
||||
wxMutexGuiLeave();
|
||||
#endif //__WXGTK__
|
||||
}
|
||||
|
||||
void OnThreadSignal(wxCommandEvent& event);
|
||||
|
||||
OPJDecoThread *CreateDecoThread(void);
|
||||
OPJEncoThread *CreateEncoThread(void);
|
||||
|
||||
|
||||
OPJChildFrame *m_childframe;
|
||||
|
||||
wxBitmap m_image, m_image100;
|
||||
@@ -419,7 +424,7 @@ class OPJFrame: public wxMDIParentFrame
|
||||
void OnQuit(wxCommandEvent& WXUNUSED(event));
|
||||
void OnClose(wxCommandEvent& WXUNUSED(event));
|
||||
void OnZoom(wxCommandEvent& WXUNUSED(event));
|
||||
void OnFit(wxCommandEvent& WXUNUSED(event));
|
||||
void OnFit(wxCommandEvent& event);
|
||||
void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));
|
||||
void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));
|
||||
void OnToggleToolbar(wxCommandEvent& WXUNUSED(event));
|
||||
@@ -443,7 +448,7 @@ class OPJFrame: public wxMDIParentFrame
|
||||
void SaveFile(wxArrayString paths, wxArrayString filenames);
|
||||
void OnNotebook(wxNotebookEvent& event);
|
||||
void Rescale(int scale, OPJChildFrame *child);
|
||||
void OnLogmsgEvent(wxCommandEvent &event);
|
||||
void OnThreadLogmsg(wxCommandEvent& event);
|
||||
|
||||
OPJMarkerTreeHash m_treehash;
|
||||
OPJChildFrameHash m_childhash;
|
||||
@@ -523,7 +528,10 @@ enum {
|
||||
|
||||
OPJFRAME_BROWSEWIN = 10000,
|
||||
OPJFRAME_LOGWIN,
|
||||
OPJFRAME_TOOLBAR
|
||||
OPJFRAME_TOOLBAR,
|
||||
|
||||
OPJFRAME_THREADLOGMSG,
|
||||
OPJCANVAS_THREADSIGNAL
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
wxT("468")
|
||||
wxT("491")
|
||||
|
||||
@@ -128,46 +128,61 @@ jpeg2000familytype(unsigned char *hdr, int hdr_len)
|
||||
|
||||
}
|
||||
|
||||
/* sample error callback expecting a FILE* client object */
|
||||
void jpeg2000_error_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
/* we have to use this to avoid GUI-noGUI threads crashing */
|
||||
void printevent(const char *msg)
|
||||
{
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
|
||||
wxLogMessage(wxT("%s"), msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
}
|
||||
|
||||
/* sample error callback expecting a FILE* client object */
|
||||
void jpeg2000_error_callback(const char *msg, void *client_data) {
|
||||
char mess[MAX_MESSAGE_LEN + 20];
|
||||
int message_len = strlen(msg);
|
||||
|
||||
if (message_len > MAX_MESSAGE_LEN)
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
|
||||
if (msg[message_len - 1] == '\n')
|
||||
message_len--;
|
||||
|
||||
sprintf(mess, "[ERROR] %.*s", message_len, msg);
|
||||
printevent(mess);
|
||||
}
|
||||
|
||||
/* sample warning callback expecting a FILE* client object */
|
||||
void jpeg2000_warning_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
char mess[MAX_MESSAGE_LEN + 20];
|
||||
int message_len = strlen(msg);
|
||||
|
||||
if (message_len > MAX_MESSAGE_LEN)
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
|
||||
if (msg[message_len - 1] == '\n')
|
||||
message_len--;
|
||||
|
||||
sprintf(mess, "[WARNING] %.*s", message_len, msg);
|
||||
printevent(mess);
|
||||
}
|
||||
|
||||
/* sample debug callback expecting no client object */
|
||||
void jpeg2000_info_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
char mess[MAX_MESSAGE_LEN + 20];
|
||||
int message_len = strlen(msg);
|
||||
|
||||
if (message_len > MAX_MESSAGE_LEN)
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
|
||||
if (msg[message_len - 1] == '\n')
|
||||
message_len--;
|
||||
|
||||
sprintf(mess, "[INFO] %.*s", message_len, msg);
|
||||
printevent(mess);
|
||||
}
|
||||
|
||||
/* macro functions */
|
||||
|
||||
Reference in New Issue
Block a user