Visual studio fixes

This commit is contained in:
Yevgen Muntyan 2015-07-11 14:32:02 -07:00
parent 6242d6019b
commit 41096674ea
47 changed files with 200 additions and 112 deletions

View File

@ -101,7 +101,7 @@ pkg_check_modules(XLIB x11 xext xrender ice sm)
pkg_check_modules(LIBXML2 REQUIRED libxml-2.0)
find_library(LIBM m)
#find_library(LIBM m)
find_package(Gettext REQUIRED)
SET(GETTEXT_PACKAGE "${MOO_PACKAGE_NAME}")
@ -114,6 +114,12 @@ SET(MOO_PYTHON "${PYTHON_EXECUTABLE}")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
add_definitions(-DMOO_COMPILATION=1 -DHAVE_CONFIG_H=1 -DXDG_PREFIX=_moo_edit_xdg -DG_LOG_DOMAIN=\"Moo\")
if(WIN32)
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__WIN32__=1 -D_CRT_SECURE_NO_WARNINGS=1 -D_CRT_NONSTDC_NO_WARNINGS=1)
add_definitions(-DHAVE_MMAP=1)
set(MOO_OS_WIN32 TRUE)
endif(WIN32)
# zzz SUBDIRS = po po-gsv api doc moo
add_subdirectory(api)
#add_subdirectory(api)
add_subdirectory(moo)

24
config.h.in Normal file
View File

@ -0,0 +1,24 @@
#pragma once
#define MOO_PACKAGE_NAME "@MOO_PACKAGE_NAME@"
#define MOO_DISPLAY_VERSION "@MOO_DISPLAY_VERSION@"
#define MOO_WEBSITE "@MOO_WEBSITE@"
#define MOO_WEB_CONTACT "@MOO_WEB_CONTACT@"
#define MOO_EMAIL "@MOO_EMAIL@"
#define MOO_COPYRIGHT "@MOO_COPYRIGHT@"
#define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"
#define MEDIT_PORTABLE_DATA_DIR "@MEDIT_PORTABLE_DATA_DIR@"
#define MEDIT_PORTABLE_CACHE_DIR "@MEDIT_PORTABLE_CACHE_DIR@"
#define MEDIT_PORTABLE_MAGIC_FILE_NAME "@MEDIT_PORTABLE_MAGIC_FILE_NAME@"
//SET(MOO_PREFS_XML_FILE_NAME "prefs.xml")
//SET(MOO_STATE_XML_FILE_NAME "state.xml")
//SET(MOO_NAMED_SESSION_XML_FILE_NAME "session-%s.xml")
//SET(MOO_SESSION_XML_FILE_NAME "session.xml")
//SET(MEDIT_PORTABLE_MAGIC_FILE_NAME "medit-portable")
//SET(MEDIT_PORTABLE_DATA_DIR "medit-portable-data")
//SET(MEDIT_PORTABLE_CACHE_DIR "medit-portable-cache")

View File

@ -2,7 +2,13 @@
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/genmarshals_h.cmake
"EXECUTE_PROCESS(COMMAND ${GLIB_GENMARSHAL} --prefix=_moo_marshal --header ${CMAKE_CURRENT_SOURCE_DIR}/marshals.list
OUTPUT_FILE marshals.h.tmp)
RESULT_VARIABLE result
OUTPUT_VARIABLE error
ERROR_VARIABLE error
OUTPUT_FILE marshals.h.tmp)
if(NOT result EQUAL 0)
MESSAGE(FATAL_ERROR ${ERROR_VARIABLE})
endif()
file(RENAME marshals.h.tmp marshals.h)
")
add_custom_command(OUTPUT marshals.h
@ -72,6 +78,8 @@ add_executable(medit WIN32
${MEDIT_SOURCES}
)
include_directories(${PROJECT_SOURCE_DIR}/moo/mooutils/moowin32/ms)
include_directories(
${PROJECT_BINARY_DIR}
${GTK_INCLUDE_DIRS}
@ -84,7 +92,7 @@ target_link_libraries(medit
${GMODULE_LIBRARIES}
${LIBXML2_LIBRARIES}
${XLIB_LIBRARIES}
${LIBM}
#${LIBM}
${moo_libadd}
${MEDIT_LIBS}
)

View File

@ -520,7 +520,7 @@ breakup_string (const char *string,
s = strstr (string, delimiter);
if (s)
{
guint delimiter_len = strlen (delimiter);
gsize delimiter_len = strlen (delimiter);
do
{

View File

@ -719,7 +719,7 @@ start_input (MooApp *app)
gboolean
moo_app_send_msg (const char *pid,
const char *data,
int len)
gssize len)
{
g_return_val_if_fail (data != NULL, FALSE);
return _moo_app_input_send_msg (pid, data, len);

View File

@ -83,7 +83,7 @@ void moo_app_set_ui_xml (MooApp *app,
gboolean moo_app_send_msg (const char *pid,
const char *data,
int len);
gssize len);
gboolean moo_app_send_files (MooOpenInfoArray *files,
guint32 stamp,

View File

@ -132,7 +132,7 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label9">
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="label" translatable="yes" comments="Part of the phrase &quot;Print line numbers&quot; &quot;every&quot; &quot;1&quot; &quot;lines&quot;">lines</property>
</widget>

View File

@ -586,7 +586,7 @@ do_load_text (MooEdit *edit,
g_string_append_c (strbuf, '\n');
}
gtk_text_buffer_insert_at_cursor (buffer, strbuf->str, strbuf->len);
gtk_text_buffer_insert_at_cursor (buffer, strbuf->str, (int) strbuf->len);
if (mixed_le)
le = MOO_LE_NATIVE;
@ -633,7 +633,7 @@ moo_edit_reload_local (MooEdit *edit,
*/
static char *
get_contents_with_fixed_line_end (GtkTextBuffer *buffer, const char *le, guint le_len)
get_contents_with_fixed_line_end (GtkTextBuffer *buffer, const char *le, gsize le_len)
{
GtkTextIter line_start;
GString *contents;

View File

@ -935,7 +935,7 @@ int
moo_edit_get_n_views (MooEdit *doc)
{
g_return_val_if_fail (MOO_IS_EDIT (doc), 0);
return moo_edit_view_array_get_size (doc->priv->views);
return (int) moo_edit_view_array_get_size (doc->priv->views);
}
/**
@ -1910,7 +1910,7 @@ _moo_edit_strip_whitespace (MooEdit *doc)
{
GtkTextIter end;
char *slice, *p;
int len;
gssize len;
if (gtk_text_iter_ends_line (&iter))
continue;

View File

@ -3275,7 +3275,7 @@ tab_icon_motion_notify (GtkWidget *evbox,
if (info->drag_started)
return TRUE;
if (gtk_drag_check_threshold (evbox, info->x, info->y, event->x, event->y))
if (gtk_drag_check_threshold (evbox, info->x, info->y, (int) event->x, (int) event->y))
{
info->drag_started = TRUE;
tab_icon_start_drag (evbox, (GdkEvent*) event, window);

View File

@ -305,7 +305,7 @@ lang_mgr_get_lang_for_bak_filename (MooLangMgr *mgr,
{
MooLang *lang = NULL;
char *base = NULL;
int len;
gsize len;
guint i;
static const char *bak_globs[] = {"*~", "*.bak", "*.in", "*.orig"};
@ -316,7 +316,7 @@ lang_mgr_get_lang_for_bak_filename (MooLangMgr *mgr,
for (i = 0; i < G_N_ELEMENTS (bak_globs); ++i)
{
int ext_len = strlen (bak_globs[i]) - 1;
gsize ext_len = strlen (bak_globs[i]) - 1;
if (len > ext_len && _moo_glob_match_simple (bak_globs[i], filename))
{

View File

@ -580,7 +580,7 @@ moo_text_buffer_insert_text (GtkTextBuffer *text_buffer,
return;
if (length < 0)
length = strlen (text);
length = (int) strlen (text);
start_offset = gtk_text_iter_get_offset (pos);
first_line = gtk_text_iter_get_line (pos);

View File

@ -654,7 +654,7 @@ create_ln_layout (MooPrintOperation *op,
op->priv->page.text_width = op->priv->page.width - op->priv->page.text_x;
pango_layout_set_alignment (op->priv->ln_layout, PANGO_ALIGN_RIGHT);
pango_layout_set_width (op->priv->ln_layout, op->priv->page.ln_margin);
pango_layout_set_width (op->priv->ln_layout, (int) op->priv->page.ln_margin);
if (freeme)
pango_font_description_free (freeme);
@ -958,12 +958,12 @@ moo_print_operation_begin_print (GtkPrintOperation *operation,
if (GET_OPTION (op, MOO_PRINT_WRAP))
{
pango_layout_set_width (op->priv->layout, op->priv->page.text_width * PANGO_SCALE);
pango_layout_set_width (op->priv->layout, (int) (op->priv->page.text_width * PANGO_SCALE));
pango_layout_set_wrap (op->priv->layout, settings->wrap_mode);
}
else if (GET_OPTION (op, MOO_PRINT_ELLIPSIZE))
{
pango_layout_set_width (op->priv->layout, op->priv->page.text_width * PANGO_SCALE);
pango_layout_set_width (op->priv->layout, (int) (op->priv->page.text_width * PANGO_SCALE));
pango_layout_set_ellipsize (op->priv->layout, PANGO_ELLIPSIZE_END);
}
@ -2087,14 +2087,14 @@ struct HFFormat {
static HFFormatChunk *
hf_format_chunk_new (HFFormatType type,
const char *string,
int len)
gssize len)
{
HFFormatChunk *chunk = g_slice_new0 (HFFormatChunk);
chunk->type = type;
if (string)
chunk->string = g_strndup (string, len >= 0 ? len : (int) strlen (string));
chunk->string = g_strndup (string, len >= 0 ? len : strlen (string));
return chunk;
}

View File

@ -217,7 +217,7 @@ find_last_match (GRegex *regex,
int *end_pos,
GMatchInfo **match_infop)
{
int len, start;
gssize len, start;
GMatchInfo *match_info = NULL;
*start_pos = -1;

View File

@ -502,7 +502,7 @@ static MooFold *
get_fold_at_mouse (GtkTextView *text_view,
GdkEventButton *event)
{
int line = left_window_to_line (text_view, event->y);
int line = left_window_to_line (text_view, (int) event->y);
MooTextBuffer *buffer = MOO_TEXT_BUFFER (gtk_text_view_get_buffer (text_view));
return moo_text_buffer_get_fold_at_line (buffer, line);
}
@ -555,7 +555,7 @@ left_window_click (GtkTextView *text_view,
if (view->priv->lm.show_icons && event->x >= 0 && event->x < view->priv->lm.icon_width)
{
gboolean ret;
int line = left_window_to_line (text_view, event->y);
int line = left_window_to_line (text_view, (int) event->y);
g_signal_emit_by_name (text_view, "line-mark-clicked", line, &ret);
return ret;
}
@ -664,7 +664,7 @@ event_button_to_buffer (GtkTextView *text_view,
{
gtk_text_view_window_to_buffer_coords (text_view,
gtk_text_view_get_window_type (text_view, event->window),
event->x, event->y, x, y);
(int) event->x, (int) event->y, x, y);
}
static void
@ -735,7 +735,7 @@ _moo_text_view_button_press_event (GtkWidget *widget,
}
else
{
int line = left_window_to_line (text_view, event->y);
int line = left_window_to_line (text_view, (int) event->y);
gtk_text_buffer_get_iter_at_line (buffer, &iter, line);
}

View File

@ -67,7 +67,7 @@ struct _MooFileEntryCompletionPrivate {
char *dirname;
char *display_dirname;
char *display_basename;
guint display_basename_len;
gsize display_basename_len;
char *real_text;
gboolean walking_list;
@ -510,7 +510,7 @@ completion_parse_text (MooFileEntryCompletion *cmpl,
GError *error = NULL;
MooFolder *folder;
gboolean result = FALSE;
guint text_len;
gsize text_len;
char *path = NULL, *dirname = NULL;
char *display_dirname = NULL, *display_basename = NULL;
@ -898,7 +898,7 @@ completion_list_button_press (MooFileEntryCompletion *cmpl,
GtkTreeIter iter;
if (gtk_tree_view_get_path_at_pos (cmpl->priv->treeview,
event->x, event->y,
(int) event->x, (int) event->y,
&path, NULL, NULL, NULL))
{
gtk_tree_model_get_iter (cmpl->priv->model, &iter, path);

View File

@ -1102,7 +1102,7 @@ normalize_path_win32 (G_GNUC_UNUSED MooFileSystem *fs,
if (isdir)
{
guint len = strlen (normpath);
gsize len = strlen (normpath);
if (!len || normpath[len -1] != '\\')
{

View File

@ -30,7 +30,7 @@ typedef struct TextFuncs {
const char *str);
gboolean (*file_has_prefix) (MooFile *file,
const char *str,
guint len);
gsize len);
char* (*normalize) (const char *str,
gssize len);
} TextFuncs;
@ -119,7 +119,7 @@ model_find_next_match (GtkTreeModel *model,
gboolean exact_match)
{
char *normalized_text;
guint normalized_text_len;
gsize normalized_text_len;
g_return_val_if_fail (text != NULL, FALSE);
@ -167,7 +167,7 @@ model_find_max_prefix (GtkTreeModel *model,
GtkTreeIter *unique_iter_p)
{
GtkTreeIter iter;
guint text_len;
gsize text_len;
GString *prefix = NULL;
gboolean unique = FALSE;

View File

@ -3560,7 +3560,7 @@ file_list_button_press (MooFileView *fileview,
if (event->button != 3)
return FALSE;
if (_moo_tree_view_get_path_at_pos (view, event->x, event->y, &filter_path))
if (_moo_tree_view_get_path_at_pos (view, (int) event->x, (int) event->y, &filter_path))
{
if (!_moo_tree_view_path_is_selected (view, filter_path))
{
@ -4937,7 +4937,7 @@ typeahead_find_match_visible (MooFileView *fileview,
GtkTreeIter *filter_iter,
gboolean exact_match)
{
guint len;
gsize len;
g_return_val_if_fail (text && text[0], FALSE);
@ -4959,7 +4959,7 @@ typeahead_find_match_hidden (MooFileView *fileview,
GtkTreeIter *iter,
gboolean exact)
{
guint len;
gsize len;
GtkTreeModel *model = fileview->priv->model;
g_return_val_if_fail (text && text[0], FALSE);

View File

@ -1774,7 +1774,7 @@ static void value_changed (MooIconView *view,
GtkAdjustment *adj)
{
if (adj->value != view->priv->xoffset)
moo_icon_view_scroll_to (view, adj->value);
moo_icon_view_scroll_to (view, (int) adj->value);
}
@ -1872,7 +1872,7 @@ moo_icon_view_button_press (GtkWidget *widget,
if (event->button == 1)
{
gtk_widget_grab_focus (widget);
_moo_icon_view_get_path_at_pos (view, event->x, event->y,
_moo_icon_view_get_path_at_pos (view, (int) event->x, (int) event->y,
&path, NULL, NULL, NULL);
switch (event->type)
@ -1912,8 +1912,8 @@ moo_icon_view_button_press (GtkWidget *widget,
/* this is later checked in maybe_drag */
view->priv->button_pressed = event->button;
view->priv->button_press_mods = mods;
view->priv->button_press_x = event->x + view->priv->xoffset;
view->priv->button_press_y = event->y;
view->priv->button_press_x = (int) event->x + view->priv->xoffset;
view->priv->button_press_y = (int) event->y;
return TRUE;
@ -2132,7 +2132,7 @@ moo_icon_view_drag_select (MooIconView *view,
gdk_region_union_with_rect (region, &rect);
gdk_window_invalidate_region (GTK_WIDGET (view)->window, region, TRUE);
drag_scroll_check (view, event->x, event->y);
drag_scroll_check (view, (int) event->x, (int) event->y);
rect_items_list = moo_icon_view_get_paths_in_rect (view, &rect);
new_selection = path_set_from_list (rect_items_list);
@ -3622,7 +3622,7 @@ moo_icon_view_maybe_drag (MooIconView *view,
if (!gtk_drag_check_threshold (GTK_WIDGET (view),
view->priv->button_press_x - view->priv->xoffset,
view->priv->button_press_y,
event->x, event->y))
(int) event->x, (int) event->y))
return FALSE;
button = view->priv->button_pressed;

View File

@ -704,7 +704,7 @@ _moo_accel_parse (const char *accel,
GdkModifierType *modifiers)
{
guint key = 0;
guint len;
gsize len;
GdkModifierType mods = (GdkModifierType) 0;
char *p;

View File

@ -228,7 +228,7 @@ moo_ipc_send (GObject *sender,
gssize len)
{
GString *header;
guint id_len;
gsize id_len;
g_return_if_fail (!sender || G_IS_OBJECT (sender));
g_return_if_fail (id != NULL);
@ -303,7 +303,7 @@ get_uint (const char *data,
if (!errno && !end[0] && val <= G_MAXUINT)
{
*dest = val;
*dest = (guint)val;
result = TRUE;
}

View File

@ -84,7 +84,7 @@ static const char *input_channel_get_name (InputChannel *ch);
static void
exec_callback (char cmd,
const char *data,
guint len)
gsize len)
{
g_return_if_fail (inp_instance && inp_instance->callback);
if (cmd == IPC_MAGIC_CHAR)
@ -1101,7 +1101,7 @@ write_data (HANDLE file,
{
DWORD bytes_written;
if (!WriteFile (file, data, len, &bytes_written, NULL))
if (!WriteFile (file, data, (DWORD) len, &bytes_written, NULL))
{
char *err_msg = g_win32_error_message (GetLastError ());
g_warning ("could not write data to '%s': %s", pipe_name, err_msg);

View File

@ -23,7 +23,7 @@ G_BEGIN_DECLS
typedef void (*MooAppInputCallback) (char cmd,
const char *data,
guint len,
gsize len,
gpointer cb_data);
void _moo_app_input_start (const char *name,

View File

@ -27,17 +27,17 @@ array_type##_foreach (const ArrayType *ar, \
ArrayType##Foreach func, \
gpointer data) \
{ \
guint i; \
gsize i; \
g_return_if_fail (ar != NULL && func != NULL); \
for (i = 0; i < ar->n_elms; ++i) \
func (ar->elms[i], data); \
} \
\
void array_type##_sort (ArrayType *ar, GCompareFunc func); \
int array_type##_find (const ArrayType *ar, ElmType *elm); \
gssize array_type##_find (const ArrayType *ar, ElmType *elm); \
void array_type##_remove (ArrayType *ar, ElmType *elm); \
void array_type##_clear (ArrayType *ar); \
guint array_type##_insert_sorted (ArrayType *ar, ElmType *elm, \
gsize array_type##_insert_sorted (ArrayType *ar, ElmType *elm, \
GCompareFunc func); \
\
G_INLINE_FUNC gboolean array_type##_is_empty (ArrayType *ar) \
@ -87,7 +87,7 @@ array_type##_append (ArrayType *ar, ElmType *elm) \
\
void array_type##_append_array (ArrayType *ar, ArrayType *ar2) \
{ \
guint i, old_size; \
gsize i, old_size; \
g_return_if_fail (ar != NULL && ar2 != NULL); \
if (!ar2->n_elms) \
return; \
@ -116,7 +116,7 @@ array_type##_copy (ArrayType *ar) \
\
if (ar->n_elms) \
{ \
guint i; \
gsize i; \
MOO_IP_ARRAY_GROW (ElmType*, copy, elms, ar->n_elms); \
for (i = 0; i < ar->n_elms; ++i) \
copy->elms[i] = copy_elm (ar->elms[i]); \
@ -127,7 +127,7 @@ array_type##_copy (ArrayType *ar) \
\
void array_type##_remove (ArrayType *ar, ElmType *elm) \
{ \
guint i; \
gsize i; \
\
g_return_if_fail (ar != NULL); \
\
@ -148,8 +148,8 @@ void array_type##_clear (ArrayType *ar) \
\
if (ar->n_elms) \
{ \
guint i; \
guint n_elms = ar->n_elms; \
gsize i; \
gsize n_elms = ar->n_elms; \
ElmType **elms = ar->elms; \
MOO_IP_ARRAY_INIT (ElmType*, ar, elms, 0); \
\
@ -184,9 +184,9 @@ array_type##_sort (ArrayType *ar, GCompareFunc func) \
func); \
} \
\
int array_type##_find (const ArrayType *ar, ElmType *elm) \
gssize array_type##_find (const ArrayType *ar, ElmType *elm) \
{ \
guint i; \
gsize i; \
g_return_val_if_fail (ar != NULL && elm != NULL, -1); \
for (i = 0; i < ar->n_elms; ++i) \
if (ar->elms[i] == elm) \

View File

@ -1031,7 +1031,7 @@ list_button_press (MooCombo *combo,
GtkTreeIter iter;
if (gtk_tree_view_get_path_at_pos (combo->priv->treeview,
event->x, event->y,
(int) event->x, (int) event->y,
&path, NULL, NULL, NULL))
{
gtk_tree_model_get_iter (combo->priv->model, &iter, path);

View File

@ -91,7 +91,7 @@ static void moo_entry_changed (GtkEditable *editable);
static void init_undo_actions (void);
static MooUndoAction *insert_action_new (GtkEditable *editable,
const gchar *text,
gint length,
gssize length,
gint *position);
static MooUndoAction *delete_action_new (GtkEditable *editable,
gint start_pos,
@ -629,7 +629,7 @@ moo_entry_do_insert_text (GtkEditable *editable,
gint *position)
{
if (length < 0)
length = strlen (text);
length = (int) strlen (text);
if (*position < 0)
*position = GTK_ENTRY(editable)->text_length;
@ -793,7 +793,7 @@ init_undo_actions (void)
static MooUndoAction *
insert_action_new (G_GNUC_UNUSED GtkEditable *editable,
const gchar *text,
gint length,
gssize length,
gint *position)
{
InsertAction *action;
@ -807,7 +807,7 @@ insert_action_new (G_GNUC_UNUSED GtkEditable *editable,
action->pos = *position;
action->text = g_strndup (text, length);
action->length = length;
action->length = (int) length;
action->chars = g_utf8_strlen (text, length);
return (MooUndoAction*) action;

View File

@ -988,7 +988,7 @@ moo_font_selection_size_activate (GtkWidget *w,
fontsel = MOO_FONT_SELECTION (data);
text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry));
new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
new_size = (gint) MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
if (fontsel->size != new_size)
moo_font_selection_set_size (fontsel, new_size);
@ -1003,7 +1003,7 @@ moo_font_selection_size_focus_out (MooFontSelection *fontsel)
const gchar *text;
text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry));
new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
new_size = (gint) MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
moo_font_selection_set_size (fontsel, new_size);

View File

@ -1821,11 +1821,19 @@ parse_property (GParamSpec *param_spec,
else
{
if (param_spec->value_type == G_TYPE_UINT)
g_value_set_uint (&param->value, val);
{
moo_assert (val <= G_MAXUINT);
g_value_set_uint (&param->value, (guint) val);
}
else if (param_spec->value_type == G_TYPE_ULONG)
g_value_set_ulong (&param->value, val);
{
moo_assert (val <= G_MAXULONG);
g_value_set_ulong (&param->value, (gulong) val);
}
else
{
g_value_set_uint64 (&param->value, val);
}
}
}
else if (param_spec->value_type == G_TYPE_FLOAT ||
@ -1842,7 +1850,7 @@ parse_property (GParamSpec *param_spec,
else
{
if (param_spec->value_type == G_TYPE_FLOAT)
g_value_set_float (&param->value, val);
g_value_set_float (&param->value, (float) val);
else
g_value_set_double (&param->value, val);
}

View File

@ -130,7 +130,7 @@ struct MooMarkupText {
MooMarkupDoc *doc; /* the containing document */
char *text; /* 0-terminated content of the node */
guint size; /* strlen (text) */
gsize size; /* strlen (text) */
};

View File

@ -2784,8 +2784,8 @@ tab_drag_start (MooNotebook *nb,
g_return_if_fail (nb->priv->button_pressed);
event_x = event->x;
event_y = event->y;
event_x = (int) event->x;
event_y = (int) event->y;
if (!translate_coords (nb->priv->tab_window, event->window, &event_x, &event_y))
{
@ -2830,8 +2830,8 @@ tab_drag_motion (MooNotebook *nb,
if (event)
{
event_x = event->x;
event_y = event->y;
event_x = (int) event->x;
event_y = (int) event->y;
if (!translate_coords (nb->priv->tab_window, event->window, &event_x, &event_y))
{
@ -2939,24 +2939,24 @@ moo_notebook_get_event_tab (MooNotebook *nb,
switch (event->type)
{
case GDK_MOTION_NOTIFY:
x = event->motion.x;
y = event->motion.y;
x = (int)event->motion.x;
y = (int)event->motion.y;
break;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
x = event->button.x;
y = event->button.y;
x = (int)event->button.x;
y = (int)event->button.y;
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
x = event->crossing.x;
y = event->crossing.y;
x = (int)event->crossing.x;
y = (int)event->crossing.y;
break;
case GDK_SCROLL:
x = event->scroll.x;
y = event->scroll.y;
x = (int)event->scroll.x;
y = (int)event->scroll.y;
break;
default:
g_return_val_if_reached (-1);
@ -2979,8 +2979,8 @@ moo_notebook_button_press (GtkWidget *widget,
MooNotebook *nb = MOO_NOTEBOOK (widget);
int x, y;
x = event->x;
y = event->y;
x = (int) event->x;
y = (int) event->y;
if (!translate_coords (nb->priv->tab_window, event->window, &x, &y))
return FALSE;
@ -3069,8 +3069,8 @@ moo_notebook_scroll_event (GtkWidget *widget,
MooNotebook *nb = MOO_NOTEBOOK (widget);
int x, y;
x = event->x;
y = event->y;
x = (int) event->x;
y = (int) event->y;
if (!translate_coords (nb->priv->tab_window, event->window, &x, &y))
return FALSE;
@ -3190,8 +3190,8 @@ popup_position_func (G_GNUC_UNUSED GtkMenu *menu,
if (data->event)
{
(*x) += data->event->x;
(*y) += data->event->y;
(*x) += (int) data->event->x;
(*y) += (int) data->event->y;
}
else
{

View File

@ -3100,8 +3100,8 @@ handle_motion (GtkWidget *widget,
if (!gtk_drag_check_threshold (widget,
paned->priv->handle_drag_start_x,
paned->priv->handle_drag_start_y,
event->x,
event->y))
(int) event->x,
(int) event->y))
return FALSE;
paned->priv->handle_in_drag = TRUE;

View File

@ -31,8 +31,6 @@ inline static int moo_stat (const char *filename, struct stat *buf)
/* _moo_check_stat_struct above checks that struct stat is okay,
cast to void* is to avoid using glib's internal _g_stat_struct */
return g_stat (filename, (struct _g_stat_struct*) buf);
#elif defined (_MSC_VER)
return g_stat (filename, (struct _stat32*) buf);
#else
return g_stat (filename, buf);
#endif
@ -44,8 +42,6 @@ inline static int moo_lstat (const char *filename, struct stat *buf)
/* _moo_check_stat_struct above checks that struct stat is okay,
cast to void* is to avoid using glib's internal _g_stat_struct */
return g_lstat (filename, (struct _g_stat_struct*) buf);
#elif defined (_MSC_VER)
return g_lstat (filename, (struct _stat32*) buf);
#else
return g_lstat (filename, buf);
#endif

View File

@ -1374,11 +1374,11 @@ glob_to_re (const char *pattern)
if (p[1] == '^')
{
g_string_append_c (string, '^');
escaped = g_regex_escape_string (p + 2, bracket - p - 2);
escaped = g_regex_escape_string (p + 2, (int) (bracket - p - 2));
}
else
{
escaped = g_regex_escape_string (p + 1, bracket - p - 1);
escaped = g_regex_escape_string (p + 1, (int) (bracket - p - 1));
}
g_string_append (string, escaped);
g_free (escaped);

View File

@ -66,7 +66,7 @@ G_STMT_START { \
if ((c_)->n_##name_ + howmuch_ > (c_)->n_##name_##_allocd__) \
{ \
gsize old_size__ = (c_)->n_##name_##_allocd__; \
gsize new_size__ = MAX(old_size__ * 1.2, \
gsize new_size__ = MAX((gsize) (old_size__ * 1.2), \
(c_)->n_##name_ + howmuch_); \
(c_)->name_ = (ElmType*) g_realloc ((c_)->name_, \
new_size__ * sizeof *(c_)->name_); \

View File

@ -1851,7 +1851,7 @@ void MOO_NORETURN _moo_errorv (MooCodeLoc loc, const char *format, va_list args)
*/
gboolean
_moo_regex_escape (const char *string,
int bytes,
gssize bytes,
GString *dest)
{
const char *p, *piece, *end;

View File

@ -207,7 +207,7 @@ guint _moo_io_add_watch_full (GIOChannel *channel,
gboolean _moo_regex_escape (const char *string,
int bytes,
gssize bytes,
GString *dest);
const char *moo_error_message (GError *error);

View File

@ -945,14 +945,14 @@ moo_expander_cell_get_size (GtkCellRenderer *cell,
if (x_offset)
{
float xalign = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
(1.0 - cell->xalign) : cell->xalign;
*x_offset = xalign * (cell_area->width - width);
(1.0f - cell->xalign) : cell->xalign;
*x_offset = (int) (xalign * (cell_area->width - width));
*x_offset = MAX (*x_offset, 0);
}
if (y_offset)
{
*y_offset = cell->yalign * (cell_area->height - height);
*y_offset = (int) (cell->yalign * (cell_area->height - height));
*y_offset = MAX (*y_offset, 0);
}
}
@ -1136,7 +1136,7 @@ tree_view_button_press (GtkTreeView *treeview,
goto out;
if (!gtk_tree_view_get_path_at_pos (treeview,
event->x, event->y,
(int) event->x, (int) event->y,
&path, &column,
&cell_x, &cell_y))
goto out;

View File

@ -0,0 +1,13 @@
#ifndef MOO_FNMATCH_H
#define MOO_FNMATCH_H
// #include "mooutils/mooutils-misc.h"
// #include "mooutils/mooutils-fs.h"
#define fnmatch _moo_win32_fnmatch
int _moo_win32_fnmatch (const char *pattern,
const char *string,
int flags);
#endif /* MOO_FNMATCH_H */

View File

@ -0,0 +1,11 @@
#ifndef MOO_NETINET_IN_H
#define MOO_NETINET_IN_H
#include <glib.h>
#define ntohl g_ntohl
#define ntohs g_ntohs
#define htonl g_htonl
#define htons g_htons
#endif /* MOO_NETINET_IN_H */

View File

@ -0,0 +1,22 @@
#ifndef MOO_SYS_MMAN_H
#define MOO_SYS_MMAN_H
#include <glib.h>
#define mmap _moo_win32_mmap
#define munmap _moo_win32_munmap
void *_moo_win32_mmap (gpointer start,
guint64 length,
int prot,
int flags,
int fd,
guint64 offset);
int _moo_win32_munmap (gpointer start,
gsize length);
#define PROT_READ 1
#define MAP_SHARED 1
#define MAP_FAILED ((gpointer) -1)
#endif /* MOO_SYS_MMAN_H */

View File

@ -2081,7 +2081,7 @@ treeview_button_press (GtkTreeView *treeview,
if (event->type != GDK_BUTTON_PRESS || event->button != 3)
return FALSE;
gtk_tree_view_get_path_at_pos (treeview, event->x, event->y,
gtk_tree_view_get_path_at_pos (treeview, (int) event->x, (int) event->y,
&path, NULL, &x, &y);
selection = gtk_tree_view_get_selection (treeview);

View File

@ -770,7 +770,7 @@ process_grep_line (MooLineView *view,
}
else
{
line_no = line_no_64 - 1;
line_no = (int) (line_no_64 - 1);
}
view_line = moo_line_view_start_line (view);
@ -908,7 +908,7 @@ append_grep_globs (GString *command,
}
else
{
guint len = strlen (*p);
gsize len = strlen (*p);
if ((*p)[len-1] == '/')
{

View File

@ -221,7 +221,7 @@ moo_line_view_button_release (GtkWidget *widget,
{
gtk_text_view_window_to_buffer_coords (textview,
GTK_TEXT_WINDOW_TEXT,
event->x, event->y,
(int) event->x, (int) event->y,
&buffer_x, &buffer_y);
/* XXX */
gtk_text_view_get_line_at_y (textview, &iter, buffer_y, NULL);
@ -473,7 +473,7 @@ moo_line_view_lookup_tag (MooLineView *view,
int
moo_line_view_write_line (MooLineView *view,
const char *text,
gssize len,
int len,
GtkTextTag *tag)
{
int line;
@ -563,7 +563,7 @@ moo_line_view_start_line (MooLineView *view)
void
moo_line_view_write (MooLineView *view,
const char *text,
gssize len,
int len,
GtkTextTag *tag)
{
GtkTextBuffer *buffer;

View File

@ -87,13 +87,13 @@ void moo_line_view_clear (MooLineView *view);
int moo_line_view_start_line (MooLineView *view);
void moo_line_view_write (MooLineView *view,
const char *text,
gssize len,
int len,
GtkTextTag *tag);
void moo_line_view_end_line (MooLineView *view);
int moo_line_view_write_line (MooLineView *view,
const char *text,
gssize len,
int len,
GtkTextTag *tag);
void moo_line_view_set_cursor (MooLineView *view,

View File

@ -466,7 +466,7 @@ process_line (MooOutputFilterRegex *filter,
FilterState *state,
OutputType type)
{
int start_pos;
gssize start_pos;
int match_start, match_end;
int line_no;
PatternInfo *pattern;

View File

@ -570,7 +570,7 @@ load_file (const char *filename,
MooCommandData *cmd_data;
MooCommandFactory *cmd_factory;
char **params;
guint suffix_len = 0;
gsize suffix_len = 0;
cmd_data = _moo_command_parse_file (filename, &cmd_factory, &params);
if (!cmd_data)