summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2011-03-21 16:55:11 +0000
committerJeff Trawick <trawick@apache.org>2011-03-21 16:55:11 +0000
commit5028e042339d98fd617886aa86782f89ef591911 (patch)
tree56dd448c11f77c53a545e0027a8c7ed8814351ec
parent81a0ee7096379e7973ea1b7b695d483b677dda15 (diff)
downloadapr-5028e042339d98fd617886aa86782f89ef591911.tar.gz
merge trunk revs 1083169, 1083177, 1083178, 1083183, and 1083227
to resolve some gcc warnings and dead code on Windows (the testlfsabi change from r1083183 is omitted, as the testcases aren't in this branch) git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1083869 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--apr.dsp4
-rw-r--r--file_io/win32/filestat.c6
-rw-r--r--libapr.dsp4
-rw-r--r--misc/unix/errorcodes.c100
-rw-r--r--network_io/win32/sendrecv.c2
-rw-r--r--test/testrand.c2
-rw-r--r--test/testshm.c2
-rw-r--r--threadproc/win32/signals.c3
-rw-r--r--threadproc/win32/threadpriv.c2
-rw-r--r--time/win32/access.c204
-rw-r--r--time/win32/timestr.c4
-rw-r--r--user/win32/groupinfo.c4
-rw-r--r--user/win32/userinfo.c12
13 files changed, 72 insertions, 277 deletions
diff --git a/apr.dsp b/apr.dsp
index 9fe415ac8..82eda32c0 100644
--- a/apr.dsp
+++ b/apr.dsp
@@ -520,10 +520,6 @@ SOURCE=.\threadproc\win32\threadpriv.c
# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\time\win32\access.c
-# End Source File
-# Begin Source File
-
SOURCE=.\time\win32\time.c
# End Source File
# Begin Source File
diff --git a/file_io/win32/filestat.c b/file_io/win32/filestat.c
index cdd507d1a..0d2225a96 100644
--- a/file_io/win32/filestat.c
+++ b/file_io/win32/filestat.c
@@ -97,7 +97,7 @@ static void resolve_prot(apr_finfo_t *finfo, apr_int32_t wanted, PACL dacl)
* there is no reason for os_level testing here.
*/
if ((wanted & APR_FINFO_WPROT) && !worldid) {
- SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_WORLD_SID_AUTHORITY;
+ SID_IDENTIFIER_AUTHORITY SIDAuth = {SECURITY_WORLD_SID_AUTHORITY};
if (AllocateAndInitializeSid(&SIDAuth, 1, SECURITY_WORLD_RID,
0, 0, 0, 0, 0, 0, 0, &worldid))
atexit(free_world);
@@ -268,7 +268,7 @@ apr_status_t more_finfo(apr_finfo_t *finfo, const void *ufile,
((wanted & APR_FINFO_PROT) ? &dacl : NULL),
NULL, &pdesc);
else
- return APR_INCOMPLETE;
+ return APR_INCOMPLETE; /* should not occur */
if (rv == ERROR_SUCCESS)
apr_pool_cleanup_register(finfo->pool, pdesc, free_localheap,
apr_pool_cleanup_null);
@@ -319,6 +319,8 @@ apr_status_t more_finfo(apr_finfo_t *finfo, const void *ufile,
sizelo = GetCompressedFileSizeW((apr_wchar_t*)ufile, &sizehi);
else if (whatfile == MORE_OF_FSPEC)
sizelo = GetCompressedFileSizeA((char*)ufile, &sizehi);
+ else
+ return APR_EGENERAL; /* should not occur */
if (sizelo != INVALID_FILE_SIZE || GetLastError() == NO_ERROR) {
#if APR_HAS_LARGE_FILES
diff --git a/libapr.dsp b/libapr.dsp
index a4aeff3d8..b1783bf3f 100644
--- a/libapr.dsp
+++ b/libapr.dsp
@@ -572,10 +572,6 @@ SOURCE=.\threadproc\win32\threadpriv.c
# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\time\win32\access.c
-# End Source File
-# Begin Source File
-
SOURCE=.\time\win32\time.c
# End Source File
# Begin Source File
diff --git a/misc/unix/errorcodes.c b/misc/unix/errorcodes.c
index 4764998c3..75567c246 100644
--- a/misc/unix/errorcodes.c
+++ b/misc/unix/errorcodes.c
@@ -189,56 +189,56 @@ static const struct {
apr_status_t code;
const char *msg;
} gaErrorList[] = {
- WSAEINTR, "Interrupted system call",
- WSAEBADF, "Bad file number",
- WSAEACCES, "Permission denied",
- WSAEFAULT, "Bad address",
- WSAEINVAL, "Invalid argument",
- WSAEMFILE, "Too many open sockets",
- WSAEWOULDBLOCK, "Operation would block",
- WSAEINPROGRESS, "Operation now in progress",
- WSAEALREADY, "Operation already in progress",
- WSAENOTSOCK, "Socket operation on non-socket",
- WSAEDESTADDRREQ, "Destination address required",
- WSAEMSGSIZE, "Message too long",
- WSAEPROTOTYPE, "Protocol wrong type for socket",
- WSAENOPROTOOPT, "Bad protocol option",
- WSAEPROTONOSUPPORT, "Protocol not supported",
- WSAESOCKTNOSUPPORT, "Socket type not supported",
- WSAEOPNOTSUPP, "Operation not supported on socket",
- WSAEPFNOSUPPORT, "Protocol family not supported",
- WSAEAFNOSUPPORT, "Address family not supported",
- WSAEADDRINUSE, "Address already in use",
- WSAEADDRNOTAVAIL, "Can't assign requested address",
- WSAENETDOWN, "Network is down",
- WSAENETUNREACH, "Network is unreachable",
- WSAENETRESET, "Net connection reset",
- WSAECONNABORTED, "Software caused connection abort",
- WSAECONNRESET, "Connection reset by peer",
- WSAENOBUFS, "No buffer space available",
- WSAEISCONN, "Socket is already connected",
- WSAENOTCONN, "Socket is not connected",
- WSAESHUTDOWN, "Can't send after socket shutdown",
- WSAETOOMANYREFS, "Too many references, can't splice",
- WSAETIMEDOUT, "Connection timed out",
- WSAECONNREFUSED, "Connection refused",
- WSAELOOP, "Too many levels of symbolic links",
- WSAENAMETOOLONG, "File name too long",
- WSAEHOSTDOWN, "Host is down",
- WSAEHOSTUNREACH, "No route to host",
- WSAENOTEMPTY, "Directory not empty",
- WSAEPROCLIM, "Too many processes",
- WSAEUSERS, "Too many users",
- WSAEDQUOT, "Disc quota exceeded",
- WSAESTALE, "Stale NFS file handle",
- WSAEREMOTE, "Too many levels of remote in path",
- WSASYSNOTREADY, "Network system is unavailable",
- WSAVERNOTSUPPORTED, "Winsock version out of range",
- WSANOTINITIALISED, "WSAStartup not yet called",
- WSAEDISCON, "Graceful shutdown in progress",
- WSAHOST_NOT_FOUND, "Host not found",
- WSANO_DATA, "No host data of that type was found",
- 0, NULL
+ {WSAEINTR, "Interrupted system call"},
+ {WSAEBADF, "Bad file number"},
+ {WSAEACCES, "Permission denied"},
+ {WSAEFAULT, "Bad address"},
+ {WSAEINVAL, "Invalid argument"},
+ {WSAEMFILE, "Too many open sockets"},
+ {WSAEWOULDBLOCK, "Operation would block"},
+ {WSAEINPROGRESS, "Operation now in progress"},
+ {WSAEALREADY, "Operation already in progress"},
+ {WSAENOTSOCK, "Socket operation on non-socket"},
+ {WSAEDESTADDRREQ, "Destination address required"},
+ {WSAEMSGSIZE, "Message too long"},
+ {WSAEPROTOTYPE, "Protocol wrong type for socket"},
+ {WSAENOPROTOOPT, "Bad protocol option"},
+ {WSAEPROTONOSUPPORT, "Protocol not supported"},
+ {WSAESOCKTNOSUPPORT, "Socket type not supported"},
+ {WSAEOPNOTSUPP, "Operation not supported on socket"},
+ {WSAEPFNOSUPPORT, "Protocol family not supported"},
+ {WSAEAFNOSUPPORT, "Address family not supported"},
+ {WSAEADDRINUSE, "Address already in use"},
+ {WSAEADDRNOTAVAIL, "Can't assign requested address"},
+ {WSAENETDOWN, "Network is down"},
+ {WSAENETUNREACH, "Network is unreachable"},
+ {WSAENETRESET, "Net connection reset"},
+ {WSAECONNABORTED, "Software caused connection abort"},
+ {WSAECONNRESET, "Connection reset by peer"},
+ {WSAENOBUFS, "No buffer space available"},
+ {WSAEISCONN, "Socket is already connected"},
+ {WSAENOTCONN, "Socket is not connected"},
+ {WSAESHUTDOWN, "Can't send after socket shutdown"},
+ {WSAETOOMANYREFS, "Too many references, can't splice"},
+ {WSAETIMEDOUT, "Connection timed out"},
+ {WSAECONNREFUSED, "Connection refused"},
+ {WSAELOOP, "Too many levels of symbolic links"},
+ {WSAENAMETOOLONG, "File name too long"},
+ {WSAEHOSTDOWN, "Host is down"},
+ {WSAEHOSTUNREACH, "No route to host"},
+ {WSAENOTEMPTY, "Directory not empty"},
+ {WSAEPROCLIM, "Too many processes"},
+ {WSAEUSERS, "Too many users"},
+ {WSAEDQUOT, "Disc quota exceeded"},
+ {WSAESTALE, "Stale NFS file handle"},
+ {WSAEREMOTE, "Too many levels of remote in path"},
+ {WSASYSNOTREADY, "Network system is unavailable"},
+ {WSAVERNOTSUPPORTED, "Winsock version out of range"},
+ {WSANOTINITIALISED, "WSAStartup not yet called"},
+ {WSAEDISCON, "Graceful shutdown in progress"},
+ {WSAHOST_NOT_FOUND, "Host not found"},
+ {WSANO_DATA, "No host data of that type was found"},
+ {0, NULL}
};
diff --git a/network_io/win32/sendrecv.c b/network_io/win32/sendrecv.c
index a01f0329a..3fa0c8dda 100644
--- a/network_io/win32/sendrecv.c
+++ b/network_io/win32/sendrecv.c
@@ -210,6 +210,7 @@ APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from,
}
+#if APR_HAS_SENDFILE
static apr_status_t collapse_iovec(char **off, apr_size_t *len,
struct iovec *iovec, int numvec,
char *buf, apr_size_t buflen)
@@ -240,7 +241,6 @@ static apr_status_t collapse_iovec(char **off, apr_size_t *len,
}
-#if APR_HAS_SENDFILE
/*
* apr_status_t apr_socket_sendfile(apr_socket_t *, apr_file_t *, apr_hdtr_t *,
* apr_off_t *, apr_size_t *, apr_int32_t flags)
diff --git a/test/testrand.c b/test/testrand.c
index 6ced4a34f..333491f3e 100644
--- a/test/testrand.c
+++ b/test/testrand.c
@@ -63,6 +63,7 @@ static void rand_run_kat(abts_case *tc, rnd_fn *f, apr_random_t *r,
}
}
+#if APR_HAS_FORK
static int rand_check_kat(rnd_fn *f, apr_random_t *r,
const unsigned char expected[128])
{
@@ -76,6 +77,7 @@ static int rand_check_kat(rnd_fn *f, apr_random_t *r,
return 1;
return 0;
}
+#endif
static void rand_add_zeroes(apr_random_t *r)
{
diff --git a/test/testshm.c b/test/testshm.c
index 6c192f290..bbaf62504 100644
--- a/test/testshm.c
+++ b/test/testshm.c
@@ -31,6 +31,7 @@
#if APR_HAS_SHARED_MEMORY
+#if APR_HAS_FORK
static int msgwait(int sleep_sec, int first_box, int last_box)
{
int i;
@@ -58,6 +59,7 @@ static void msgput(int boxnum, char *msg)
apr_cpystrn(boxes[boxnum].msg, msg, strlen(msg) + 1);
boxes[boxnum].msgavail = 1;
}
+#endif /* APR_HAS_FORK */
static void test_anon_create(abts_case *tc, void *data)
{
diff --git a/threadproc/win32/signals.c b/threadproc/win32/signals.c
index b97023094..f19fb0324 100644
--- a/threadproc/win32/signals.c
+++ b/threadproc/win32/signals.c
@@ -17,6 +17,7 @@
#include "apr_arch_threadproc.h"
#include "apr_arch_file_io.h"
#include "apr_thread_proc.h"
+#include "apr_signal.h"
#include "apr_file_io.h"
#include "apr_general.h"
#if APR_HAVE_SIGNAL_H
@@ -50,7 +51,7 @@ void apr_signal_init(apr_pool_t *pglobal)
{
}
-const char *apr_signal_description_get(int signum)
+APR_DECLARE(const char *) apr_signal_description_get(int signum)
{
return "unknown signal (not supported)";
}
diff --git a/threadproc/win32/threadpriv.c b/threadproc/win32/threadpriv.c
index 0cbfe620e..787c142c4 100644
--- a/threadproc/win32/threadpriv.c
+++ b/threadproc/win32/threadpriv.c
@@ -41,7 +41,7 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new,
apr_threadkey_t *key)
{
- if ((*new) = TlsGetValue(key->key)) {
+ if (((*new) = TlsGetValue(key->key))) {
return APR_SUCCESS;
}
return apr_get_os_error();
diff --git a/time/win32/access.c b/time/win32/access.c
deleted file mode 100644
index c3ccad6bc..000000000
--- a/time/win32/access.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "apr_arch_atime.h"
-#include "apr_time.h"
-#include "apr_general.h"
-#include "apr_lib.h"
-
-apr_status_t apr_get_curtime(struct atime_t *time, apr_time_t *rv)
-{
- if (time) {
- (*rv) = time->currtime;
- return APR_SUCCESS;
- }
- return APR_ENOTIME;
-}
-
-apr_status_t apr_get_sec(struct atime_t *time, apr_int32_t *rv)
-{
- if (time) {
- (*rv) = time->explodedtime->wSecond;
- return APR_SUCCESS;
- }
- return APR_ENOTIME;
-}
-
-apr_status_t apr_get_min(struct atime_t *time, apr_int32_t *rv)
-{
- if (time) {
- (*rv) = time->explodedtime->wMinute;
- return APR_SUCCESS;
- }
- return APR_ENOTIME;
-}
-
-apr_status_t apr_get_hour(struct atime_t *time, apr_int32_t *rv)
-{
- if (time) {
- (*rv) = time->explodedtime->wHour;
- return APR_SUCCESS;
- }
- return APR_ENOTIME;
-}
-
-apr_status_t apr_get_mday(struct atime_t *time, apr_int32_t *rv)
-{
- if (time) {
- (*rv) = time->explodedtime->wDay;
- return APR_SUCCESS;
- }
- return APR_ENOTIME;
-}
-
-apr_status_t apr_get_mon(struct atime_t *time, apr_int32_t *rv)
-{
- if (time) {
- (*rv) = time->explodedtime->wMonth;
- return APR_SUCCESS;
- }
- return APR_ENOTIME;
-}
-
-apr_status_t apr_get_year(struct atime_t *time, apr_int32_t *rv)
-{
- if (time) {
- (*rv) = time->explodedtime->wYear;
- return APR_SUCCESS;
- }
- return APR_ENOTIME;
-}
-
-apr_status_t apr_get_wday(struct atime_t *time, apr_int32_t *rv)
-{
- if (time) {
- (*rv) = time->explodedtime->wDayOfWeek;
- return APR_SUCCESS;
- }
- return APR_ENOTIME;
-}
-
-apr_status_t apr_set_sec(struct atime_t *time, apr_int32_t value)
-{
- if (!time) {
- return APR_ENOTIME;
- }
- if (time->explodedtime == NULL) {
- time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt,
- sizeof(SYSTEMTIME));
- }
- if (time->explodedtime == NULL) {
- return APR_ENOMEM;
- }
- time->explodedtime->wSecond = value;
- return APR_SUCCESS;
-}
-
-apr_status_t apr_set_min(struct atime_t *time, apr_int32_t value)
-{
- if (!time) {
- return APR_ENOTIME;
- }
- if (time->explodedtime == NULL) {
- time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt,
- sizeof(SYSTEMTIME));
- }
- if (time->explodedtime == NULL) {
- return APR_ENOMEM;
- }
- time->explodedtime->wMinute = value;
- return APR_SUCCESS;
-}
-
-apr_status_t apr_set_hour(struct atime_t *time, apr_int32_t value)
-{
- if (!time) {
- return APR_ENOTIME;
- }
- if (time->explodedtime == NULL) {
- time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt,
- sizeof(SYSTEMTIME));
- }
- if (time->explodedtime == NULL) {
- return APR_ENOMEM;
- }
- time->explodedtime->wHour = value;
- return APR_SUCCESS;
-}
-
-apr_status_t apr_set_mday(struct atime_t *time, apr_int32_t value)
-{
- if (!time) {
- return APR_ENOTIME;
- }
- if (time->explodedtime == NULL) {
- time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt,
- sizeof(SYSTEMTIME));
- }
- if (time->explodedtime == NULL) {
- return APR_ENOMEM;
- }
- time->explodedtime->wDay = value;
- return APR_SUCCESS;
-}
-
-apr_status_t apr_set_mon(struct atime_t *time, apr_int32_t value)
-{
- if (!time) {
- return APR_ENOTIME;
- }
- if (time->explodedtime == NULL) {
- time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt,
- sizeof(SYSTEMTIME));
- }
- if (time->explodedtime == NULL) {
- return APR_ENOMEM;
- }
- time->explodedtime->wMonth = value;
- return APR_SUCCESS;
-}
-
-apr_status_t apr_set_year(struct atime_t *time, apr_int32_t value)
-{
- if (!time) {
- return APR_ENOTIME;
- }
- if (time->explodedtime == NULL) {
- time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt,
- sizeof(SYSTEMTIME));
- }
- if (time->explodedtime == NULL) {
- return APR_ENOMEM;
- }
- time->explodedtime->wYear = value;
- return APR_SUCCESS;
-}
-
-apr_status_t apr_set_wday(struct atime_t *time, apr_int32_t value)
-{
- if (!time) {
- return APR_ENOTIME;
- }
- if (time->explodedtime == NULL) {
- time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt,
- sizeof(SYSTEMTIME));
- }
- if (time->explodedtime == NULL) {
- return APR_ENOMEM;
- }
- time->explodedtime->wDayOfWeek = value;
- return APR_SUCCESS;
-}
diff --git a/time/win32/timestr.c b/time/win32/timestr.c
index 116924991..fc9130bc6 100644
--- a/time/win32/timestr.c
+++ b/time/win32/timestr.c
@@ -120,8 +120,8 @@ APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t)
#ifndef _WIN32_WCE
-apr_size_t win32_strftime_extra(char *s, size_t max, const char *format,
- const struct tm *tm)
+static apr_size_t win32_strftime_extra(char *s, size_t max, const char *format,
+ const struct tm *tm)
{
/* If the new format string is bigger than max, the result string won't fit
* anyway. If format strings are added, made sure the padding below is
diff --git a/user/win32/groupinfo.c b/user/win32/groupinfo.c
index 7739a5428..585642f07 100644
--- a/user/win32/groupinfo.c
+++ b/user/win32/groupinfo.c
@@ -36,11 +36,11 @@ APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *gid,
DWORD rv;
char *pos;
- if (pos = strchr(groupname, '/')) {
+ if ((pos = strchr(groupname, '/'))) {
domain = apr_pstrndup(p, groupname, pos - groupname);
groupname = pos + 1;
}
- else if (pos = strchr(groupname, '\\')) {
+ else if ((pos = strchr(groupname, '\\'))) {
domain = apr_pstrndup(p, groupname, pos - groupname);
groupname = pos + 1;
}
diff --git a/user/win32/userinfo.c b/user/win32/userinfo.c
index 3d45df4f3..12931ade6 100644
--- a/user/win32/userinfo.c
+++ b/user/win32/userinfo.c
@@ -30,7 +30,7 @@
* depends on IsValidSid(), which internally we better test long
* before we get here!
*/
-void get_sid_string(char *buf, apr_size_t blen, apr_uid_t id)
+static void get_sid_string(char *buf, apr_size_t blen, apr_uid_t id)
{
PSID_IDENTIFIER_AUTHORITY psia;
DWORD nsa;
@@ -45,10 +45,10 @@ void get_sid_string(char *buf, apr_size_t blen, apr_uid_t id)
+ ((DWORD)(psia->Value[3]) << 16) + ((DWORD)(psia->Value[2]) << 24);
sa = (DWORD)(psia->Value[1]) + ((DWORD)(psia->Value[0]) << 8);
if (sa) {
- slen = apr_snprintf(buf, blen, "S-%lu-0x%04x%08x",
- SID_REVISION, sa, nsa);
+ slen = apr_snprintf(buf, blen, "S-%d-0x%04x%08x",
+ SID_REVISION, (unsigned int)sa, (unsigned int)nsa);
} else {
- slen = apr_snprintf(buf, blen, "S-%lu-%lu",
+ slen = apr_snprintf(buf, blen, "S-%d-%lu",
SID_REVISION, nsa);
}
@@ -211,11 +211,11 @@ APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid,
DWORD rv;
char *pos;
- if (pos = strchr(username, '/')) {
+ if ((pos = strchr(username, '/'))) {
domain = apr_pstrndup(p, username, pos - username);
username = pos + 1;
}
- else if (pos = strchr(username, '\\')) {
+ else if ((pos = strchr(username, '\\'))) {
domain = apr_pstrndup(p, username, pos - username);
username = pos + 1;
}