From: <ny...@us...> - 2007-02-09 02:52:19
|
Revision: 317 http://svn.sourceforge.net/pmplib/?rev=317&view=rev Author: nyaochi Date: 2007-02-08 18:52:20 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Fix build on POSIX environments. Modified Paths: -------------- trunk/pmplib/Makefile.am trunk/pmplib/configure.in trunk/pmplib/frontend/easypmp/cui/console_posix.c trunk/pmplib/lib/filepath/Makefile.am trunk/pmplib/lib/filepath/filepath_posix.c trunk/pmplib/lib/filepath/rel2abs.c trunk/pmplib/lib/filepath/rel2abs.h trunk/pmplib/lib/pmp/Makefile.am trunk/pmplib/lib/pmp/pmp_posix.c trunk/pmplib/lib/ucs2/Makefile.am trunk/pmplib/lib/ucs2/ucs2char_iconv.c Modified: trunk/pmplib/Makefile.am =================================================================== --- trunk/pmplib/Makefile.am 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/Makefile.am 2007-02-09 02:52:20 UTC (rev 317) @@ -1,6 +1,6 @@ # $Id$ -SUBDIRS = m4 libltdl lib/ucs2 lib/filepath lib/pmp lib/gmi lib/playlist lib/pmp_irivnavi lib/pmp_portalplayer1 lib/pmp_iriverplus2 lib/pmp_iriverplus3 frontend/easypmp/cui +SUBDIRS = m4 libltdl include lib/ucs2 lib/filepath lib/pmp lib/gmi lib/playlist lib/pmp_irivnavi lib/pmp_portalplayer1 lib/pmp_iriverplus2 lib/pmp_iriverplus3 frontend/easypmp/cui docdir = $(prefix)/share/doc/@PACKAGE@ doc_DATA = README INSTALL COPYING AUTHORS ChangeLog Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/configure.in 2007-02-09 02:52:20 UTC (rev 317) @@ -228,7 +228,7 @@ dnl ------------------------------------------------------------------ dnl Output the configure results. dnl ------------------------------------------------------------------ -AC_CONFIG_FILES(Makefile m4/Makefile lib/ucs2/Makefile lib/filepath/Makefile lib/pmp/Makefile lib/gmi/Makefile lib/pmp_irivnavi/Makefile lib/pmp_portalplayer1/Makefile lib/pmp_iriverplus2/Makefile lib/pmp_iriverplus3/Makefile lib/playlist/Makefile frontend/easypmp/cui/Makefile) +AC_CONFIG_FILES(Makefile m4/Makefile include/Makefile include/pmplib/Makefile lib/ucs2/Makefile lib/filepath/Makefile lib/pmp/Makefile lib/gmi/Makefile lib/pmp_irivnavi/Makefile lib/pmp_portalplayer1/Makefile lib/pmp_iriverplus2/Makefile lib/pmp_iriverplus3/Makefile lib/playlist/Makefile frontend/easypmp/cui/Makefile) if test -n "$JS_CFLAGS" ; then AC_DEFINE([HAVE_JSAPI_H], 1, [Define if you have the jsapi.h header]) Modified: trunk/pmplib/frontend/easypmp/cui/console_posix.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-02-09 02:52:20 UTC (rev 317) @@ -38,7 +38,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #ifdef HAVE_STRING_H #include <string.h> Modified: trunk/pmplib/lib/filepath/Makefile.am =================================================================== --- trunk/pmplib/lib/filepath/Makefile.am 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/filepath/Makefile.am 2007-02-09 02:52:20 UTC (rev 317) @@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libfilepath.la libfilepath_la_SOURCES = \ - ../../include/filepath.h \ + ../../include/pmplib/filepath.h \ filepath_posix.c \ rel2abs.h \ rel2abs.c Modified: trunk/pmplib/lib/filepath/filepath_posix.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_posix.c 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/filepath/filepath_posix.c 2007-02-09 02:52:20 UTC (rev 317) @@ -34,7 +34,7 @@ #include <string.h> #include <sys/stat.h> -#include "filepath.h" +#include <pmplib/filepath.h> #include "rel2abs.h" int find_file(const ucs2char_t* path, int recursive, filepath_findfile_callback callback, void *instance) @@ -265,14 +265,14 @@ return (*path != PATHCHAR); } -int filepath_file_exists(const ucs2char_t *path) +int filepath_file_exists(const ucs2char_t *filename) { int ret = 0; struct stat st; char *mbs_path = ucs2dupmbs(filename); if (mbs_path) { - path_decode(mbs_path); + filepath_decode(mbs_path); //fprintf(stderr, "is_exist: %s\n", mbs_path); ret = open(mbs_path, 0); free(mbs_path); @@ -364,3 +364,54 @@ } return 0; } + +time_t filepath_mtime(const ucs2char_t *filename) +{ + int ret = 0; + struct stat st; + char *mbs_path = ucs2dupmbs(filename); + + if (mbs_path) { + filepath_decode(mbs_path); + ret = stat(mbs_path, &st); + free(mbs_path); + if (ret == 0) { + return st.st_mtime; + } + } + return 0; +} + +uint32_t filepath_size(const ucs2char_t *filename) +{ + int ret = 0; + struct stat st; + char *mbs_path = ucs2dupmbs(filename); + + if (mbs_path) { + filepath_decode(mbs_path); + ret = stat(mbs_path, &st); + free(mbs_path); + if (ret == 0) { + return (uint32_t)st.st_size; + } + } + return 0; +} + +int filepath_is_dir(const ucs2char_t *filename) +{ + int ret = 0; + struct stat st; + char *mbs_path = ucs2dupmbs(filename); + + if (mbs_path) { + filepath_decode(mbs_path); + ret = stat(mbs_path, &st); + free(mbs_path); + if (ret == 0) { + return ((st.st_mode & S_IFMT) == S_IFDIR); + } + } + return 0; +} Modified: trunk/pmplib/lib/filepath/rel2abs.c =================================================================== --- trunk/pmplib/lib/filepath/rel2abs.c 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/filepath/rel2abs.c 2007-02-09 02:52:20 UTC (rev 317) @@ -39,7 +39,7 @@ #include <os.h> #include <errno.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "rel2abs.h" Modified: trunk/pmplib/lib/filepath/rel2abs.h =================================================================== --- trunk/pmplib/lib/filepath/rel2abs.h 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/filepath/rel2abs.h 2007-02-09 02:52:20 UTC (rev 317) @@ -25,7 +25,7 @@ #ifndef __REL2ABS_H__ #define __REL2ABS_H__ -#include <ucs2char.h> +#include <pmplib/ucs2char.h> /** * \addtogroup filepath Modified: trunk/pmplib/lib/pmp/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp/Makefile.am 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/pmp/Makefile.am 2007-02-09 02:52:20 UTC (rev 317) @@ -3,7 +3,8 @@ lib_LTLIBRARIES = libpmp.la libpmp_la_SOURCES = \ - ../../include/pmp.h \ + ../../include/pmplib/pmp.h \ + ../../include/pmplib/os_types.h \ pmp.c \ pmp_posix.c Modified: trunk/pmplib/lib/pmp/pmp_posix.c =================================================================== --- trunk/pmplib/lib/pmp/pmp_posix.c 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/pmp/pmp_posix.c 2007-02-09 02:52:20 UTC (rev 317) @@ -32,11 +32,10 @@ #include <ltdl.h> #include <os.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> -#include <filepath.h> -#include <pmp.h> - struct tag_pmplib_t { uint32_t num_plugins; lt_dlhandle *plugins; Modified: trunk/pmplib/lib/ucs2/Makefile.am =================================================================== --- trunk/pmplib/lib/ucs2/Makefile.am 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/ucs2/Makefile.am 2007-02-09 02:52:20 UTC (rev 317) @@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libucs2.la libucs2_la_SOURCES = \ - ../../include/ucs2char.h \ + ../../include/pmplib/ucs2char.h \ ucs2char.c \ ucs2char_iconv.c Modified: trunk/pmplib/lib/ucs2/ucs2char_iconv.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-09 02:52:20 UTC (rev 317) @@ -231,7 +231,7 @@ -static void path_decode(char *p) +static void filepath_decode(char *p) { while (*p) { if (*p == 0x005C) { @@ -248,7 +248,7 @@ char* mbs = (char *)alloca(mbs_size * sizeof(char)); if (mbs) { ucs2tombs(mbs, mbs_size, ucs2str, ucs2len(ucs2str)+1); - return (fputs(mbs, fp) != EOF : 0 ? 1); + return (fputs(mbs, fp) != EOF ? 0 : 1); } else { return 1; } @@ -261,61 +261,10 @@ if (mbs_filename) { /* Convert '\\' to '/'. */ - path_decode(mbs_filename); + filepath_decode(mbs_filename); //fprintf(stderr, "fopen: %s\n", mbs_filename); fp = fopen(mbs_filename, mode); } free(mbs_filename); return fp; } - -time_t filepath_mtime(const ucs2char_t *filename) -{ - int ret = 0; - struct stat st; - char *mbs_path = ucs2dupmbs(filename); - - if (mbs_path) { - path_decode(mbs_path); - ret = stat(mbs_path, &st); - free(mbs_path); - if (ret == 0) { - return st.st_mtime; - } - } - return 0; -} - -uint32_t filepath_size(const ucs2char_t *filename) -{ - int ret = 0; - struct stat st; - char *mbs_path = ucs2dupmbs(filename); - - if (mbs_path) { - path_decode(mbs_path); - ret = stat(mbs_path, &st); - free(mbs_path); - if (ret == 0) { - return (uint32_t)st.st_size; - } - } - return 0; -} - -int filepath_is_dir(const ucs2char_t *filename) -{ - int ret = 0; - struct stat st; - char *mbs_path = ucs2dupmbs(filename); - - if (mbs_path) { - path_decode(mbs_path); - ret = stat(mbs_path, &st); - free(mbs_path); - if (ret == 0) { - return ((st.st_mode & S_IFMT) == S_IFDIR); - } - } - return 0; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |