summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp
diff options
context:
space:
mode:
authornobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-09-16 21:19:02 +0000
committernobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-09-16 21:19:02 +0000
commit40fdc8a404e75ab03b68cc62e9987cf208fd8c30 (patch)
tree37d9c4d3abe4aefd8a34ed797883dd2cd4862ca7 /TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp
parentc254b281f1b9a4ca19dd0c3ee73a0654a7718909 (diff)
downloadATCD-40fdc8a404e75ab03b68cc62e9987cf208fd8c30.tar.gz
This commit was manufactured by cvs2svn to create branchtypecode-overhaul
'typecode-overhaul'.
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp')
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp b/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp
index d9fa7b9369f..8f093465ffe 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp
@@ -30,7 +30,7 @@ void
TAO_NS_FlatFileStream::remove ()
{
ACE_TRACE("remove");
- ACE_OS::unlink(ACE_TEXT_CHAR_TO_TCHAR(file_.c_str()));
+ ACE_OS::unlink(file_.c_str());
}
int
@@ -58,21 +58,21 @@ TAO_NS_FlatFileStream::open()
if( strchr(mode_.c_str(), 'c') )
flags |= O_CREAT;
#ifndef ACE_WIN32
- if( ACE_OS::flock_init (&filelock_, flags, ACE_TEXT_CHAR_TO_TCHAR(file_.c_str()), 0666) != 0 )
+ if( ACE_OS::flock_init (&filelock_, flags, file_.c_str(), 0666) != 0 )
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open file %s for mode %s: (%d) %s\n",
file_.c_str(), mode_.c_str(),
errno, ACE_OS::strerror(errno)),
-1);
#else
- if( (filelock_.handle_= ACE_OS::open (ACE_TEXT_CHAR_TO_TCHAR(file_.c_str()), flags, 0)) == ACE_INVALID_HANDLE )
+ if( (filelock_.handle_= ACE_OS::open (file_.c_str(), flags, 0)) == ACE_INVALID_HANDLE )
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open file %s for mode %s: (%d) %s\n",
file_.c_str(), mode_.c_str(),
errno, ACE_OS::strerror(errno)),
-1);
#endif
- this->fl_ = ACE_OS::fdopen(filelock_.handle_, ACE_TEXT_CHAR_TO_TCHAR(fdmode));
+ this->fl_ = ACE_OS::fdopen(filelock_.handle_, fdmode);
if (this->fl_ == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot fdopen file %s for mode %s: (%d) %s\n",
@@ -89,10 +89,9 @@ TAO_NS_FlatFileStream::close()
ACE_OS::fflush(fl_);
#ifndef ACE_WIN32
ACE_OS::flock_destroy (&filelock_, 0);
+#else
+ ACE_OS::fclose (fl_);
#endif
- ACE_OS::fclose (fl_); // even though flock_destroy closes the handle
- // we still need to destroy the FILE*
-
fl_ = 0;
return 0;
}
@@ -134,11 +133,7 @@ TAO_NS_FlatFileStream::last_changed(void)
ACE_TRACE("TAO_NS_FlatFileStream::last_changed");
ACE_stat st;
ACE_OS::fstat(filelock_.handle_, &st);
-#if !defined (ACE_HAS_WINCE)
return st.st_mtime;
-#else
- return st.st_mtime.sec ();
-#endif /* ACE_HAS_WINCE */
}
TAO_Storable_Base &
@@ -181,15 +176,15 @@ TAO_NS_FlatFileStream::operator <<(
ACE_OS::fprintf(this->fl_, "%d\n", type);
ACE_CString id = record.id();
- ACE_OS::fprintf(this->fl_, ACE_TEXT_ALWAYS_CHAR(ACE_SIZE_T_FORMAT_SPECIFIER "\n%s\n"),
+ ACE_OS::fprintf(this->fl_, ACE_SIZE_T_FORMAT_SPECIFIER "\n%s\n",
id.length(), id.c_str());
ACE_CString kind = record.kind();
- ACE_OS::fprintf(this->fl_, ACE_TEXT_ALWAYS_CHAR(ACE_SIZE_T_FORMAT_SPECIFIER "\n%s\n"),
+ ACE_OS::fprintf(this->fl_, ACE_SIZE_T_FORMAT_SPECIFIER "\n%s\n",
kind.length(), kind.c_str());
ACE_CString ref = record.ref();
- ACE_OS::fprintf(this->fl_, ACE_TEXT_ALWAYS_CHAR(ACE_SIZE_T_FORMAT_SPECIFIER "\n%s\n"),
+ ACE_OS::fprintf(this->fl_, ACE_SIZE_T_FORMAT_SPECIFIER "\n%s\n",
ref.length(), ref.c_str());
ACE_OS::fflush(this->fl_);
@@ -215,7 +210,7 @@ TAO_NS_FlatFileStream::operator >>(
char *id = new char[bufSize+1];
//char *id;
//ACE_NEW_RETURN (id, char[bufSize+1], 1);
- ACE_OS::fgets(ACE_TEXT_CHAR_TO_TCHAR(id), bufSize+1, fl_);
+ ACE_OS::fgets(id, bufSize+1, fl_);
ACE_CString newId(id);
record.id(newId);
delete [] id;
@@ -225,7 +220,7 @@ TAO_NS_FlatFileStream::operator >>(
char *kind = new char[bufSize+1];
//char *kind;
//ACE_NEW (kind, char[bufSize+1]);
- ACE_OS::fgets(ACE_TEXT_CHAR_TO_TCHAR(kind), bufSize+1, fl_);
+ ACE_OS::fgets(kind, bufSize+1, fl_);
kind[bufSize] = '\0';
ACE_CString newKind(kind);
record.kind(newKind);
@@ -236,7 +231,7 @@ TAO_NS_FlatFileStream::operator >>(
char *ref = new char[bufSize+1];
//char *ref;
//ACE_NEW(ref, char[bufSize+1]);
- ACE_OS::fgets(ACE_TEXT_CHAR_TO_TCHAR(ref), bufSize+1, fl_);
+ ACE_OS::fgets(ref, bufSize+1, fl_);
ACE_CString newRef(ref);
record.ref(newRef);
delete [] ref;
@@ -281,7 +276,7 @@ TAO_Storable_Base *TAO_NS_FlatFileFactory::create_stream(
TAO_Storable_Base *stream = 0;
ACE_NEW_RETURN (stream,
- TAO_NS_FlatFileStream(file, ACE_TEXT_ALWAYS_CHAR(mode)),
+ TAO_NS_FlatFileStream(file, mode),
0);
return stream;
}