This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
+#include "system/locale.h"
#include "vfs_posix.h"
-#include "system/iconv.h"
+#include "param/param.h"
/*
this mangling scheme uses the following format
try to find a 8.3 name in the cache, and if found then
return the original long name.
*/
-static const char *check_cache(struct pvfs_mangle_context *ctx,
- const char *name)
+static char *check_cache(struct pvfs_mangle_context *ctx,
+ TALLOC_CTX *mem_ctx, const char *name)
{
uint32_t hash, multiplier;
unsigned int i;
}
if (extension[0]) {
- return talloc_asprintf(ctx, "%s.%s", prefix, extension);
+ return talloc_asprintf(mem_ctx, "%s.%s", prefix, extension);
}
- return talloc_strdup(ctx, prefix);
+ return talloc_strdup(mem_ctx, prefix);
}
if (! FLAG_CHECK(lead_chars[i], FLAG_ASCII)) {
lead_chars[i] = '_';
}
- lead_chars[i] = toupper(lead_chars[i]);
+ lead_chars[i] = toupper((unsigned char)lead_chars[i]);
}
for (;i<ctx->mangle_prefix;i++) {
lead_chars[i] = '_';
extension_length = 0;
if (dot_p) {
for (i=1; extension_length < 3 && dot_p[i]; i++) {
- char c = dot_p[i];
+ unsigned char c = dot_p[i];
if (FLAG_CHECK(c, FLAG_ASCII)) {
extension[extension_length++] = toupper(c);
}
char *pvfs_mangled_lookup(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx,
const char *name)
{
- const char *ret;
- ret = check_cache(pvfs->mangle_ctx, name);
- if (ret) {
- return talloc_steal(mem_ctx, ret);
- }
- return NULL;
+ return check_cache(pvfs->mangle_ctx, mem_ctx, name);
}