diff --git a/CMakeLists.txt b/CMakeLists.txt index d3120943..0a69d78d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/config.h.in b/config.h.in new file mode 100644 index 00000000..5fd35568 --- /dev/null +++ b/config.h.in @@ -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") diff --git a/moo/CMakeLists.txt b/moo/CMakeLists.txt index 62c1fd9d..7990e763 100644 --- a/moo/CMakeLists.txt +++ b/moo/CMakeLists.txt @@ -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} ) diff --git a/moo/gtksourceview/gtksourceiter.c b/moo/gtksourceview/gtksourceiter.c index 9a50d3a9..a29ffc88 100644 --- a/moo/gtksourceview/gtksourceiter.c +++ b/moo/gtksourceview/gtksourceiter.c @@ -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 { diff --git a/moo/mooapp/mooapp.c b/moo/mooapp/mooapp.c index 7bfa2aef..19fb6ff0 100644 --- a/moo/mooapp/mooapp.c +++ b/moo/mooapp/mooapp.c @@ -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); diff --git a/moo/mooapp/mooapp.h b/moo/mooapp/mooapp.h index 2a1904f0..4c9811fe 100644 --- a/moo/mooapp/mooapp.h +++ b/moo/mooapp/mooapp.h @@ -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, diff --git a/moo/mooedit/glade/mooprint.glade b/moo/mooedit/glade/mooprint.glade index 78351874..7eadb5f1 100644 --- a/moo/mooedit/glade/mooprint.glade +++ b/moo/mooedit/glade/mooprint.glade @@ -132,7 +132,7 @@ - + True lines diff --git a/moo/mooedit/mooedit-fileops.c b/moo/mooedit/mooedit-fileops.c index d0087ec7..a255b8fb 100644 --- a/moo/mooedit/mooedit-fileops.c +++ b/moo/mooedit/mooedit-fileops.c @@ -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; diff --git a/moo/mooedit/mooedit.c b/moo/mooedit/mooedit.c index 571288a4..924dacae 100644 --- a/moo/mooedit/mooedit.c +++ b/moo/mooedit/mooedit.c @@ -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; diff --git a/moo/mooedit/mooeditwindow.c b/moo/mooedit/mooeditwindow.c index 40755c5c..edc182a2 100644 --- a/moo/mooedit/mooeditwindow.c +++ b/moo/mooedit/mooeditwindow.c @@ -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); diff --git a/moo/mooedit/moolangmgr.c b/moo/mooedit/moolangmgr.c index 94de273b..9b8047bb 100644 --- a/moo/mooedit/moolangmgr.c +++ b/moo/mooedit/moolangmgr.c @@ -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)) { diff --git a/moo/mooedit/mootextbuffer.c b/moo/mooedit/mootextbuffer.c index bc80f92e..aa11cb16 100644 --- a/moo/mooedit/mootextbuffer.c +++ b/moo/mooedit/mootextbuffer.c @@ -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); diff --git a/moo/mooedit/mootextprint.c b/moo/mooedit/mootextprint.c index 20850be0..31c19b49 100644 --- a/moo/mooedit/mootextprint.c +++ b/moo/mooedit/mootextprint.c @@ -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; } diff --git a/moo/mooedit/mootextsearch.c b/moo/mooedit/mootextsearch.c index 9a841267..08094574 100644 --- a/moo/mooedit/mootextsearch.c +++ b/moo/mooedit/mootextsearch.c @@ -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; diff --git a/moo/mooedit/mootextview-input.c b/moo/mooedit/mootextview-input.c index 7b443517..6f666b93 100644 --- a/moo/mooedit/mootextview-input.c +++ b/moo/mooedit/mootextview-input.c @@ -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); } diff --git a/moo/moofileview/moofileentry.c b/moo/moofileview/moofileentry.c index 803276ae..ac583f5e 100644 --- a/moo/moofileview/moofileentry.c +++ b/moo/moofileview/moofileentry.c @@ -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); diff --git a/moo/moofileview/moofilesystem.c b/moo/moofileview/moofilesystem.c index 694ae03e..93914f13 100644 --- a/moo/moofileview/moofilesystem.c +++ b/moo/moofileview/moofilesystem.c @@ -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] != '\\') { diff --git a/moo/moofileview/moofileview-aux.h b/moo/moofileview/moofileview-aux.h index 3da5a806..64fa0e4d 100644 --- a/moo/moofileview/moofileview-aux.h +++ b/moo/moofileview/moofileview-aux.h @@ -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; diff --git a/moo/moofileview/moofileview.c b/moo/moofileview/moofileview.c index fa067a49..f96137e4 100644 --- a/moo/moofileview/moofileview.c +++ b/moo/moofileview/moofileview.c @@ -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); diff --git a/moo/moofileview/mooiconview.c b/moo/moofileview/mooiconview.c index 9ea2593e..97fd5683 100644 --- a/moo/moofileview/mooiconview.c +++ b/moo/moofileview/mooiconview.c @@ -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; diff --git a/moo/mooutils/mooaccel.c b/moo/mooutils/mooaccel.c index 8025b060..42626476 100644 --- a/moo/mooutils/mooaccel.c +++ b/moo/mooutils/mooaccel.c @@ -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; diff --git a/moo/mooutils/mooapp-ipc.c b/moo/mooutils/mooapp-ipc.c index 14ab417e..b766819b 100644 --- a/moo/mooutils/mooapp-ipc.c +++ b/moo/mooutils/mooapp-ipc.c @@ -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; } diff --git a/moo/mooutils/mooappinput.c b/moo/mooutils/mooappinput.c index d2a0aa68..1709261c 100644 --- a/moo/mooutils/mooappinput.c +++ b/moo/mooutils/mooappinput.c @@ -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); diff --git a/moo/mooutils/mooappinput.h b/moo/mooutils/mooappinput.h index 5fab794b..f83d3620 100644 --- a/moo/mooutils/mooappinput.h +++ b/moo/mooutils/mooappinput.h @@ -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, diff --git a/moo/mooutils/mooarray.h b/moo/mooutils/mooarray.h index 3ae6a4df..97cbbe6a 100644 --- a/moo/mooutils/mooarray.h +++ b/moo/mooutils/mooarray.h @@ -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) \ diff --git a/moo/mooutils/moocombo.c b/moo/mooutils/moocombo.c index 7211a435..a6d71cc6 100644 --- a/moo/mooutils/moocombo.c +++ b/moo/mooutils/moocombo.c @@ -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); diff --git a/moo/mooutils/mooentry.c b/moo/mooutils/mooentry.c index 37a4fa62..7af9e2a6 100644 --- a/moo/mooutils/mooentry.c +++ b/moo/mooutils/mooentry.c @@ -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; diff --git a/moo/mooutils/moofontsel.c b/moo/mooutils/moofontsel.c index 9f509df6..34d99729 100644 --- a/moo/mooutils/moofontsel.c +++ b/moo/mooutils/moofontsel.c @@ -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); diff --git a/moo/mooutils/mooglade.c b/moo/mooutils/mooglade.c index a7860dcc..12ef3853 100644 --- a/moo/mooutils/mooglade.c +++ b/moo/mooutils/mooglade.c @@ -1821,11 +1821,19 @@ parse_property (GParamSpec *param_spec, else { if (param_spec->value_type == G_TYPE_UINT) - g_value_set_uint (¶m->value, val); + { + moo_assert (val <= G_MAXUINT); + g_value_set_uint (¶m->value, (guint) val); + } else if (param_spec->value_type == G_TYPE_ULONG) - g_value_set_ulong (¶m->value, val); + { + moo_assert (val <= G_MAXULONG); + g_value_set_ulong (¶m->value, (gulong) val); + } else + { g_value_set_uint64 (¶m->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 (¶m->value, val); + g_value_set_float (¶m->value, (float) val); else g_value_set_double (¶m->value, val); } diff --git a/moo/mooutils/moomarkup.h b/moo/mooutils/moomarkup.h index 82d76db9..cba514cd 100644 --- a/moo/mooutils/moomarkup.h +++ b/moo/mooutils/moomarkup.h @@ -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) */ }; diff --git a/moo/mooutils/moonotebook.c b/moo/mooutils/moonotebook.c index a2b2e421..d7aa2e94 100644 --- a/moo/mooutils/moonotebook.c +++ b/moo/mooutils/moonotebook.c @@ -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 { diff --git a/moo/mooutils/moopaned.c b/moo/mooutils/moopaned.c index 64369c9f..5d6730ae 100644 --- a/moo/mooutils/moopaned.c +++ b/moo/mooutils/moopaned.c @@ -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; diff --git a/moo/mooutils/moostat.h b/moo/mooutils/moostat.h index 180ca89c..a1b111a8 100644 --- a/moo/mooutils/moostat.h +++ b/moo/mooutils/moostat.h @@ -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 diff --git a/moo/mooutils/mooutils-fs.c b/moo/mooutils/mooutils-fs.c index f0907e73..0f383b94 100644 --- a/moo/mooutils/mooutils-fs.c +++ b/moo/mooutils/mooutils-fs.c @@ -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); diff --git a/moo/mooutils/mooutils-mem.h b/moo/mooutils/mooutils-mem.h index 0455cc95..e64fe1a6 100644 --- a/moo/mooutils/mooutils-mem.h +++ b/moo/mooutils/mooutils-mem.h @@ -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_); \ diff --git a/moo/mooutils/mooutils-misc.c b/moo/mooutils/mooutils-misc.c index d66cc76d..f6a71553 100644 --- a/moo/mooutils/mooutils-misc.c +++ b/moo/mooutils/mooutils-misc.c @@ -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; diff --git a/moo/mooutils/mooutils-misc.h b/moo/mooutils/mooutils-misc.h index 961dd6e7..47831977 100644 --- a/moo/mooutils/mooutils-misc.h +++ b/moo/mooutils/mooutils-misc.h @@ -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); diff --git a/moo/mooutils/mooutils-treeview.c b/moo/mooutils/mooutils-treeview.c index 1dff8581..57c2c466 100644 --- a/moo/mooutils/mooutils-treeview.c +++ b/moo/mooutils/mooutils-treeview.c @@ -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; diff --git a/moo/mooutils/moowin32/ms/fnmatch.h b/moo/mooutils/moowin32/ms/fnmatch.h new file mode 100644 index 00000000..ce218300 --- /dev/null +++ b/moo/mooutils/moowin32/ms/fnmatch.h @@ -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 */ diff --git a/moo/mooutils/moowin32/ms/netinet/in.h b/moo/mooutils/moowin32/ms/netinet/in.h new file mode 100644 index 00000000..6a00e0c9 --- /dev/null +++ b/moo/mooutils/moowin32/ms/netinet/in.h @@ -0,0 +1,11 @@ +#ifndef MOO_NETINET_IN_H +#define MOO_NETINET_IN_H + +#include + +#define ntohl g_ntohl +#define ntohs g_ntohs +#define htonl g_htonl +#define htons g_htons + +#endif /* MOO_NETINET_IN_H */ diff --git a/moo/mooutils/moowin32/ms/sys/mman.h b/moo/mooutils/moowin32/ms/sys/mman.h new file mode 100644 index 00000000..27528a52 --- /dev/null +++ b/moo/mooutils/moowin32/ms/sys/mman.h @@ -0,0 +1,22 @@ +#ifndef MOO_SYS_MMAN_H +#define MOO_SYS_MMAN_H + +#include + +#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 */ diff --git a/moo/plugins/moofilelist.c b/moo/plugins/moofilelist.c index afd23580..0884925f 100644 --- a/moo/plugins/moofilelist.c +++ b/moo/plugins/moofilelist.c @@ -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); diff --git a/moo/plugins/moofind.c b/moo/plugins/moofind.c index e4f7f4b8..f891e67d 100644 --- a/moo/plugins/moofind.c +++ b/moo/plugins/moofind.c @@ -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] == '/') { diff --git a/moo/plugins/support/moolineview.c b/moo/plugins/support/moolineview.c index 5afa0c76..ed2138e2 100644 --- a/moo/plugins/support/moolineview.c +++ b/moo/plugins/support/moolineview.c @@ -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; diff --git a/moo/plugins/support/moolineview.h b/moo/plugins/support/moolineview.h index 7997186f..abfd42f2 100644 --- a/moo/plugins/support/moolineview.h +++ b/moo/plugins/support/moolineview.h @@ -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, diff --git a/moo/plugins/usertools/moooutputfilterregex.c b/moo/plugins/usertools/moooutputfilterregex.c index 235ddf84..6975e67c 100644 --- a/moo/plugins/usertools/moooutputfilterregex.c +++ b/moo/plugins/usertools/moooutputfilterregex.c @@ -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; diff --git a/moo/plugins/usertools/moousertools.c b/moo/plugins/usertools/moousertools.c index b7aa1cc3..9f643487 100644 --- a/moo/plugins/usertools/moousertools.c +++ b/moo/plugins/usertools/moousertools.c @@ -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, ¶ms); if (!cmd_data)