Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/azatoth/minidlna.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Fürstenberg <azatoth@gmail.com>2011-03-29 03:24:05 +0400
committerCarl Fürstenberg <azatoth@gmail.com>2011-03-29 03:24:33 +0400
commit33d34429e78ce62241f2c0c558141101c2cf1742 (patch)
tree381b3d982a74a6a3a3d5c6b6f7974152f7b0d932
parent2b5af06d239450de6ad401314d4618af34b4aff8 (diff)
Use cygwin macro instead of defining ownpatch-hiero_cygwin
-rw-r--r--SConstruct3
-rw-r--r--getifaddr.c26
-rw-r--r--inotify.c28
-rw-r--r--minidlna.c22
-rw-r--r--upnphttp.c12
-rw-r--r--uuid.c12
6 files changed, 53 insertions, 50 deletions
diff --git a/SConstruct b/SConstruct
index 2189029..1a5d4ad 100644
--- a/SConstruct
+++ b/SConstruct
@@ -301,6 +301,9 @@ if not env.GetOption('clean') and not env.GetOption('help'):
log_path = "/var/log"
else :
pass # unknown linux dist
+ elif "cygwin" in os_name.lower():
+ conf.Define("MSG_MORE", 0)
+
else :
print("Unknown operating system '%s'" % os_name)
Exit(2)
diff --git a/getifaddr.c b/getifaddr.c
index 64f9622..fdd30a4 100644
--- a/getifaddr.c
+++ b/getifaddr.c
@@ -87,15 +87,15 @@ getsysaddr(char * buf, int len)
int s = socket(PF_INET, SOCK_STREAM, 0);
struct sockaddr_in addr;
struct ifreq ifr;
-#ifdef CYGWIN
+#ifdef cygwin
struct ifconf ifc;
char *ptr;
int result;
char buffer[1024];
-#endif
+#endif /* cygwin */
int ret = -1;
-#ifdef CYGWIN
+#ifdef cygwin
ifc.ifc_buf = buffer;
ifc.ifc_len = (sizeof(buffer)/sizeof(buffer[0]));
@@ -108,33 +108,33 @@ getsysaddr(char * buf, int len)
result = ioctl(s, SIOCGIFCONF, &ifc);
ptr = buffer;
-#endif
+#endif /* cygwin */
-#ifndef CYGWIN
+#ifndef cygwin
for (i=1; i > 0; i++)
-#else // CYGWIN
+#else
for (i=1; i > 0; i++, ptr += sizeof(struct ifreq))
-#endif // CYGWIN
+#endif /* cygwin */
{
ifr.ifr_ifindex = i;
-#ifndef CYGWIN
+#ifndef cygwin
if( ioctl(s, SIOCGIFNAME, &ifr) < 0 )
break;
if(ioctl(s, SIOCGIFADDR, &ifr, sizeof(struct ifreq)) < 0)
continue;
-#else // CYGWIN
+#else
if (ptr >= buf + ifc.ifc_len)
break;
memcpy(&ifr, ptr, sizeof(ifr));
result = ioctl(s, SIOCGIFADDR, &ifr, sizeof(struct ifreq));
if (ifr.ifr_addr.sa_family != AF_INET)
continue;
-#endif // CYGWIN
+#endif /* cygwin */
memcpy(&addr, &ifr.ifr_addr, sizeof(addr));
-#ifndef CYGWIN
+#ifndef cygwin
if(strncmp(inet_ntoa(addr.sin_addr), "127.", 4) == 0)
continue;
-#else // CYGWIN
+#else
if( (strncmp(inet_ntoa(addr.sin_addr), "127.", 4) == 0)
|| (strncmp(inet_ntoa(addr.sin_addr), "169.", 4) == 0) )
{
@@ -143,7 +143,7 @@ getsysaddr(char * buf, int len)
}
else
DPRINTF(E_WARN, L_GENERAL, "found address #%d= %s : used\n", i, inet_ntoa(addr.sin_addr));
-#endif // CYGWIN
+#endif /* cygwin */
if(!inet_ntop(AF_INET, &addr.sin_addr, buf, len))
{
DPRINTF(E_ERROR, L_GENERAL, "inet_ntop(): %s\n", strerror(errno));
diff --git a/inotify.c b/inotify.c
index e5993a9..7f8eecf 100644
--- a/inotify.c
+++ b/inotify.c
@@ -35,7 +35,7 @@
#ifdef HAVE_INOTIFY_H
#include <sys/inotify.h>
#else
-#ifndef CYGWIN
+#ifndef cygwin
#include "linux/inotify.h"
#include "linux/inotify-syscalls.h"
#endif
@@ -51,13 +51,13 @@
#include "playlist.h"
#include "log.h"
-#ifdef CYGWIN
+#ifdef cygwin
#include <sys/cygwin.h>
#define PATH_BUF_SIZE PATH_MAX
static time_t next_pl_fill = 0;
-#else // CYGWIN
+#else /* cygwin */
#define EVENT_SIZE ( sizeof (struct inotify_event) )
#define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
@@ -285,7 +285,7 @@ int add_dir_watch(int fd, char * path, char * filename)
return(i);
}
-#endif // CYGWIN
+#endif /* cygwin */
int
inotify_insert_file(char * name, const char * path)
@@ -450,9 +450,9 @@ inotify_insert_directory(int fd, char *name, const char * path)
char * sql;
char **result;
char *id=NULL, *path_buf, *parent_buf, *esc_name;
-#ifndef CYGWIN
+#ifndef cygwin
int wd;
-#endif // CYGWIN
+#endif /* cygwin */
int rows;
enum file_types type = TYPE_UNKNOWN;
enum media_types dir_type = ALL_MEDIA;
@@ -471,7 +471,7 @@ inotify_insert_directory(int fd, char *name, const char * path)
free(parent_buf);
sqlite3_free(sql);
-#ifndef CYGWIN
+#ifndef cygwin
wd = add_watch(fd, path);
if( wd == -1 )
{
@@ -481,7 +481,7 @@ inotify_insert_directory(int fd, char *name, const char * path)
{
DPRINTF(E_INFO, L_INOTIFY, "Added watch to %s [%d]\n", path, wd);
}
-#endif // CYGWIN
+#endif /* cygwin */
media_path = media_dirs;
while( media_path )
@@ -624,9 +624,9 @@ inotify_remove_directory(int fd, const char * path)
sqlite_int64 detailID = 0;
int rows, i, ret = 1;
-#ifndef CYGWIN
+#ifndef cygwin
remove_watch(fd, path);
-#endif // CYGWIN
+#endif /* cygwin */
sql = sqlite3_mprintf("SELECT ID from DETAILS where PATH glob '%q/*'"
" UNION ALL SELECT ID from DETAILS where PATH = '%q'", path, path);
if( (sql_get_table(db, sql, &result, &rows, NULL) == SQLITE_OK) )
@@ -650,7 +650,7 @@ inotify_remove_directory(int fd, const char * path)
return ret;
}
-#ifndef CYGWIN
+#ifndef cygwin
void *
start_inotify()
{
@@ -766,7 +766,7 @@ quitting:
return 0;
}
-#else // CYGWIN
+#else /* cygwin */
#include <windows.h>
@@ -876,7 +876,7 @@ insert_to_delete_from_db(int searchNo)
}
}
free(esc_name);
-#endif
+#endif /* 0 */
NextOff = m_BufferTmp->NextEntryOffset;
m_BufferTmp = (FILE_NOTIFY_INFORMATION *)((char *)m_BufferTmp + NextOff);
} while (NextOff != 0);
@@ -1083,4 +1083,4 @@ quitting:
return 0;
}
-#endif // CYGWIN
+#endif /* cygwin */
diff --git a/minidlna.c b/minidlna.c
index 68e1be3..a85884c 100644
--- a/minidlna.c
+++ b/minidlna.c
@@ -392,7 +392,7 @@ init(int argc, char * * argv)
{
switch(ary_options[i].id)
{
-#ifndef CYGWIN
+#ifndef cygwin
case UPNPIFNAME:
if(getifaddr(ary_options[i].value, ext_ip_addr, INET_ADDRSTRLEN) >= 0)
{
@@ -402,7 +402,7 @@ init(int argc, char * * argv)
else
fprintf(stderr, "Interface %s not found, ignoring.\n", ary_options[i].value);
break;
-#endif // CYGWIN
+#endif /* cygwin */
case UPNPLISTENING_IP:
if(n_lan_addr < MAX_LAN_ADDR)
{
@@ -458,13 +458,13 @@ init(int argc, char * * argv)
case 'p':
if( ary_options[i].value[0] == 'P' || ary_options[i].value[0] == 'p' )
type = IMAGES_ONLY;
-#ifndef CYGWIN
+#ifndef cygwin
myval = index(ary_options[i].value, '/');
-#else // CYGWIN
+#else
myval = index(ary_options[i].value, '"');
if (!myval)
myval = index(ary_options[i].value, '/');
-#endif // CYGWIN
+#endif /* cygwin */
case '/':
path = realpath(myval ? myval:ary_options[i].value, real_path);
if( !path )
@@ -754,11 +754,11 @@ init(int argc, char * * argv)
else
{
#ifdef USE_DAEMON
-#ifndef CYGWIN
+#ifndef cygwin
if(daemon(0, 0)<0) {
#else
if(daemon(1, 0)<0) { // keep cuurend cwd
-#endif // CYGWIN
+#endif /* cygwin */
perror("daemon()");
}
pid = getpid();
@@ -857,7 +857,7 @@ main(int argc, char * * argv)
textdomain("minidlna");
#endif
-#ifdef CYGWIN
+#ifdef cygwin
#include <sys/cygwin.h>
{
char *localappdata;
@@ -868,7 +868,7 @@ main(int argc, char * * argv)
//strcat(db_path, "/minidlna");
sprintf(db_path, "%s\\minidlna", localappdata);
}
-#endif // CYGWIN
+#endif /* cygwin */
if(init(argc, argv) != 0)
return 1;
@@ -891,9 +891,9 @@ main(int argc, char * * argv)
#endif
LIST_INIT(&upnphttphead);
-#ifdef CYGWIN
+#ifdef cygwin
DPRINTF(E_INFO, L_GENERAL, "db_path = %s\n", db_path);
-#endif // CYGWIN
+#endif /* cygwin */
new_db = open_db();
if( !new_db )
diff --git a/upnphttp.c b/upnphttp.c
index 90def43..6fd7df4 100644
--- a/upnphttp.c
+++ b/upnphttp.c
@@ -67,9 +67,9 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
-#ifndef CYGWIN
+#ifndef cygwin
#include <sys/sendfile.h>
-#endif // CYGWIN
+#endif /* cygwin */
#include <arpa/inet.h>
#include "upnpglobalvars.h"
@@ -1134,13 +1134,13 @@ send_file(struct upnphttp * h, int sendfd, off_t offset, off_t end_offset)
off_t send_size;
off_t ret;
char *buf = NULL;
-#ifndef CYGWIN
+#ifndef cygwin
int try_sendfile = 1;
-#endif // CYGWIN
+#endif /* cygwin */
while( offset < end_offset )
{
-#ifndef CYGWIN
+#ifndef cygwin
if( try_sendfile )
{
send_size = ( ((end_offset - offset) < MAX_BUFFER_SIZE) ? (end_offset - offset + 1) : MAX_BUFFER_SIZE);
@@ -1160,7 +1160,7 @@ send_file(struct upnphttp * h, int sendfd, off_t offset, off_t end_offset)
continue;
}
}
-#endif // CYGWIN
+#endif /* cygwin */
/* Fall back to regular I/O */
if( !buf )
buf = malloc(MIN_BUFFER_SIZE);
diff --git a/uuid.c b/uuid.c
index 58d1ddd..a929aa9 100644
--- a/uuid.c
+++ b/uuid.c
@@ -29,9 +29,9 @@
#include <fcntl.h>
#include <unistd.h>
#include "config.h"
-#ifndef CYGWIN
+#ifndef cygwin
#include <sys/syscall.h>
-#endif // CYGWIN
+#endif /* cygwin */
#include <string.h>
#include <net/if.h>
#include <sys/ioctl.h>
@@ -54,11 +54,11 @@ monotonic_us(void)
{
struct timespec ts;
-#ifndef CYGWIN
+#ifndef cygwin
syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts);
#else
clock_gettime(CLOCK_MONOTONIC, &ts);
-#endif //CYGWIN
+#endif /* cygwin */
return ts.tv_sec * 1000000ULL + ts.tv_nsec / 1000;
}
@@ -169,11 +169,11 @@ generate_uuid(unsigned char uuid_out[16])
* nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of
* Gregorian reform to the Christian calendar).
*/
-#ifndef CYGWIN
+#ifndef cygwin
syscall(__NR_clock_gettime, CLOCK_REALTIME, &ts);
#else
clock_gettime(CLOCK_REALTIME, &ts);
-#endif //CYGWIN
+#endif /* cygwin */
time_all = ((u_int64_t)ts.tv_sec) * (NSEC_PER_SEC / 100);
time_all += ts.tv_nsec / 100;