~evarlast/ubuntu/utopic/mongodb/upstart-workaround-debian-bug-718702

« back to all changes in this revision

Viewing changes to src/mongo/db/pipeline/document_source_filter_base.cpp

  • Committer: Package Import Robot
  • Author(s): James Page, James Page, Robie Basak
  • Date: 2013-05-29 17:44:42 UTC
  • mfrom: (44.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130529174442-z0a4qmoww4y0t458
Tags: 1:2.4.3-1ubuntu1
[ James Page ]
* Merge from Debian unstable, remaining changes:
  - Enable SSL support:
    + d/control: Add libssl-dev to BD's.
    + d/rules: Enabled --ssl option.
    + d/mongodb.conf: Add example SSL configuration options.
  - d/mongodb-server.mongodb.upstart: Add upstart configuration.
  - d/rules: Don't strip binaries during scons build for Ubuntu.
  - d/control: Add armhf to target archs.
  - d/p/SConscript.client.patch: fixup install of client libraries.
  - d/p/0010-install-libs-to-usr-lib-not-usr-lib64-Closes-588557.patch:
    Install libraries to lib not lib64.
* Dropped changes:
  - d/p/arm-support.patch: Included in Debian.
  - d/p/double-alignment.patch: Included in Debian.
  - d/rules,control: Debian also builds with avaliable system libraries
    now.
* Fix FTBFS due to gcc and boost upgrades in saucy:
  - d/p/0008-ignore-unused-local-typedefs.patch: Add -Wno-unused-typedefs
    to unbreak building with g++-4.8.
  - d/p/0009-boost-1.53.patch: Fixup signed/unsigned casting issue.

[ Robie Basak ]
* d/p/0011-Use-a-signed-char-to-store-BSONType-enumerations.patch: Fixup
  build failure on ARM due to missing signed'ness of char cast.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    }
29
29
 
30
30
    void DocumentSourceFilterBase::findNext() {
31
 
        /* only do this the first time */
32
 
        if (unstarted) {
33
 
            hasNext = !pSource->eof();
34
 
            unstarted = false;
35
 
        }
36
 
 
37
 
        while(hasNext) {
38
 
            boost::intrusive_ptr<Document> pDocument(pSource->getCurrent());
39
 
            hasNext = pSource->advance();
40
 
 
41
 
            if (accept(pDocument)) {
42
 
                pCurrent = pDocument;
 
31
        unstarted = false;
 
32
 
 
33
        for(bool hasDoc = !pSource->eof(); hasDoc; hasDoc = pSource->advance()) {
 
34
            pCurrent = pSource->getCurrent();
 
35
            if (accept(pCurrent)) {
 
36
                pSource->advance(); // Start next call at correct position
 
37
                hasCurrent = true;
43
38
                return;
44
39
            }
45
40
        }
46
41
 
47
 
        pCurrent.reset();
 
42
        // Nothing matched
 
43
        pCurrent = Document();
 
44
        hasCurrent = false;
48
45
    }
49
46
 
50
47
    bool DocumentSourceFilterBase::eof() {
51
48
        if (unstarted)
52
49
            findNext();
53
50
 
54
 
        return (pCurrent.get() == NULL);
 
51
        return !hasCurrent;
55
52
    }
56
53
 
57
54
    bool DocumentSourceFilterBase::advance() {
68
65
         */
69
66
        findNext();
70
67
 
71
 
        return (pCurrent.get() != NULL);
 
68
        return hasCurrent;
72
69
    }
73
70
 
74
 
    boost::intrusive_ptr<Document> DocumentSourceFilterBase::getCurrent() {
75
 
        if (unstarted)
76
 
            findNext();
77
 
 
78
 
        verify(pCurrent.get() != NULL);
 
71
    Document DocumentSourceFilterBase::getCurrent() {
 
72
        verify(hasCurrent);
79
73
        return pCurrent;
80
74
    }
81
75
 
83
77
        const intrusive_ptr<ExpressionContext> &pExpCtx):
84
78
        DocumentSource(pExpCtx),
85
79
        unstarted(true),
86
 
        hasNext(false),
 
80
        hasCurrent(false),
87
81
        pCurrent() {
88
82
    }
89
83
}