On windows make sure we add the initial path separator only if we are
creating a relative path. Use BEGIN_C_DECLS and END_C_DECLS on some header files. This commit was SVN r15254.
Этот коммит содержится в:
родитель
951e4929b9
Коммит
003d1b8665
@ -25,9 +25,8 @@
|
|||||||
#ifndef OPAL_BASENAME_H
|
#ifndef OPAL_BASENAME_H
|
||||||
#define OPAL_BASENAME_H
|
#define OPAL_BASENAME_H
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
BEGIN_C_DECLS
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* Return the basename of a filename.
|
* Return the basename of a filename.
|
||||||
*
|
*
|
||||||
@ -102,8 +101,6 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
OPAL_DECLSPEC char *opal_dirname(const char* filename);
|
OPAL_DECLSPEC char *opal_dirname(const char* filename);
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
END_C_DECLS
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* OPAL_BASENAME_H */
|
#endif /* OPAL_BASENAME_H */
|
||||||
|
@ -52,9 +52,7 @@
|
|||||||
|
|
||||||
#include "opal_config.h"
|
#include "opal_config.h"
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
BEGIN_C_DECLS
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a size_t to an int.
|
* Convert a size_t to an int.
|
||||||
@ -76,8 +74,6 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
OPAL_DECLSPEC int opal_size2int(size_t in, int *out, bool want_check) __opal_attribute_nonnull__(2);
|
OPAL_DECLSPEC int opal_size2int(size_t in, int *out, bool want_check) __opal_attribute_nonnull__(2);
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
END_C_DECLS
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,17 +41,11 @@
|
|||||||
#define OPAL_OS_DIRPATH_CREATE_H
|
#define OPAL_OS_DIRPATH_CREATE_H
|
||||||
|
|
||||||
#include "opal_config.h"
|
#include "opal_config.h"
|
||||||
#include <stdio.h>
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_STAT_H
|
#ifdef HAVE_SYS_STAT_H
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
BEGIN_C_DECLS
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param path A pointer to a string that contains the path name to be built.
|
* @param path A pointer to a string that contains the path name to be built.
|
||||||
@ -119,8 +113,6 @@ OPAL_DECLSPEC int opal_os_dirpath_destroy(const char *path,
|
|||||||
bool recursive,
|
bool recursive,
|
||||||
opal_os_dirpath_destroy_callback_fn_t cbfunc);
|
opal_os_dirpath_destroy_callback_fn_t cbfunc);
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
END_C_DECLS
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -50,6 +50,7 @@ char *opal_os_path(bool relative, ...)
|
|||||||
while (NULL != (element = va_arg(ap, char*))) {
|
while (NULL != (element = va_arg(ap, char*))) {
|
||||||
num_elements++;
|
num_elements++;
|
||||||
total_length = total_length + strlen(element);
|
total_length = total_length + strlen(element);
|
||||||
|
if( path_sep[0] != element[0] ) total_length++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == num_elements) { /* must be looking for a simple answer */
|
if (0 == num_elements) { /* must be looking for a simple answer */
|
||||||
@ -58,8 +59,7 @@ char *opal_os_path(bool relative, ...)
|
|||||||
if (relative) {
|
if (relative) {
|
||||||
strcpy(path, ".");
|
strcpy(path, ".");
|
||||||
strcat(path, path_sep);
|
strcat(path, path_sep);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
#ifndef __WINDOWS__
|
#ifndef __WINDOWS__
|
||||||
strcpy(path, path_sep);
|
strcpy(path, path_sep);
|
||||||
#endif
|
#endif
|
||||||
@ -90,11 +90,12 @@ char *opal_os_path(bool relative, ...)
|
|||||||
|
|
||||||
/* Windows does not require to have the initial separator. */
|
/* Windows does not require to have the initial separator. */
|
||||||
if( NULL != (element = va_arg(ap1, char*)) ) {
|
if( NULL != (element = va_arg(ap1, char*)) ) {
|
||||||
#ifndef __WINDOWS__
|
|
||||||
if (path_sep[0] != element[0]) {
|
if (path_sep[0] != element[0]) {
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
if( relative )
|
||||||
|
#endif /* __WINDOWS__ */
|
||||||
strcat(path, path_sep);
|
strcat(path, path_sep);
|
||||||
}
|
}
|
||||||
#endif /* __WINDOWS__ */
|
|
||||||
strcat(path, element);
|
strcat(path, element);
|
||||||
}
|
}
|
||||||
while (NULL != (element=va_arg(ap1, char*))) {
|
while (NULL != (element=va_arg(ap1, char*))) {
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user