| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 : Subscription(Type::DOWNLOADABLE, id), mFixedTitle(false), mLastCheck(0), | 21 : Subscription(Type::DOWNLOADABLE, id), mFixedTitle(false), mLastCheck(0), |
| 22 mHardExpiration(0), mSoftExpiration(0), mLastDownload(0), mLastSuccess(0), | 22 mHardExpiration(0), mSoftExpiration(0), mLastDownload(0), mLastSuccess(0), |
| 23 mErrorCount(0), mDataRevision(0), mDownloadCount(0) | 23 mErrorCount(0), mDataRevision(0), mDownloadCount(0) |
| 24 { | 24 { |
| 25 SetTitle(id); | 25 SetTitle(id); |
| 26 } | 26 } |
| 27 | 27 |
| 28 OwnedString DownloadableSubscription::Serialize() const | 28 OwnedString DownloadableSubscription::Serialize() const |
| 29 { | 29 { |
| 30 OwnedString result(Subscription::Serialize()); | 30 OwnedString result(Subscription::Serialize()); |
| 31 char buffer[32]; | |
| 32 if (mFixedTitle) | 31 if (mFixedTitle) |
| 33 result.append(u"fixedTitle=true\n"_str); | 32 result.append(u"fixedTitle=true\n"_str); |
| 34 if (!mHomepage.empty()) | 33 if (!mHomepage.empty()) |
| 35 { | 34 { |
| 36 result.append(u"homepage="_str); | 35 result.append(u"homepage="_str); |
| 37 result.append(mHomepage); | 36 result.append(mHomepage); |
| 38 result.append(u'\n'); | 37 result.append(u'\n'); |
| 39 } | 38 } |
| 40 if (mLastCheck) | 39 if (mLastCheck) |
| 41 { | 40 { |
| 42 result.append(u"lastCheck="_str); | 41 result.append(u"lastCheck="_str); |
| 43 int len = sprintf(buffer, "%.0f", mLastCheck); | 42 result.append(mLastCheck); |
| 44 result.append(buffer, len); | |
| 45 result.append(u'\n'); | 43 result.append(u'\n'); |
| 46 } | 44 } |
| 47 if (mHardExpiration) | 45 if (mHardExpiration) |
| 48 { | 46 { |
| 49 result.append(u"expires="_str); | 47 result.append(u"expires="_str); |
| 50 int len = sprintf(buffer, "%.0f", mHardExpiration); | 48 result.append(mHardExpiration); |
| 51 result.append(buffer, len); | |
| 52 result.append(u'\n'); | 49 result.append(u'\n'); |
| 53 } | 50 } |
| 54 if (mSoftExpiration) | 51 if (mSoftExpiration) |
| 55 { | 52 { |
| 56 result.append(u"softExpiration="_str); | 53 result.append(u"softExpiration="_str); |
| 57 int len = sprintf(buffer, "%.0f", mSoftExpiration); | 54 result.append(mSoftExpiration); |
| 58 result.append(buffer, len); | |
| 59 result.append(u'\n'); | 55 result.append(u'\n'); |
| 60 } | 56 } |
| 61 if (mLastDownload) | 57 if (mLastDownload) |
| 62 { | 58 { |
| 63 result.append(u"lastDownload="_str); | 59 result.append(u"lastDownload="_str); |
| 64 int len = sprintf(buffer, "%.0f", mLastDownload); | 60 result.append(mLastDownload); |
| 65 result.append(buffer, len); | |
| 66 result.append(u'\n'); | 61 result.append(u'\n'); |
| 67 } | 62 } |
| 68 if (!mDownloadStatus.empty()) | 63 if (!mDownloadStatus.empty()) |
| 69 { | 64 { |
| 70 result.append(u"downloadStatus="_str); | 65 result.append(u"downloadStatus="_str); |
| 71 result.append(mDownloadStatus); | 66 result.append(mDownloadStatus); |
| 72 result.append(u'\n'); | 67 result.append(u'\n'); |
| 73 } | 68 } |
| 74 if (mLastSuccess) | 69 if (mLastSuccess) |
| 75 { | 70 { |
| 76 result.append(u"lastSuccess="_str); | 71 result.append(u"lastSuccess="_str); |
| 77 int len = sprintf(buffer, "%.0f", mLastSuccess); | 72 result.append(mLastSuccess); |
| 78 result.append(buffer, len); | |
| 79 result.append(u'\n'); | 73 result.append(u'\n'); |
| 80 } | 74 } |
| 81 if (mErrorCount) | 75 if (mErrorCount) |
| 82 { | 76 { |
| 83 result.append(u"errors="_str); | 77 result.append(u"errors="_str); |
| 84 int len = sprintf(buffer, "%i", mErrorCount); | 78 result.append(mErrorCount); |
| 85 result.append(buffer, len); | |
| 86 result.append(u'\n'); | 79 result.append(u'\n'); |
| 87 } | 80 } |
| 88 if (mDataRevision) | 81 if (mDataRevision) |
| 89 { | 82 { |
| 90 result.append(u"version="_str); | 83 result.append(u"version="_str); |
| 91 int len = sprintf(buffer, "%.0f", mDataRevision); | 84 result.append(mDataRevision); |
| 92 result.append(buffer, len); | |
| 93 result.append(u'\n'); | 85 result.append(u'\n'); |
| 94 } | 86 } |
| 95 if (!mRequiredVersion.empty()) | 87 if (!mRequiredVersion.empty()) |
| 96 { | 88 { |
| 97 result.append(u"requiredVersion="_str); | 89 result.append(u"requiredVersion="_str); |
| 98 result.append(mRequiredVersion); | 90 result.append(mRequiredVersion); |
| 99 result.append(u'\n'); | 91 result.append(u'\n'); |
| 100 } | 92 } |
| 101 if (mDownloadCount) | 93 if (mDownloadCount) |
| 102 { | 94 { |
| 103 result.append(u"downloadCount="_str); | 95 result.append(u"downloadCount="_str); |
| 104 int len = sprintf(buffer, "%i", mDownloadCount); | 96 result.append(mDownloadCount); |
| 105 result.append(buffer, len); | |
| 106 result.append(u'\n'); | 97 result.append(u'\n'); |
| 107 } | 98 } |
| 108 return result; | 99 return result; |
| 109 } | 100 } |
| LEFT | RIGHT |