Commit fc6ee058 authored by sponcec3's avatar sponcec3 Committed by Sebastien Ponce
Browse files

Fixed compilation in -O2 mode.

This in particular includes fixing the remaining strict-aliasing issues.
parent 03287518
......@@ -2984,8 +2984,8 @@ std::vector<castor::vdqm::TapeAccessSpecification*>*
//The result from the select statement
oracle::occi::ResultSet *rset;
// Execute statement and get result
u_signed64 id;
u_signed64 id = 0;
// Get the Statement object, creating one if necessary
oracle::occi::Statement *stmt = NULL;
const StatementId stmtId = SELECT_TAPE_ACCESS_SPECIFICATIONS_SQL_STMT;
......@@ -3031,7 +3031,7 @@ std::vector<castor::vdqm::TapeAccessSpecification*>*
}
// Now get the TapeAccessSpecification from its id
std::vector<castor::vdqm::TapeAccessSpecification*>* result;
std::vector<castor::vdqm::TapeAccessSpecification*>* result = 0;
try {
castor::BaseAddress ad;
ad.setCnvSvcName("DbCnvSvc");
......
......@@ -326,7 +326,7 @@ castor::tape::tapegateway::VmgrTapeGatewayHelper::getTapeInfoAssertAvailable
// call getTapeInfo
TapeInfo info = getTapeInfo(vid, shuttingDown);
// Interpret the status and throw an exception for non-available tapes.
int err_number;
int err_number = 0;
std::string statName;
if (info.vmgrTapeInfo.status & (DISABLED|EXPORTED|ARCHIVED)){
if (info.vmgrTapeInfo.status & DISABLED) {
......
......@@ -40,9 +40,9 @@ namespace UnitTests {
SPC-4. This test also validates the handling of multi-bytes numbers,
as SCSI structures are big endian (and main development target is
little endian. */
unsigned char inqBuff [100];
memset(inqBuff, 0, sizeof(inqBuff));
castor::tape::SCSI::Structures::inquiryData_t & inq = *((castor::tape::SCSI::Structures::inquiryData_t *) inqBuff);
castor::tape::SCSI::Structures::inquiryData_t inq;
unsigned char *inqBuff = (unsigned char*)&inq;
memset(inqBuff, 0, sizeof(inq));
/* Peripheral device type */
ASSERT_EQ(0, inq.perifDevType);
inqBuff[0] |= (0x1A & 0x1F) << 0;
......
......@@ -486,7 +486,7 @@ char *_Cregexp_reg(int paren, /* Parenthesized? */
char *ret;
char *br;
char *ender;
int parno;
int parno = 0;
int flags;
*flagp = HASWIDTH; /* Tentatively. */
......
......@@ -31,37 +31,37 @@ int loader(){
return -1;
}
dlerror(); // Clear any existing error
*(void **) (&Cclient_initContext) = dlsym(handle, "Csec_client_initContext");
Cclient_initContext = (int (*)(Csec_context_t *,int,Csec_protocol *))dlsym(handle, "Csec_client_initContext");
if (!Cclient_initContext) {
fprintf (stderr, "%s\n", dlerror());
return -1;
}
*(void **) (&Cserver_initContext) = dlsym(handle, "Csec_server_initContext");
Cserver_initContext = (int (*)(Csec_context_t *,int,Csec_protocol *))dlsym(handle, "Csec_server_initContext");
if (!Cserver_initContext) {
fprintf (stderr, "%s\n", dlerror());
return -1;
}
*(void **) (&Cclient_establishContext) = dlsym(handle, "Csec_client_establishContext");
Cclient_establishContext = (int (*)(Csec_context_t *,int))dlsym(handle, "Csec_client_establishContext");
if (!Cclient_establishContext) {
fprintf (stderr, "%s\n", dlerror());
return -1;
}
*(void **) (&Cserver_establishContext) = dlsym(handle, "Csec_server_establishContext");
Cserver_establishContext = (int (*)(Csec_context_t *,int))dlsym(handle, "Csec_server_establishContext");
if (!Cserver_establishContext) {
fprintf (stderr, "%s\n", dlerror());
return -1;
}
*(void **) (&CclearContext) = dlsym(handle, "Csec_clearContext");
CclearContext = (int (*)(Csec_context_t *))dlsym(handle, "Csec_clearContext");
if (!CclearContext) {
fprintf (stderr, "%s\n", dlerror());
return -1;
}
*(void **) (&CgetClientId) = dlsym(handle, "Csec_server_getClientId");
CgetClientId = (int (*)(Csec_context_t *, char **, char **))dlsym(handle, "Csec_server_getClientId");
if (!CgetClientId) {
fprintf (stderr, "%s\n", dlerror());
return -1;
}
*(void **) (&CmapUser) = dlsym(handle, "Csec_mapToLocalUser");
CmapUser = (int (*)(const char *, const char *, char *, size_t, uid_t *, gid_t *))dlsym(handle, "Csec_mapToLocalUser");
if (!CmapUser) {
fprintf (stderr, "%s\n", dlerror());
return -1;
......
......@@ -11,7 +11,7 @@
#define _CNS_CONSTANTS_H
#include "Castor_limits.h"
#define DIRXSIZE (HYPERSIZE+WORDSIZE+LONGSIZE+LONGSIZE+LONGSIZE+HYPERSIZE+TIME_TSIZE+TIME_TSIZE+TIME_TSIZE+WORDSIZE+BYTESIZE)
#define DIRXSIZE (HYPERSIZE+WORDSIZE+LONGSIZE+LONGSIZE+LONGSIZE+HYPERSIZE+TIME_TSIZE+TIME_TSIZE+TIME_TSIZE+WORDSIZE+1)
#define CNS_ROOT "/castor"
#define CNS_SEC_PORT 5510
......
......@@ -22,7 +22,6 @@
#define SHORT WORD
/* #define U_SHORT U_WORD */
#define SHORTSIZE WORDSIZE
#define SHORTADDR WORDADDR
#define marshall_WORD marshall_SHORT
#define unmarshall_WORD unmarshall_SHORT
......@@ -76,14 +75,14 @@ typedef char* bitvct; /* bit vector type definition */
*/
#define marshall_BYTE(ptr,n) { BYTE n_ = n; \
(void) memcpy((ptr),BYTEADDR(n_),BYTESIZE); \
INC_PTR(ptr,BYTESIZE); \
(void) memcpy((ptr),&n_,1); \
INC_PTR(ptr,1); \
}
#define unmarshall_BYTE(ptr,n) { BYTE n_ = 0; \
(void) memcpy(BYTEADDR(n_),(ptr),BYTESIZE); \
(void) memcpy(&n_,(ptr),1); \
n = n_; \
INC_PTR(ptr,BYTESIZE); \
INC_PTR(ptr,1); \
}
/*
......@@ -91,12 +90,12 @@ typedef char* bitvct; /* bit vector type definition */
*/
#define marshall_SHORT(ptr,n) { SHORT n_ = htons((unsigned short)(n)); \
(void) memcpy((ptr),SHORTADDR(n_),SHORTSIZE); \
(void) memcpy((ptr),&n_,SHORTSIZE); \
INC_PTR(ptr,SHORTSIZE); \
}
#define unmarshall_SHORT(ptr,n) { SHORT n_ = 0; \
(void) memcpy(SHORTADDR(n_),(ptr),SHORTSIZE); \
(void) memcpy(&n_,(ptr),SHORTSIZE); \
n = ntohs((unsigned short)(n_)); \
if ( BIT_ISSET(ptr,0) && sizeof(SHORT)-SHORTSIZE > 0 ) \
(void) memset((char *)&n,255,sizeof(SHORT)-SHORTSIZE); \
......@@ -108,12 +107,12 @@ typedef char* bitvct; /* bit vector type definition */
*/
#define marshall_LONG(ptr,n) { LONG n_ = htonl((unsigned long)(n)); \
(void) memcpy((ptr),LONGADDR(n_),LONGSIZE); \
(void) memcpy((ptr),&n_,LONGSIZE); \
INC_PTR(ptr,LONGSIZE); \
}
#define unmarshall_LONG(ptr,n) { LONG n_ = 0; \
(void) memcpy(LONGADDR(n_),(ptr),LONGSIZE); \
(void) memcpy(&n_,(ptr),LONGSIZE); \
n = ntohl((unsigned long)(n_)); \
if ( BIT_ISSET(ptr,0) && sizeof(LONG)-LONGSIZE > 0 ) \
(void) memset((char *)&n,255,sizeof(LONG)-LONGSIZE); \
......@@ -148,23 +147,22 @@ EXTERN_C int _unmarshall_STRINGN (char **, char*, int);
*/
#define marshall_HYPER(ptr,n) { U_HYPER u_ = n; \
LONG n_ = htonl(*((U_LONG *)((char *)&(u_)+LONGSIZE))); \
(void) memcpy((ptr),LONGADDR(n_),LONGSIZE); \
U_LONG n_ = htonl((U_LONG)u_); \
(void) memcpy((ptr),&n_,LONGSIZE); \
INC_PTR(ptr,LONGSIZE); \
n_ = htonl(*((U_LONG *)&(u_))); \
(void) memcpy((ptr),LONGADDR(n_),LONGSIZE); \
n_ = htonl((U_LONG)(u_ >> 32)); \
(void) memcpy((ptr),&n_,LONGSIZE); \
INC_PTR(ptr,LONGSIZE); \
}
#define unmarshall_HYPER(ptr,n) { U_HYPER u_ = 0; \
LONG n_ = 0; \
(void) memcpy(LONGADDR(n_),(ptr),LONGSIZE); \
*((LONG *)((char *)&(u_)+LONGSIZE)) = \
ntohl((U_LONG)(n_)); \
U_LONG n_ = 0; \
(void) memcpy(&n_,(ptr),LONGSIZE); \
u_ = ntohl(n_); \
INC_PTR(ptr,LONGSIZE); \
n_ = 0; \
(void) memcpy(LONGADDR(n_),(ptr),LONGSIZE); \
*((LONG *)&(u_)) = ntohl((U_LONG)(n_)); \
(void) memcpy(&n_,(ptr),LONGSIZE); \
u_ |= (((U_HYPER)ntohl(n_)) << 32); \
INC_PTR(ptr,LONGSIZE); \
n = u_; \
}
......
......@@ -19,7 +19,6 @@
* Data representation
*/
#define BYTESIZE 1
#define WORDSIZE 2
#define LONGSIZE 4
#define QUADSIZE 8
......@@ -33,10 +32,6 @@ typedef char BYTE;
typedef short WORD;
typedef int LONG;
#define BYTEADDR(x) (((char *)&(x))+sizeof(BYTE)-BYTESIZE)
#define WORDADDR(x) (((char *)&(x))+sizeof(WORD)-WORDSIZE)
#define LONGADDR(x) (((char *)&(x))+sizeof(LONG)-LONGSIZE)
typedef long long signed64;
typedef unsigned long long u_signed64;
......
......@@ -307,11 +307,6 @@ typedef struct file_list {
/*
* Macros
*/
#define LOWERCASE(X) {char *__c; \
for (__c=X; *__c != '\0'; __c++) *__c=tolower(*__c); }
#define UPPERCASE(X) {char *__c; \
for (__c=X; *__c != '\0'; __c++) *__c=toupper(*__c); }
#if !defined(min)
#define min(X,Y) (X < Y ? X : Y)
#endif /* min */
......
......@@ -58,7 +58,7 @@ extern "C" {
opts.stage_port=0;
const char* protocol = "rfio";
int filenb = 0;
char* filename;
char* filename = 0;
while ((c = Cgetopt_long (argc, argv, "M:S:P:h", longopts, NULL)) != -1) {
switch (c) {
......
......@@ -58,7 +58,7 @@ extern "C" {
opts.stage_port=0;
const char* protocol = "rfio";
int filenb = 0;
char* filename;
char* filename = 0;
while ((c = Cgetopt_long (argc, argv, "M:S:P:h", longopts, NULL)) != -1) {
switch (c) {
......
......@@ -1061,7 +1061,7 @@ int compute_du4dir (struct Cns_srv_thread_info *thip,
};
struct dirlist *dlc; /* Pointer to current directory in the list */
struct dirlist *dlf = NULL; /* Pointer to first directory in the list */
struct dirlist *dll; /* Pointer to last directory in the list */
struct dirlist *dll = NULL; /* Pointer to last directory in the list */
struct Cns_file_metadata fmd_entry;
if (Cns_chkentryperm (direntry, S_IREAD|S_IEXEC, uid, gid, clienthost))
......@@ -4829,11 +4829,11 @@ int Cns_srv_utime(char *req_data,
struct Cns_srv_thread_info *thip,
struct Cns_srv_request_info *reqinfo)
{
time_t actime;
time_t actime = 0;
u_signed64 cwd;
struct Cns_file_metadata filentry;
char *func = "utime";
time_t modtime;
time_t modtime = 0;
char path[CA_MAXPATHLEN+1];
char cwdpath[CA_MAXPATHLEN+1];
char *rbp;
......
......@@ -151,7 +151,7 @@ int chdirclass (char *dir,int oldclass,int newclass,char *newclass_name)
Cns_DIR *dirp;
struct dirlist *dlc; /* pointer to current directory in the list */
struct dirlist *dlf = NULL; /* pointer to first directory in the list */
struct dirlist *dll; /* pointer to last directory in the list */
struct dirlist *dll = 0; /* pointer to last directory in the list */
struct Cns_direnstat *dxp;
classtobechanged = 1;
......
......@@ -41,7 +41,7 @@ int chmoddir (char *dir,
Cns_DIR *dirp;
struct dirlist *dlc; /* pointer to current directory in the list */
struct dirlist *dlf = NULL; /* pointer to first directory in the list */
struct dirlist *dll; /* pointer to last directory in the list */
struct dirlist *dll = 0; /* pointer to last directory in the list */
struct Cns_direnstat *dxp;
char fullpath[CA_MAXPATHLEN+1];
int errflg = 0;
......
......@@ -47,7 +47,7 @@ int main(int argc, char **argv)
struct group *gr;
int i;
gid_t newgid;
uid_t newuid;
uid_t newuid = 0;
char *p;
char *path;
struct passwd *pwd;
......@@ -173,7 +173,7 @@ int chowndir (char *dir, uid_t newuid, gid_t newgid)
Cns_DIR *dirp;
struct dirlist *dlc; /* pointer to current directory in the list */
struct dirlist *dlf = NULL; /* pointer to first directory in the list */
struct dirlist *dll; /* pointer to last directory in the list */
struct dirlist *dll = NULL; /* pointer to last directory in the list */
struct Cns_direnstat *dxp;
char fullpath[CA_MAXPATHLEN+1];
int errflg = 0;
......
......@@ -268,7 +268,7 @@ int procpath (char *dir)
Cns_DIR *dirp;
struct dirlist *dlc; /* pointer to current directory in the list */
struct dirlist *dlf = NULL; /* pointer to first directory in the list */
struct dirlist *dll; /* pointer to last directory in the list */
struct dirlist *dll = NULL; /* pointer to last directory in the list */
struct Cns_direnstat *dxp;
if ((dirp = Cns_opendir (dir)) == NULL)
......
......@@ -233,7 +233,7 @@ int listdir(char *dir)
Cns_DIR *dirp;
struct dirlist *dlc; /* pointer to current directory in the list */
struct dirlist *dlf = NULL; /* pointer to first directory in the list */
struct dirlist *dll; /* pointer to last directory in the list */
struct dirlist *dll = NULL; /* pointer to last directory in the list */
struct dirent *dp;
struct Cns_direnstatc *dxcp;
struct Cns_direnstatg *dxp;
......
......@@ -41,7 +41,7 @@ int main(int argc,
int errflg = 0;
int hflg = 0;
int i;
mode_t mask;
mode_t mask = 0;
int mflag = 0;
mode_t mode;
char *p;
......
......@@ -197,7 +197,7 @@ int removedir (char *dir)
Cns_DIR *dirp;
struct dirlist *dlc; /* pointer to current directory in the list */
struct dirlist *dlf = NULL; /* pointer to first directory in the list */
struct dirlist *dll; /* pointer to last directory in the list */
struct dirlist *dll = NULL; /* pointer to last directory in the list */
struct Cns_direnstat *dxp;
char fullpath[CA_MAXPATHLEN+1];
......
......@@ -41,7 +41,7 @@ int send2nsdx(int *socketp,
char *getconfent();
char *getenv();
struct hostent *hp;
struct Cns_linkinfo *li;
struct Cns_linkinfo *li = 0;
int magic;
int n;
int nbretry;
......@@ -50,10 +50,10 @@ int send2nsdx(int *socketp,
char *q;
int rep_type;
char repbuf[REPBUFSZ];
int repbuf2sz;
int repbuf2sz = 0;
int retrycnt = 0;
int retryint;
int s;
int s = 0;
struct sockaddr_in sin; /* internet socket */
struct servent *sp,*sec_sp;
struct Cns_api_thread_info *thip = NULL;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment