You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-util/codeblocks/files/codeblocks-8.02-gcc44.patch

155 lines
4.3 KiB

diff -Naurp codeblocks-8.02-orig/src/src/prefix.cpp codeblocks-8.02/src/src/prefix.cpp
--- codeblocks-8.02-orig/src/src/prefix.cpp 2008-02-27 07:15:26.000000000 -0600
+++ codeblocks-8.02/src/src/prefix.cpp 2009-07-29 17:05:52.797543317 -0600
@@ -12,7 +12,7 @@
* Written by: Mike Hearn <mike@theoretic.com>
* Hongli Lai <h.lai@chello.nl>
* http://autopackage.org/
- *
+ *
* This source code is public domain. You can relicense this code
* under whatever license you want.
*
@@ -202,21 +202,20 @@ br_locate_prefix (void *symbol)
char *
br_prepend_prefix (void *symbol, char *path)
{
- char *tmp, *newpath;
-
- br_return_val_if_fail (symbol != NULL, (char*)NULL);
- br_return_val_if_fail (path != NULL, (char*)NULL);
+ br_return_val_if_fail (symbol != 0, (char*)0);
+ br_return_val_if_fail (path != 0, (char*)0);
- tmp = br_locate_prefix (symbol);
- if (!tmp) return (char*)NULL;
+ char* tmp = br_locate_prefix (symbol);
+ if (!tmp) return (char*)0;
+ char *newpath;
if (strcmp (tmp, "/") == 0)
newpath = strdup (path);
else
newpath = br_strcat (tmp, path);
/* Get rid of compiler warning ("br_prepend_prefix never used") */
- if (0) br_prepend_prefix (NULL, (char*)NULL);
+ if (0) br_prepend_prefix (0, (char*)0);
free (tmp);
return newpath;
@@ -240,9 +239,7 @@ static pthread_once_t br_thread_key_once
static void
br_thread_local_store_fini ()
{
- char *specific;
-
- specific = (char *) pthread_getspecific (br_thread_key);
+ char* specific = (char *) pthread_getspecific (br_thread_key);
if (specific)
{
free (specific);
@@ -301,11 +298,9 @@ const char *
br_thread_local_store (char *str)
{
#if BR_PTHREADS
- char *specific;
-
pthread_once (&br_thread_key_once, br_thread_local_store_init);
- specific = (char *) pthread_getspecific (br_thread_key);
+ char* specific = (char *) pthread_getspecific (br_thread_key);
br_str_free (specific);
pthread_setspecific (br_thread_key, str);
@@ -338,16 +333,13 @@ br_thread_local_store (char *str)
char *
br_strcat (const char *str1, const char *str2)
{
- char *result;
- size_t len1, len2;
-
if (!str1) str1 = "";
if (!str2) str2 = "";
- len1 = strlen (str1);
- len2 = strlen (str2);
+ size_t len1 = strlen (str1);
+ size_t len2 = strlen (str2);
- result = (char *) malloc (len1 + len2 + 1);
+ char* result = (char *) malloc (len1 + len2 + 1);
memcpy (result, str1, len1);
memcpy (result + len1, str2, len2);
result[len1 + len2] = '\0';
@@ -360,16 +352,13 @@ br_strcat (const char *str1, const char
static char *
br_strndup (char *str, size_t size)
{
- char *result = (char *) NULL;
- size_t len;
+ br_return_val_if_fail (str != (char *) 0, (char *) 0);
- br_return_val_if_fail (str != (char *) NULL, (char *) NULL);
-
- len = strlen (str);
+ size_t len = strlen (str);
if (!len) return strdup ("");
if (size > len) size = len;
- result = (char *) calloc (sizeof (char), len + 1);
+ char* result = (char *) calloc (sizeof (char), len + 1);
memcpy (result, str, size);
return result;
}
@@ -389,16 +378,16 @@ br_strndup (char *str, size_t size)
char *
br_extract_dir (const char *path)
{
- char *end, *result;
-
- br_return_val_if_fail (path != (char *) NULL, (char *) NULL);
+ br_return_val_if_fail (path != (char *) 0, (char *) 0);
- end = strrchr (path, '/');
+ const char* end = strrchr (path, '/');
if (!end) return strdup (".");
while (end > path && *end == '/')
+ {
end--;
- result = br_strndup ((char *) path, end - path + 1);
+ }
+ char* result = br_strndup ((char *) path, end - path + 1);
if (!*result)
{
free (result);
@@ -424,15 +413,13 @@ br_extract_dir (const char *path)
char *
br_extract_prefix (const char *path)
{
- char *end, *tmp, *result;
-
- br_return_val_if_fail (path != (char *) NULL, (char *) NULL);
+ br_return_val_if_fail (path != (char *) 0, (char *) 0);
if (!*path) return strdup ("/");
- end = strrchr (path, '/');
+ const char* end = strrchr (path, '/');
if (!end) return strdup (path);
- tmp = br_strndup ((char *) path, end - path);
+ char* tmp = br_strndup ((char *) path, end - path);
if (!*tmp)
{
free (tmp);
@@ -441,7 +428,7 @@ br_extract_prefix (const char *path)
end = strrchr (tmp, '/');
if (!end) return tmp;
- result = br_strndup (tmp, end - tmp);
+ char* result = br_strndup (tmp, end - tmp);
free (tmp);
if (!*result)