IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4525


Ignore:
Timestamp:
Jul 8, 2005, 2:31:49 PM (21 years ago)
Author:
jhoblitt
Message:

change nebParseURI() to return size_t
change nebParseURI() to use snprintf() instead of sprintf()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/nebclient/src/nebclient.c

    r4524 r4525  
    44 * Copyright (C) 2005  Joshua Hoblitt
    55 *
    6  * $Id: nebclient.c,v 1.23 2005-07-09 00:05:40 jhoblitt Exp $
     6 * $Id: nebclient.c,v 1.24 2005-07-09 00:31:49 jhoblitt Exp $
    77 */
    88
     
    2929static off_t nebCopyFile(nebServer *server, const char *source, const char *dest);
    3030static off_t nebCopyFilehandle(nebServer *server, int sourceFH, int destFH);
    31 static int nebParseURI(nebServer *server, const char *URI, char **filename);
     31static size_t nebParseURI(nebServer *server, const char *URI, char **filename);
    3232static bool nebNukeFile(nebServer *server, const char *filename);
    3333
     
    538538}
    539539
    540 static int nebParseURI(nebServer *server, const char *URI, char **filename)
     540static size_t nebParseURI(nebServer *server, const char *URI, char **filename)
    541541{
    542542    regex_t         myregex;
     
    545545    char            *pattern = "^file:(.*)$";
    546546    int             status;
    547     int             matchStart, matchEnd;
    548     int             matchLength;
     547    size_t          matchStart, matchEnd;
     548    size_t          matchLength;
     549    size_t          filename_size;
    549550
    550551    if (!URI) {
     
    570571    regfree(&myregex);
    571572
    572     matchStart = (int)mymatch[1].rm_so;
    573     matchEnd   = (int)mymatch[1].rm_eo;
     573    matchStart = (size_t)mymatch[1].rm_so;
     574    matchEnd   = (size_t)mymatch[1].rm_eo;
    574575    matchLength = matchEnd - matchStart;
    575576
     
    578579    }
    579580
    580     *filename = xmalloc(matchLength + 1);
    581 
    582     sprintf(*filename, "%.*s", matchLength, URI + matchStart);
     581    filename_size = matchLength + 1;
     582    *filename = xmalloc(filename_size);
     583
     584    snprintf(*filename, filename_size, "%.*s", matchLength, URI + matchStart);
    583585
    584586    return strlen(*filename);
Note: See TracChangeset for help on using the changeset viewer.