Make resizeline() and lineptr() static and give them prototypes.
[sgt/putty] / mac / macstore.c
index fa6493a..ecd0355 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: macstore.c,v 1.1 2002/11/19 02:13:46 ben Exp $ */
+/* $Id: macstore.c,v 1.5 2002/12/28 22:44:27 ben Exp $ */
 
 /*
  * macstore.c: Macintosh-specific impementation of the interface
@@ -87,7 +87,6 @@ struct write_settings {
 void *open_settings_w(char *sessionname) {
     short sessVRefNum, tmpVRefNum;
     long sessDirID, tmpDirID;
-    FSSpec sessfile;
     OSErr error;
     Str255 psessionname;
     struct write_settings *ws;
@@ -221,7 +220,7 @@ void *open_settings_r(char *sessionname) {
 char *read_setting_s(void *handle, char *key, char *buffer, int buflen) {
     int fd;
     Handle h;
-    OSErr error;
+    size_t len;
 
     if (handle == NULL) goto out;
     fd = *(int *)handle;
@@ -230,8 +229,11 @@ char *read_setting_s(void *handle, char *key, char *buffer, int buflen) {
     h = get1namedresource(FOUR_CHAR_CODE('TEXT'), key);
     if (h == NULL) goto out;
 
-    if (GetHandleSize(h) > buflen) goto out;
-    p2cstrcpy(buffer, (StringPtr)*h);
+    len = GetHandleSize(h);
+    if (len + 1 > buflen) goto out;
+    memcpy(buffer, *h, len);
+    buffer[len] = '\0';
+
     ReleaseResource(h);
     if (ResError() != noErr) goto out;
     return buffer;
@@ -243,7 +245,6 @@ char *read_setting_s(void *handle, char *key, char *buffer, int buflen) {
 int read_setting_i(void *handle, char *key, int defvalue) {
     int fd;
     Handle h;
-    OSErr error;
     int value;
 
     if (handle == NULL) goto out;