Ignore:
Timestamp:
2001-04-05T17:08:52+12:00 (23 years ago)
Author:
sjboddie
Message:

Had a bit of a tidy up in the fnord webserver code. The main change of note
was the removal of our reliance on the MAX_URL_SIZE constant. URLs and post
data of any length should now work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/w32server/locate.cpp

    r1203 r2286  
     1/**********************************************************************
     2 *
     3 * locate.cpp
     4 * Copyright (C) 1996
     5 *
     6 * A component of the fnord webserver written by [email protected].
     7 *
     8 * Altered for use with the Greenstone digital library software by the
     9 * New Zealand Digital Library Project at the University of Waikato,
     10 * New Zealand.
     11 *
     12 * This program is free software; you can redistribute it and/or modify
     13 * it under the terms of the GNU General Public License as published by
     14 * the Free Software Foundation; either version 2 of the License, or
     15 * (at your option) any later version.
     16 *
     17 * This program is distributed in the hope that it will be useful,
     18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     20 * GNU General Public License for more details.
     21 *
     22 * You should have received a copy of the GNU General Public License
     23 * along with this program; if not, write to the Free Software
     24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     25 *
     26 *********************************************************************/
     27
    128#include "text_t.h"
    229#include <windows.h>
     
    1441
    1542static int location_found=0;
    16 char data_location[MAX_URL_SIZE];
     43char data_location[MAX_FILENAME_SIZE];
    1744
    1845void set_location(char *possible)
     
    2451      strcat(data_location,"\\");
    2552    location_found = 1;
    26     }
     53  }
    2754}
    2855
     
    3158  char *send;
    3259  if (location_found != 0) return;
    33   if (GetModuleFileName(NULL,data_location,MAX_URL_SIZE) <= 0)
     60  if (GetModuleFileName(NULL,data_location,MAX_FILENAME_SIZE) <= 0)
    3461    send = data_location;
    3562  else {
     
    188215    fprintf(log_file,"%s",msg);
    189216    fflush(log_file);
    190     }
     217  }
    191218  if (gsdl_show_console) {
    192219    char buffer[1024];  HDC dc;
     
    195222    display_text(dc,buffer);
    196223    ReleaseDC(GSDL_Window,dc);
    197     }
     224  }
    198225}
    199226
     
    201228{
    202229  if (log_file != NULL) {
    203       int len = 0;
    204       while (len < n) {
    205           fputc (msg[len], log_file);
    206           len++;
    207       }
    208       fflush(log_file);
    209   }
    210 
     230    int len = 0;
     231    while (len < n) {
     232      fputc (msg[len], log_file);
     233      len++;
     234    }
     235    fflush(log_file);
     236  }
     237 
    211238  // these messages are not send to the console
    212239  if (gsdl_show_console) {
     
    215242    display_text(dc,"message only written to log file\n");
    216243    ReleaseDC(GSDL_Window,dc);
    217     }
     244  }
    218245}
    219246
    220247void LogCriticalError(char *cderr, char *Msg)
    221248{
    222     char MsgBoxStr[200];
    223 
    224     strcpy(MsgBoxStr, "Critical Error Number ");
    225     strcat(MsgBoxStr, cderr);
    226     strcat(MsgBoxStr, "\n");
    227     strcat(MsgBoxStr, Msg);
    228     strcat(MsgBoxStr, "\nGreenstone Digital Library software\nshutting down");
    229     MessageBox(GSDL_Window, MsgBoxStr, "Greenstone Digital Library Software",
    230         MB_OK | MB_ICONERROR);
    231     PostMessage(GSDL_Window, WM_DESTROY, 0, 0);
     249  char MsgBoxStr[200];
     250 
     251  strcpy(MsgBoxStr, "Critical Error Number ");
     252  strcat(MsgBoxStr, cderr);
     253  strcat(MsgBoxStr, "\n");
     254  strcat(MsgBoxStr, Msg);
     255  strcat(MsgBoxStr, "\nGreenstone Digital Library software\nshutting down");
     256  MessageBox(GSDL_Window, MsgBoxStr, "Greenstone Digital Library Software",
     257         MB_OK | MB_ICONERROR);
     258  PostMessage(GSDL_Window, WM_DESTROY, 0, 0);
    232259}
    233260
     
    236263DWORD DiffTickCounts (DWORD first, DWORD second)
    237264{
    238     if (second >= first) return (second-first);
    239     return (MAXDWORD-first+1+second);
    240 }
     265  if (second >= first) return (second-first);
     266  return (MAXDWORD-first+1+second);
     267}
Note: See TracChangeset for help on using the changeset viewer.