aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-05-30 17:07:22 +0000
committerdos-reis <gdr@axiomatics.org>2011-05-30 17:07:22 +0000
commit72d3df9188861d62e9c6e1a29a720d6dc0696d99 (patch)
tree4d33deaf2b78e62f66a037654a3dbdb665016ed6 /src/lib
parentf99ece56ccd39726097c11bb2f78f79c2ab340ef (diff)
downloadopen-axiom-72d3df9188861d62e9c6e1a29a720d6dc0696d99.tar.gz
fix const-correctness in old C codes
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cfuns-c.c6
-rw-r--r--src/lib/fnct_key.c11
-rw-r--r--src/lib/sockio-c.c5
-rw-r--r--src/lib/wct.c6
4 files changed, 13 insertions, 15 deletions
diff --git a/src/lib/cfuns-c.c b/src/lib/cfuns-c.c
index a4ae8f39..f0b7aed7 100644
--- a/src/lib/cfuns-c.c
+++ b/src/lib/cfuns-c.c
@@ -2,7 +2,7 @@
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2010, Gabriel Dos Reis.
+ Copyright (C) 2007-2011, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -160,7 +160,7 @@ directoryp(char *path)
OPENAXIOM_C_EXPORT int
make_path_from_file(char *s, char *t)
{
- char *pos = "";
+ char *pos = NULL;
char *c;
/** simply copies the path name from t into s **/
@@ -209,7 +209,7 @@ make_path_from_file(char *s, char *t)
static inline int
axiom_has_write_access(const struct stat* file_info)
{
- int effetive_uid = geteuid();
+ uid_t effetive_uid = geteuid();
if (effetive_uid == 0)
return 1;
diff --git a/src/lib/fnct_key.c b/src/lib/fnct_key.c
index bac0fdb5..69498ec0 100644
--- a/src/lib/fnct_key.c
+++ b/src/lib/fnct_key.c
@@ -1,7 +1,7 @@
/*
Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
All rights reserved.
- Copyright (C) Gabriel Dos Reis.
+ Copyright (C) 2007-2011 Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -65,7 +65,7 @@ using namespace OpenAxiom;
fkey function_key[13]; /** Strings which replace function
keys when a key is hit ***/
-static char *defaulteditor = "clefedit";
+static const char *defaulteditor = "clefedit";
char editorfilename[100];
@@ -153,11 +153,8 @@ define_function_keys(void)
}
break;
}
- if (type != -1) {
- (function_key[key]).str =
- (char *) malloc(strlen(string) + 1);
- sprintf((function_key[key]).str, "%s", string);
- }
+ if (type != -1)
+ (function_key[key]).str = strdup(string);
}
}
diff --git a/src/lib/sockio-c.c b/src/lib/sockio-c.c
index 31439c43..a29be625 100644
--- a/src/lib/sockio-c.c
+++ b/src/lib/sockio-c.c
@@ -105,17 +105,18 @@ int spad_server_number = -1;
This is needed only for MS platforms. */
static int openaxiom_socket_module_loaded = 0;
+#ifdef __WIN32__
/* Windows require some handshaking with the WinSock DLL before
we can even think about talking about sockets. */
static void
openaxiom_unload_socket_module(void)
{
-#ifdef __WIN32__
WSACleanup();
openaxiom_socket_module_loaded = 0;
-#endif
}
+#endif
+
static void
openaxiom_load_socket_module(void)
diff --git a/src/lib/wct.c b/src/lib/wct.c
index 200d9a3d..35cc01e9 100644
--- a/src/lib/wct.c
+++ b/src/lib/wct.c
@@ -1,7 +1,7 @@
/*
Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
All rights reserved.
- Copyright (C) Gabriel Dos Reis.
+ Copyright (C) 2007-2011 Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -463,13 +463,13 @@ reintern1Wct(Wct *pwct)
}
void
-sfatal(char *s)
+sfatal(const char *s)
{
fatal("%s", s);
}
void
-fatal(char *fmt,char * s)
+fatal(const char* fmt, const char* s)
{
static char fbuf[256];