-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
136 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- origsrc/apt-cacher-ng-2/source/header.cc 2016-11-23 05:32:02.000000000 +0900 | ||
+++ src/apt-cacher-ng-2/source/header.cc 2016-11-27 10:41:57.495387800 +0900 | ||
@@ -18,6 +18,13 @@ | ||
|
||
#include <map> | ||
|
||
+#if defined(__CYGWIN__) | ||
+extern "C" | ||
+char *_EXFUN(strptime, (const char *__restrict, | ||
+ const char *__restrict, | ||
+ struct tm *__restrict)); | ||
+#endif | ||
+ | ||
using namespace std; | ||
|
||
namespace acng | ||
@@ -158,7 +165,7 @@ int header::Load(LPCSTR const in, unsign | ||
|
||
while (isspace((uint)*end)) end--; | ||
end++; | ||
- | ||
+ | ||
if (frontLine.empty()) | ||
{ | ||
frontLine.assign(in, string::size_type(end-in)); | ||
@@ -193,14 +200,14 @@ int header::Load(LPCSTR const in, unsign | ||
const char *sep=(const char*) memchr(szBegin, ':', end-szBegin); | ||
if (!sep) | ||
return -1; | ||
- | ||
+ | ||
auto key = szBegin; | ||
size_t keyLen=sep-szBegin; | ||
|
||
sep++; | ||
while (sep<end && isspace((uint)*sep)) | ||
sep++; | ||
- | ||
+ | ||
lastLineIdx = HEADPOS_NOTFORUS; | ||
|
||
for(const auto& xh : mapId2Headname) | ||
@@ -277,7 +284,7 @@ void header::prep(eHeadPos key, size_t l | ||
} | ||
|
||
void header::set(eHeadPos key, off_t nValue) | ||
-{ | ||
+{ | ||
char buf[3*sizeof(off_t)]; | ||
int len=sprintf(buf, OFF_T_FMT, nValue); | ||
set(key, buf, len); | ||
@@ -310,11 +317,11 @@ int header::StoreToFile(cmstring &sPath) | ||
if(fd<0) | ||
return -errno; | ||
} | ||
- | ||
+ | ||
auto hstr=ToString(); | ||
const char *p=hstr.rptr(); | ||
nByteCount=hstr.length(); | ||
- | ||
+ | ||
for(string::size_type pos=0; pos<(uint)nByteCount;) | ||
{ | ||
int ret=write(fd, p+pos, nByteCount-pos); | ||
@@ -324,7 +331,7 @@ int header::StoreToFile(cmstring &sPath) | ||
continue; | ||
if(EINTR == errno) | ||
continue; | ||
- | ||
+ | ||
ret=errno; | ||
forceclose(fd); | ||
return -ret; | ||
@@ -337,7 +344,7 @@ int header::StoreToFile(cmstring &sPath) | ||
if(errno != EINTR) | ||
return -errno; | ||
} | ||
- | ||
+ | ||
return nByteCount; | ||
} | ||
|
||
@@ -361,7 +368,7 @@ bool header::ParseDate(const char *s, st | ||
if(!s || !tm) | ||
return false; | ||
for(const auto& fmt : fmts) | ||
- if(::strptime(s, fmt, tm)) | ||
+ if(strptime(s, fmt, tm)) | ||
return true; | ||
|
||
return false; |