Skip to content

Commit

Permalink
cleanup; resolve most of warnings (not used variables)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentWei committed Nov 1, 2017
1 parent 6333f47 commit b83d95b
Show file tree
Hide file tree
Showing 78 changed files with 178 additions and 180 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ set (prefix ${CMAKE_INSTALL_PREFIX})
set (exec_prefix "\${prefix}")
set (libdir "\${exec_prefix}/lib")
set (includedir "\${prefix}/include")
set (MiniGUI_VERSION ${MINIGUI_VERSION})
configure_file(
"${PROJECT_SOURCE_DIR}/minigui.pc.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NICKNAME}.pc")
Expand Down
45 changes: 23 additions & 22 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ dnl Set various version strings - taken gratefully from the SDL sources
# if backwards compatibility has been broken,
# set MINIGUI_BINARY_AGE and MINIGUI_INTERFACE_AGE to 0.
#
MiniGUI_MAJOR_VERSION=3
MiniGUI_MINOR_VERSION=0
MiniGUI_MICRO_VERSION=13
MiniGUI_INTERFACE_AGE=0
MiniGUI_BINARY_AGE=0
MiniGUI_VERSION=$MiniGUI_MAJOR_VERSION.$MiniGUI_MINOR_VERSION.$MiniGUI_MICRO_VERSION

AC_SUBST(MiniGUI_MAJOR_VERSION)
AC_SUBST(MiniGUI_MINOR_VERSION)
AC_SUBST(MiniGUI_MICRO_VERSION)
AC_SUBST(MiniGUI_INTERFACE_AGE)
AC_SUBST(MiniGUI_BINARY_AGE)
AC_SUBST(MiniGUI_VERSION)
MINIGUI_MAJOR_VERSION=3
MINIGUI_MINOR_VERSION=0
MINIGUI_MICRO_VERSION=13
MINIGUI_INTERFACE_AGE=0
MINIGUI_BINARY_AGE=0
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION

AC_SUBST(MINIGUI_MAJOR_VERSION)
AC_SUBST(MINIGUI_MINOR_VERSION)
AC_SUBST(MINIGUI_MICRO_VERSION)
AC_SUBST(MINIGUI_INTERFACE_AGE)
AC_SUBST(MINIGUI_BINARY_AGE)
AC_SUBST(MINIGUI_VERSION)

dnl ========================================================================
dnl libtool versioning
LT_RELEASE=$MiniGUI_MAJOR_VERSION.$MiniGUI_MINOR_VERSION
LT_CURRENT=`expr $MiniGUI_MICRO_VERSION - $MiniGUI_INTERFACE_AGE`
LT_REVISION=$MiniGUI_INTERFACE_AGE
LT_AGE=`expr $MiniGUI_BINARY_AGE - $MiniGUI_INTERFACE_AGE`
LT_RELEASE=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION
LT_CURRENT=`expr $MINIGUI_MICRO_VERSION - $MINIGUI_INTERFACE_AGE`
LT_REVISION=$MINIGUI_INTERFACE_AGE
LT_AGE=`expr $MINIGUI_BINARY_AGE - $MINIGUI_INTERFACE_AGE`

AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
Expand Down Expand Up @@ -1386,15 +1386,15 @@ if test "x$build_png_support" != "xno"; then
build_png_support=no, -lz -lm)
fi

AC_DEFINE_UNQUOTED(MINIGUI_MAJOR_VERSION, $MiniGUI_MAJOR_VERSION,
AC_DEFINE_UNQUOTED(MINIGUI_MAJOR_VERSION, $MINIGUI_MAJOR_VERSION,
[Major version of MiniGUI])
AC_DEFINE_UNQUOTED(MINIGUI_MINOR_VERSION, $MiniGUI_MINOR_VERSION,
AC_DEFINE_UNQUOTED(MINIGUI_MINOR_VERSION, $MINIGUI_MINOR_VERSION,
[Minor version of MiniGUI])
AC_DEFINE_UNQUOTED(MINIGUI_MICRO_VERSION, $MiniGUI_MICRO_VERSION,
AC_DEFINE_UNQUOTED(MINIGUI_MICRO_VERSION, $MINIGUI_MICRO_VERSION,
[Micro version of MiniGUI])
AC_DEFINE_UNQUOTED(MINIGUI_INTERFACE_AGE, $MiniGUI_INTERFACE_AGE,
AC_DEFINE_UNQUOTED(MINIGUI_INTERFACE_AGE, $MINIGUI_INTERFACE_AGE,
[Interface age of MiniGUI])
AC_DEFINE_UNQUOTED(MINIGUI_BINARY_AGE, $MiniGUI_BINARY_AGE,
AC_DEFINE_UNQUOTED(MINIGUI_BINARY_AGE, $MINIGUI_BINARY_AGE,
[Binary age of MiniGUI])

dnl ========================================================================
Expand Down Expand Up @@ -2543,3 +2543,4 @@ if [[ $? -ne 0 ]]; then
else
echo "Done."
fi

4 changes: 4 additions & 0 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@
# endif
# endif
# else
# undef PACKAGE
# undef VERSION
# undef PACKAGE_BUGREPORT
# undef PACKAGE_NAME
# undef PACKAGE_STRING
# undef PACKAGE_TARNAME
# undef PACKAGE_VERSION
# include "mgconfig.h"
# undef PACKAGE
# undef VERSION
# undef PACKAGE_BUGREPORT
# undef PACKAGE_NAME
# undef PACKAGE_STRING
Expand Down
2 changes: 1 addition & 1 deletion minigui.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ includedir=@includedir@

Name: MiniGUI
Description: A windowing system for embedded system.
Version: @MiniGUI_VERSION@
Version: @MINIGUI_VERSION@
Requires:
Libs: -L${libdir} -lminigui_@MGLIB_SUFFIX@ @MINIGUI_LIBRARIES_LIST@
Libs.private:
Expand Down
2 changes: 1 addition & 1 deletion src/client/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
INCLUDES = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include

noinst_LTLIBRARIES = libclient.la

Expand Down
2 changes: 1 addition & 1 deletion src/control/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
INCLUDES = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include

noinst_LTLIBRARIES = libcontrol.la

Expand Down
14 changes: 9 additions & 5 deletions src/control/bidiedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ static BOOL check_sel_edge(int* p, int* num, PBIDISLEDITDATA sled)
return FALSE;
}

if(!*num > 1) return TRUE;
if (!(*num > 1)) return TRUE;
if(sled->selStart == p[0] && (sled->selEnd+1) == p[1]){
p[1] -= 1;
}
Expand Down Expand Up @@ -596,7 +596,9 @@ sleSetSel (HWND hWnd, PBIDISLEDITDATA sled, int sel_start, int sel_end)
*/
static void set_caret_pos (HWND hWnd, PBIDISLEDITDATA sled, int x, BOOL bSel)
{
#ifdef _DEBUG
int out_chars = 0;
#endif
int out_glyphs = 0;
HDC hdc;
SIZE txtsize;
Expand All @@ -606,15 +608,19 @@ static void set_caret_pos (HWND hWnd, PBIDISLEDITDATA sled, int x, BOOL bSel)
sleWindowToContent (sled, &x);

if (x - sled->startx <= 0) {
#ifdef _DEBUG
out_chars = 0;
#endif
txtsize.cx = 0;
}
else {
out_glyphs = GetGlyphsExtentPoint (hdc, GLYPHS, GLYPHSLEN,
x - sled->startx, &txtsize);
#ifdef _DEBUG
if(out_glyphs <= GLYPHSLEN){
out_chars = get_glyph_text_index(sled, out_glyphs);
}
#endif
_MG_PRINTF ("editPos=%d,out_chars=%d\n", out_glyphs, out_chars);
}
if (!bSel) {
Expand Down Expand Up @@ -2101,13 +2107,13 @@ static void
esleft_input_char_refresh (HWND hWnd,
PBIDISLEDITDATA sled, char *charBuffer, int chars)
{
int old_caretpos_x, cur_caretpos_x;
int old_caretpos_x;
int old_sel_start, old_sel_end;
int old_sel_start_x, old_sel_end_x, cur_sel_start_x;
RECT scroll_rc, refresh_rc;
int scroll_len;
int old_edit_pos_x, cur_edit_pos_x;
int old_nContX, cur_ncontx;
int old_nContX;
//char_size is width of input chars; sel_size is width of the selected area
int char_size, sel_size;
int glyphs_len_x;
Expand All @@ -2128,8 +2134,6 @@ esleft_input_char_refresh (HWND hWnd,

calc_glyph_pos_cx(hWnd, sled, sled->editPos, &cur_edit_pos_x);
calc_glyph_pos_cx(hWnd, sled, old_sel_start, &cur_sel_start_x);
cur_ncontx = sled->nContX;
cur_caretpos_x = get_caretpos_x(hWnd);
char_size = cur_edit_pos_x - cur_sel_start_x;
sel_size = abs(old_sel_start_x - old_sel_end_x);

Expand Down
10 changes: 7 additions & 3 deletions src/control/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,13 @@ static void paint_content_focus(HDC hdc, PCONTROL pctrl, RECT* prc_cont)
BOOL is_get_fmt = FALSE;
gal_pixel old_pixel;
RECT focus_rc;
int status, type;
const WINDOW_ELEMENT_RENDERER* win_rdr;

/* Not used vars.
int status, type;
status = BUTTON_STATUS (pctrl);
type = BUTTON_TYPE (pctrl);
*/
win_rdr = GetWindowInfo((HWND)pctrl)->we_rdr;

/*draw button content*/
Expand Down Expand Up @@ -592,16 +594,18 @@ static int ctrlst_rdrst[12] = {
static void paint_check_radio_btn (HDC hdc, PCONTROL pctrl)
{
const WINDOW_ELEMENT_RENDERER* win_rdr;
gal_pixel text_pixel;
int rdr_st;

RECT rcClient;
RECT rcContent;
RECT rcBitmap;


win_rdr = GetWindowInfo((HWND)pctrl)->we_rdr;

/* Not used vars
gal_pixel text_pixel;
text_pixel = GetWindowElementPixelEx((HWND)pctrl, hdc, WE_FGC_WINDOW);
*/

rdr_st = ctrlst_rdrst [ BUTTON_STATUS (pctrl) &
(BST_POSE_MASK|BST_CHECK_MASK) ];
Expand Down
12 changes: 7 additions & 5 deletions src/control/combobox.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,10 @@ static void ComboBoxDrawSpinButton (HWND hwnd, HDC hdc , int which, int status)
PCOMBOBOXDATA pData;
PCONTROL pCtrl;
const WINDOWINFO *win_info;
DWORD main_3d, fg_3d;
DWORD fg_3d;
BOOL bGetDC = FALSE;

if(hdc == 0)
{
if (hdc == 0) {
bGetDC = TRUE;
hdc = GetClientDC(hwnd);
}
Expand All @@ -97,8 +96,11 @@ static void ComboBoxDrawSpinButton (HWND hwnd, HDC hdc , int which, int status)
win_info = GetWindowInfo(hwnd);
pData = (PCOMBOBOXDATA)pCtrl->dwAddData2;

main_3d = GetWindowElementAttr(hwnd,WE_MAINC_THREED_BODY);
fg_3d = GetWindowElementAttr(hwnd,WE_FGC_THREED_BODY);
/* not used var
DWORD main_3d;
main_3d = GetWindowElementAttr(hwnd, WE_MAINC_THREED_BODY);
*/
fg_3d = GetWindowElementAttr(hwnd, WE_FGC_THREED_BODY);

if(which == 0)
status = LFRDR_BTN_STATUS_NORMAL;
Expand Down
10 changes: 7 additions & 3 deletions src/control/edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,6 @@ static void esright_backspace_refresh(HWND hWnd, PSLEDITDATA sled, int del)
scroll_rc.right = sled->rcVis.right;
old_caret_x = get_caretpos_x(hWnd);


sleInsertText_refresh (hWnd, sled, NULL, del);
edtSetCaretPos (hWnd, sled);
cur_caret_x = get_caretpos_x(hWnd);
Expand Down Expand Up @@ -1648,13 +1647,13 @@ static void
esleft_input_char_refresh (HWND hWnd,
PSLEDITDATA sled, char *charBuffer, int chars)
{
int old_caretpos_x, cur_caretpos_x;
int old_caretpos_x;
int old_sel_start, old_sel_end;
int old_sel_start_x, old_sel_end_x, cur_sel_start_x;
RECT scroll_rc, refresh_rc;
int scroll_len;
int old_edit_pos_x, cur_edit_pos_x;
int old_nContX, cur_ncontx;
int old_nContX;
//char_size is width of input chars; sel_size is width of the selected area
int char_size, sel_size;
int txtlen_x;
Expand All @@ -1675,8 +1674,13 @@ esleft_input_char_refresh (HWND hWnd,

calc_charpos_cx(hWnd, sled, sled->editPos, &cur_edit_pos_x);
calc_charpos_cx(hWnd, sled, old_sel_start, &cur_sel_start_x);

/* Not used var
int cur_caretpos_x, cur_ncontx;
cur_ncontx = sled->nContX;
cur_caretpos_x = get_caretpos_x(hWnd);
*/

char_size = cur_edit_pos_x - cur_sel_start_x;
sel_size = abs(old_sel_start_x - old_sel_end_x);

Expand Down
6 changes: 2 additions & 4 deletions src/control/menubutton.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ static PMBITEM mbRemoveItem (PMENUBTNDATA mb_data, int* pos)
#else
static PMBITEM mbRemoveItem (PMENUBTNDATA mb_data, int* pos)
{
int index = 0, found = 0;
int index = 0;
PMBITEM pmbi, prev;

if (!mb_data->first_item)
Expand All @@ -319,7 +319,6 @@ static PMBITEM mbRemoveItem (PMENUBTNDATA mb_data, int* pos)
pmbi = mb_data->first_item;
while (pmbi->next) {
if (*pos == index) {
found = 1;
break;
}

Expand All @@ -328,7 +327,6 @@ static PMBITEM mbRemoveItem (PMENUBTNDATA mb_data, int* pos)
index ++;
}

//if (found == 1 || *pos == index) {
if (*pos <= index) {
prev->next = pmbi->next;
return pmbi;
Expand Down Expand Up @@ -839,7 +837,7 @@ static int MenuButtonCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lPa
fg_color = GetWindowElementAttr (hWnd, WE_FGC_WINDOW);
fc = RGBA2Pixel (hdc, GetRValue(fg_color), GetGValue(fg_color),
GetBValue(fg_color), GetAValue(fg_color));
SetTextColor (hdc, fg_color);
SetTextColor (hdc, fc);
DrawText (hdc, text, -1, &rcText, uFormat);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/control/propsheet.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,10 @@ scroll_tab_right (HWND hwnd, PCONTROL ctrl, PPROPSHEETDATA propsheet)

static void scroll_tab_left (HWND hwnd, PCONTROL ctrl, PPROPSHEETDATA propsheet)
{
/* not used vars
PPROPPAGE page;
page = propsheet->first_display_page;
*/

if (propsheet->active == propsheet->head) {
return;
Expand Down
2 changes: 0 additions & 2 deletions src/control/scrollbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,6 @@ static int ScrollBarCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lPar
{
int pos = (int)wParam;
BOOL redraw = (BOOL)lParam;
int old_pos;
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);

if (pos == data->curPos)
Expand All @@ -994,7 +993,6 @@ static int ScrollBarCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lPar
pos = data->maxPos;
}

old_pos = data->curPos;
data->curPos = pos;

if (data->curPos == data->minPos)
Expand Down
9 changes: 5 additions & 4 deletions src/control/scrolled.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,19 +277,20 @@ int scrolled_content_to_visible (PSCRDATA pscrdata, int *x, int *y)
/* recalc visible area and container area, then set scrollbar */
void scrolled_recalc_areas (HWND hWnd, PSCRDATA pscrdata, int new_w, int new_h)
{
int old_vw, old_vh;

if (!pscrdata || new_w <= 0 || new_h <= 0)
return;

old_vw = pscrdata->visibleWidth;
old_vh = pscrdata->visibleHeight;
/* reset viewport as client - margin */
pscrdata->visibleWidth = new_w;
pscrdata->visibleHeight = new_h;
scrolled_set_visible (hWnd, pscrdata);

/*
int old_vw, old_vh;
old_vw = pscrdata->visibleWidth;
old_vh = pscrdata->visibleHeight;
if (pscrdata->nContWidth == old_vw) {
pscrdata->nContWidth = pscrdata->visibleWidth;
//should refresh the whole window
Expand Down
4 changes: 3 additions & 1 deletion src/control/scrollview.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,13 @@ void scrollview_destroy (PSVDATA psvdata)
int ScrollViewCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
PSVDATA psvdata = NULL;
PSVLIST psvlist = NULL;

if (message != MSG_CREATE) {
psvdata = (PSVDATA) GetWindowAdditionalData2 (hWnd);
/* not used vars
PSVLIST psvlist = NULL;
psvlist = &psvdata->svlist;
*/
}

switch (message) {
Expand Down
2 changes: 1 addition & 1 deletion src/ex_ctrl/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
INCLUDES = -I$(abs_top_srcdir)/include -I$(abs_top_srcdir)/src/control/ -I$(abs_top_srcdir)/src/include
AM_CPPFLAGS = -I$(abs_top_srcdir)/include -I$(abs_top_srcdir)/src/control/ -I$(abs_top_srcdir)/src/include

noinst_LTLIBRARIES = libexctrl.la

Expand Down
Loading

0 comments on commit b83d95b

Please sign in to comment.