1. I don't know how should be this function(Function is more complicated, bun not so much to use regexs): static gunichar *package_rel_path(const gunichar *package) G_GNU_MALLOC { gunichar *ret; gsize iter;
ret = /* what here? */; if(!package) return NULL; iter = 0; do { if(package[iter] == 'a') ret[iter] = 'A'; else ret[iter] = package[iter]; } while(package[++iter[) return ret; } or static gchar *package_rel_path(const gchar *package) G_GNU_MALLOC { gchar *ret; gchar *ret_iter; ret_iter = ret = g_malloc0(strlen(package)); do { gunichar c; c = g_utf8_get_char(package); if(package[iter] == 'a') ret[iter] = 'A'; else ret[iter[ = /* What's here? */; } while(*(ret_iter = g_utf8_next_char(ret_iter)) && *(package = g_utf8_next_char(package)); return ret; } 2. I'd like to check if this dir exists(gchar/gunichar depends on previous function). Is it correct: static gboolean package_path(gchar *path, GError **error) { GDir *dir; if(error) *error = NULL; #ifndef G_OS_WIN32 /* Is it needed or g_filename_from_utf8 return utf8? */ gchar *local; /* If gunichar what's here? */ local = g_filename_from_utf8(path, -1, NULL, NULL, error); if(!error && *error) return NULL; dir = g_dir_open(local, 0, NULL); #else dir = g_dir_open(path, 0, NULL ); #endif if(dir) { g_dir_close(dir); return TRUE; } return FALSE; } Thanks in advance.
_______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list