aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/odbc/gpps.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-10-25 03:08:03 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-10-25 03:08:03 +0000
commit51f62d505e2aba66bf7870c7bd005cd32e7d0953 (patch)
tree127e7cbbf6679dbc2e3cfd08786ab88a7a801f50 /src/interfaces/odbc/gpps.c
parent8a17ed63359325c567694fdd378e71803a53cc73 (diff)
downloadpostgresql-51f62d505e2aba66bf7870c7bd005cd32e7d0953.tar.gz
postgresql-51f62d505e2aba66bf7870c7bd005cd32e7d0953.zip
Standardize on MAXPGPATH as the size of a file pathname buffer,
eliminating some wildly inconsistent coding in various parts of the system. I set MAXPGPATH = 1024 in config.h.in. If anyone is really convinced that there ought to be a configure-time test to set the value, go right ahead ... but I think it's a waste of time.
Diffstat (limited to 'src/interfaces/odbc/gpps.c')
-rw-r--r--src/interfaces/odbc/gpps.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/interfaces/odbc/gpps.c b/src/interfaces/odbc/gpps.c
index 8d2796673ca..b067ca1c10e 100644
--- a/src/interfaces/odbc/gpps.c
+++ b/src/interfaces/odbc/gpps.c
@@ -36,11 +36,6 @@
#define FALSE ((BOOL)0)
#endif
-#if HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#else
-#define MAXPATHLEN 255
-#endif
DWORD
GetPrivateProfileString(char *theSection, // section name
@@ -50,7 +45,7 @@ GetPrivateProfileString(char *theSection, // section name
size_t theReturnBufferLength, // byte length of return buffer
char *theIniFileName) // pathname of ini file to search
{
- char buf[MAXPATHLEN+1];
+ char buf[MAXPGPATH];
char* ptr = 0;
FILE* aFile = 0;
size_t aLength;
@@ -70,8 +65,8 @@ GetPrivateProfileString(char *theSection, // section name
if( ptr == NULL)
{
- if( MAXPATHLEN < j )
- theIniFileName[MAXPATHLEN] = '\0';
+ if( MAXPGPATH-1 < j )
+ theIniFileName[MAXPGPATH-1] = '\0';
sprintf(buf,"%s",theIniFileName);
}
@@ -84,12 +79,12 @@ GetPrivateProfileString(char *theSection, // section name
* the file won't be found and thus the default value will be
* returned.
*/
- if( MAXPATHLEN < strlen(ptr) + j )
+ if( MAXPGPATH-1 < strlen(ptr) + j )
{
- if( MAXPATHLEN < strlen(ptr) )
- ptr[MAXPATHLEN] = '\0';
+ if( MAXPGPATH-1 < strlen(ptr) )
+ ptr[MAXPGPATH-1] = '\0';
else
- theIniFileName[MAXPATHLEN-strlen(ptr)] = '\0';
+ theIniFileName[MAXPGPATH-1-strlen(ptr)] = '\0';
}
sprintf( buf, "%s/%s",ptr,theIniFileName );
@@ -323,7 +318,7 @@ WritePrivateProfileString(char *theSection, // section name
char *theBuffer, // input buffer
char *theIniFileName) // pathname of ini file to write
{
- char buf[MAXPATHLEN+1];
+ char buf[MAXPGPATH];
char* ptr = 0;
FILE* aFile = 0;
size_t aLength;
@@ -349,8 +344,8 @@ WritePrivateProfileString(char *theSection, // section name
if( ptr == NULL)
{
- if( MAXPATHLEN < j )
- theIniFileName[MAXPATHLEN] = '\0';
+ if( MAXPGPATH-1 < j )
+ theIniFileName[MAXPGPATH-1] = '\0';
sprintf(buf,"%s",theIniFileName);
}
@@ -363,12 +358,12 @@ WritePrivateProfileString(char *theSection, // section name
// the file won't be found and thus the default value will be
// returned.
//
- if( MAXPATHLEN < strlen(ptr) + j )
+ if( MAXPGPATH-1 < strlen(ptr) + j )
{
- if( MAXPATHLEN < strlen(ptr) )
- ptr[MAXPATHLEN] = '\0';
+ if( MAXPGPATH-1 < strlen(ptr) )
+ ptr[MAXPGPATH-1] = '\0';
else
- theIniFileName[MAXPATHLEN-strlen(ptr)] = '\0';
+ theIniFileName[MAXPGPATH-1-strlen(ptr)] = '\0';
}
sprintf( buf, "%s/%s",ptr,theIniFileName );