gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r10484: Make constructing a string a


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10484: Make constructing a string a bit simpler.
Date: Mon, 29 Dec 2008 15:50:26 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10484
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2008-12-29 15:50:26 +0100
message:
  Make constructing a string a bit simpler.
modified:
  libnet/http.cpp
=== modified file 'libnet/http.cpp'
--- a/libnet/http.cpp   2008-12-25 22:27:51 +0000
+++ b/libnet/http.cpp   2008-12-29 14:50:26 +0000
@@ -1325,19 +1325,14 @@
         cmd = HTTP::HTTP_DELETE;
     }
 
-    // For valid requests, the second argument, delimited by spaces is the 
filespec
-    // of the file being requested or transmitted.
+    // For valid requests, the second argument, delimited by spaces
+    // is the filespec of the file being requested or transmitted.
     if (cmd != HTTP::HTTP_NONE) {
        boost::uint8_t *start = std::find(data, data+7, ' ') + 1;
        boost::uint8_t *end   = std::find(start + 2, data+PATH_MAX, ' ');
-       // FIXME: there has got to be a way to copy into a string that actually 
works.
-       char path[(end-start) + 1];
-       memset(path, 0, (end-start) + 1);
-       std::copy(start, end, path);
-       _filespec = path;
-//     _filespec.reserve((end - start));
-//     std::fill(_filespec.begin(), _filespec.end(), 0);
-//     std::copy(start, end, _filespec.begin());
+       
+    // This is fine as long as end is within the buffer.
+    _filespec = std::string(start, end);
     }
     
     return cmd;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]