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) pkg_check_modules(LIBXML2 REQUIRED libxml-2.0)
find_library(LIBM m) #find_library(LIBM m)
find_package(Gettext REQUIRED) find_package(Gettext REQUIRED)
SET(GETTEXT_PACKAGE "${MOO_PACKAGE_NAME}") 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) 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\") 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 # zzz SUBDIRS = po po-gsv api doc moo
add_subdirectory(api) #add_subdirectory(api)
add_subdirectory(moo) 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 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/genmarshals_h.cmake
"EXECUTE_PROCESS(COMMAND ${GLIB_GENMARSHAL} --prefix=_moo_marshal --header ${CMAKE_CURRENT_SOURCE_DIR}/marshals.list "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) file(RENAME marshals.h.tmp marshals.h)
") ")
add_custom_command(OUTPUT marshals.h add_custom_command(OUTPUT marshals.h
@ -72,6 +78,8 @@ add_executable(medit WIN32
${MEDIT_SOURCES} ${MEDIT_SOURCES}
) )
include_directories(${PROJECT_SOURCE_DIR}/moo/mooutils/moowin32/ms)
include_directories( include_directories(
${PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR}
${GTK_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS}
@ -84,7 +92,7 @@ target_link_libraries(medit
${GMODULE_LIBRARIES} ${GMODULE_LIBRARIES}
${LIBXML2_LIBRARIES} ${LIBXML2_LIBRARIES}
${XLIB_LIBRARIES} ${XLIB_LIBRARIES}
${LIBM} #${LIBM}
${moo_libadd} ${moo_libadd}
${MEDIT_LIBS} ${MEDIT_LIBS}
) )

View File

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

View File

@ -719,7 +719,7 @@ start_input (MooApp *app)
gboolean gboolean
moo_app_send_msg (const char *pid, moo_app_send_msg (const char *pid,
const char *data, const char *data,
int len) gssize len)
{ {
g_return_val_if_fail (data != NULL, FALSE); g_return_val_if_fail (data != NULL, FALSE);
return _moo_app_input_send_msg (pid, data, len); 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, gboolean moo_app_send_msg (const char *pid,
const char *data, const char *data,
int len); gssize len);
gboolean moo_app_send_files (MooOpenInfoArray *files, gboolean moo_app_send_files (MooOpenInfoArray *files,
guint32 stamp, guint32 stamp,

View File

@ -132,7 +132,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="label9"> <widget class="GtkLabel" id="label9">
<property name="visible">True</property> <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> <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> </widget>

View File

@ -586,7 +586,7 @@ do_load_text (MooEdit *edit,
g_string_append_c (strbuf, '\n'); 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) if (mixed_le)
le = MOO_LE_NATIVE; le = MOO_LE_NATIVE;
@ -633,7 +633,7 @@ moo_edit_reload_local (MooEdit *edit,
*/ */
static char * 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; GtkTextIter line_start;
GString *contents; GString *contents;

View File

@ -935,7 +935,7 @@ int
moo_edit_get_n_views (MooEdit *doc) moo_edit_get_n_views (MooEdit *doc)
{ {
g_return_val_if_fail (MOO_IS_EDIT (doc), 0); 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; GtkTextIter end;
char *slice, *p; char *slice, *p;
int len; gssize len;
if (gtk_text_iter_ends_line (&iter)) if (gtk_text_iter_ends_line (&iter))
continue; continue;

View File

@ -3275,7 +3275,7 @@ tab_icon_motion_notify (GtkWidget *evbox,
if (info->drag_started) if (info->drag_started)
return TRUE; 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; info->drag_started = TRUE;
tab_icon_start_drag (evbox, (GdkEvent*) event, window); 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; MooLang *lang = NULL;
char *base = NULL; char *base = NULL;
int len; gsize len;
guint i; guint i;
static const char *bak_globs[] = {"*~", "*.bak", "*.in", "*.orig"}; 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) 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)) 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; return;
if (length < 0) if (length < 0)
length = strlen (text); length = (int) strlen (text);
start_offset = gtk_text_iter_get_offset (pos); start_offset = gtk_text_iter_get_offset (pos);
first_line = gtk_text_iter_get_line (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; 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_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) if (freeme)
pango_font_description_free (freeme); pango_font_description_free (freeme);
@ -958,12 +958,12 @@ moo_print_operation_begin_print (GtkPrintOperation *operation,
if (GET_OPTION (op, MOO_PRINT_WRAP)) 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); pango_layout_set_wrap (op->priv->layout, settings->wrap_mode);
} }
else if (GET_OPTION (op, MOO_PRINT_ELLIPSIZE)) 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); pango_layout_set_ellipsize (op->priv->layout, PANGO_ELLIPSIZE_END);
} }
@ -2087,14 +2087,14 @@ struct HFFormat {
static HFFormatChunk * static HFFormatChunk *
hf_format_chunk_new (HFFormatType type, hf_format_chunk_new (HFFormatType type,
const char *string, const char *string,
int len) gssize len)
{ {
HFFormatChunk *chunk = g_slice_new0 (HFFormatChunk); HFFormatChunk *chunk = g_slice_new0 (HFFormatChunk);
chunk->type = type; chunk->type = type;
if (string) 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; return chunk;
} }

View File

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

View File

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

View File

@ -67,7 +67,7 @@ struct _MooFileEntryCompletionPrivate {
char *dirname; char *dirname;
char *display_dirname; char *display_dirname;
char *display_basename; char *display_basename;
guint display_basename_len; gsize display_basename_len;
char *real_text; char *real_text;
gboolean walking_list; gboolean walking_list;
@ -510,7 +510,7 @@ completion_parse_text (MooFileEntryCompletion *cmpl,
GError *error = NULL; GError *error = NULL;
MooFolder *folder; MooFolder *folder;
gboolean result = FALSE; gboolean result = FALSE;
guint text_len; gsize text_len;
char *path = NULL, *dirname = NULL; char *path = NULL, *dirname = NULL;
char *display_dirname = NULL, *display_basename = NULL; char *display_dirname = NULL, *display_basename = NULL;
@ -898,7 +898,7 @@ completion_list_button_press (MooFileEntryCompletion *cmpl,
GtkTreeIter iter; GtkTreeIter iter;
if (gtk_tree_view_get_path_at_pos (cmpl->priv->treeview, 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)) &path, NULL, NULL, NULL))
{ {
gtk_tree_model_get_iter (cmpl->priv->model, &iter, path); 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) if (isdir)
{ {
guint len = strlen (normpath); gsize len = strlen (normpath);
if (!len || normpath[len -1] != '\\') if (!len || normpath[len -1] != '\\')
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -84,7 +84,7 @@ static const char *input_channel_get_name (InputChannel *ch);
static void static void
exec_callback (char cmd, exec_callback (char cmd,
const char *data, const char *data,
guint len) gsize len)
{ {
g_return_if_fail (inp_instance && inp_instance->callback); g_return_if_fail (inp_instance && inp_instance->callback);
if (cmd == IPC_MAGIC_CHAR) if (cmd == IPC_MAGIC_CHAR)
@ -1101,7 +1101,7 @@ write_data (HANDLE file,
{ {
DWORD bytes_written; 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 ()); char *err_msg = g_win32_error_message (GetLastError ());
g_warning ("could not write data to '%s': %s", pipe_name, err_msg); 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, typedef void (*MooAppInputCallback) (char cmd,
const char *data, const char *data,
guint len, gsize len,
gpointer cb_data); gpointer cb_data);
void _moo_app_input_start (const char *name, void _moo_app_input_start (const char *name,

View File

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

View File

@ -1031,7 +1031,7 @@ list_button_press (MooCombo *combo,
GtkTreeIter iter; GtkTreeIter iter;
if (gtk_tree_view_get_path_at_pos (combo->priv->treeview, 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)) &path, NULL, NULL, NULL))
{ {
gtk_tree_model_get_iter (combo->priv->model, &iter, path); 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 void init_undo_actions (void);
static MooUndoAction *insert_action_new (GtkEditable *editable, static MooUndoAction *insert_action_new (GtkEditable *editable,
const gchar *text, const gchar *text,
gint length, gssize length,
gint *position); gint *position);
static MooUndoAction *delete_action_new (GtkEditable *editable, static MooUndoAction *delete_action_new (GtkEditable *editable,
gint start_pos, gint start_pos,
@ -629,7 +629,7 @@ moo_entry_do_insert_text (GtkEditable *editable,
gint *position) gint *position)
{ {
if (length < 0) if (length < 0)
length = strlen (text); length = (int) strlen (text);
if (*position < 0) if (*position < 0)
*position = GTK_ENTRY(editable)->text_length; *position = GTK_ENTRY(editable)->text_length;
@ -793,7 +793,7 @@ init_undo_actions (void)
static MooUndoAction * static MooUndoAction *
insert_action_new (G_GNUC_UNUSED GtkEditable *editable, insert_action_new (G_GNUC_UNUSED GtkEditable *editable,
const gchar *text, const gchar *text,
gint length, gssize length,
gint *position) gint *position)
{ {
InsertAction *action; InsertAction *action;
@ -807,7 +807,7 @@ insert_action_new (G_GNUC_UNUSED GtkEditable *editable,
action->pos = *position; action->pos = *position;
action->text = g_strndup (text, length); action->text = g_strndup (text, length);
action->length = length; action->length = (int) length;
action->chars = g_utf8_strlen (text, length); action->chars = g_utf8_strlen (text, length);
return (MooUndoAction*) action; return (MooUndoAction*) action;

View File

@ -988,7 +988,7 @@ moo_font_selection_size_activate (GtkWidget *w,
fontsel = MOO_FONT_SELECTION (data); fontsel = MOO_FONT_SELECTION (data);
text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry)); 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) if (fontsel->size != new_size)
moo_font_selection_set_size (fontsel, 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; const gchar *text;
text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry)); 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); moo_font_selection_set_size (fontsel, new_size);

View File

@ -1821,11 +1821,19 @@ parse_property (GParamSpec *param_spec,
else else
{ {
if (param_spec->value_type == G_TYPE_UINT) 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) 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 else
{
g_value_set_uint64 (&param->value, val); g_value_set_uint64 (&param->value, val);
}
} }
} }
else if (param_spec->value_type == G_TYPE_FLOAT || else if (param_spec->value_type == G_TYPE_FLOAT ||
@ -1842,7 +1850,7 @@ parse_property (GParamSpec *param_spec,
else else
{ {
if (param_spec->value_type == G_TYPE_FLOAT) if (param_spec->value_type == G_TYPE_FLOAT)
g_value_set_float (&param->value, val); g_value_set_float (&param->value, (float) val);
else else
g_value_set_double (&param->value, val); g_value_set_double (&param->value, val);
} }

View File

@ -130,7 +130,7 @@ struct MooMarkupText {
MooMarkupDoc *doc; /* the containing document */ MooMarkupDoc *doc; /* the containing document */
char *text; /* 0-terminated content of the node */ 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); g_return_if_fail (nb->priv->button_pressed);
event_x = event->x; event_x = (int) event->x;
event_y = event->y; event_y = (int) event->y;
if (!translate_coords (nb->priv->tab_window, event->window, &event_x, &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) if (event)
{ {
event_x = event->x; event_x = (int) event->x;
event_y = event->y; event_y = (int) event->y;
if (!translate_coords (nb->priv->tab_window, event->window, &event_x, &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) switch (event->type)
{ {
case GDK_MOTION_NOTIFY: case GDK_MOTION_NOTIFY:
x = event->motion.x; x = (int)event->motion.x;
y = event->motion.y; y = (int)event->motion.y;
break; break;
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS: case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS: case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:
x = event->button.x; x = (int)event->button.x;
y = event->button.y; y = (int)event->button.y;
break; break;
case GDK_ENTER_NOTIFY: case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY: case GDK_LEAVE_NOTIFY:
x = event->crossing.x; x = (int)event->crossing.x;
y = event->crossing.y; y = (int)event->crossing.y;
break; break;
case GDK_SCROLL: case GDK_SCROLL:
x = event->scroll.x; x = (int)event->scroll.x;
y = event->scroll.y; y = (int)event->scroll.y;
break; break;
default: default:
g_return_val_if_reached (-1); g_return_val_if_reached (-1);
@ -2979,8 +2979,8 @@ moo_notebook_button_press (GtkWidget *widget,
MooNotebook *nb = MOO_NOTEBOOK (widget); MooNotebook *nb = MOO_NOTEBOOK (widget);
int x, y; int x, y;
x = event->x; x = (int) event->x;
y = event->y; y = (int) event->y;
if (!translate_coords (nb->priv->tab_window, event->window, &x, &y)) if (!translate_coords (nb->priv->tab_window, event->window, &x, &y))
return FALSE; return FALSE;
@ -3069,8 +3069,8 @@ moo_notebook_scroll_event (GtkWidget *widget,
MooNotebook *nb = MOO_NOTEBOOK (widget); MooNotebook *nb = MOO_NOTEBOOK (widget);
int x, y; int x, y;
x = event->x; x = (int) event->x;
y = event->y; y = (int) event->y;
if (!translate_coords (nb->priv->tab_window, event->window, &x, &y)) if (!translate_coords (nb->priv->tab_window, event->window, &x, &y))
return FALSE; return FALSE;
@ -3190,8 +3190,8 @@ popup_position_func (G_GNUC_UNUSED GtkMenu *menu,
if (data->event) if (data->event)
{ {
(*x) += data->event->x; (*x) += (int) data->event->x;
(*y) += data->event->y; (*y) += (int) data->event->y;
} }
else else
{ {

View File

@ -3100,8 +3100,8 @@ handle_motion (GtkWidget *widget,
if (!gtk_drag_check_threshold (widget, if (!gtk_drag_check_threshold (widget,
paned->priv->handle_drag_start_x, paned->priv->handle_drag_start_x,
paned->priv->handle_drag_start_y, paned->priv->handle_drag_start_y,
event->x, (int) event->x,
event->y)) (int) event->y))
return FALSE; return FALSE;
paned->priv->handle_in_drag = TRUE; 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, /* _moo_check_stat_struct above checks that struct stat is okay,
cast to void* is to avoid using glib's internal _g_stat_struct */ cast to void* is to avoid using glib's internal _g_stat_struct */
return g_stat (filename, (struct _g_stat_struct*) buf); return g_stat (filename, (struct _g_stat_struct*) buf);
#elif defined (_MSC_VER)
return g_stat (filename, (struct _stat32*) buf);
#else #else
return g_stat (filename, buf); return g_stat (filename, buf);
#endif #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, /* _moo_check_stat_struct above checks that struct stat is okay,
cast to void* is to avoid using glib's internal _g_stat_struct */ cast to void* is to avoid using glib's internal _g_stat_struct */
return g_lstat (filename, (struct _g_stat_struct*) buf); return g_lstat (filename, (struct _g_stat_struct*) buf);
#elif defined (_MSC_VER)
return g_lstat (filename, (struct _stat32*) buf);
#else #else
return g_lstat (filename, buf); return g_lstat (filename, buf);
#endif #endif

View File

@ -1374,11 +1374,11 @@ glob_to_re (const char *pattern)
if (p[1] == '^') if (p[1] == '^')
{ {
g_string_append_c (string, '^'); 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 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_string_append (string, escaped);
g_free (escaped); g_free (escaped);

View File

@ -66,7 +66,7 @@ G_STMT_START { \
if ((c_)->n_##name_ + howmuch_ > (c_)->n_##name_##_allocd__) \ if ((c_)->n_##name_ + howmuch_ > (c_)->n_##name_##_allocd__) \
{ \ { \
gsize old_size__ = (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_)->n_##name_ + howmuch_); \
(c_)->name_ = (ElmType*) g_realloc ((c_)->name_, \ (c_)->name_ = (ElmType*) g_realloc ((c_)->name_, \
new_size__ * sizeof *(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 gboolean
_moo_regex_escape (const char *string, _moo_regex_escape (const char *string,
int bytes, gssize bytes,
GString *dest) GString *dest)
{ {
const char *p, *piece, *end; 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, gboolean _moo_regex_escape (const char *string,
int bytes, gssize bytes,
GString *dest); GString *dest);
const char *moo_error_message (GError *error); const char *moo_error_message (GError *error);

View File

@ -945,14 +945,14 @@ moo_expander_cell_get_size (GtkCellRenderer *cell,
if (x_offset) if (x_offset)
{ {
float xalign = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? float xalign = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
(1.0 - cell->xalign) : cell->xalign; (1.0f - cell->xalign) : cell->xalign;
*x_offset = xalign * (cell_area->width - width); *x_offset = (int) (xalign * (cell_area->width - width));
*x_offset = MAX (*x_offset, 0); *x_offset = MAX (*x_offset, 0);
} }
if (y_offset) 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); *y_offset = MAX (*y_offset, 0);
} }
} }
@ -1136,7 +1136,7 @@ tree_view_button_press (GtkTreeView *treeview,
goto out; goto out;
if (!gtk_tree_view_get_path_at_pos (treeview, if (!gtk_tree_view_get_path_at_pos (treeview,
event->x, event->y, (int) event->x, (int) event->y,
&path, &column, &path, &column,
&cell_x, &cell_y)) &cell_x, &cell_y))
goto out; 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) if (event->type != GDK_BUTTON_PRESS || event->button != 3)
return FALSE; 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); &path, NULL, &x, &y);
selection = gtk_tree_view_get_selection (treeview); selection = gtk_tree_view_get_selection (treeview);

View File

@ -770,7 +770,7 @@ process_grep_line (MooLineView *view,
} }
else else
{ {
line_no = line_no_64 - 1; line_no = (int) (line_no_64 - 1);
} }
view_line = moo_line_view_start_line (view); view_line = moo_line_view_start_line (view);
@ -908,7 +908,7 @@ append_grep_globs (GString *command,
} }
else else
{ {
guint len = strlen (*p); gsize len = strlen (*p);
if ((*p)[len-1] == '/') 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_view_window_to_buffer_coords (textview,
GTK_TEXT_WINDOW_TEXT, GTK_TEXT_WINDOW_TEXT,
event->x, event->y, (int) event->x, (int) event->y,
&buffer_x, &buffer_y); &buffer_x, &buffer_y);
/* XXX */ /* XXX */
gtk_text_view_get_line_at_y (textview, &iter, buffer_y, NULL); gtk_text_view_get_line_at_y (textview, &iter, buffer_y, NULL);
@ -473,7 +473,7 @@ moo_line_view_lookup_tag (MooLineView *view,
int int
moo_line_view_write_line (MooLineView *view, moo_line_view_write_line (MooLineView *view,
const char *text, const char *text,
gssize len, int len,
GtkTextTag *tag) GtkTextTag *tag)
{ {
int line; int line;
@ -563,7 +563,7 @@ moo_line_view_start_line (MooLineView *view)
void void
moo_line_view_write (MooLineView *view, moo_line_view_write (MooLineView *view,
const char *text, const char *text,
gssize len, int len,
GtkTextTag *tag) GtkTextTag *tag)
{ {
GtkTextBuffer *buffer; GtkTextBuffer *buffer;

View File

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

View File

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

View File

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